code wiki / (root) / nx_bom.nx

nx_bom.nx

buildroot/runtime/nx_bom.nx

8343 B185 linesdepth 2pulls 2 transitivereach 6 importersview sourcekind librarytopic bom
docsdependenciesstructsconstsfunctions

about

nx_bom.nx -- LIB: component library + supply-chain BILL OF MATERIALS, as a digital twin of real procurement. A parts library carries REAL data per part (mfr part number, unit price in CENTS, available stock). A design maps each component instance to a library part; the BOM aggregates by part -> quantity + extended cost, sums an EXACT integer total (no float rounding -> what you'd really pay), and flags supply-chain SHORTFALLS (required qty > stock = can't source). Composes the schematic's component list (schematic -> ... -> BOM). Data-driven: adding a part = a library row. never-brick #26: pure arithmetic, bounded, deterministic. license_tier: ORIGINAL

dependencies 1 imports · 5 importers

nx_syscalls.nx nx_bom.nx nx_assembly_gate.nx nx_bom_gate.nx nx_bom_test.nx nx_market.nx nx_market_test.nx

imports: nx_syscalls.nx

imported by: nx_assembly_gate.nxnx_bom_gate.nxnx_bom_test.nxnx_market.nxnx_market_test.nx

structs

72struct NxPart
81struct NxBom

consts

41const BC_HARVEST: i64 = 1 // pull water out of air (thermoelectric condensation)
42const BC_COLLECT: i64 = 2 // catch and hold the condensate
43const BC_TREAT: i64 = 3 // make it safe
44const BC_MINERAL: i64 = 4 // make it taste like water
45const BC_CONTROL: i64 = 5 // sense, drive, power
46const BC_ENCLOSURE: i64 = 6 // the box
48const BM_BUY: i64 = 0
49const BM_MAKE: i64 = 1 // vertical integration: we fabricate it ourselves
51const BP_PELTIER: i64 = 0
52const BP_HEATSINK: i64 = 1
53const BP_INTAKE_FAN: i64 = 2
54const BP_CONDENSATE_TRAY: i64 = 3
55const BP_RESERVOIR: i64 = 4
56const BP_UVC_LED: i64 = 5
57const BP_CARBON_FILTER: i64 = 6
58const BP_PUMP: i64 = 7
59const BP_MINERAL_CARTRIDGE: i64 = 8
60const BP_TDS_SENSOR: i64 = 9
61const BP_MCU_BOARD: i64 = 10
62const BP_PSU: i64 = 11
63const BP_HUMIDITY_SENSOR: i64 = 12
64const BP_RELAY_BOARD: i64 = 13
65const BP_WIRING_HARNESS: i64 = 14
66const BP_ENCLOSURE: i64 = 15
67const BP_CATALOG_N: i64 = 16
69const BOM_PART_BYTES: i64 = 48 // 6 i64 fields
70const BOM_BOM_BYTES: i64 = 40 // 5 i64 fields

functions

10func bom_qty(comp_part: *i64, ncomp: i64, part: i64) -> i64
18func bom_total_cents(comp_part: *i64, ncomp: i64, lib_price: *i64, nlib: i64) -> i64
called by 2: mainmain calls 1: bom_qty
89func bom_set(p: *NxPart, id: i64, cost: i64, mass: i64, lead: i64, cat: i64, mb: i64) -> i64
called by 1: nx_bom_part
103func nx_bom_part(id: i64) -> *NxPart
127func nx_bom_water_qty(id: i64) -> i64
135func nx_bom_water_assemble() -> *NxBom
156func nx_bom_water_category_cost(cat: i64) -> i64
173func nx_bom_critical_path_days(b: *NxBom) -> i64 { return b.max_lead_days }
called by 1: main
176func bom_shortfalls(comp_part: *i64, ncomp: i64, lib_stock: *i64, nlib: i64) -> i64
called by 1: main calls 1: bom_qty