A classical engineering problem is to control an inverted pendulum. The pendulum system consists of an electrical motor, a gear, and a pendulum connected to a cart. The position of the cart is controlled using a controller with LQ (Linear Quadratic) design. The first priority of the controller is to make sure that the pendulum stays in an upright position.
Control signals for the pendulum.
To be able to control the pendulum, the position of the cart x and the pendulum angle ϕ are measured. The movement of the cart can be controlled via a force F, using the flange input.
Simulate the system for 20 seconds and view the result in an animation window. The figure below shows an animation at time 11.3 seconds, using the pulse reference signal (referenceType = 2).
Animation of the pendulum system.
The position of the cart can be changed by the referenceType parameter. With the time table option (referenceType = 3), you can create your own arbitrary signal. Change different parameters of the system, e.g. limit the maximum output signal from the controller (controller.uMax) or the length of the pendulum (pendulum.l_pendulum), and see what happens.