nx_steam_test.nx source
↩ module page · 31 lines · 1381 B
1// nx_steam_test.nx -- smoke for nx_steam. Proves the saturated-steam
2// table, latent heat, process energy, and retort gauge pressure.
3// Exit code = failed assertion number; 0 = all pass.
4
5import "nx_syscalls.nx"
6import "nx_steam.nx"
7
8func main() -> i64 {
9 // --- saturated-steam pressure/temperature ---
10 if st_sat_pressure_kpa(100) != 101 { return 1 }
11 if st_sat_pressure_kpa(121) != 205 { return 2 } // retort standard
12
13 // --- latent heat decreases with temperature ---
14 if st_latent_heat_kjkg(100) != 2257 { return 3 }
15 if st_latent_heat_kjkg(121) != 2200 { return 4 }
16 if st_latent_heat_kjkg(40) <= st_latent_heat_kjkg(121) { return 5 }
17
18 // --- process energy ---
19 if st_sensible_heat_j(1000, 4186, 80) != 334880 { return 6 } // heat 1 kg by 80 K
20 if st_latent_energy_j(1000, 2257) != 2257000 { return 7 } // evaporate 1 kg
21 if st_energy_to_boil_j(1000, 20) != 2591880 { return 8 } // 20 C -> steam
22
23 // --- condensing steam delivers heat (how a retort heats) ---
24 if st_condensation_energy_j(500, 121) != 1100000 { return 9 } // 500 g steam at 121 C
25
26 // --- retort gauge pressure (what the vessel is rated to) ---
27 if st_retort_gauge_kpa(121) != 104 { return 10 } // 205 - 101 ~ 15 psi
28 if st_sat_pressure_kpa(55) != 0 - 1 { return 11 } // off-table -> -1
29
30 return 0
31}