code wiki / (root) / nx_chem_solution.nx

nx_chem_solution.nx

buildroot/runtime/nx_chem_solution.nx

3134 B79 linesdepth 2pulls 2 transitivereach 5 importersview sourcekind librarytopic chem
docsdependenciesstructsconstsfunctions

about

nx_chem_solution.nx -- FOOD-SCIENCE SUITE / SOLUTION CHEMISTRY rung. The aqueous chemistry food runs on: buffers (Henderson-Hasselbalch), the pH/pOH relation, molar concentration, dilution (C1V1 = C2V2), and titratable acidity. pH is the master variable of preservation and fermentation, so this grounds the whole safety story in chemistry. INTEGER-EXACT. pH/pKa x1000; concentration in mM; volume in mL; mass in mg; molar mass x10. Henderson-Hasselbalch is exact at decade buffer ratios (log10 of a power of ten is an integer): pH = pKa + log_ratio. THE exceed: buffer pH, dilutions, and titratable acidity are COMPUTED from chemistry; and cs_is_high_acid ties straight to the preservation / canning botulinum line (pH < 4.6) -- one chemical source of truth. grounded: henderson_hasselbalch_equation + molar_concentration + c1v1_c2v2_dilution + titratable_acidity_titration genealogy_id: solution_chemistry + nishi_food_science_suite

dependencies 1 imports · 3 importers

nx_syscalls.nx nx_chem_solution.nx nx_chem_solution_test.nx nx_thermal_process.nx nx_water_activity.nx

imports: nx_syscalls.nx

imported by: nx_chem_solution_test.nxnx_thermal_process.nxnx_water_activity.nx

structs

none

consts

20const CS_MAGIC_14000: i64 = 14000
21const CS_MAGIC_10000: i64 = 10000
22const CS_MAGIC_100000: i64 = 100000
24const CS_HIGH_ACID_PH_MILLI: i64 = 4600 // FDA acidified-foods line

functions

31func cs_buffer_ph_milli(pka_milli: i64, log_ratio: i64) -> i64
36func cs_buffer_ph_at_pka(pka_milli: i64) -> i64
called by 1: main calls 1: cs_buffer_ph_milli
41func cs_poh_milli(ph_milli: i64) -> i64
called by 1: main
46func cs_is_high_acid(ph_milli: i64) -> i64
55func cs_molarity_mm(mass_mg: i64, mw_x10: i64, vol_ml: i64) -> i64
called by 1: main
62func cs_dilute_final_conc(c1: i64, v1: i64, v2: i64) -> i64
called by 1: main
68func cs_dilute_volume_needed(c1: i64, c2: i64, v2: i64) -> i64
called by 1: main
77func cs_titratable_acid_mg(v_ml: i64, normality_x1000: i64, meqwt_x100: i64) -> i64
called by 1: main