top of page

Cart-Pendulum Control and Simulation

This was a complex cart model on a fixed y-direction fixture with a pendulum connected to the cart's center. Modeling this was quite difficult, but it really honed my engineering skills in Simulink, Controls, and Modeling. My Control Theory professor sponsored me on this project, and I would not be nearly as interested in this field today without his challenging extracurricular projects! 

​

I collected the data from a load cell, a couple of strain gauges, and a LabVIEW program I developed. I then drew the Free Body Diagrams based on my dynamics knowledge. I also measured the pendulum's mass and length before the experiment. The goal was to model the system with Simulink and MATLAB then compare the model to the experimental data.

Nomenclature for Following Derivations

Nomenclature.png
---->Measured before experiments
---->Measured before experiments
FBD.png
system.png

Modeling and Deriving Equations of Motion

Using the Free Body Diagrams that were derived, I found the following equations to use for an energy modeling approach
K: Kinetic Energy
V: Potential Energy

I input the equations into a Langrangian equation for energy modeling

I also accounted for friction from generalized forces, reflecting non-conservative work using the following equations below

With this information, the equations of motion can be found using the Lagrangian. Since there are two degrees of freedom, you need two equations of motion, x and theta

Plugging the above information into the Lagrangian gives the following equations of motion
Note: for equation 2, I used trigonometric identities to simplify the equation

eq9.png

Linearizing the Equations of Motion

To minimize computation time and complexity, we need to linearize the equations of motion. I decided to use Taylor Series Approximations due to the simplicity. Below are the results

eq11.png

After the Taylor Series Approximation, the following is obtained

eq12.png

This can be rearranged to be

eq13.png

Log Decrement to Find the Values of Variables

log decrement.png

Using the properties of Log Decrement, the period and decrement parameter can be found for the system when it is UNCOUPLED (Coupled system does not show log decrement since it is nonlinear). This allows the variables to be found since it reduces the complexity of the system. Using relationships established between these parameters and the frequency domain,  the Dampening Ratio, Natural Frequency, and Damped Natural Frequency can be found

Using the relationship between second-order ODEs and the frequency domain parameters, the Mass of the Cart, the dampening coefficient, and the angular dampening coefficient can be found

The following comparison between the second-order frequency domain equation and the equations of motion create three equations and three unknowns, meaning it is solvable

This solves for M1, c, and b. We now know all of the parameters. This allows us to create a Simulink Model with the parameters

Parameters Measured or Calculated

parameters of all values.png

Simulink Models

sim table.png

Below is the Nonlinear Simulink to model the system. As you can see, it is extremely complicated. Each branch is labeled with the constants to maximize readability. The runtime of this model was around 25 seconds!

nonlinear simulink.png

This is the Linearized Simulink. As you can see, it is much, much simpler! This was based on the linearized Equations of Motion seen above. The branches are labeled with the respective constants to maximize readability. The accuracy of this Simulink vs the Nonlinear is within 2% of each other. The runtime of this model was only 5 seconds, compared to the nonlinear model having a runtime of 25 seconds!

linear simulink.png

Results

These Graphs compare the Simulink Models to the Experimental Data Collected in LabVIEW. The left graph is the Displacement vs Time for the Cart. The right graph is the Angular Displacement vs Time for the Pendulum attached to the Cart. As seen, the difference between the Linearized and Nonlinear Simulink Models is very minor. Both do not exactly match the Experimental Data, but that is to be expected for a system this complicated. 

sim comparisons.png

As seen in the graphs, the largest difference is seen at the beginning of the time. This is probably due to an incorrect assumption of an initial condition within the model.

Famous Model Quote:
"There are no correct models, but some are useful"

bottom of page