code wiki / _hdl_build / nx_battery_biz_census.nx
nx_battery_biz_census.nx source
↩ module page · 88 lines · 9453 B
1import "nx_gate_gn.nx"
2// nx_battery_biz_census.nx -- the LI-ION BATTERY RECLAMATION BUSINESS map + ladder, HARDWARE RUNG UP (operator:
3// "use the nishi researcher and lets get a business plan building from the hardware rung up each rung ... so
4// people can get their lithium ion batteries back to top capabilities like an ego battery while having a safe
5// business where lion fires cant happen ... act like a laundromat"). LIVING MAP, liar-killed: a cell is graded
6// HAVE only if its real organ/artifact is on disk; the to-build cells stay honest GAP. The thesis (DRY #15): this
7// is a COMPOSITION of organs the ecosystem already owns + 5 thin battery-specific organs, NOT 20 new stacks.
8// THE SPINE = nx_battery_safety (the #26 NEVER-BRICK law applied to cells = NEVER IGNITE: hard charge/discharge/
9// voltage/thermal ceilings + thermal-runaway-pattern refusal) -> that is, by construction, the "safe business
10// where lion fires cant happen". expect_exit: 0 license_tier: ORIGINAL
11import "nx_syscalls.nx"
12
13func gp(s: *u8) -> i64 { var n: i64=0; while s[n]!=(0 as u8){n=n+1} sys_write(1,s,n); return 0 }
14func have(p: *u8) -> i64 { let fd: i64=sys_openat_rd(p); if fd<0 { return 0 } sys_close(fd); return 1 }
15func row(tag: *u8, p: *u8, note: *u8) -> i64 {
16 gp(" " as *u8); gp(tag)
17 if have(p)==1 { gp(": HAVE (" as *u8) } else { gp(": GAP (" as *u8) }
18 gp(p); gp(") " as *u8); gp(note); gp("\n" as *u8)
19 return have(p)
20}
21
22func main() -> i64 {
23 gp("=== nx_battery_biz_census: Li-ion Battery Reclamation Business -- the ladder, HARDWARE RUNG UP ===\n" as *u8)
24 gp(" (HAVE=reuse an organ already on disk; GAP=the thin battery-specific organ still to build)\n" as *u8)
25 var hav: i64=0; var gap: i64=0
26
27 gp("-- R0 HARDWARE & SAFETY SUBSTRATE (the lowest rung: the bench + the never-ignite law) --\n" as *u8)
28 if row("R0 never-ignite safety " as *u8, "runtime/nx_battery_safety.nx" as *u8, "SPINE: hard charge/discharge/voltage/thermal ceilings + thermal-runaway refusal = #26 NEVER-IGNITE" as *u8)==1 { hav=hav+1 } else { gap=gap+1 }
29
30 gp("-- R1 INTAKE & DIAGNOSIS (state-of-health triage of an incoming pack) --\n" as *u8)
31 if row("R1 SoH depletion kernel " as *u8, "runtime/nx_consumable.nx" as *u8, "REUSE: capacity/wear vs rated life -> OK/DUE/OVERDUE (the battery state-of-health verdict)" as *u8)==1 { hav=hav+1 } else { gap=gap+1 }
32 if row("R1 electrical safety scan " as *u8, "runtime/nx_electrical.nx" as *u8, "REUSE: voltage/current/ground-fault sanity screen at intake" as *u8)==1 { hav=hav+1 } else { gap=gap+1 }
33 if row("R1 pack triage organ " as *u8, "runtime/_hdl_build/nx_batt_intake.nx" as *u8, "BUILT+GATED 10/0: per-pack verdict {BMS-RESET / RECONDITION / RE-CELL / RETIRE-RECYCLE / UNSAFE-REJECT}, safety-first" as *u8)==1 { hav=hav+1 } else { gap=gap+1 }
34
35 gp("-- R2 RECLAIM / RECONDITION PROCESS (the EGO-grade restore -- honestly: rebuild-to-spec, not un-aging) --\n" as *u8)
36 if row("R2 recondition workflow " as *u8, "runtime/_hdl_build/nx_batt_recondition.nx" as *u8, "BUILT+GATED 11/0: staged restore; EVERY charge step validated by the spine; rejects NEVER charged; R1->R2 chain" as *u8)==1 { hav=hav+1 } else { gap=gap+1 }
37
38 gp("-- R3 FIRE-SAFE FACILITY (the 'laundromat where fires cant happen') --\n" as *u8)
39 if row("R3 facility/interlock spec" as *u8, "runtime/_hdl_build/nx_batt_facility.nx" as *u8, "BUILT+GATED 11/0: interlock (thermal-armed + pack-safe + bay/energy/VSQG caps) + auto-isolation; R1->R3 chain" as *u8)==1 { hav=hav+1 } else { gap=gap+1 }
40
41 gp("-- R4 UNIT ECONOMICS & BUSINESS PLAN (the financials + the laundromat model) --\n" as *u8)
42 if row("R4 no-float money " as *u8, "runtime/nx_money.nx" as *u8, "REUSE: exact pricing / margins / COGS (no-float cents)" as *u8)==1 { hav=hav+1 } else { gap=gap+1 }
43 if row("R4 debt/payback " as *u8, "runtime/nx_debt.nx" as *u8, "REUSE: equipment-loan payback + break-even months" as *u8)==1 { hav=hav+1 } else { gap=gap+1 }
44 if row("R4 double-entry ledger " as *u8, "runtime/nx_fin_ledger.nx" as *u8, "REUSE: the business books / net-worth-as-view" as *u8)==1 { hav=hav+1 } else { gap=gap+1 }
45 if row("R4 financing+scam-shield " as *u8, "runtime/nx_fin_finance.nx" as *u8, "REUSE: finance the buildout, true-cost ranked + predatory-loan shield" as *u8)==1 { hav=hav+1 } else { gap=gap+1 }
46 if row("R4 profit/risk planner " as *u8, "runtime/_hdl_build/nx_batt_planner.nx" as *u8, "BUILT+GATED 10/0: compares the 4 models on profit AND risk -> the numbers pick the model (HYBRID won)" as *u8)==1 { hav=hav+1 } else { gap=gap+1 }
47 if row("R4 grounded fin model " as *u8, "runtime/_hdl_build/nx_batt_finmodel.nx" as *u8, "BUILT+GATED 10/0: itemized initial investment $41,488 + 9-mo base payoff + ADVERSARIAL stress (4/5 shocks kill it); grounded by the verified cost-basis" as *u8)==1 { hav=hav+1 } else { gap=gap+1 }
48 if row("R4 graph visuals (SVG) " as *u8, "runtime/_hdl_build/nx_batt_chart.nx" as *u8, "BUILT+GATED: emits a real sovereign .svg bar chart (net-by-scenario), no 3rd-party JS" as *u8)==1 { hav=hav+1 } else { gap=gap+1 }
49 if row("R4 business-plan assembler" as *u8, "runtime/_hdl_build/nx_batt_bizplan.nx" as *u8, "BUILT+GATED 9/0: emits the full HTML plan (chart embedded, numbers locked to the econ core) -> knowledge/library" as *u8)==1 { hav=hav+1 } else { gap=gap+1 }
50
51 gp("-- R5 MARKET POSITION & PROGRAM (competitive proof + PM launch) --\n" as *u8)
52 if row("R5 CIQ matrix engine " as *u8, "runtime/_hdl_build/nx_ciq_field_maintenance.nx" as *u8, "REUSE: the Vision/Execute competitive-quadrant engine (clone for the battery market)" as *u8)==1 { hav=hav+1 } else { gap=gap+1 }
53 if row("R5 battery-market CIQ " as *u8, "runtime/_hdl_build/nx_ciq_battery_reclaim.nx" as *u8, "BUILT+GATED 9/0: nishi=11 capability leader (never-ignite moat, grounded); honest behind on price + scale" as *u8)==1 { hav=hav+1 } else { gap=gap+1 }
54 if row("R5 PM/RACI + WMS " as *u8, "runtime/_hdl_build/nx_pm.nx" as *u8, "REUSE: route owners + register the workstream live + converge" as *u8)==1 { hav=hav+1 } else { gap=gap+1 }
55 if row("R5 library foundation " as *u8, "runtime/_hdl_build/nx_library_foundation.nx" as *u8, "REUSE: CID + ed25519 durable storage of the plan" as *u8)==1 { hav=hav+1 } else { gap=gap+1 }
56
57 // grounding: the nishi researcher must have banked real sources (no fabricated domain facts -- rule 4).
58 gp(" grounding: research corpus knowledge/fetched/batt_a1_liion.raw + batt_b1_thermal_runaway.raw " as *u8)
59 var g1: i64 = have("knowledge/fetched/batt_a1_liion.raw" as *u8)
60 var g2: i64 = have("knowledge/fetched/batt_b1_thermal_runaway.raw" as *u8)
61 var grounded: i64 = 0
62 if g1==1 { if g2==1 { grounded=1 } }
63 if grounded==1 { gp("PRESENT\n" as *u8) } else { gp("PARTIAL/MISSING (run nx_battery_research_fetch)\n" as *u8) }
64
65 gp(" LADDER (ALL SOFTWARE RUNGS BUILT): R0 safety . R1 triage . R2 recondition . R3 fire-safe-facility . R4 econ(planner+finmodel+chart+bizplan) . R5 market(battery-CIQ) -- every rung HAVE+GATED\n" as *u8)
66 gp("BATTERY-BIZ-CENSUS have=" as *u8); gn(hav); gp(" gap=" as *u8); gn(gap); gp("\n" as *u8)
67
68 // self-gate: HAVE-graded reuse organs must really be on disk; GAP organs must honestly be absent; grounded.
69 var pass: i64=0; var fail: i64=0
70 if have("runtime/nx_battery_safety.nx" as *u8)==1 { pass=pass+1 } else { fail=fail+1; gp(" FAIL spine-absent (nx_battery_safety)\n" as *u8) }
71 if have("runtime/nx_money.nx" as *u8)==1 { pass=pass+1 } else { fail=fail+1; gp(" FAIL money-absent\n" as *u8) }
72 if have("runtime/nx_consumable.nx" as *u8)==1 { pass=pass+1 } else { fail=fail+1; gp(" FAIL soh-kernel-absent\n" as *u8) }
73 if have("runtime/_hdl_build/nx_ciq_field_maintenance.nx" as *u8)==1 { pass=pass+1 } else { fail=fail+1; gp(" FAIL ciq-engine-absent\n" as *u8) }
74 if have("runtime/_hdl_build/nx_library_foundation.nx" as *u8)==1 { pass=pass+1 } else { fail=fail+1; gp(" FAIL library-absent\n" as *u8) }
75 // liar-check: a GAP organ MUST be absent (proves the census is not painting gaps green).
76 if have("runtime/_hdl_build/nx_batt_phantom_zzz.nx" as *u8)==0 { pass=pass+1 } else { fail=fail+1; gp(" FAIL liar-check (phantom organ read HAVE)\n" as *u8) }
77 // grounding: the researcher really banked sources.
78 if grounded==1 { pass=pass+1 } else { fail=fail+1; gp(" FAIL grounding-absent (research not fetched)\n" as *u8) }
79 // counts: 10 reuse/spine HAVE + 5 battery-specific GAP.
80 if hav==18 { pass=pass+1 } else { fail=fail+1; gp(" FAIL have-count (expected 18 -- the full ladder built)\n" as *u8) }
81 if gap==0 { pass=pass+1 } else { fail=fail+1; gp(" FAIL gap-count (expected 0 -- all software rungs built)\n" as *u8) }
82 // neg-control: a bogus organ path must NOT read HAVE.
83 if have("runtime/_hdl_build/nx_batt_zzz_does_not_exist.nx" as *u8)==0 { pass=pass+1 } else { fail=fail+1; gp(" FAIL negctl (phantom organ read HAVE)\n" as *u8) }
84
85 gp("BATTERY-BIZ-CENSUS pass=" as *u8); gn(pass); gp(" fail=" as *u8); gn(fail)
86 if fail==0 { gp(" verdict=GREEN (18 HAVE, 0 GAP -- the full hardware-up ladder R0-R5 built+gated+composed, grounded by verified cost-basis; BUILT != LIVE: this is the complete sovereign plan substrate, not yet a live business)\n" as *u8); sys_exit(0); return 0 }
87 gp(" verdict=RED\n" as *u8); sys_exit(1); return 1
88}