nx_ice_scale_gate.nx source
↩ module page · 192 lines · 8992 B
1// nx_ice_scale_gate.nx -- gate for the personal-to-industrial ladder.
2//
3// T0 residence: 1200 s in a home barrel, 30 s in a continuous freezer
4// T1 **the mechanism: undercooling RISES with scale, 13000 -> 21500 mC
5// T2 crystal at draw 32.5 um continuous, 16.2 um cold-extruded; the BATCH
6// figure is UNKNOWN rather than invented
7// T3 **the ordering IS measured: scaling up improves crystal size
8// T4 a home freezer is not a hardening tunnel: 720 min vs 25 min
9// T5 throughput 6 / 37 / 600 litres per hour across the ladder
10// T6 **freezing energy DERIVED at 224794 J/kg, 766 permil of it LATENT
11// T7 34 Wh/kg electrical at a COP of 1.80
12// T8 **energy costs 0.55 cents per litre -- it is NOT the cost driver
13// T9 ***labour per litre falls 100x across the ladder -- it IS the driver
14// T10 the organ holds no verified price and says so
15// T11 the cold chain, where the small producer actually wins
16// T12 impossible classes, temperatures and fractions REFUSE
17//
18// license_tier: ORIGINAL expect_exit: 0
19import "nx_syscalls.nx"
20import "nx_ice_scale.nx"
21
22func gw(s: *u8) -> i64 { var n: i64=0; while s[n]!=(0 as u8){n=n+1} sys_write(1,s,n); return 0 }
23func gn(v: i64) -> i64 {
24 let b: *u8=sys_mmap(28); var m: i64=v; if m<0 {sys_write(1,"-" as *u8,1); m=0-m}
25 let t: *u8=sys_mmap(28); var k: i64=0; if m==0 {t[0]=48 as u8;k=1} while m>0 {t[k]=(48+(m%10)) as u8;m=m/10;k=k+1}
26 var i: i64=0; while i<k {b[i]=t[k-1-i];i=i+1} sys_write(1,b,k); return 0
27}
28func gck(pass: i64, name: *u8, fails: *i64) -> i64 {
29 if pass==1 { gw(" PASS " as *u8) } else { gw(" FAIL " as *u8); fails[0]=fails[0]+1 }
30 gw(name); gw("\n" as *u8); return 0
31}
32
33// A reference mix at 40% total solids: 60% water, 86% of it frozen at -18 C,
34// freezing point -2.5 C, entering the barrel at +4 C. Density 1.090 kg/L.
35const GT_T_IN_MC: i64 = 4000
36const GT_T_FP_MC: i64 = 0 - 2500
37const GT_T_FINAL_MC: i64 = 0 - 18000
38const GT_WATER: i64 = 600
39const GT_FROZEN: i64 = 860
40const GT_MIX_DENS: i64 = 1090
41const GT_COP_Q2: i64 = 180
42const GT_TARIFF_C: i64 = 15
43const GT_WAGE_C_H: i64 = 2000
44
45func t0() -> i64 {
46 if isc_residence_s(ISC_BATCH_HOME) != 1200 { return 0 }
47 if isc_residence_s(ISC_BATCH_COMMERCIAL) != 480 { return 0 }
48 if isc_residence_s(ISC_CONTINUOUS) != 30 { return 0 }
49 return 1
50}
51
52// Nucleation rises with undercooling and coarsening rises with time. The
53// continuous freezer wins on BOTH: more undercooling, less time.
54func t1() -> i64 {
55 if isc_undercooling_mc(ISC_BATCH_HOME) != 13000 { return 0 }
56 if isc_undercooling_mc(ISC_BATCH_COMMERCIAL) != 16000 { return 0 }
57 if isc_undercooling_mc(ISC_CONTINUOUS) != 21500 { return 0 }
58 if isc_undercooling_mc(ISC_CONTINUOUS) <= isc_undercooling_mc(ISC_BATCH_HOME) { return 0 }
59 if isc_residence_s(ISC_CONTINUOUS) >= isc_residence_s(ISC_BATCH_HOME) { return 0 }
60 return 1
61}
62
63func t2() -> i64 {
64 if isc_crystal_at_draw_q1(ISC_CONTINUOUS) != 325 { return 0 }
65 if isc_crystal_at_draw_q1(ISC_COLD_EXTRUSION) != 162 { return 0 }
66 // the source gives no batch diameter, so neither does this
67 if isc_crystal_at_draw_q1(ISC_BATCH_HOME) != ISC_UNKNOWN { return 0 }
68 if isc_crystal_at_draw_q1(ISC_BATCH_COMMERCIAL) != ISC_UNKNOWN { return 0 }
69 return 1
70}
71
72func t3() -> i64 {
73 if isc_batch_makes_larger_crystals(ISC_BATCH_HOME, ISC_CONTINUOUS) != 1 { return 0 }
74 if isc_batch_makes_larger_crystals(ISC_BATCH_COMMERCIAL, ISC_CONTINUOUS) != 1 { return 0 }
75 // and the reverse claim is not quietly also true
76 if isc_batch_makes_larger_crystals(ISC_CONTINUOUS, ISC_BATCH_HOME) != 0 { return 0 }
77 if isc_scaling_improves_crystal_size() != 1 { return 0 }
78 if isc_small_batch_is_finer() != 0 { return 0 }
79 return 1
80}
81
82func t4() -> i64 {
83 if isc_has_true_hardening(ISC_BATCH_HOME) != 0 { return 0 }
84 if isc_has_true_hardening(ISC_CONTINUOUS) != 1 { return 0 }
85 if isc_hardening_minutes(ISC_BATCH_HOME) != 720 { return 0 }
86 if isc_hardening_minutes(ISC_CONTINUOUS) != 25 { return 0 }
87 return 1
88}
89
90func t5() -> i64 {
91 if isc_throughput_l_per_h(ISC_BATCH_HOME, 2) != 6 { return 0 }
92 if isc_throughput_l_per_h(ISC_BATCH_COMMERCIAL, 5) != 37 { return 0 }
93 if isc_throughput_l_per_h(ISC_CONTINUOUS, 5) != 600 { return 0 }
94 return 1
95}
96
97// The energy is derived from latent heat and two specific heats, not quoted.
98func t6() -> i64 {
99 let e: i64 = isc_freeze_energy_j_per_kg(GT_T_IN_MC, GT_T_FP_MC, GT_T_FINAL_MC, GT_WATER, GT_FROZEN)
100 if e != 224794 { return 0 }
101 let share: i64 = isc_latent_share_permil(GT_T_IN_MC, GT_T_FP_MC, GT_T_FINAL_MC, GT_WATER, GT_FROZEN)
102 if share != 766 { return 0 }
103 // the phase change dominates the temperature change, which is the design fact
104 if share <= 500 { return 0 }
105 return 1
106}
107
108func t7() -> i64 {
109 let e: i64 = isc_freeze_energy_j_per_kg(GT_T_IN_MC, GT_T_FP_MC, GT_T_FINAL_MC, GT_WATER, GT_FROZEN)
110 if isc_electrical_wh_per_kg(e, GT_COP_Q2) != 34 { return 0 }
111 return 1
112}
113
114// 0.55 cents per litre. Freezing energy is not what makes ice cream expensive.
115func t8() -> i64 {
116 let e: i64 = isc_freeze_energy_j_per_kg(GT_T_IN_MC, GT_T_FP_MC, GT_T_FINAL_MC, GT_WATER, GT_FROZEN)
117 let wh: i64 = isc_electrical_wh_per_kg(e, GT_COP_Q2)
118 if isc_energy_cost_per_l_cents_q2(wh, GT_MIX_DENS, GT_TARIFF_C) != 55 { return 0 }
119 return 1
120}
121
122// ***THE MONETISATION RESULT. One operator at 20 dollars an hour costs 333
123// cents per litre at 6 L/h and 3.33 at 600 L/h -- a hundredfold fall, and it
124// is plain arithmetic, not a learning curve. A pint carries 158 cents of
125// labour at the home tier and 1.6 at the industrial one.
126func t9() -> i64 {
127 let home: i64 = isc_throughput_l_per_h(ISC_BATCH_HOME, 2)
128 let cont: i64 = isc_throughput_l_per_h(ISC_CONTINUOUS, 5)
129 let lh: i64 = isc_labour_per_l_cents_q2(GT_WAGE_C_H, 1, home)
130 let lc: i64 = isc_labour_per_l_cents_q2(GT_WAGE_C_H, 1, cont)
131 if lh != 33333 { return 0 }
132 if lc != 333 { return 0 }
133 if lh / lc != 100 { return 0 }
134 // and labour dwarfs the energy it replaces at the small end
135 let e: i64 = isc_freeze_energy_j_per_kg(GT_T_IN_MC, GT_T_FP_MC, GT_T_FINAL_MC, GT_WATER, GT_FROZEN)
136 let wh: i64 = isc_electrical_wh_per_kg(e, GT_COP_Q2)
137 let en: i64 = isc_energy_cost_per_l_cents_q2(wh, GT_MIX_DENS, GT_TARIFF_C)
138 if lh <= en { return 0 }
139 return 1
140}
141
142func t10() -> i64 {
143 if isc_cost_is_indicative() != 1 { return 0 }
144 if isc_holds_any_verified_price() != 0 { return 0 }
145 if isc_cogs_per_l_cents(100, 1, 3, 40) != 144 { return 0 }
146 return 1
147}
148
149func t11() -> i64 {
150 if isc_retail_cabinet_is_abuse(0 - 18000) != 1 { return 0 }
151 if isc_retail_cabinet_is_abuse(0 - 5000) != 0 { return 0 }
152 if isc_short_chain_beats_plant_freezer() != 1 { return 0 }
153 if isc_quality_advantage_is_at_the_freezer() != 0 { return 0 }
154 return 1
155}
156
157func t12() -> i64 {
158 if isc_residence_s(99) != ISC_INVALID { return 0 }
159 if isc_throughput_l_per_h(ISC_CONTINUOUS, 0) != ISC_INVALID { return 0 }
160 // entering the barrel already below its freezing point is not a process
161 if isc_freeze_energy_j_per_kg(0 - 5000, GT_T_FP_MC, GT_T_FINAL_MC, GT_WATER, GT_FROZEN) != ISC_INVALID { return 0 }
162 // more than all the water frozen is not a state
163 if isc_freeze_energy_j_per_kg(GT_T_IN_MC, GT_T_FP_MC, GT_T_FINAL_MC, GT_WATER, 1001) != ISC_INVALID { return 0 }
164 if isc_electrical_wh_per_kg(100000, 0) != ISC_INVALID { return 0 }
165 if isc_labour_per_l_cents_q2(GT_WAGE_C_H, 1, 0) != ISC_INVALID { return 0 }
166 return 1
167}
168
169func main() -> i64 {
170 let fails: *i64 = sys_mmap(16) as *i64
171 fails[0] = 0
172 gw("=== nx_ice_scale -- personal to industrial ===\n" as *u8)
173
174 gck(t0(), "T0 residence 1200 s home vs 30 s continuous" as *u8, fails)
175 gck(t1(), "T1 undercooling RISES with scale 13000 -> 21500 mC" as *u8, fails)
176 gck(t2(), "T2 32.5 um continuous, 16.2 cold-extruded, batch UNKNOWN" as *u8, fails)
177 gck(t3(), "T3 scaling UP improves crystal size; reverse claim false" as *u8, fails)
178 gck(t4(), "T4 a home freezer is not a hardening tunnel 720 vs 25 min" as *u8, fails)
179 gck(t5(), "T5 throughput 6 / 37 / 600 litres per hour" as *u8, fails)
180 gck(t6(), "T6 energy DERIVED 224794 J/kg, 766 permil latent" as *u8, fails)
181 gck(t7(), "T7 34 Wh/kg electrical at COP 1.80" as *u8, fails)
182 gck(t8(), "T8 energy is 0.55 c/L -- NOT the cost driver" as *u8, fails)
183 gck(t9(), "T9 labour per litre falls 100x -- it IS the driver" as *u8, fails)
184 gck(t10(), "T10 no verified price is held, and it says so" as *u8, fails)
185 gck(t11(), "T11 cold chain: where the small producer actually wins" as *u8, fails)
186 gck(t12(), "T12 impossible class, temperature and fraction REFUSE" as *u8, fails)
187
188 gw("pass=" as *u8); gn(13 - fails[0]); gw("/13\n" as *u8)
189 if fails[0] == 0 { gw("verdict=GREEN\n" as *u8) } else { gw("verdict=RED\n" as *u8) }
190 sys_exit(fails[0])
191 return 0
192}