WOLFRAM SYSTEM MODELER
Placeholder for the InvertedPendulum example model, available on the Wolfram SystemModeler website.
This is a placeholder model. It requires the ModelPlug and PlanarMechanics libraries.
The following documentation is taken from the main example of the downloadable model. Once you have downloaded all the model dependencies, the model can be downloaded here.
This model studies how a linear-quadratic regulator (LQR) can be used to stabilize an inverted pendulum.
The model requires the free PlanarMechanics library, availiable from the SystemModeler Library Store.
The inverted pendulum model consists of a pendulum and a cart, with the axis of rotation of the pendulum being located at the center of the cart. The pendulum is initialized with its center of mass above the rotation axis. When located directly above the cart, the pendulum will be in steady state and will stay there until disturbed.
While a pendulum that hangs straight down will be in a stable position, an inverted pendulum is unstable. That means that any small disturbance will cause the pendulum to tip over and never return to its original position.
A control system can be used to stabilize the unstable pendulum. Here, a linear-quadratic regulator is used. First, the regulator measures the states of the system, namely the cart position and velocity, the pendulum angle and the angular velocity. The regulator then calculates a force that should be applied on the cart in order for all the states to become zero. In other words, the regulator aims to have the pendulum pointing straight up (defined here as 0 degrees) and the cart return to the origin.
By simulating the model, you can try different values of the parameters and see how the control system responds.
To simulate the model and see the generated 3D animation, follow the steps below:
You can change the magnitude of the force that is applied to the pendulum by changing the pendulumDisturbanceForce parameter.
This domain example is an informational resource made freely available by Wolfram Research.
A summary of the licensing terms can be found at:
The full legal code can be found at: