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