The Drift Correct BTrain Converter applies statistical drift correction to measured magnetic field data by analyzing historical current-field relationships and compensating for systematic measurement drift over multiple machine cycles. It uses marker-based alignment and linear drift models to improve field measurement accuracy for hysteresis compensation calculations.
Trigger
SR.BMEAS-SP-B-SD/CycleSamples#samples - Measured magnetic field cycle samples from Super-Periodic field measurement system, buffered with 10-cycle history for drift analysis.
Buffered Subscriptions
Historical Current Log: MBI/LOG.I.REF (alias: IREF_LOG_HISTORY) - Buffer of 10 previous cycles of logged reference current for drift correlation analysis
Current Programmed Reference: rmi://virtual_sps/MBI/IREF (alias: IREF_PROG) - Current programmed reference for cycle-by-cycle comparison
I2B Calibration Function: rda3://${NODE_ID}/UCAP.I2B.CALIBRATION/Acquisition (alias: CALIBRATION) - Current-to-field calibration as DiscreteFunction
All subscriptions use buffer_size=1 except the trigger and history which maintain 10-cycle buffers for statistical analysis.
Drift Correction Logic
The converter implements a multi-step drift correction algorithm:
- Marker Identification - Find field crossing points at 0.11T (300A equivalent) for cycle alignment
- Historical Analysis - Compare current cycle against previous cycles using buffered history
- Drift Calculation - Compute linear drift coefficients from field-current correlation residuals
- Correction Application - Apply calculated drift correction to measured field values
- Quality Validation - Ensure correction improves measurement accuracy before applying
Drift Detection Process
• Cycle Filtering: Skip ZERO cycles and low-current cycles below marker threshold • Reference Interpolation: Generate expected field from calibration function and programmed current • Residual Analysis: Calculate measurement vs. reference differences across multiple cycles • Trend Identification: Use linear regression to identify systematic drift patterns • Correction Scaling: Apply proportional correction based on drift magnitude and confidence
Output
Property: Acquisition - Drift-corrected magnetic field measurements with improved accuracy
Device: SPS.BTRAIN.BMEAS.SP
Usage: Provides corrected field measurements for precise hysteresis compensation calculations
Error Handling
The converter gracefully handles various failure modes. ZERO cycles are automatically skipped as they lack sufficient field excitation for meaningful correction. Low current cycles below the 300A threshold are bypassed to avoid noise amplification. When drift correction fails validation, the system falls back to original measurements. The converter continuously monitors correction effectiveness and disables correction when improvements are minimal.
Dependencies
- Calibration Provider for I2B calibration function
- sps-ucap-hysteresis-compensation package
- Super-Periodic field measurement system for trigger data
- MBI current logging system for historical correlation
Notes
The converter maintains statistical confidence in drift corrections by requiring multiple cycles of consistent drift patterns before applying corrections. Field measurement accuracy improvements are validated against calibration residuals to ensure corrections enhance rather than degrade measurement quality.