Skip to content

About

Modelling an inverted pendulum cart system, and stabilizing it using a Siemens PLC.

Resources

Stars

1 star

Watchers

1 watching

Forks

Latest commit

 

History

81 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 

Repository files navigation

Inverted Pendulum

MATLAB Control Systems PLC

Overview

This repository contains the mathematical modeling, simulation scripts, and control system design files for an Inverted Pendulum semester project. The project explores both classical and modern control techniques, including PID controllers, root locus analysis, state-space representations, pole placement, and Linear-Quadratic Regulator (LQR) design with observer-based feedback—applied to an industrial mechatronic system.


Hardware Architecture & Specifications

The physical system relies on industrial components managed via a Schneider Electric PLC and motion servo drives:


Mathematical Modeling & Lagrangian Dynamics

The nonlinear dynamics of the cart-pendulum system are derived using Lagrangian mechanics in MATLAB (modellering.m, modelleringB.m, modelleringC.m, modelleringD.m).

  1. Kinetic and Potential Energy: Formulated for cart mass $M$, pendulum mass $m$, pendulum length $l$, and moment of inertia $I$.
  2. Linearization: The equations of motion are linearized around the upright unstable equilibrium point ($\theta = \pi$ or $0$ depending on convention) using Jacobians to form the state-space matrices $(A, B, C, D)$.
  3. Transfer Functions: Derived individual transfer functions for both the cart position ($x$) and pendulum angle ($\phi$).

Control Methodologies

The project implements and simulates multiple control strategies:

  • Classical PID & Root Locus: Single-input, single-output (SISO) loops tuned via root locus (rlocus) and automated tuning (pidtune) with discretization for PLC deployment ($T_s = 0.001\text{ s}$).
  • Full-State Feedback & LQR: Optimal control weighting matrices ($Q$ and $R$) configured to balance cart displacement tracking and pendulum stabilization, paired with precompensation scaling (rscale).
  • State Observers: Designed full-order observers via pole placement to estimate unmeasured states from sensor outputs.

Repository File Structure

  • modellering.m / modelleringC.m / modelleringD.m: Core symbolic derivation, Lagrangian formulation, Jacobian linearization, and state-space model generation.
  • alternative_method.m: Transfer function modeling based on classical control references (e.g., University of Michigan control tutorials).
  • Controlability.m / Observability.m: Controllability and observability matrix rank checks and canonical form transformations.
  • Hardware.md: Datasheet references and configuration notes for physical Schneider Electric hardware.

About

Modelling an inverted pendulum cart system, and stabilizing it using a Siemens PLC.

Resources

Stars

1 star

Watchers

1 watching

Forks

Contributors

Languages