Closing the Control Loop¶
Firstly, start PyMoskito from the commandline and reapply the previous steps:
- select
PendulumModel
asModel
- change the initial state of
PendulumModel
to[0, 100, 0, 0]
- select
ODEInt
asSolver
- change the end time of
Solver
to 10 - select
AdditiveMixer
asModelMixer
Now, it gets interesting, select:
- the new
BasicController
asController
- change
Input A
ofModelMixer
toController
and - select
Setpoint
asTrajectory
to generate desired values for out new setup. The setpoint 0
demands that
the cart position (the output defined by our model) should be kept at zero.
To enter string values, type 'Controller'
or "Controller"
and remember to press enter to confirm the input.
The Properties window should now look like Fig. 6
Now, hit F5
to run the simulation.
After simulating, you find a few more diagrams in the data section.
Fig. 7 shows the example of the control error.
Feel free to experiment with the settings and see, if the control loop reacts the way you would have predicted. Keep in mind that the implemented controller is static. The control law does not adapt to changes of the model parameters, since the controller gain is calculated from values stored in the controller class. You can use this effect to simulate the situation, where the controller design was based on model parameters that differ from the real parameters of the process.
These were all the fundamental functions of PyMoskito considered necessary to work with it. One more important, but also more advanced feature is the system’s visualization in 2D or 3D. This animation appears in the window at the top right, which remained grey during this tutorial (see Fig. 3, Fig. 5, Fig. 7). For more information on this topic, see the lesson on visualization.