code wiki / (root) / nx_print_sim.nx

nx_print_sim.nx

buildroot/runtime/nx_print_sim.nx

15531 B374 linesdepth 4pulls 5 transitivereach 2 importersview sourcekind librarytopic print
docsdependenciesstructsconstsfunctions

about

nx_print_sim.nx -- military/aerospace-grade print simulator, FIRST STONE. ===================================================================== CARDINAL (2026-05-20): "real life simulation like the military or aircraft do where we can simulate a print with settings in hyperspeed to see what issues will happen in reality with those settings none of this guesswork bullshit" Bar: simulate the entire print at hyperspeed (24h Christus print evaluated in seconds) and emit predicted failures with cause + location + magnitude. No heuristics; real physics throughout. 12-18 sessions to military-grade per the cardinal. Modeled physics roadmap (none of which industry slicers do at slice-time): - Thermal: hotend + bed + chamber + cooling-fan heat diffusion - Mechanical: bridge sag + pillar buckling + adhesion stress - Flow: pressure advance + viscosity + max-flow ceiling - Adhesion: first-layer adhesion + warp force vs bed-grip - Kinematic: input-shaping residual + ringing + collision detect FIRST STONE (this file): state tracking + ONE real physical invariant: HOTEND MAX-FLOW CEILING. Volumetric flow rate (width × height × speed in mm³/s) is a real physical limit (hotend power budget); exceeding it predicts underextrusion. Industry slicers CLAMP speed proactively against the parameter; we SIMULATE what would happen if user-supplied G-code exceeded it. Per [[feedback-exceed-means-superior-capability-not-toy-parameter-addition]]: this primitive earns the EXCEED label only when it correctly predicts a real-print failure that industry slicers miss. Today it's a TRUE check (real physics) but the simulator-as-capability is at the first stone -- EXCEED claim is for the full integrated simulator that lands across the 12-18 session arc. ===================================================================== license_tier: ORIGINAL

dependencies 3 imports · 2 importers

nx_syscalls.nx nx_machine_graph.nx nx_material_profile.nx nx_print_sim.nx nx_print_sim_spaghetti_test.nx nx_print_sim_test.nx

imports: nx_syscalls.nxnx_machine_graph.nxnx_material_profile.nx

imported by: nx_print_sim_spaghetti_test.nxnx_print_sim_test.nx

structs

78struct NxPrintSimIssue
93struct NxPrintSim

consts

43const NX_MAGIC_1024: i64 = 1024
52const NX_SIM_ISSUE_NONE: i64 = 0
53const NX_SIM_ISSUE_HOTEND_FLOW_CEILING: i64 = 1 // SHIPPED
54const NX_SIM_ISSUE_MATERIAL_FLOW_CEILING: i64 = 2 // SHIPPED
55const NX_SIM_ISSUE_LAYER_TIME_LOW: i64 = 3 // queued (thermal arc)
56const NX_SIM_ISSUE_BRIDGE_SAG: i64 = 4 // queued (mechanical arc)
57const NX_SIM_ISSUE_PILLAR_BUCKLING: i64 = 5 // queued (mechanical arc)
58const NX_SIM_ISSUE_COLLISION: i64 = 6 // queued (kinematic arc)
59const NX_SIM_ISSUE_BED_ADHESION_LIFT: i64 = 7 // queued (adhesion arc)
60const NX_SIM_ISSUE_RINGING_VISIBLE: i64 = 8 // queued (kinematic arc)
65const NX_SIM_ISSUE_ENVELOPE_VIOLATION: i64 = 9 // SHIPPED (this update)
66const NX_SIM_ISSUE_BED_CRASH: i64 = 10 // SHIPPED (this update)
67const NX_SIM_ISSUE_TIPOVER_RISK: i64 = 11 // SHIPPED (this update)
68const NX_SIM_ISSUE_N: i64 = 12
89const NX_PRINT_SIM_ISSUE_BYTES: i64 = 48
127const NX_PRINT_SIM_BYTES: i64 = 144 // 18 fields × 8
130const NX_PRINT_SIM_SENTINEL_HI: i64 = 9223372036854775000
131const NX_PRINT_SIM_SENTINEL_LO: i64 = -9223372036854775000
133const NX_PRINT_SIM_Q14: i64 = 16384
134const NX_PRINT_SIM_Q14_SQ: i64 = 268435456 // 16384²
322const NX_PRINT_SIM_GRAVITY_MMS2: i64 = 9810

functions

70func nx_sim_issue_is_valid(k: i64) -> i64
called by 2: mainmain
138func nx_print_sim_new(machine: *NxMachineGraph,
called by 2: mainmain calls 1: sys_mmap
171func nx_print_sim_append_issue(s: *NxPrintSim,
205func nx_print_sim_extrude_move(s: *NxPrintSim,
called by 2: mainmain calls 1: nx_print_sim_append_issue
286func nx_print_sim_n_issues(s: *NxPrintSim) -> i64
291func nx_print_sim_get_issue(s: *NxPrintSim, i: i64) -> *NxPrintSimIssue
called by 2: mainmain
324func nx_print_sim_finalize(s: *NxPrintSim) -> i64
called by 1: main calls 1: nx_print_sim_append_issue