@@ -31,6 +31,7 @@ constexpr double MIN_RESONANCE_AMPLITUDE_CUTOFF = 0.10;
3131// WNN Constraints
3232constexpr double WNN_MAX_CURVATURE_PROXY = 5.0e-11 ;
3333constexpr double WNN_MIN_OSCILLATORY_PREFACTOR = 0.85 ;
34+ constexpr double INVALID_TELEMETRY_SENTINEL = -1.0 ;
3435
3536} // namespace DSM_Config
3637
@@ -80,6 +81,8 @@ class DeterministicSafetyMonitor {
8081 bool safing_sequence_active_;
8182
8283 bool hasInvalidInputs (const DsmSensorInputs& inputs) const ;
84+ bool hasInvalidWnnTelemetry (const WnnTelemetry& wnn_telem) const ;
85+ bool isWnnThresholdBreached (const WnnTelemetry& wnn_telem) const ;
8386 bool checkResonanceStability (double A_t, double J_coupling) const ;
8487 double estimateCurvatureScalar (double dilation) const ;
8588 bool checkCurvatureViolation (double R_estimated) const ;
@@ -120,6 +123,22 @@ DeterministicSafetyMonitor::hasInvalidInputs(
120123 !std::isfinite (inputs.current_resonance_amplitude );
121124}
122125
126+ inline bool
127+ DeterministicSafetyMonitor::hasInvalidWnnTelemetry (
128+ const WnnTelemetry& wnn_telem
129+ ) const {
130+ return !std::isfinite (wnn_telem.curvature_proxy ) ||
131+ !std::isfinite (wnn_telem.oscillatory_prefactor );
132+ }
133+
134+ inline bool
135+ DeterministicSafetyMonitor::isWnnThresholdBreached (
136+ const WnnTelemetry& wnn_telem
137+ ) const {
138+ return wnn_telem.curvature_proxy > DSM_Config::WNN_MAX_CURVATURE_PROXY ||
139+ wnn_telem.oscillatory_prefactor < DSM_Config::WNN_MIN_OSCILLATORY_PREFACTOR ;
140+ }
141+
123142inline bool
124143DeterministicSafetyMonitor::checkResonanceStability (
125144 double A_t,
@@ -193,11 +212,27 @@ DeterministicSafetyMonitor::pollWnnAndEnforce(
193212 uint32_t rollback_count,
194213 PhysicsState& active_state_pointer
195214) {
196- if (wnn_telem.curvature_proxy > DSM_Config::WNN_MAX_CURVATURE_PROXY ||
197- wnn_telem.oscillatory_prefactor < DSM_Config::WNN_MIN_OSCILLATORY_PREFACTOR ) {
215+ const bool invalid_wnn_input = hasInvalidWnnTelemetry (wnn_telem);
216+ const bool threshold_breach = isWnnThresholdBreached (wnn_telem);
217+
218+ if (invalid_wnn_input || threshold_breach) {
219+ // Keep safing active until the broader control loop restores margins.
220+ safing_sequence_active_ = true ;
221+ if (invalid_wnn_input) {
222+ std::cerr << " DSM ALERT: Non-finite WNN telemetry detected — ROLLBACK\n " ;
223+ } else {
224+ std::cerr << " DSM ALERT: WNN thresholds exceeded — ROLLBACK\n " ;
225+ }
226+
227+ const double logged_curvature = std::isfinite (wnn_telem.curvature_proxy )
228+ ? wnn_telem.curvature_proxy
229+ : DSM_Config::INVALID_TELEMETRY_SENTINEL ;
230+ const double logged_prefactor = std::isfinite (wnn_telem.oscillatory_prefactor )
231+ ? wnn_telem.oscillatory_prefactor
232+ : DSM_Config::INVALID_TELEMETRY_SENTINEL ;
198233
199234 // Breach detected! Log to ITL and execute immediate rollback
200- itl_manager.log_wnn_rollback_event (wnn_telem. curvature_proxy , wnn_telem. oscillatory_prefactor );
235+ itl_manager.log_wnn_rollback_event (logged_curvature, logged_prefactor );
201236
202237 return trigger_wnn_immediate_rollback (
203238 rollback_store,
0 commit comments