code wiki / (root) / nx_estimate_test.nx

nx_estimate_test.nx

buildroot/runtime/nx_estimate_test.nx

4200 B95 linesdepth 7pulls 14 transitivereach 0 importersview sourcekind gate/proof
docsdependenciesstructsconstsfunctions

about

nx_estimate_test.nx -- pre-print estimate sanity checks against hand-computed expected ranges. Test inputs: tetrahedron at edge=10mm (Q14 = 10*16384=163840), Qidi X-Max 3 + Generic PLA, 20% infill. Expected math: bbox extent = 10mm × 10mm × 10mm bbox volume = 1000 mm³ perim_fraction = 8%; infill_fraction = (100-8)*20/100 = 18.4% solid_pct = 26% -> solid_volume ≈ 260 mm³ (with integer trunc, 260) filament_xsect (1.75mm) = π × 0.875² ≈ 2.405 mm² filament_mm = 260 / 2.405 ≈ 108 mm sustainable_flow = min(machine 35, material 15) = 15 mm³/s extrude_time = 260 / 15 ≈ 17.3 sec; with 25% overhead ≈ 21.7 sec print_minutes ≈ 0 (rounds down from 21 sec) Closed-form invariants: (a) OK verdict for 10mm tetrahedron + 20% infill PLA on Qidi. (b) volume_mm3 in [200, 320] (c) filament_mm in [80, 140] (d) print_minutes in [0, 1] (e) WARN_TINY for 1mm tetrahedron (tiny volume) (f) WARN_LONG for huge mesh (200mm cube ≈ 8M mm³ -> >24h at low flow). (g) WARN_FIL for medium-large mesh consuming > 250m filament. (h) ERR_INPUT for negative density. (i) Verdict names non-NULL. expect_exit: 0 license_tier: ORIGINAL

dependencies 5 imports · 0 importers

nx_syscalls.nx nx_mesh.nx nx_machine_graph.nx nx_material_profile.nx nx_estimate.nx nx_estimate_test.nx

imports: nx_syscalls.nxnx_mesh.nxnx_machine_graph.nxnx_material_profile.nxnx_estimate.nx

imported by: nobody (leaf or entry point)

call flow from main pre-order; caps 40 nodes / depth 6 declared; ↻ = already shown

main nx_machine_graph_qidi_xmax nx_machine_graph_alloc sys_mmap nx_material_profile_generi nx_material_profile_alloc sys_mmap ↻ nx_mesh_make_tetrahedron nx_mesh_alloc sys_mmap ↻ nx_mesh_set_vertex nx_mesh_set_triangle nx_estimate_print sys_mmap ↻ nx_mesh_bbox_compute sys_mmap ↻ nx_mesh_get_vertex_x nx_mesh_get_vertex_y nx_mesh_get_vertex_z nx_gcex_filament_xsect_q14 nx_muldiv_i64 nx_i128_alloc nx_i128_mul_i64 nx_i128_mul_u64 nx_i128_neg nx_i128_div_i64 nx_i128_is_neg nx_i128_neg ↻ nx_i128_udiv_u64 nx_est_verdict_name

structs

none

consts

39const Q14: i64 = 16384

functions

41func main() -> i64