Modelling a solenoid with return spring¶
This script will demonstrate the modelling of a solenoid with a return spring. When the power supply is switched off, the spring pulls the piston 5 mm away from the centre of the coil. Turning the power supply on at t=0.1 s retracts the piston to the centre of the coil. At t=0.3 s, an external load of 10 N is applied to the plunger.
The solenoid is modelled here using blocks from the magnetic component library.
Principle of operation:¶
The current flowing through the solenoid creates a magnetomotive force that creates flux through the solenoid's magnetic core. A counter force is created which actuates the piston to close the air gap, which is initially 5 mm long. The flux in the magnetic core increases as the air gap length decreases.
Realisation of the model run using software control:¶
Loading the model:
modelName = "Solenoid_with_Magnetic_Blocks";
actuator_model = modelName in [m.name for m in engee.get_all_models()] ? engee.open( modelName ) : engee.load( "$(@__DIR__)/$(modelName).engee");
Running a loaded model:
results = engee.run( modelName );
Load and visualise the data from the simulation.¶
Reading csv files with data on solenoid movement and magnetic flux variation, with subsequent conversion to dataframe and matrix.
position = results["Position"];
MF = results["MF"];
Connection of the library for plotting graphs:
using Plots
Connecting backend - method for displaying graphics:
gr()
Plotting a graph describing the change in solenoid position.
plot(position.time, position.value, xlabel="Время, с", ylabel="Перемещение, м", title="Изменение положения соленоида")
Construct a graph describing the change in magnetic flux.
plot(MF.time, MF.value, xlabel="Время, с", ylabel="Магнитный поток, Вб", title="Изменение магнитного потока")
Conclusion¶
In this example, it has been demonstrated that as the solenoid is moved and the air gap decreases, the magnetic flux value increases.