Engee documentation
Notebook

Demonstration of the influence of PID controller coefficients on the control system output signal

Let's consider the control system from the model pid_demo_mask.engee. It consists of a control object and a PID controller. In this example we will show how to control the PID controller coefficient values from the script and analyse the simulation results.

image.png

There are various methods to adjust the PID controller. However, sometimes it is necessary to adjust the coefficients manually to achieve the technical requirements of the system. To realise the parameter changes we used the Engee tool - cell masks.

When you change the value of any coefficient, the code hiding under the mask runs with the new parameters automatically. After execution you get a new result. In our case, the result will be a graph of the system response to a single step action.

Load the model and try to change some parameter.

In [ ]:
modelName = "pid_demo_mask";
PID_model = modelName in [m.name for m in engee.get_all_models()] ? engee.open( modelName ) : engee.load( "$(@__DIR__)/$(modelName).engee");
In [ ]:
K_p = 29.59 # @param {type:"slider", min:0, max:50, step:0.01}
K_i = 1.23 # @param {type:"slider", min:0, max:5, step:0.01}
K_d = 0.49 # @param {type:"slider", min:0, max:3, step:0.01}

results = engee.run( modelName )

PID_res_e_t = results["out"].time;
PID_res_e_d = results["out"].value;
PID_ref_e_d = results["ref"].value;

plot(PID_res_e_t , [PID_res_e_d PID_ref_e_d], legend = false)
plot!(title = "Результаты моделирования в Engee", ylabel = "Отклик", xlabel="Время, c")
xlims!(0,20)
Out[0]:

You can disable automatic updating of the result by clicking on image.png next to the cell start button. You can also change the maximum, minimum value and step change of the parameter in the code under the cell mask.

Blocks used in example