Engee documentation
Notebook

Spring-deployment system with regulator

Let us construct a system in which a force from a force source controlled by a regulator acts on the mass and to which a spring and a damper are connected, which creates a complex mode of motion of the system.

Features of the model

A pulse signal with a period of 5s is input to the system, followed by a PID controller that transmits a control signal to the system.

The initial speed of the mass block is equal to 10 m/s.

image.png

The controller controls a source that acts on the mass with a force proportional to the difference between the control signal and the position of the mass block according to the sensor.

Running the model and analysing the results

In [ ]:
model_name = "mass-spring-damper-with-controller";
model_name in [m.name for m in engee.get_all_models()] ? engee.open(model_name) : engee.load( "$(@__DIR__)/$(model_name).engee");
res = engee.run( model_name );
In [ ]:
Fпружина = collect( res["Пружина.F"] );
Fдемпфер = collect( res["Демпфер.F"] );
ctrl = collect( res["PID Controller.1"] );
Fисточник = collect( res["Force Source.F"] );
Pмасса = collect( res["Relative Translational Motion Sensor.2"] );
In [ ]:
gr()
plot(
    plot( Pмасса.time, Pмасса.value, label="Положение" ),
    ( plot( Fисточник.time, Fисточник.value, label="Источник" ); 
      plot!( Fпружина.time, Fпружина.value, label = "Пружниа" ); 
      plot!( Fдемпфер.time, Fдемпфер.value, label="Демпфер" ) ),
      layout=(2,1), lw=3
)
Out[0]:

Conclusion

The parameters of this PID controller can be adjusted manually or in an automated procedure. The mechanical parameters can also be changed, but the focus remains the same: to reduce the discrepancy between the system response and the control signal.