From 028e8baf195745f3210ce4de0fdf9eed7aa992af Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8E=8B=E6=A2=A6=E8=BF=9C?= <1063331231@qq.com> Date: Fri, 25 Jul 2025 21:03:39 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E8=AE=A1=E7=AE=97=E9=93=9C?= =?UTF-8?q?=E7=9F=BF=E7=9F=B3=E5=90=AB=E9=87=8F=E7=9A=84=E5=B7=A5=E5=85=B7?= =?UTF-8?q?=E7=B1=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../common/utils/TitrationResultAnalyzerUtils.java | 108 +++++++++++++++++++++ 1 file changed, 108 insertions(+) create mode 100644 src/main/java/com/iflytop/colortitration/app/common/utils/TitrationResultAnalyzerUtils.java diff --git a/src/main/java/com/iflytop/colortitration/app/common/utils/TitrationResultAnalyzerUtils.java b/src/main/java/com/iflytop/colortitration/app/common/utils/TitrationResultAnalyzerUtils.java new file mode 100644 index 0000000..c619e22 --- /dev/null +++ b/src/main/java/com/iflytop/colortitration/app/common/utils/TitrationResultAnalyzerUtils.java @@ -0,0 +1,108 @@ +package com.iflytop.colortitration.app.common.utils; + +import java.io.PrintStream; +import java.nio.charset.StandardCharsets; + +public class TitrationResultAnalyzerUtils { + + // 铜的摩尔质量 (g/mol) + private static final double MOLAR_MASS_CU = 63.55; + + /** + * 计算铜离子浓度(mol/L) + * + * @param sampleVolumeTitrant 样品消耗的Na₂S₂O₃体积 (mL) + * @param blankVolumeTitrant 空白消耗的Na₂S₂O₃体积 (mL) + * @param titrantConcentration Na₂S₂O₃标准溶液浓度 (mol/L) + * @param oreSolutionVolume 矿石溶液取样体积 (mL) + * @return 铜离子浓度 (mol/L) + */ + public static double calculateCopperConcentration( + double sampleVolumeTitrant, + double blankVolumeTitrant, + double titrantConcentration, + double oreSolutionVolume) { + + // 扣除空白后的实际消耗体积 (mL) + double netVolume = sampleVolumeTitrant - blankVolumeTitrant; + + // 计算铜离子浓度 (mol/L) + // 注意:1 mol Cu²⁺ 对应 2 mol Na₂S₂O₃,因此需要除以2 + return (netVolume * titrantConcentration) / (2 * oreSolutionVolume); + } + + /** + * 计算铜离子质量浓度(g/L) + * + * @param sampleVolumeTitrant 样品消耗的Na₂S₂O₃体积 (mL) + * @param blankVolumeTitrant 空白消耗的Na₂S₂O₃体积 (mL) + * @param titrantConcentration Na₂S₂O₃标准溶液浓度 (mol/L) + * @param oreSolutionVolume 矿石溶液取样体积 (mL) + * @return 铜离子质量浓度 (g/L) + */ + public static double calculateCopperMassConcentration( + double sampleVolumeTitrant, + double blankVolumeTitrant, + double titrantConcentration, + double oreSolutionVolume) { + + // 先计算摩尔浓度,再转换为质量浓度 + double molarConcentration = calculateCopperConcentration( + sampleVolumeTitrant, + blankVolumeTitrant, + titrantConcentration, + oreSolutionVolume); + + return molarConcentration * MOLAR_MASS_CU; + } + + /** + * 计算矿石中铜的百分比含量(%) + * + * @param sampleVolumeTitrant 样品消耗的Na₂S₂O₃体积 (mL) + * @param blankVolumeTitrant 空白消耗的Na₂S₂O₃体积 (mL) + * @param titrantConcentration Na₂S₂O₃标准溶液浓度 (mol/L) + * @param oreSolutionVolume 矿石溶液总体积 (mL) + * @param sampleMass 矿石样品质量 (g) + * @return 铜含量百分比 (%) + */ + public static double calculateCopperPercentage( + double sampleVolumeTitrant, + double blankVolumeTitrant, + double titrantConcentration, + double oreSolutionVolume, + double sampleMass) { + + // 计算总铜的质量 (g) + double totalCopperMass = calculateCopperMassConcentration( + sampleVolumeTitrant, + blankVolumeTitrant, + titrantConcentration, + oreSolutionVolume) * oreSolutionVolume / 1000; + + return (totalCopperMass / sampleMass) * 100; + } + + public static void main(String[] args) { + System.setOut(new PrintStream(System.out, true, StandardCharsets.UTF_8)); + // 示例数据 + double sampleVolume = 18.50; // mL + double blankVolume = 0.20; // mL + double na2s2o3Concentration = 0.0200; // mol/L + double oreVolume = 25.00; // mL + double sampleMass = 0.2500; // g + + // 计算结果 + double cuConcentration = calculateCopperConcentration( + sampleVolume, blankVolume, na2s2o3Concentration, oreVolume); + double cuMassConcentration = calculateCopperMassConcentration( + sampleVolume, blankVolume, na2s2o3Concentration, oreVolume); + double cuPercentage = calculateCopperPercentage( + sampleVolume, blankVolume, na2s2o3Concentration, oreVolume, sampleMass); + + // 输出结果 + System.out.printf("铜离子浓度: %.5f mol/L%n", cuConcentration); + System.out.printf("铜离子质量浓度: %.3f g/L%n", cuMassConcentration); + System.out.printf("矿石中铜含量: %.2f%%%n", cuPercentage); + } +} \ No newline at end of file