Derive the mathematical equations of the system and implement them in Simulink, as in this example. Simscape also provides some electrical, magnetic and mechanical blocks that can probably help. There's a demo in Simscape of a solenoid with magnetic blocks that you can probably inspire yourself from.
HTH,
Arnaud