Not sure all information here is up to date.
Old flow
Model input: Model output:
Pre-processing
Removing the linear component of the field
Computing the scaled variables
PhyLSTM
Applying PhyLSTM:
Loss
Computing the loss, the is proportional to the square of the L2 norm and MSE:
and with the Bouc-Wen loss components.
Postprocessing
Unscaling the variables. The is not unscaled normally as we are only interested , but is provided here for completeness. Note that we do not have and
Adding back the linear component
New flow
This is a new data flow proposed to refactor the PhyLSTM code, baking in a running normalization of the variables and , however this is deemed impractical as the running normalization does not work with
Model input: Model output:
Pre-processing (in PhyLSTMModule)
Compute the scaling parameters (after transformation of the parameter to avoid lookahead bias):
Removing the linear component of the field
Scale
PhyLSTM
Applying PhyLSTM:
And compute the linear part using the fixed linear layer:
Loss
Computing the loss, the is proportional to the square of the L2 norm and MSE:
|| \hat{\dot{B}} - \dot{B} ||^2_2 & = || (\hat{\dot{B}}_{nl} + \dot{B}_{ln}) - \dot{B} ||^2_2 \\ & = || (\sigma_{\dot{B}_{nl}} \underbrace{\hat{\dot{B}}_{s, nl}}_{PhyLSTM(I_s)} + \mu_{\dot{B}_{nl}} + k\dot{I}) - \dot{B} ||^2_2 \\ & = || \sigma_{\dot{B}_{nl}} \hat{\dot{B}}_{s, nl} + \mu_{\dot{B}_{nl}} - \dot{B}_{nl} ||^2_2 \\ & = || \sigma_{\dot{B}_{nl}} \hat{\dot{B}}_{s, nl} + \mu_{\dot{B}_{nl}} - (\sigma_{\dot{B}_{nl}} \dot{B}_{s, nl} + \mu_{\dot{B}_{nl}}) ||^2_2 \\ & = || \hat{\dot{B}}_{nl} - \dot{B}_{nl} ||^2_2 \\ & = \sigma^2_{\dot{B}_{nl}} || \hat{\dot{B}}_{s, nl} - \dot{B}_{s, nl} ||^2_2 \end{align}$$ ### Postprocessing (in PhyLSTMModule) Unscaling the variables\begin{align} \hat{B}{nl} & = \sigma{B_{nl}} \hat{B}{s, nl} + \mu{B_{nl}} \ (~ \hat{\dot{B}}{nl} &= \sigma{\dot{B}{nl}}\hat{\dot{B}}{s, nl} + \mu_{\dot{B}_{nl}} ~) \end{align}
\begin{align} \hat{B} & = \hat{B}{nl} + B{ln} = \sigma_{B_{nl}} \hat{B}{s, nl} + \mu{B_{nl}} + kI + m \ \hat{\dot{B}} & = \hat{\dot{B}}{nl} + \dot{B}{ln} = \sigma_{\dot{B}{nl}}\hat{\dot{B}}{s, nl} + \mu_{\dot{B}_{nl}} + k\dot{I} \end{align}
### Computing the mean of the nonlinear part For $B_{nl}$ $$\begin{cases} \mu_{B_{nl}} & = \mu_B - (k\mu_I + m) \\ \sigma_{B_{nl}} & = \sqrt{\sigma_B^2 + k^2\sigma_I^2} \end{cases}$$ and $\dot{B}_{nl}$ $$\begin{cases} \mu_{\dot{B}_{nl}} & = \mu_\dot{B} - k\mu_\dot{I} \\ \sigma_{\dot{B}_nl} & = \sqrt{\sigma_\dot{B}^2 + k^2\sigma_\dot{I}^2} \end{cases}$$ #### Proof\mu_{B_{nl}} = E[B_{nl}] = E[B - (kI+m)] = E[B] - (kE[I] + m) = \mu_B - k\mu_I - m
$$\begin{align} \sigma_{B_{nl}} &= \sqrt{E[B_{nl}^2]-E[B_{nl}]^2} \\ & = \sqrt{E[B_{nl}^2] - \mu_{nl}^2} \\ & = \sqrt{E[(B-(kI+m))^2] - \mu_{nl}^2} \\ & = \sqrt{E[B^2 - 2 BkI - 2 B m + I^2 k^2 + 2 kIm + m^2]-\mu_{B_{nl}}^2} \\ & = \sqrt{(\sigma^2_B + \mu^2_B) - 2k\mu_I\mu_B - 2m\mu_B + k^2(\sigma_I^2 + \mu_I^2) + 2km\mu_I + m^2 - \mu_{B_{nl}}^2} \\ & = \sqrt{\sigma_B^2 + k^2\sigma_I^2} \end{align}$$ because $$\begin{align} E[B_{nl}] & = E[(B-(kI+m))^2] \\ & = E[B^2 - 2 BkI - 2 B m + I^2 k^2 + 2 kIm + m^2] \\ & = E[B^2] - 2kE[I]E[B]- 2mE[B]+ k^2E[I^2] + 2kmE[I] + m^2 \\ & = (\sigma^2_B + \mu^2_B) - 2k\mu_I\mu_B - 2m\mu_B + k^2(\sigma_I^2 + \mu_I^2) + 2km\mu_I + m^2 \end{align}$$ andE[X^2] = \sigma^2 + E[X]^2 = \sigma^2+\mu
and $$\begin{align} \mu_{B_{nl}}^2 & = (\mu_B - k\mu_I - m)^2 \\ & = \mu_B^2 - 2k\mu_B\mu_I - 2m\mu_B + 2km\mu_I + k^2\mu_I^2 + m^2 \end{align}$$ For the derivative $\dot{B}_{nl}$ the same proof follows, but without the constant $m$. ### Eddy current decay The original PhyLSTM follows\begin{align} o & = \textrm{LSTM}(I)\ z & = \textrm{FC}(o), \quad z = {\hat{B}, \hat{\dot{B}},\hat{r}} \end{align}
Assuming that eddy currents are captured in the LSTM output $o$, we could simply computey = \textrm{FC}2(o), \quad y={\hat{I}\textrm{e}, \hat{\dot{I}}_\textrm{e}}
\hat{B}_\textrm{e} = c\hat{I}_e
\hat{B} \rightarrow \hat{B} + \hat{B}_\textrm{e}
Simply by following equations $\eqref{dotIe},\eqref{Ie},\eqref{Be}$ adding to the objective function\begin{align} \mathcal{L}4 & = \left|\left| \frac{d}{dt}\hat{I}\textrm{e}-\hat{\dot{I}}_\textrm{e} \right|\right|^2_2 \
\mathcal{L}5 & = \left|\left| \hat{\dot{I}}\textrm{e} - (a\dot{I}+b\hat{I}_\textrm{e}) \right|\right|^2_2 \end{align}