Demonstration of the effect of the coefficients of the PID controller on the output signal of the control system
Consider the ACS from the model pid_demo_mask.engee
. It consists of a control object and a PID controller. In this example, we will show how you can control the values of the PID controller coefficients from a script and analyze the simulation results.

There are various techniques for adjusting the PID controller. However, sometimes it is necessary to adjust the coefficients manually in order to achieve the technical requirements for the system. To implement parameter changes, we used the Engee tool - cell masks.
When you change the value of any coefficient, the code hiding under the mask starts automatically with the new parameters. After execution, you get a new result. In our case, the result will be a graph of the system's response to a single step-by-step effect.
Load the model and try to change any parameter.
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");
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)
The automatic result update can be disabled by clicking on next to the cell launch button. You can also change the maximum, minimum value and step of parameter change in the code under the cell mask.