# Systems Perspective Description Language — CNC & Additive Manufacturing (SPDL-CNC) **Specification Document ID:** `SPDL-CNC-SPEC-2026-v4.2` **Classification:** Open Epistemic Standard / Real-Time Zero-Heap Machine Tool & Slicer Substrate **Principal Architect:** Asse van Nix | Systems Perspective Framework & Proof-Driven Architecture Group **Target Environment:** Zig 0.16.0 Freestanding WASM (`wasm32-freestanding`) · Bare-Metal DSP/FPGA Motion Controllers · Real-Time Linux (RT-PREEMPT) **Applied Standards:** ISO/IEC 14977 EBNF · GBNF Maskable · ISO 23125 (Machine Tool Safety) · ISO 14649 (STEP-NC Replacement) · ISO 6983 (RS-274D / G-code Replacement) · ISO/ASTM 52900 --- ## 1. Epistemic Architecture: Why G-code and STEP-NC Must Be Replaced Originating at MIT in 1958 for punched-tape numerical controllers, **RS-274D / G-code (ISO 6983)** remains the dominant motion control language for subtractive and additive manufacturing. In modern high-speed 5-axis machining and autonomous robotic additive manufacturing, G-code exhibits critical structural defects: 1. **Kinematic Decoupling from Physics:** A command such as `G01 X120.4 Y80.2 F1500` is purely geometrical. It is completely blind to cutting force vectors, tool deflection, regenerative chatter, spindle torque curves, material thermal expansion, and melt-pool enthalpy. 2. **Post-Processor Fragmentation:** Because G-code lacks semantic awareness of the physical machine tool envelope, CAM systems must generate hundreds of incompatible dialects (Fanuc, Heidenhain, Siemens, Haas), moving critical safety logic out of the controller into unverified offline software. 3. **The STEP-NC Failure:** ISO 14649 (STEP-NC) attempted to add high-level features but wrapped them in sprawling, multi-megabyte EXPRESS/STEP data schemas requiring complex object models and dynamic heap allocations that real-time motion interpolation kernels cannot parse. **SPDL-CNC** unifies geometry, cutting physics, and machine tool dynamics into single-line, zero-heap epistemic records. --- ## 2. Physical Invariants, DAEs & Mathematical Proof Gates ``` SPDL-CNC PHYSICAL MANIFOLD ┌─────────────────────────────────────────────────────────────────────────────┐ │ CHIP FORMATION & CUTTING FORCE DYNAMICS (Kienzle Model) │ │ F_c = k_c1.1 * b * h^(1 - m_c) <= F_max │ ├─────────────────────────────────────────────────────────────────────────────┤ │ REGENERATIVE CHATTER LYAPUNOV STABILITY (Altintas-Budak Formulation) │ │ a_lim = -1 / (2 * K_t * Re[G(j*omega_c)]) │ │ V(delta_x) = delta_x^T * P * delta_x, dV/dt <= -alpha * V │ ├─────────────────────────────────────────────────────────────────────────────┤ │ ADDITIVE MELT-POOL ENTHALPY & FLOW (Rosenthal Boundary) │ │ T(r, xi) - T_0 = (Q / (2 * pi * k * r)) * exp(-v * (r + xi) / (2 * alpha))│ └─────────────────────────────────────────────────────────────────────────────┘ ``` ### 2.1 Cutting Force & Deflection Barrier Function The instantaneous cutting force vector $\mathbf{F} \in \mathbb{R}^3$ must not exceed tool shank yield strength or cause dimensional deflection exceeding tolerance $\delta_{\text{tol}}$: $$h_{\text{force}}(\mathbf{x}) = F_{\text{yield}} - \|\mathbf{F}_{\text{kienzle}}(\mathbf{x}, \mathbf{u})\|_2 \ge 0$$ $$h_{\text{deflection}}(\mathbf{x}) = \delta_{\text{tol}} - \frac{\|\mathbf{F}_{\text{tangential}}\| L_{\text{tool}}^3}{3 E I} \ge 0$$ ### 2.2 Spatial Collision Avoidance Control Barrier Function (CBF) For 5-axis tool assemblies with spindle housing $\mathcal{O}_{\text{tool}}(q)$ and workpiece/fixtures $\mathcal{O}_{\text{fixture}}$: $$h_{\text{collision}}(q) = \text{dist}(\mathcal{O}_{\text{tool}}(q), \mathcal{O}_{\text{fixture}}) - d_{\text{safety\_margin}} \ge 0$$ --- ## 3. Formal ISO/IEC 14977 EBNF Grammar ```ebnf CncManifest = { Line } ; Line = [ Whitespace ] , ( Comment | CncRecord ) , Newline ; Whitespace = { " " | "\t" | "\r" } ; Newline = "\n" | "\r\n" ; Comment = "#" , { AnyChar - Newline } ; CncRecord = "(I) @CNC_INVARIANT" , " " , InvariantFields | "(M) @TOOL_PROFILE" , " " , ToolFields | "(M) @KINEMATIC_CHAIN" , " " , KinematicFields | "(B) @FORCE_BARRIER" , " " , ForceBarrierFields | "(B) @CHATTER_BARRIER" , " " , ChatterBarrierFields | "(B) @SPATIAL_KEEP_OUT" , " " , SpatialKeepOutFields | "(M) @MOTION_PRIMITIVE" , " " , MotionFields | "(T) @SPINDLE_OBSERVER" , " " , ObserverFields ; InvariantFields = "id:" , Token , " max_jerk_m_s3:" , Number , " cycle_us:" , Integer , " alloc_policy:ZERO_HEAP" ; ToolFields = "id:" , Token , " type:" , ToolType , " dia_mm:" , Number , " flutes:" , Integer , " stickout_mm:" , Number , " e_gpa:" , Number ; ToolType = "ENDMILL_FLAT" | "BALL_NOSE" | "BULL_NOSE" | "EXTRUDER_FDM" | "LASER_POWDER_DED" ; KinematicFields = "id:" , Token , " type:" , MachineClass , " limits_xyz:[" , Box3D , "]" , " limits_ab:[" , Box2D , "]" ; MachineClass = "TABLE_TABLE_5AX" | "HEAD_TABLE_5AX" | "GANTRY_3AX" | "ROBOT_ARM_6AX" ; ForceBarrierFields= "id:" , Token , " target_tool:" , Token , " max_force_n:" , Number , " max_deflection_um:" , Number ; ChatterBarrierFields = "id:" , Token , " target_spindle:" , Token , " max_chatter_amp_um:" , Number , " lyapunov_alpha:" , Number ; SpatialKeepOutFields = "id:" , Token , " target_assembly:" , Token , " zone:[" , CoordBox , "] min_clearance_mm:" , Number ; MotionFields = "id:" , Token , " seg:" , Integer , " path:" , PathType , " end:[" , Coord5D , "]" , " feed_mm_min:" , Number , " spindle_rpm:" , Number , [ " additive:" , AdditiveSpec ] ; PathType = "LINEAR" | "SPLINE_NURBS" | "HELICAL" | "RETRACT_SAFE" ; AdditiveSpec = "FLOW_MM3_S(" , Number , ") TEMP_C(" , Number , ")" ; ObserverFields = "id:" , Token , " spindle_kw:" , Number , " vibe_rms_g:" , Number , " tool_temp_c:" , Number ; Box3D = Number , " " , Number , " " , Number , " " , Number , " " , Number , " " , Number ; Box2D = Number , " " , Number , " " , Number , " " , Number ; Coord5D = Number , " " , Number , " " , Number , " " , Number , " " , Number ; CoordBox = Number , " " , Number , " " , Number , " " , Number , " " , Number , " " , Number ; Token = Letter , { Letter | Digit | "_" | "-" } ; Number = [ "-" ] , Digit , { Digit } , [ "." , { Digit } ] ; Integer = [ "-" ] , Digit , { Digit } ; Letter = "A".."Z" | "a".."z" ; Digit = "0".."9" ; AnyChar = ? Any valid Unicode code point ? ; ``` --- ## 4. GBNF Structured Sampling Grammar ```gbnf root ::= CncRecord "\n" CncRecord ::= "(I) @CNC_INVARIANT" " " InvariantFields | "(M) @TOOL_PROFILE" " " ToolFields | "(M) @KINEMATIC_CHAIN" " " KinematicFields | "(B) @FORCE_BARRIER" " " ForceBarrierFields | "(B) @CHATTER_BARRIER" " " ChatterBarrierFields | "(B) @SPATIAL_KEEP_OUT" " " SpatialKeepOutFields | "(M) @MOTION_PRIMITIVE" " " MotionFields | "(T) @SPINDLE_OBSERVER" " " ObserverFields InvariantFields ::= "id:" [A-Za-z0-9_-]+ " max_jerk_m_s3:" [0-9.]+ " cycle_us:" [0-9]+ " alloc_policy:ZERO_HEAP" ToolFields ::= "id:" [A-Za-z0-9_-]+ " type:" ("ENDMILL_FLAT"|"BALL_NOSE"|"BULL_NOSE"|"EXTRUDER_FDM"|"LASER_POWDER_DED") " dia_mm:" [0-9.]+ " flutes:" [0-9]+ " stickout_mm:" [0-9.]+ " e_gpa:" [0-9.]+ KinematicFields ::= "id:" [A-Za-z0-9_-]+ " type:" ("TABLE_TABLE_5AX"|"HEAD_TABLE_5AX"|"GANTRY_3AX"|"ROBOT_ARM_6AX") " limits_xyz:[" [0-9. -]+ "] limits_ab:[" [0-9. -]+ "]" ForceBarrierFields ::= "id:" [A-Za-z0-9_-]+ " target_tool:" [A-Za-z0-9_-]+ " max_force_n:" [0-9.]+ " max_deflection_um:" [0-9.]+ ChatterBarrierFields ::= "id:" [A-Za-z0-9_-]+ " target_spindle:" [A-Za-z0-9_-]+ " max_chatter_amp_um:" [0-9.]+ " lyapunov_alpha:" [0-9.]+ SpatialKeepOutFields ::= "id:" [A-Za-z0-9_-]+ " target_assembly:" [A-Za-z0-9_-]+ " zone:[" [0-9. -]+ "] min_clearance_mm:" [0-9.]+ MotionFields ::= "id:" [A-Za-z0-9_-]+ " seg:" [0-9]+ " path:" ("LINEAR"|"SPLINE_NURBS"|"HELICAL"|"RETRACT_SAFE") " end:[" [0-9. -]+ "] feed_mm_min:" [0-9.]+ " spindle_rpm:" [0-9.]+ ( " additive:FLOW_MM3_S(" [0-9.]+ ") TEMP_C(" [0-9.]+ ")" )? ObserverFields ::= "id:" [A-Za-z0-9_-]+ " spindle_kw:" [0-9.]+ " vibe_rms_g:" [0-9.]+ " tool_temp_c:" [0-9.]+ ``` --- ## 5. Production SPDL-CNC Manifest Exemplar ```spdl # ============================================================================== # SPDL-CNC v4.2 MANIFEST: 5-AXIS AEROSPACE IMPELLER BLISK MACHINING # Material: Inconel 718 | Spindle: HSK-A63 24,000 RPM | Controller: RT-WASM # ============================================================================== (I) @CNC_INVARIANT id:INV-BLISK-01 max_jerk_m_s3:45.0 cycle_us:250 alloc_policy:ZERO_HEAP # --- MACHINE & TOOL PHYSICAL ASSETS --- (M) @KINEMATIC_CHAIN id:MCH_MIKRON_5AX type:TABLE_TABLE_5AX limits_xyz:[-350.0 350.0 -300.0 300.0 -250.0 250.0] limits_ab:[-120.0 120.0 -360.0 360.0] (M) @TOOL_PROFILE id:TOOL_T14_BALL type:BALL_NOSE dia_mm:10.0 flutes:4 stickout_mm:42.0 e_gpa:620.0 # --- PHYSICAL SAFETY & PROCESS BARRIERS --- (B) @FORCE_BARRIER id:BAR_CUTTING_LOAD target_tool:TOOL_T14_BALL max_force_n:850.0 max_deflection_um:12.5 (B) @CHATTER_BARRIER id:BAR_REGEN_STABILITY target_spindle:MCH_MIKRON_5AX max_chatter_amp_um:6.0 lyapunov_alpha:8.5 (B) @SPATIAL_KEEP_OUT id:BAR_ROTARY_TABLE_COLLISION target_assembly:MCH_MIKRON_5AX zone:[-180.0 180.0 -180.0 180.0 -50.0 0.0] min_clearance_mm:5.0 # --- INVARIANT-GOVERNED CONTINUOUS TOOLPATH PRIMITIVES --- (M) @MOTION_PRIMITIVE id:SEG_00142 seg:142 path:SPLINE_NURBS end:[42.105 88.312 -14.200 -12.450 45.120] feed_mm_min:2400.0 spindle_rpm:14500.0 (M) @MOTION_PRIMITIVE id:SEG_00143 seg:143 path:SPLINE_NURBS end:[43.210 89.145 -14.185 -12.550 46.210] feed_mm_min:2400.0 spindle_rpm:14500.0 (M) @MOTION_PRIMITIVE id:SEG_00144 seg:144 path:RETRACT_SAFE end:[43.210 89.145 50.000 0.000 0.000] feed_mm_min:12000.0 spindle_rpm:8000.0 # --- HIGH-SPEED IN-SITU PROCESS TELEMETRY --- (T) @SPINDLE_OBSERVER id:TEL_SPINDLE_01 spindle_kw:4.82 vibe_rms_g:0.24 tool_temp_c:64.2 ``` --- ## 6. Standards Compliance & Verification Matrix ``` ╔═════════════════════════════════╦══════════════════════╦═════════════════════════════════════════════════════╗ ║ Dimension │ Verification Standard│ Enforced Implementation Evidence ║ ╠═════════════════════════════════╬══════════════════════╬═════════════════════════════════════════════════════╣ ║ Cutting Physics Bounding │ Kienzle Force Model │ Cutting force <= Yield limit; Deflection <= delta. ║ ║ Regenerative Chatter Stability │ Altintas-Budak DAE │ Real-time Lyapunov decay (dV/dt <= -alpha * V). ║ ║ Collision Avoidance │ ISO 23125 (Safety) │ Control Barrier Function min_clearance >= 5mm. ║ ║ Real-Time Determinism │ Freestanding Silicon │ Zero heap allocations; fixed cycle period (250us). ║ ║ Autonomous Machine Synthesis │ ISO/IEC 14977 / GBNF │ GBNF logit mask guarantees 100% syntactical safety. ║ ╚═════════════════════════════════╩══════════════════════╩═════════════════════════════════════════════════════╝ ```