// Generated by EML-lang C# backend (Unity-ready) // Source module: aerospace_actuator_guard_band // Kernel digest: sha256:0b0ef5a5baecb59acc7d28dc64bc959d9f3378cfbc278204c737cef5bc755aaa // Functions: 1 // Constants: 0 // // Every method carries [MethodImpl(AggressiveInlining)] // and uses System.Math (no allocations, no GC pressure). // Tuple returns ship as readonly record struct. using System; using System.Runtime.CompilerServices; namespace Forge { public static class AerospaceActuatorGuardBand { /// /// actuator_command_within_band /// /// source obligations for actuator_command_within_band: {O1, O2} /// O1 [43d7c3ff9568] -> PRESERVED (equivalent) throw before return; NOT Debug.Assert, which Release compiles out /// build: unconditional -- an explicit throw, NOT Debug.Assert, which Release compiles out /// O2 [ca2e303109b7] -> PRESERVED (equivalent) throw before return; NOT Debug.Assert, which Release compiles out /// build: unconditional -- an explicit throw, NOT Debug.Assert, which Release compiles out /// /// Pfaffian profile: pfaffian_r=0, cost_class=p0-d4-w0-c0, drift_risk=LOW. /// Unity hint: pfaffian_r=0; ~2 ns/call (~500,000 calls/ms; ~0.013% of 16 ms frame per 1000 calls -- desktop CPU baseline, profile on target). /// forge.requires: (u_min <= u_max) /// forge.ensures: (u_min <= result) /// forge.ensures: (result <= u_max) /// forge.verify: lean theorem=actuator_command_within_band /// /// type Real /// type Real /// type Real /// type Real /// type Real /// type Real /// type Real /// type Real /// Real [MethodImpl(MethodImplOptions.AggressiveInlining)] public static double actuator_command_within_band(double error, double integral, double deriv, double kp, double ki, double kd, double u_min, double u_max) { if (!((u_min <= u_max))) throw new ArgumentException("actuator_command_within_band: requires violated: (u_min <= u_max)"); double result = Math.Max(u_min, Math.Min((((kp * error) + (ki * integral)) + (kd * deriv)), u_max)); if (!((u_min <= result))) throw new InvalidOperationException("actuator_command_within_band: ensures violated"); if (!((result <= u_max))) throw new InvalidOperationException("actuator_command_within_band: ensures violated"); return result; } } }