TMMS04_05_Simulation.pdf

TMMS04: Simulation of Mechatronic Systems
Magnus Sethson
September 16, 2014
Abstract
The simulation tool is an essential part of the development of modern mechatronic products. Today most development departments and groups tries to foresee problems, performance, manufacturability, compatibility, efficiency, stability and robustness by making use
of computational tools that simulates or mimics the real physical effects onto the system
under study. This computational based lesson serves as an introduction to wast domain of
simulation tools and an outline of the most basic numerical steps needed for such tools.
This document include preparation tasks as homework, see section 4. The tasks should
be prepared in text and shown to the teachers on the beginning of the class.
1
Background
The idea of using physical models and sub-scale studies for predicting the behaviour of a fullsize system is old. Older than the computer era. Perhaps the best examples come from wind
tunnels, water landscape modelling and ship-building. However, with the advent of computers
mankind have gained access to a tremendous power of physical modelling, prediction and study
analysis.
The field of modelling and simulation within the domain of mechanical, hydraulic and electric
dynamics studies have emerged from single domain tools focusing on a particular application or
simulation technique to complete general solvers of multi-domain engineering challenges, still
maintaining the domain specific characteristics of the modelling and numerical processes. The
coupling to geometry modelling tools is becoming more and more important. Optimisation
and operational studies does also play a role in the upcoming engineering platforms. Oftenlly
integrated by a user supplied flow of information written in a scripting computer language.
2
Simulation of dynamic systems
Please take your time to read this through, it will help yourself to understand the
upcoming studies of the forklift project in the course. There are some homework that is
needed before you attend the class. During the class you will get help with the first task in this
document. The whole purpose of this class and assignment is to get a deeper understanding of
the mechanism behind simulation programs. To know their sometimes dubious character; they
almost always deliver an answer. But the answer is not better than the models included.
During this exercise you should ask yourself two questions; 1: What physical phenomena
are included in the mathematical model? 2: Is the model used in a proper way? In fact, you
should alway ask yourself these questions when working with computerised tools for engineering
1
TMMS04
Simulation of Mechatronic Systems
September 16, 2014
purposes. We can not expect a better result than the sharpness of the tool and our skilled use
of it.
As the tools become more and more integrated we can expect the engineers using them not
to have a full understanding of all sub-domains the tools can handle. That is somehow a new
and recent situation with the advent of co-simulation and multi-domain softwares. The tools
can easily be used by less skilled engineers or engineers with a non-expertise knowledge level in
some subdomains of the simulation model. It is advised to make use of mathematical models
with great care.
3
The example system
The system under study is an simplified elevator made for lifting minor loads such as tools
and parts in workshop building. It could also be a food elevator in an restaurant. The system
consist of an electric DC motor, a gearbox, a winch drum and vertical guides for the carriage.
R
DC-motor
Winch
Gearbox
+
rd
Tm
Vm (t)
Ke , Kt
!m
Te
U g , ⌘g
Tg
Te
!d
Jm
L
ze : Elevator position
Te : Torque due to elevator
Tg : Gearbox torque
Tm : Motor torque
Be
rd : Drum radius
me : Elevator and load mass
Be : Elevator guides damping
Elevator
me
!d : Drum rotational speed
Ug : Gearbox gear ratio
⌘g : Gearbox efficiency
ze = ! d r d
!m : Motor rotational speed
Kt : Motor torque constant
Ke : Motor back-EMF constant
R : Motor resistance
L : Motor inductance
Vm (t) : Supply voltage
Figure 1: The general outline of the model.
The system are described by a number of mathematical expressions modelling the physical
behaviour of the components. These are rewritten here from literature and lecture slides.
The motor is represented by the two equations describing the electric circuit and the torque
generation.
2
TMMS04
Simulation of Mechatronic Systems
Vm (t) = im (t) R +
dim (t)
L + Ke ωm (t)
dt
Tm (t) = Kt im (t)
September 16, 2014
(1)
(2)
The rotational inertia, Jm , may be modelled in different ways, here it is assumed to represented as directly connected to the motor shaft.
Jm ω̇m (t) = Tm (t) − Tg (t)
(3)
The gearbox is represented by its input-output shaft gear ratio Ug and internal efficiency.
An ideal gearbox have no problem to transfer energy in any direction between the two shafts.
However, a real transmission gearbox only transfer power from the input side to the output
side. Hence the introduction of gearbox efficiency, ηg .
Te (t) = Tg (t) Ug ηg
ωm (t) = Ug ωd (t)
(4)
(5)
The position of the elevator is represented by the ze coordinate.
me z̈e (t) =
Te (t)
− me g − Be że (t)
rd
(6)
There are some kinematics included in the system as well. There are a relation between
elevator position and the amount of wire on the drum. From this insight one can make the
following assumptions about the relation between motor speed and elevator position. To be
able to describe the relation between elevator position ze and rotational speed of the motor
ωm one need to introduce some help variables; Θm and Θd . They represent the total angular
motion of each shaft. Hence follows that the time derivative of the Θm equals the rotational
speed ωm .
ze (t) = Θd (t) rd
(7)
Θm (t) = Ug Θd (t)
(8)
Θ̇d (t) = ωd (t)
(9)
3
TMMS04
4
Simulation of Mechatronic Systems
September 16, 2014
Model
Once the physics of the system is understood it is time to form an iterative update function
useful for updating the states in the model. The first task is to establish expressions for the
lowest derivatives of the states in the system. Select the states in the system to be motor
current, rotational speed and angle; (di/dt, ωm , Θm ). Make use of equations 1 to 9 above. Drop
the time dependance (t). This is homework!
Make use of your mathematical algebraic skills and fill in the missing parts of the following
set of equations describing the system states:

d


im = . . .



 dt
Θ̈m = . . .
(10)

Z T




 Θ̇m =
Θ̈m dt
0
4
TMMS04
5
Simulation of Mechatronic Systems
September 16, 2014
Tasks
The following sections describe tasks that should be fulfilled (task 5.1 and 5.2 bellow) and extra
tasks for the fun of simulation technology just. All of the addressed tasks should be reported
to examiner in paper form. Once you have eq. 10 in place the rest should not be particular
difficult. Make use of the simple forward Euler integration method, repeated here:
x[(n + 1)∆T ] = x[n∆T ] + ∆T
d
x[n∆T ]
dt
(11)
(12)
Make some “smart” selection of the order the states are updated. Use the following as input
for Vm (t) = min(120*max(0,sin(6*t)),24) . t = 0.0 to 1.0s. Use a ∆T of 0.001.
5.1
TASK: Simulation program
(1) Report on screen to the teachers in class a small simulation program in MATLAB m-script
form that iterates the solution indicated by eq. 10. (2) Also, present a plot of im and ze vs.
time t. You can save your diagrams as PDF-files for later printout.
5.2
TASK: Evaluation
(1) Make a change to your program so that the applied voltage Vm becomes zero after t = 0.5s.
Present, on screen to the teacher in class or later in a PDF, a plot of ωm (t). What is happening?
Give a short explanation to the terminal rotational speed. (2) Also present the m-script. (3)
Can you figure out from the simulation results how much energy that is put into the system for
that cycle? Can you calculate the energy input in Joules?
5.3
TASK: Change integration method
(1) Use the MATLAB m-script from task 5.1 above as an starting point and upgrade it to make
use of the trapezoidal integration method described in the lecture notes. Report the script and
code to the teacher and a plot of im and ze vs. time t in a similar fashion.
(2) Now you have a more stable integration method than previous. Lets study some problematic behaviours then. What happens if you set Be = 0. Keep ∆T = 0.001. Try to see what
is the smallest value you can set Be to and still have a reasonable result.
5.4
Play!
Besides the tasks above for your assignment. Try your simulation program with some changes
in parameters. What happens if you lower the resistance by 20 %? Change the inductance?
Increase the mass?
5
TMMS04
6
Simulation of Mechatronic Systems
September 16, 2014
Data
To make some differences in the class you get some of the parameters depending on your month
of birth. According to the following table.
Month
Jan.
Feb.
Mars
April
June
July
Aug.
Sept.
Oct.
Nov.
Dec.
R[Ω]
13.94
15.23
8.68
13.31
15.62
15.98
16.00
15.67
14.96
14.95
8.93
Ke [V /s]
0.0347
0.0340
0.0384
0.0351
0.0338
0.0336
0.0336
0.0337
0.0341
0.0341
0.0382
Kt [N m/A]
0.0344
0.0337
0.0381
0.0348
0.0335
0.0333
0.0333
0.0334
0.0338
0.0338
0.0379
Ug [−]
5.8
5.9
5.2
5.7
6.0
6.0
6.0
6.0
5.9
5.9
5.3
η[%]
63
62
66
63
62
62
62
62
62
62
66
L[H]
0.009
0.009
0.006
0.008
0.009
0.010
0.010
0.009
0.009
0.009
0.006
rd [m]
0.1561
0.1522
0.1793
0.1582
0.1510
0.1501
0.1500
0.1508
0.1529
0.1529
0.1775
me [kg]
0.9
0.8
1.0
0.9
0.8
0.8
0.8
0.8
0.8
0.8
1.0
Be [N s/m]
0.021
0.022
0.023
0.021
0.023
0.024
0.020
0.021
0.020
0.022
0.021
Jm = 10−6 .
6
TMMS04
7
Simulation of Mechatronic Systems
September 16, 2014
Hints
Here are some good hints for solving these tasks. First a program skeleton:
% 909977-3451, Kalle Kanon, [email protected]
R=2.0
Ke=1
Kt=1
Ug=38
Ng=.....
G=9.81
di=0
i=.....
sim=[];
dt=0.001;
for t=0:dt:1,
Vm=min(120*max(0,sin(24*t)),24);
di = .......
i=i+dt*di;
ddW= .......
dW=.......
W=.......
z=W/Ug*rd;
sim=[sim; t Vm i ddW dW W z];
end;
There are some useful MATLAB-commands for these tasks. Take a look at cumsum, plot,
title, xlabel, ylabel, legend
Also, there are a number of alternatives to the Mathworks MATLAB environment. Depending if your private computer(s) are running Windows, Mac OS X or Linux your have a number
of options: octave, Scilab, FreeMat and the older Rlab. MATLAB or a similar tool is very
useful in mechatronics development. Make yourself fluent in at least one of them!
Good Luck!
7