You are on page 1of 45

MH504: Modelling and Simulation of

Mechatronic Systems

Atul Thakur, Ph.D.


Department of Mechanical Engineering
IIT Patna

Ref: Chapter 1-3 of System Dynamics: Modeling and


Simulation of Mechatronic Systems by Karnopp,
Margolis, and Rosenberg
Syllabus
 Physical Modelling: Mechanical and electrical systems, physical laws,
continuity equations, compatibility equations, system engineering concept,
system modelling with structured analysis, modelling paradigms for
mechatronic system, block diagrams, mathematical models, systems of
differential-algebraic equations, response analysis of electrical systems,
thermal systems, fluid systems, mechanical rotational system, electrical-
mechanical coupling
 Simulation Techniques: Solution of model equations and their interpretation,
zeroth, first and second order system, solution of 2nd order electro-
mechanical equation by finite element method, transfer function and
frequency response, non-parametric methods, transient, correlation,
frequency, Fourier and spectra analysis, design of identification experiments,
choice of model structure, scaling, numeric methods, validation, methods of
lumped element simulation, modelling of sensors and actuators, hardware in
the loop simulation (HIL), rapid controller prototyping, coupling of
simulation tools, simulation of systems in software (MATLAB, LabVIEW)
environment
System We don’t care about internal
physics such as grain structure of
 System is entity separable from universe
spring material or molecular
phenomenon – Systems Viewpoint
 Composed on interacting parts
 A system can be thought as box or block
diagram
 Having an input and corresponding output
 Inputs and outputs of system important
 not what goes inside the system

Input Output
Displacement Force
Spring Mass System

Output force = Spring Stiffness × Input Displacement


Example – Thermal Power Plant

Source:Youtube (Lesics)
Example – Thermal Power Plant
(contd.)

https://www.kepco.co.jp/english/energy/fuel/thermal_power/shikumi/index.html
Steady State and Dynamic Operation of
Systems
 Steady-state operation: system variables are assumed to remain constant in time
 Dynamic operation: Behaviour as a function of time is important

Example of Commercial Aircraft Operation

• For the analysis of fuel economy,


the steady-state operation is
considered
• For most of the operational
time, speed will not change

• For structural design, dynamic


operation is considered
• Time-varying stresses due
to movement in turbulent
air, emergency maneuvers,
or hard landings
Real systems cannot operate in a purely steady-state manner
Models of Systems
 Models are simplified abstracted constructs
 Used for predicting system behavior
 Broadly two types of models
 Physical
 Mathematical
 Characteristic feature of a model
 Some crucial aspects of real system is present in the model
while others are excluded
Examples of Physical Scaled Models

Real X48C Aircraft Scaled Physical Model


Source: https://www.airandspaceforces.com/x-48c-on-display-at-edwards-museum/
Source: Youtube (NASA Langley Research)

Real Canal
Scaled physical model of flood control design
Source: Youtube (Stantech)
Mathematical Models
 Developed based on mathematical equations and computer simulations
 Physical laws and boundary conditions are used
 For instance, we can model how the aircraft responds to pilot input
command signals during test maneuvers
 Such a model would not have prediction capability that are not modeled
explicitly
 a scaled physical model may give an idea of aerodynamic heating even if it
is not the primary intent of the model
An Example of
Mathematical Model
Anguilliform-inspired Robot

Developed @IITP
Mathematical
Model
𝑥ሷ 𝐶𝑀
𝑎𝑇 μ𝑛 𝑆𝜃2 −𝑎𝑇 μ𝑛 𝑆𝜃 𝐶𝜃 −𝑎𝑇 μ𝑛 𝑆𝜃 𝐶𝜃 −𝑎𝑇 μ𝑛 𝑆𝜃2 𝑉𝑥𝑎 ሶ 𝑎𝑇 𝑓𝐷𝑥
= −𝑀𝑝 𝑀𝑘 − 𝑀𝑝 𝑎 𝜃 + 𝑀𝑝
−𝑎𝑇 μ𝑛 𝑆𝜃 𝐶𝜃 𝑇
𝑎 μ𝑛 𝑆𝜃 2
𝑎𝑇 μ𝑛 𝐶𝜃2 𝑇 𝑉
𝑎 μ𝑛 𝑆𝜃 𝐶𝜃 𝑦 𝑎𝑇 𝑓𝐷𝑦

where 𝑀𝑘 =
Mathematical Model
𝑙𝐾 𝑇 (𝐶𝜃 𝜃ሶ 2 + 𝑆𝜃 𝜃ሷ )
𝑙𝐾 𝑇 (𝑆𝜃 𝜃ሶ 2 − 𝐶𝜃 𝜃ሷ )
, 𝑀 𝑝 =
𝑚11 𝑚12
𝑚21 𝑚22 =
2ሶ 𝑇 𝑇 −1 𝑇 𝑣𝑐 = 𝑣𝑐,𝑥 , 𝑣𝑐,𝑦 =
𝑁𝑚 𝑎𝑇xμCM
x =+[𝜃, 𝑆, 𝜃,
𝑎
𝑛 𝜃 CM xሶ ]
−𝑎 μ 𝑆
𝑛 𝜃 𝜃𝜏𝐶 =𝑎[𝜏 1 , … , 𝜏𝑁−1 ]
[𝑠𝑐 cos 𝜃𝑐 , 𝑠𝑐 cos 𝜃𝑐 ]
𝑎𝑇 μ𝑛 𝑆𝜃 𝐶𝜃 𝑎 𝑁𝑚 + 𝑎𝑇 μ𝑛 𝐶𝜃2 𝑎
x: Robot State 𝜏: Torque Vector 𝑣𝑐 : Flow Velocity
𝑎 = 1 𝜃…:1Joint𝑇
ℜ𝑛 , 𝑓𝐷𝑥 (𝐶𝜏𝑓𝑁−1
∈ Angle , 𝐶𝐷: )Torque
and 𝑓𝐷𝑦atare − 1)𝑡ℎ joint
(𝑁 effects of drag forces𝑠𝑐 : Flow
in x Magnitude
and y directions and
xCM : Robot Coordinates 𝑁:𝑥Number ሶ = 𝑓 of 𝜏,
(𝑥, links
𝑣 ; 𝑔 , 𝑒) 𝜃𝑐 : Flow
𝑒 = [CDirection
, 𝐶 , 𝐶 , 𝐶 ]𝑇
is a sum of linear and non-linear drag forces. 𝑐 𝑝 𝑓 𝐷 𝐴 𝑚
𝜃ሷ = −𝑀𝜃 [𝐷𝑇 𝜏 − 𝑊𝜃 𝜃ሶ 2 − 𝑉𝜃 𝜃ሶ − Λ3 𝜃ሶ 𝜃ሶ − 𝐾𝐷𝑥 𝑓𝐷𝑥 − 𝐾𝐷𝑦 𝑓𝐷𝑦 ]
𝑐𝑖𝑟𝑐𝑙𝑒 x𝐶𝑀,𝑔 2𝑇 𝑒:
𝑇 𝑆Environment
2 𝜇]𝑇𝐾 𝑇Parameters
𝑆𝜃𝜃=diag([sin
𝑀 2
= 𝐽 + 𝑚𝑙 𝜃𝑆1𝜃 𝑉𝑆 …𝜃sin+ 𝑚𝑙𝜃𝑁 ] 𝐶)𝜃and
𝑉𝐶𝜃 𝐶 Λ1 + 𝑙 2 𝜇𝑛𝑔𝐾𝜃11=
+𝜃 =diag([cos 𝐾… [𝐴,cos
𝜃 +
𝜔, 𝑙𝜃
𝛽, 𝑁𝑘 𝑛 )
]𝑇,
2 𝐾𝐾 𝐶=𝜃 𝑨𝑇 𝑫𝑫𝑇 −1 𝑫
𝑜𝑓
𝑊𝜃 = 𝑚𝑙 2 𝑆𝜃 𝑉𝑆𝜃 − 𝑚𝑙 ϵ 2 𝐶 𝑉𝑆 + 𝑙 2 𝜇 𝐾 𝐾C𝑓𝑇:𝐶Drag +
𝑝 2Coefficient
𝑙 𝜇 𝐾 𝐾 𝑇 𝑆 𝜃along longitudinal direction
𝜃 𝜃 𝑛 1 𝜃 𝑛 2 𝜃
𝑎𝑐𝑐𝑒𝑝𝑡𝑎𝑛𝑐𝑒 𝑎 𝑎 𝐶 : Drag Coefficient along transverse direction
𝑉𝜃 = Λ11 1− 𝑙 𝜇𝑛 𝐾2 𝑉𝑥 − 𝑙𝜇𝑛 𝐾21𝑉𝑦11 𝐷
𝑔𝑝 : Gait Parameters
A == 𝐴 ⋱+⋱𝜇 𝐴 𝑎𝑎𝑡 𝑚D 𝑆 =𝐶 − ⋱𝑚 ⋱ 2 𝐶𝑡𝐴 : Added mass coefficient
𝐾 1 1 𝑛 1 12 𝜃 𝜃 11 𝜃 𝑆 − 𝜇 𝑛 2𝐴 𝑎𝑎
𝐴: (𝑚22 𝑆𝜃 𝐶𝜃 − 𝑚21 𝑆𝜃2 )
Amplitude
𝐵1 1 𝑁−1𝑡 𝑁 1 −1 2𝑁−1 𝑁 𝐶𝑡𝑀 : Added inertia coefficient
𝐾2 = 𝐴2 − 𝜇𝑛 𝐴1 𝑎𝑎 𝜃 𝑟𝑒𝑓 𝑚11 𝑆𝜃 𝐶𝜃 − 𝑚12 𝑆𝜃 − 𝜇𝑛 𝐴2𝜔: 𝑚21 𝑆𝜃 𝐶𝜃 − 𝑚22 𝐶𝜃2
𝑎𝑎 Frequency
𝑅
𝐴1 = 𝑆𝜃 𝐾 𝑆x𝜃2𝐶𝑀+ 𝐶𝜃 𝐾 𝑆𝜃 𝐶𝜃 , 𝐴2 = 𝑆𝜃 𝐾 𝑆𝜃 𝐶𝜃𝑎 + 𝐶𝜃 𝐾𝐶 𝛽:𝜃2 Phase
𝑎
Shift
μ𝑛 =F(𝐶𝐴ҧ ) is the addedሷ mass ሶ factor, ሶ 𝑉𝑥ሶ (𝑣𝑘𝑐,𝑥:) High-Level
ΩFluid and 𝑉𝑦 (𝑣𝑐,𝑦Controller
)
𝜃
Torques 𝑇 = Λ1 𝜃 − Λ2 𝜃 − Λ3 𝜃|𝜃| 𝜃
Λ 𝐶 , Λ 𝐶 and Λ 𝐶 , 𝐽 is the moment of inertia Gain
of the links
1 𝑀 1 𝑓 1 𝑓
Mathematical Model
n−i
Dynamics of the robot: Controller:
𝛼= A sin(𝜔t + (i−1)𝛽) + 𝛾
n−1
𝜏 = 𝑘𝑝 e + k d 𝑒ሶ where e = 𝛼 − 𝛼 ∗
𝑥ሶ = 𝑓 (𝑥, 𝜏, 𝑣𝑐 ; 𝑔𝑝 , 𝑒)

Closed form solution of the equation cannot be found, hence we discretize the
dynamics and the controller

Discretized dynamics: Discretized Controller:


𝑥𝑗+1 = 𝑥𝑗 + 𝑓 (𝑥𝑗 , 𝜏𝑗 , 𝑣𝑐,𝑗 ; 𝑔𝑝 , 𝑒)∆𝑡 𝜏𝑘 = 𝑘𝑝 ek + k d 𝑒ሶ𝑘 where ek = 𝛼𝑘 − 𝛼𝑘∗

∆𝑡𝑐 is the time requiredController


for image-based after ∆𝑡𝑐 and
localization
is updated > ∆𝑡data communication
We found ∆𝑡𝑐 = 0.3 s from our experiments and ∆t is set to 0.01s
𝑐𝑖𝑟𝑐𝑙𝑒 x𝐶𝑀,𝑔
𝑜𝑓 ϵ
𝑎𝑐𝑐𝑒𝑝𝑡𝑎𝑛𝑐𝑒

𝐵
𝜃𝑟𝑒𝑓
𝑅
x𝐶𝑀
Ω 𝜃ҧ

13
Controller Circle of Goal
Start
acceptance

𝑥𝐶𝑀 𝑥𝐶𝑀,𝑔

𝐴 = 0.85 rad 𝜔 = 3.1 rad/s 𝛽 = 0.80 rad 𝑘𝜃 = 0.1


𝑘𝑝 = 0.3 and 𝑘𝑑 = 0.2

14
Controller
Start Goal

𝑥𝐶𝑀 𝑥𝐶𝑀,𝑔

𝐴 = 0.85 rad 𝜔 = 3.1 rad/s 𝛽 = 0.80 rad 𝑘𝜃 = 2.0


𝑘𝑝 = 3.0 and 𝑘𝑑 = 0.1

15
State-Determined Systems
 Expressed as ordinary differential equations in terms of state variables
 State of a system is a set of variables that along with the input and dynamics equation can
predict the future state and output of the system
Example of spring mass damper system
𝑑 2 𝑥(𝑡) 𝑑𝑥(𝑡)
𝑀 +𝑏 + 𝑘𝑥(𝑡) = 𝑢(𝑡)
𝑑𝑡 2 𝑑𝑡
𝑑𝑥 𝑡
Let, 𝑥1 𝑡 = 𝑥 𝑡 and 𝑥2 𝑡 =
𝑑𝑡
0ሶ 1 𝑥1 0
𝑥ሶ 1 𝑘 𝑏 1 𝑢
= 𝑥2 +
𝑥ሶ 2 − −
𝑀 𝑀 𝑀
If we are
In general, for linear systems interested in
𝑋ሶ = 𝐴𝑋 + 𝐵𝑈 displacement
And for nonlinear systems 𝑥(𝑡) as output
𝑋ሶ = 𝑓(𝑋, 𝑢) then
Input Output 𝑌(𝑡) = 𝑥(𝑡)
Variables Dynamic System, 𝑆
Variables
𝑈 State variable, 𝑋
𝑌
State-space formulation is often used for mathematical modeling
Applications of Modeling
 Analysis
 Given present state 𝑋, action 𝑈, model 𝑆, determine future output 𝑌
 Identification
 Given history of actions 𝑈 and outputs 𝑌 obtained by experiments,
determine model 𝑆 and state variable 𝑋
 Synthesis
 Given action 𝑈 and desired output 𝑌, find system 𝑆 such that 𝑈
acting on 𝑆 will generate output 𝑌
 Control
 Given system 𝑆, design control system that uses 𝑌 obtained from
sensors to determine control input 𝑈 to make the system respond in
desired way meeting prespecified performance criteria
Multiport Systems and Bond Graphs
Engineering Multiports
 When two components are joined together physically
 Two complementary variables are simultaneously constrained to be equal for them
 Ports are places at which subsystems can be interconnected
 Power flows via ports
 Systems with one or more ports are called multiports
𝑄 𝑃
Hydraulic
𝑖 Electric Motor 𝜏 2 𝜔2 Pump
𝜔 𝜏 𝜔1 𝜏1 𝜏 𝜔
𝑄
𝑒

2-port systems

3-port system
Power Variables
 Variables that are forced to be identical when two multiports are connected
are called power variables
 Product of power variables is the instantaneous power flowing between the two
multiports
𝑄 𝑃
Example
Hydraulic
𝑖 Electric Motor Pump
𝜔 𝜏 𝜏 𝜔
𝑄
𝑒

Power is effort times flow, i.e., 𝑃 𝑡 = 𝑒 𝑡 𝑓(𝑡)


Energy Variables
 Variables in terms of which energy of system can be expressed
mathematically
𝑡
 Momentum variable 𝑝 𝑡 = ‫𝑡 𝑒 ׬‬ 𝑑𝑡 = 𝑝0 + ‫𝑡 𝑒 𝑡׬‬ 𝑑𝑡
0
𝑡
 Displacement variable 𝑞 𝑡 = ‫𝑓 ׬‬ 𝑡 𝑑𝑡 = 𝑞0 + ‫𝑓 𝑡׬‬ 𝑡 𝑑𝑡
0
 Alternatively,
𝑑𝑝 𝑡
 = 𝑒 𝑡 , 𝑑𝑝 = 𝑒𝑑𝑡
𝑑𝑡
𝑑𝑞 𝑡
 = 𝑓 𝑡 , 𝑑𝑞 = 𝑓𝑑𝑡
𝑑𝑡
 Total energy, 𝐸(𝑡) passing into or out of port can be given as 𝐸 𝑡 =
‫𝑡𝑑 𝑡 𝑓 𝑡 𝑒 ׬ = 𝑡𝑑 𝑡 𝑃 ׬‬
 Alternatively,
 𝐸 𝑡 = ‫𝑞𝑑 𝑡 𝑒 ׬ = 𝑡𝑑 𝑡 𝑓 𝑡 𝑒 ׬‬, a𝑠 𝑓𝑑𝑡 = 𝑑𝑞
 𝐸 𝑡 = ‫𝑝𝑑 𝑡 𝑓 ׬ = 𝑡𝑑)𝑡(𝑒 𝑡 𝑓 ׬ = 𝑡𝑑 𝑡 𝑓 𝑡 𝑒 ׬‬, a𝑠 𝑒𝑑𝑡 = 𝑑𝑝
Tetrahedron of State
𝑡
𝑑𝑝 𝑡 𝑞 𝑡 = න 𝑓 𝑡 𝑑𝑡 = 𝑞0 + න 𝑓 𝑡 𝑑𝑡
= 𝑒 𝑡 , 𝑑𝑝 = 𝑒𝑑𝑡
𝑑𝑡 𝑡0

𝑡 𝑑𝑞 𝑡
𝑝 𝑡 = න 𝑒 𝑡 𝑑𝑡 = 𝑝0 + න 𝑒 𝑡 𝑑𝑡 = 𝑓 𝑡 , 𝑑𝑞 = 𝑓𝑑𝑡
𝑡0
𝑑𝑡
Modeling of Systems using Power and Energy Variables
 Any system can be modeled using only four variables
 power (effort 𝑒 and flow 𝑓) and
 energy (momentum 𝑝 and displacement 𝑞)
Generalized Mechanical Mechanical Hydraulic Port Electrical Port
Variables Translation Port Rotation Port
Effort, 𝑒 Force, 𝐹 (N) Torque, 𝜏 (N-m) Pressure, 𝑃 (N/m2) Voltage, e, (V or N-
m/C)
Flow, 𝑓 Velocity, 𝑉 (m/s) Angular velocity, Volume flow rate, 𝑄 Current, I, (A or
𝜔 (rad/s) (m3/s) C/s)
Momentum, Momentum, 𝑃 (N-s) Angular Pressure momentum, Flux linkage, 𝜆(V-s)
𝑝 Momentum, 𝑝𝜏 𝑝𝑝 (N-s/m2)
(N-m-s)
Displacement, Displacement, 𝑋 (m) Angle, 𝜃 (rad) Volume, 𝑉 (m3) Charge, q (A-s)
𝑞
Power, 𝑃 𝐹(𝑡)𝑉(𝑡) (N-m/s) 𝜏 t 𝜔(𝑡) (Nm/s) 𝑃(𝑡)𝑄(𝑡) (Nm/s) e 𝑡 𝑖(𝑡) (V-A or W
or Nm/s)

Energy, 𝐸 ‫𝑥𝑑𝐹 ׬‬, ‫( 𝑃𝑑𝑉 ׬‬N- ‫𝜃𝑑𝜏 ׬‬, ‫𝑉𝑑𝑃 ׬‬, ‫) 𝑝𝑝𝑑𝑄 ׬‬ ‫𝑞𝑑𝑒 ׬‬, ‫( )𝜆𝑑𝑖 ׬‬V-A-
m) ‫( ) 𝑢𝑎𝑡𝑝𝑑𝜔 ׬‬N- (N-m) s, or W-s or N-m)
m)
Bond Graph Representation

 A port is represented as a line segment


 Efforts are placed either above or left of port lines
 Flows are placed either below or to the right of
port lines

effort
flow
effort

flow
Example – Pump, Motor, Battery

 Common Bond: When two multiports are


coupled together
 Effort and flow variables become identical
 Motor and pump have common 𝜔 and 𝜏 at
the coupling
 Battery and motor have common voltage and
current at the terminals where battery and
armature connect
Example – Automotive Drive Train
Input and Output
 If in dynamometer, speed is set and
torque is measured
 Input is speed output is torque
 If voltage is supplied and motor
responds with current
 Input is voltage output is current
 Causal stroke: indicates direction in
which effort is directed

Effort is output of A, input to B


Flow is output of B, input to A

Effort is output of B, input to A


Flow is output of A, input to B
Component Models
Basic 1-port Elements
 Single power port with single pair
of effort and flow variables

1-port representation of a complex


power distribution
Basic 1-port Resistor Elements
• In 1-port resistor, effort
and flow related by static
constitutive equation
• Resistors dissipate
energy
• Dampers in mechanical,
porous plugs in fluid
lines, resistors in
electrical ciruits Electrical Mechanical Hydraulic
1-port Capacitor
 Effort and displacement related by
static constitutive equation
 Stores energy and gives up energy
without loss
Capacitor Spring Tank
 Springs, torsion bars, electrical
capacitors, gravity tanks, accumulators

Torsion bar Accumulator


1-port Inertia
 Momentum and flow related by
constitutive equation
Electrical Inductance Mass Hydraulic inertia
 Stores energy
 Electrical inductance, mass/inertia in
mechanical systems

Rotational inertia
Effort Source and Flow Source
 Voltage supply, pressure source, vibration shakers, constant-
flow systems
Basic 2-port Elements Ideal rigid lever

 In ideal 2-port element, power is conserved

Gear pair
 Constitutive laws; 𝑒1 = 𝑚𝑒2 and 𝑚𝑓1 = 𝑓2
where 𝑚 is called transformer modulus

 Example: In case of hydraulic ram Electrical Transformer


𝐹 = 𝐴𝑃 and 𝐴𝑉 = 𝑄, here 𝐴 functions as transformer
modulus

Hydraulic ram
Gyrator
 A gyrator’s constitutive laws are 𝑒1 = 𝑟𝑓2 and 𝑟𝑓1 = 𝑒2 where r
is the gyrator modulus

Electrical Gyrator
Mechanical Gyrator

Voice Coil
Relation between Gyrator and
Transformer
Two gyrators cascaded together gives a transformer
Modulated Transformer and Modulated Gyrator

 Power conservation is maintained even when moduli 𝑚 and 𝑟 are variables

Modulated Modulated
transformer gyrator
Example

Displacement Modulated Transformer


3-Port Junction Element
 3-ports are also called junctions
 Interconnect other multiports into subsystem/system
0-Junction (Flow Junction)
 Effort on all bonds of a junction are identical and algebraic sum of
flows vanishes

Electrical Hydraulic Mechanical


1-Junction (Effort Junction)
 1-junction has single flow and sum of effort on bonds vanishes

Electrical Hydraulic
Mechanical
Relationship of 0 and 1 junctions to Physical Laws
System Bond Graph Symbol Physical Laws

Kirchoff’s current law at a node where three


conductors join

Electrical Kirchoff’s voltage law along a closed loop in which


current flows and three voltages drop
Geometric compatibility for a situation where one
force is acting and three velocities which
Mechanical algebraically sum to zero
Dynamic equilibrium of three forces associated with
one velocity/Newton’s law
Conservation of volume flow rate at a point where
three pipes join
Hydraulic Sum of pressure drops around a hydraulic circuit
involving a flow is zero
Causal Form for 1-Port
Causal Forms for 2-Port Elements

Transformer

Gyrator
Causal Form for 3-Ports
Thermal Systems as Pseudo-bond Graph
 Thermal systems often represented analogous to electric circuits
 Temperature as voltage
 Heat flow as current
 With above analogy thermal resistor, capacitor, sources can be imagined –
however there is no thermal inertia
 Temperature is effort and heat flow is flow
 One problem though is that temperature*heat flow ≠ power
 Bond graph in which effort*flow is not power is called pseudo-bond
graph
 Cannot be coupled to normal bond graph using power variables

Where,

l: thickness, k: thermal
conductivity, A:area
u is internal energy per unit mass

You might also like