## Simscape |

This example shows a solenoid with a spring return. The solenoid is modeled as an inductance whose value L depends on the plunger position x. The back emf for a time-varying inductance is given by:

v = L*di/dt + i*dL/dt [1]

As L depends on x, this becomes:

v = L*di/dt +i*dL/dx*dx/dt [2]

dL/dx can be derived from manufacturer force-stroke data using the relationship:

Force = 0.5*i^2*dL/dx [3]

dL/dx can then be integrated to get L as a function of x.

In the model, Equation 2 is rearranged to solve for i, and then implemented using Physical Signal blocks. A controlled current source then constrains the current to equate to i.