quarc_srv02_self_erecting_inverted_pendulum_demo.mdl
Open this model

MATLAB Command Line

Click to copy the following command line to the clipboard. Then paste it in the MATLAB Command Window:

quarc_srv02_self_erecting_inverted_pendulum_demo

QUARC SRV-02 Self-Erecting Inverted Pendulum

This example simulates the dynamics and control of the Quanser SRV-02 Self-Erecting Inverted Pendulum Control Challenge and animates the experiment in full 3D realism in real-time. It also serves as an example of the powerful visualization capabilities provided with QUARC, including inheritance, specular lighting and fog.

The pendulum is initially in the downward position. The controller then uses an energy-based swing-up controller to swing the pendulum back and forth until it is close to the upright position. Once the pendulum is sufficiently close to upright and is not moving too quickly, the controller switches to a balancing control algorithm to maintain the pendulum in the vertical position. The swing-up controller can be disabled using the "Swing-Up: Up to Enable" Manual Switch on the Simulink diagram.

Once the pendulum is being balanced, the arm is commanded using a square wave generated by the Setpoint subsystem and the controller continues to balance the pendulum in the upright position, despite the movement of the supporting arm. Notice how the controller exhibits non-minimum phase behaviour to ensure that the pendulum does not fall when moving to the next arm position i.e., it gives the arm an impulse in the wrong direction to get the pendulum leaning before moving the arm to the correct orientation.

QUARC SRV-02 Self-Erecting Inverted Pendulum Demo Simulink model

Demonstration

Building, deploying and starting the model

Refer to One Step Process in QUARC Basic Procedures to build, deploy and start the model.

Running the model

The Quanser 3D Viewer visualization window will show the SRV-02 simulation responding to the controller in the Simulink model trying to balance the inverted pendulum.

Stopping the model

Refer to One Step Process in QUARC Basic Procedures to stop the model.

Running the example on a different target

To run the example on a different target, refer to the instructions on the Running QUARC Examples on Remote Targets page.