CH4Inverse PINN flux observer
A hidden parameter, recovered in this tab.
A simulated drive runs a permanent magnet motor. One number inside it, the magnet's flux linkage, is hidden from the estimator: losing it is what demagnetization means. A small physics-informed network is trained from scratch here, once per 13 ms slice of the voltages and currents, and each time it has to find that number from the terminals alone. No model is downloaded. Your browser does the optimization.
Inside one window
How the inverse PINN learns
Network
time + voltages
Predictions
currents + speed
Optimizer
update + repeat
Two losses
data + physics
Choose a step to explore at your own pace.
Predict
Time and both measured voltages enter the network. Two hidden layers predict the d-axis current, q-axis current and electrical speed.
Inputs
Neural network
3 → 32 → 32 → 3
Two hidden layers with swish activations.
Predicted states
These feed both the data comparison and the motor equations.
Read the diagram explanation
The loop runs repeatedly within one measurement window. Time and measured d-axis and q-axis voltages enter a 3 → 32 → 32 → 3 neural network with swish hidden layers. Its outputs are the two currents and electrical speed.
The two current predictions are differentiated with respect to time while voltage inputs are held fixed. Their derivatives and all three predicted states enter the electrical motor equations. Resistance and inductances stay fixed; the flux-linkage estimate enters only the q-axis equation. There is no speed-derivative residual.
Data loss is the mean squared difference between predicted and measured currents and electrical speed, averaged over all samples and all three states.
Physics loss is the sum of the mean squared d-axis and q-axis electrical residuals. Each residual measures how far the predictions depart from a motor voltage equation. The optional normalization preset scales state errors and voltage residuals before comparison.
The total objective is α times the data loss plus β times the physics loss. These weights control each loss’s influence on training.
Parameter updates. The iRprop− optimizer uses the sign of each total-loss gradient, with an adaptive step size per parameter. Network weights and biases, , receive gradients through both losses. The flux-linkage estimate, , receives its gradient only through the q-axis physics residual; no measured flux target is supplied. The updated values feed the next iteration.
Illustrative training loop. 1,283 network parameters and one physical parameter, . Every window starts with a fresh network and flux-linkage estimate.
The estimator is never shown this. Lower it and you have demagnetized the magnet.
sensitivity 419 V/Wb
Inductance falls with current in the plant. The estimator keeps using the datasheet values.
is the current that makes torque; runs along the magnet axis and makes none. The drive holds each at a commanded value and steps between eight operating points. 2.0 s at 10 kHz, decimated to 1 kHz.
from a deliberately wrong 0.10 Wb
starting...
1,284 trainable values, 1 of them physicalNo pretrained weights. Everything computed in this tab.ipinn-pmsm
The other lab
- Healthy
- Demagnetization
- Eccentricity
- Inter-turn short
Motor-fault classifier
Pick a fault, watch its signature appear in the spectrum, and see a 1D CNN call it from the raw current.
Open the lab
Added Sep 2026