Modeling and Simulation of Using Matlab/Simulink
Modeling and Simulation of Using Matlab/Simulink
using Matlab/Simulink
Modeling Building
and Simulation with Simulink
Updated for Spring 2001
Raul G. Longoria
University of Texas at Austin
Department of Mechanical Engineering
x = x + u (t ) u (t) s
Inte g ra to r S co p e
algebra
e.g., u(t) = step Output
ME 379M/397 Department of Mechanical Engineering
Vehicle System Dynamics and Controls displays
The University of Texas at Austin
Simulink Description
Models are hierarchical. Model detail can be viewed by diving into blocks.
The block diagram describes the equations, and possibly the interconnection of
components.
You can simulate the model choosing from several integration methods.
Analysis can be conducted in Simulink or from the MATLAB command
window. It depends on whether an interactive or batch mode is desired.
Display functions are available for direct plotting (while simulation runs).
The simulation results can also be sent to the workspace for postprocessing
and visualization using the MATLAB graphical tools.
There are many analysis tools available, and since Simulink is integrated into
MATLAB, you can simulate, analyze, and revise models in either environment
at any point.
Do lla r
He a t C os t ($)
blowe r QDot
Te rr cmd Ga in
70 F2 C Mdo t*h a
S e t P oin t Fa hre n he it C2 F
He a te r
to Ce lsius Th e rm o sta t Indoor v s .
Blowe r Ce lsiu s to Outdoor Te m p.
Ho use Fa h re n he it
Th e rm o
50 F2C
Note: model files Avg Ou td o or Tin
P lots
Fa h re n he it
are ASCII, so they Te m p to Ce lsius
can be opened by Da ily Te m p
any text editor, or Va ria tion
Example elements:
= summer
= product
= integrator
= function (nonlinear type)
Quicker modeling
Better communication
Modularity - can connect
subsystems together to make more
complex models
Display blocks
Output to workspace
Use CTRL-R to
rotate
[t,x,y] = sim(modelname,tspan,options,ut)
help sim Use simset
SIM Simulate a Simulink model
SIM('model') will simulate your Simulink model using all simulation
parameter dialog settings including Workspace I/O options.
[T,X,Y] = SIM('model',TIMESPAN,OPTIONS,UT)
ME 379M/397 Department of Mechanical Engineering
Vehicle System Dynamics and Controls The University of Texas at Austin
Simulation Parameters
Under Simulation
menu (3 panels)
Solver settings
Workspace I/O
Diagnostics
R km
h + v
Lm Jm
m
h = k B
m m h + TL
Lm Jm
Require:
Load system
fixed field Electrical source model
ME 379M/397 Department of Mechanical Engineering
Vehicle System Dynamics and Controls The University of Texas at Austin
Model of PMDC Motor
la m da
1 la m b da
d ot 1
Vin Vm 1/Lm 1
Km s
Curre n t
la m da in t Ga in4
S um
Ga in2
Rm /Lm
Tm
Ga in 3 Km /Lm
h Ga in
h d ot
1
2 1 /J m 2
s
Moto r S pe e d To rqu e Lo a d
Ga in1 h in t S um 1
Bm
Visco us
Ga in 5 Frictio n Vin C urre nt
P MDC Motor
Ge a r F
Rloa d 0
P MDC Moto r
-K-
Ge a r B
P os ition (de g)
P os ition/Volts S ha f t Motion
P o sition
P osition S e nso r
Backlash
Stiction
= 1
h
blade
J
h b2 B
h K R
L() driving
2 L( ) 2 J v coil
1
v(t) la m bda dot s la m bda
XY Gra p h
Inte g ra tor
la m bd a /L
Note: there has to be co il re sista n ce
c urre nt
a way to have the actuator 1 00
f(u ) R2 D
always drive the blade into the gap.
0.5 *b i^2 L(th e ta ) Ra dia n s th e ta
This does it. to De g re e s
0 .5 *.5 | u| 2 la m bda dot
Blade position will
The sign is included. curre n t
f(u ) o ffse t be brought to zero when
stiffn e ss
D2 R 5
coil is energized.
sig n
la m b da /L1 K*the ta
.1
De g re e s to
B*the ta dot Ra dia ns1
torque 0 .01
da m p in g
to rq ue 1
50 0 1
hdot s h the ta dot
s
Inte gra to r1 1 /J
Inte gra to r2
0 D2R
initia l a n gle De g re e s to
Ra dia ns
help trim
TRIM Finds steady state parameters for a system given a set of conditions.
TRIM enables steady state parameters to be found that satisfy
certain input, output and state conditions.
Va r D Hyd P u m p Ou t2
Fixe d D Hyd Mo to r
Om e g a m
R.G. Lo n g o ria
Ma y 1 9 98
P a ra m e te r file : p se tup 2 .m
0.4 1000
P res s ure (P a)
0.2644 System
Angle (rad)
800
0.3
0.9482 600
0.9908 states 0.2
400
0.0000 0.1 200
0 0
0 0.1 0.2 0.3 0.4 0 0.1 0.2 0.3 0.4
time time
U= Motor Angular Velocity
30
Angular Velocity (rad/s ec)
Demonstrations.
dee - Simulink system containing DEE and associated demos.
deedemo1 - Van der Pol Equation.
deedemo2 - Lorenz Atractor.
deedemo3 - Mass and Spring.
deedemo4 - Coupled Mass and Spring System with Animation.
Volts in Current
P MDC Motor
Mode l
Load Speed
torque DEE