code wiki / (root) / nx_qc_spc.nx

nx_qc_spc.nx

buildroot/runtime/nx_qc_spc.nx

3776 B111 linesdepth 2pulls 2 transitivereach 1 importersview sourcekind librarytopic qc
docsdependenciesstructsconstsfunctions

about

nx_qc_spc.nx -- FOOD-SCIENCE SUITE / QUALITY CONTROL rung. Statistical process control for a production line: Shewhart X-bar / R control charts, process capability (Cp / Cpk), and proximate-analysis conservation + Kjeldahl protein. Turns "looks fine" into a measured, in-/out-of-control verdict and a capability index. INTEGER-EXACT via the range method: sigma is estimated as Rbar/d2 using the tabulated Shewhart constants (x1000), so NO square root is needed. Control limits carried in milli-units for precision; Cp/Cpk x1000. X-bar: UCL/LCL = Xbarbar +/- A2 * Rbar R: UCL = D4 * Rbar, LCL = D3 * Rbar Cp = (USL-LSL)/(6 sigma), sigma = Rbar/d2 Cpk = min(USL-mean, mean-LSL)/(3 sigma) (capable if Cpk >= 1.33) THE exceed: an out-of-control point and a capability index are COMPUTED from the subgroup ranges, not eyeballed; and proximate composition is conserved to 100% by construction. grounded: shewhart_control_charts + astm_process_capability_cpk + kjeldahl_nitrogen_to_protein_6.25 genealogy_id: statistical_process_control + nishi_food_science_suite

dependencies 1 imports · 1 importers

nx_syscalls.nx nx_qc_spc.nx nx_qc_spc_test.nx

imports: nx_syscalls.nx

imported by: nx_qc_spc_test.nx

structs

none

consts

25const QC_MAGIC_2282: i64 = 2282
26const QC_MAGIC_2114: i64 = 2114
27const QC_MAGIC_2059: i64 = 2059
28const QC_MAGIC_2326: i64 = 2326
30const QC_CAPABLE_CPK_MILLI: i64 = 1330 // Cpk >= 1.33 = capable
31const QC_KJELDAHL_FACTOR_X100: i64 = 625 // general N->protein factor 6.25

functions

35func qc_a2(n: i64) -> i64
called by 1: main
40func qc_d3(n: i64) -> i64
43func qc_d4(n: i64) -> i64
called by 1: main
48func qc_d2(n: i64) -> i64
called by 1: main
56func qc_xbar_ucl_milli(xbarbar: i64, a2: i64, rbar: i64) -> i64
called by 1: main
59func qc_xbar_lcl_milli(xbarbar: i64, a2: i64, rbar: i64) -> i64
called by 1: main
64func qc_in_control(x: i64, ucl_milli: i64, lcl_milli: i64) -> i64
called by 1: main
71func qc_r_ucl_milli(d4: i64, rbar: i64) -> i64
called by 1: main
77func qc_cp_milli(usl: i64, lsl: i64, d2: i64, rbar: i64) -> i64
called by 1: main
82func qc_cpk_milli(usl: i64, lsl: i64, mean: i64, d2: i64, rbar: i64) -> i64
called by 1: main
90func qc_is_capable(cpk_milli: i64) -> i64
called by 1: main
98func qc_carb_by_difference(moist: i64, protein: i64, fat: i64, ash: i64) -> i64
called by 1: main
103func qc_proximate_conserves(moist: i64, protein: i64, fat: i64, ash: i64, carb: i64) -> i64
called by 1: main
109func qc_protein_from_nitrogen(nitrogen_x10: i64) -> i64
called by 1: main