nx_bom.nx
buildroot/runtime/nx_bom.nx
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
imports: nx_syscalls.nx
imported by: nx_assembly_gate.nxnx_bom_gate.nxnx_bom_test.nxnx_market.nxnx_market_test.nx
structs
| 72 | struct NxPart |
| 81 | struct NxBom |
consts
| 41 | const BC_HARVEST: i64 = 1 // pull water out of air (thermoelectric condensation) |
| 42 | const BC_COLLECT: i64 = 2 // catch and hold the condensate |
| 43 | const BC_TREAT: i64 = 3 // make it safe |
| 44 | const BC_MINERAL: i64 = 4 // make it taste like water |
| 45 | const BC_CONTROL: i64 = 5 // sense, drive, power |
| 46 | const BC_ENCLOSURE: i64 = 6 // the box |
| 48 | const BM_BUY: i64 = 0 |
| 49 | const BM_MAKE: i64 = 1 // vertical integration: we fabricate it ourselves |
| 51 | const BP_PELTIER: i64 = 0 |
| 52 | const BP_HEATSINK: i64 = 1 |
| 53 | const BP_INTAKE_FAN: i64 = 2 |
| 54 | const BP_CONDENSATE_TRAY: i64 = 3 |
| 55 | const BP_RESERVOIR: i64 = 4 |
| 56 | const BP_UVC_LED: i64 = 5 |
| 57 | const BP_CARBON_FILTER: i64 = 6 |
| 58 | const BP_PUMP: i64 = 7 |
| 59 | const BP_MINERAL_CARTRIDGE: i64 = 8 |
| 60 | const BP_TDS_SENSOR: i64 = 9 |
| 61 | const BP_MCU_BOARD: i64 = 10 |
| 62 | const BP_PSU: i64 = 11 |
| 63 | const BP_HUMIDITY_SENSOR: i64 = 12 |
| 64 | const BP_RELAY_BOARD: i64 = 13 |
| 65 | const BP_WIRING_HARNESS: i64 = 14 |
| 66 | const BP_ENCLOSURE: i64 = 15 |
| 67 | const BP_CATALOG_N: i64 = 16 |
| 69 | const BOM_PART_BYTES: i64 = 48 // 6 i64 fields |
| 70 | const BOM_BOM_BYTES: i64 = 40 // 5 i64 fields |
functions
| 10 | func bom_qty(comp_part: *i64, ncomp: i64, part: i64) -> i64 |
| 18 | func bom_total_cents(comp_part: *i64, ncomp: i64, lib_price: *i64, nlib: i64) -> i64 |
| 89 | func bom_set(p: *NxPart, id: i64, cost: i64, mass: i64, lead: i64, cat: i64, mb: i64) -> i64 called by 1: nx_bom_part |
| 103 | func nx_bom_part(id: i64) -> *NxPart |
| 127 | func nx_bom_water_qty(id: i64) -> i64 |
| 135 | func nx_bom_water_assemble() -> *NxBom called by 3: mainmainmk_water_production_cost calls 4: sys_mmapnx_bom_water_qtynx_bom_partsys_munmap |
| 156 | func nx_bom_water_category_cost(cat: i64) -> i64 |
| 173 | func nx_bom_critical_path_days(b: *NxBom) -> i64 { return b.max_lead_days } called by 1: main |
| 176 | func bom_shortfalls(comp_part: *i64, ncomp: i64, lib_stock: *i64, nlib: i64) -> i64 |