15MH403L – EXERCISE NO. 1: Solved

$ 24.99
Category:

Description

MATHEMATICAL MODELLING OF A PENDULUM OVER A CART
Reg. No.: RA1711018010101

LAB PREREQUISITES:
Introduction to Mathematical Modeling PREREQUISITE KNOWLEDGE:
• Fundamentals of transfer function and state space representation. • Fundamentals of SIMULINK modelling of physical systems.
15MH403L-MECHATRONICS LABORATORY Page No 1
OBJECTIVES:
 To derive the transfer function of a pendulum over a cart system Understand the dynamics of the mechanism for an applied force input.
 To add a controller to the mechanism and observe the controlled behavior.
THEORY
In this experiment, an inverted pendulum on a moving cart will be investigated. A pendulum rod is free to oscillate around a fixed pivot point attached to a motor-driven cart which is constrained to move in the horizontal movement. The rod is placed in the upright vertical position, which is an unstable equilibrium point. The control objective is to apply a force to move the cart so that the pendulum remains in the vertical unstable position.

Dimensions of the Links
Parameter Values
Values used for modelling
Mass of cart (M) 0.5 Kg
Mass of pendulum (m) 0.2 Kg
Friction/Damping Coefficient (b) 0.1 N/m/sec
Gravity 9.8 m/s^2
Length of Pendulum (l) 0.3 m
Inertia 0.006 kg.m^2
EXERCISE TASKS
Task 1 : Deriving the transfer function and state space model and representing in MATLAB
The open loop transfer function of the inverted pendulum system is derived as

State Space Representation
The linearized equations of motion from above can also be represented in state-space form if they are rearranged into a series of first order differential equations. Since the equations are linear, they can then be put into the standard matrix form shown below.

Task 2: Find the open loop impulse response and open loop step response of the system
• Comment on the stability of the system
Task 3: PID Controller Design
• The controller will attempt to maintain the pendulum vertically upward when the cart is subjected to a 1-Nsec impulse. Under these conditions, the design criteria are:
1. Settling time of less than 5 seconds
2. Pendulum should not move more than 0.05 radians away from the vertical

• Controller tuning
DELIVERABLES Task 1
• MATLAB representation of transfer function and state space model derived. Task 2
• Open loop impulse response and step response of the system. • Poles and zeros of the system to understand the stability.
Task 3
• Controller design
• The effect of Kp, Ki and Kd values on the system

MATLAB CODE
%% Experiment 1 – Pendulum Over a Cart
% Tanmay Alias Manjeet Vilas Samak (RA1711018010101)
% Initialization clc; clear all; close all; % System Parameters M = 0.5; % Mass of Cart (kg) m = 0.2; % Mass of Pendulum (kg) b = 0.1; % Friction/Damping Coefficient (N/m/s) g = 9.8; % Gravity (m/s^2) l = 0.3; % Length of Pendulum (m) I = 0.006; % Inertia (kg.m^2)
%% Task 1 – System Representation % Transfer Function Representation s = tf(‘s’); q = (M+m)*(I+m*l^2)-(m*l)^2;
P_cart = (((I+m*l^2)/q)*s^2-(m*g*l/q))/(s^4+(b*(I+m*l^2))*s^3/q-
((M+m)*m*g*l)*s^2/q-b*m*g*l*s/q);
P_pend = (m*l*s/q)/(s^3+(b*(I+m*l^2))*s^2/q-((M+m)*m*g*l)*s/q-b*m*g*l/q); sys_tf = [P_cart;P_pend]; inputs = {‘u’}; outputs = {‘x’;’phi’}; set(sys_tf,’InputName’,inputs) set(sys_tf,’OutputName’,outputs) sys_tf
% State Space Representation p = I*(M+m)+M*m*l^2;
A = [0 1 0 0;
0 -(I+m*l^2)*b/p (m^2*g*l^2)/p 0;
0 0 0 1;
0 -(m*l*b)/p m*g*l*(M+m)/p 0];
B = [0;
(I+m*l^2)/p; 0; m*l/p];
C = [1 0 0 0;
0 0 1 0];
D = [0;
0];
states = {‘x’ ‘x_dot’ ‘phi’ ‘phi_dot’}; inputs = {‘u’}; outputs = {‘x’;’phi’};
sys_ss = ss(A,B,C,D,’statename’,states,’InputName’,inputs,’OutputName’,outputs)
%% Task 2 – Open Loop System Response
t = 0:0.01:10; figure
impulse(sys_tf,t) % Impulse Response figure step(sys_tf,t) % Step Response
%% Task 3 – PID Controller
Kp = input(‘Enter Kp Value: ‘); % 100
Ki = input(‘Enter Ki Value: ‘); % 1 Kd = input(‘Enter Kd Value: ‘); % 20 ctrl = pid(Kp,Ki,Kd); sys = feedback(P_pend,ctrl) figure impulse(sys) % Impulse Response
RESULTS
1. The differential equations representing the inverted pendulum over cart were formulated and the transfer function as well as state space representations of the system were programmatically written in MATLAB.
2. The open loop impulse as well as step responses of the system (inverted pendulum over cart) indicated that the system is inherently unstable (since it does not follow the bounded-input-bounded-output or BIBO criterion for stability) and that an external controller is necessary for achieving system stability, tracking and robustness.

3. A simple PID controller was designed for making the system stable and the closed loop response of the system was analysed in order to check whether the BIBO criterion for stability was met. PID controller gains Kp, Ki and Kd were manipulated to get a stable system response. The final controller gains were noted to be 100, 1 and 20 for Kp, Ki and Kd respectively, for which the closed loop system response was bounded between 0 and 0.045 thereby satisfying the BIBO criterion for stability with minimal steady state error.

LAB SESSION SCREENSHOT

INFERENCE
This experiment gave a deeper understanding about modeling and simulation of dynamic systems using a case study of an inverted pendulum over cart, which is a typical mechatronics-based design approach. Moreover, implementation of a PID controller with closed loop system response analysis was also covered in this experiment which gave an idea about practical control system design problem and analysis of controlled behavior of a system. Furthermore, this experiment also helped familiarize with the world’s most widely used software product for the purpose – MATLAB.
From this experiment, it is evident that MATLAB is a very powerful tool when it comes to study and analysis of dynamic systems (both open and closed loop system behavior), such as an inverted pendulum over cart modeled and simulated in this exercise. It provides a range of built-in functions and toolboxes for rapid system analysis across multiple representation types (including transfer function as well as state space models). Furthermore, MATLAB is also very powerful software for control system design and offers multiple tools for fast and convenient testing.

Reviews

There are no reviews yet.

Be the first to review “15MH403L – EXERCISE NO. 1: Solved”

Your email address will not be published. Required fields are marked *