nx_print_sim.nx
buildroot/runtime/nx_print_sim.nx
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
imports: nx_syscalls.nxnx_machine_graph.nxnx_material_profile.nx
imported by: nx_print_sim_spaghetti_test.nxnx_print_sim_test.nx
structs
| 78 | struct NxPrintSimIssue |
| 93 | struct NxPrintSim |
consts
| 43 | const NX_MAGIC_1024: i64 = 1024 |
| 52 | const NX_SIM_ISSUE_NONE: i64 = 0 |
| 53 | const NX_SIM_ISSUE_HOTEND_FLOW_CEILING: i64 = 1 // SHIPPED |
| 54 | const NX_SIM_ISSUE_MATERIAL_FLOW_CEILING: i64 = 2 // SHIPPED |
| 55 | const NX_SIM_ISSUE_LAYER_TIME_LOW: i64 = 3 // queued (thermal arc) |
| 56 | const NX_SIM_ISSUE_BRIDGE_SAG: i64 = 4 // queued (mechanical arc) |
| 57 | const NX_SIM_ISSUE_PILLAR_BUCKLING: i64 = 5 // queued (mechanical arc) |
| 58 | const NX_SIM_ISSUE_COLLISION: i64 = 6 // queued (kinematic arc) |
| 59 | const NX_SIM_ISSUE_BED_ADHESION_LIFT: i64 = 7 // queued (adhesion arc) |
| 60 | const NX_SIM_ISSUE_RINGING_VISIBLE: i64 = 8 // queued (kinematic arc) |
| 65 | const NX_SIM_ISSUE_ENVELOPE_VIOLATION: i64 = 9 // SHIPPED (this update) |
| 66 | const NX_SIM_ISSUE_BED_CRASH: i64 = 10 // SHIPPED (this update) |
| 67 | const NX_SIM_ISSUE_TIPOVER_RISK: i64 = 11 // SHIPPED (this update) |
| 68 | const NX_SIM_ISSUE_N: i64 = 12 |
| 89 | const NX_PRINT_SIM_ISSUE_BYTES: i64 = 48 |
| 127 | const NX_PRINT_SIM_BYTES: i64 = 144 // 18 fields × 8 |
| 130 | const NX_PRINT_SIM_SENTINEL_HI: i64 = 9223372036854775000 |
| 131 | const NX_PRINT_SIM_SENTINEL_LO: i64 = -9223372036854775000 |
| 133 | const NX_PRINT_SIM_Q14: i64 = 16384 |
| 134 | const NX_PRINT_SIM_Q14_SQ: i64 = 268435456 // 16384² |
| 322 | const NX_PRINT_SIM_GRAVITY_MMS2: i64 = 9810 |
functions
| 70 | func nx_sim_issue_is_valid(k: i64) -> i64 |
| 138 | func nx_print_sim_new(machine: *NxMachineGraph, |
| 171 | func nx_print_sim_append_issue(s: *NxPrintSim, |
| 205 | func nx_print_sim_extrude_move(s: *NxPrintSim, |
| 286 | func nx_print_sim_n_issues(s: *NxPrintSim) -> i64 |
| 291 | func nx_print_sim_get_issue(s: *NxPrintSim, i: i64) -> *NxPrintSimIssue |
| 324 | func nx_print_sim_finalize(s: *NxPrintSim) -> i64 |