Part 2-1: Numerical Simulation of Dynamic Systems
Part 2-1: Numerical Simulation of Dynamic Systems
Dynamic Systems
• So far, we have covered the following topics:
– Modeling dynamic systems
– Standard forms to represent dynamic systems
t
0
A
ìat for 0 £ t £ A / a
u (t ) = í
î A for t > A/ a
t
0
Pulse Input
• The input has a constant (finite) magnitude over a finite time
interval (the “pulse duration”), and is zero before and after
the pulse is applied
Pulse input
u(t)
ì 0 for t£0 A
ï
u (t ) = í A for 0 < t < t1
ï 0 for t ³ t1
î
t
0 t1
Impulse Input
• The input has a magnitude that lasts for a very short duration
f (t ) = 15d (t ) N f(t), N
Sinusoidal input 2
u (t ) = A sin wt + B cos wt 1
Input
0
-3
0 1 2 3 4 5
Frequency is sometimes expressed Time, sec
>> plot(t,y)
>> grid
>> xlabel(‘Time, sec’)
>> ylabel(‘Output, y’)
System Response Using
MATLAB Commands (3)
• Suppose that the input is a unit impulse at t = 0. Again, we have
several options for simulating the system response with MATLAB
• M-files step.m and impulse.m assume that the system has zero
initial conditions
– Of course, a system represented by a transfer function has zero
initial conditions by definition
>> simulink
• Clicking on the “new model” icon in the upper left corner will create
a new Simulink model, which begins as a blank template for
building the simulation block diagram
• Libraries:
– Sources (input signals like step, ramp, sine; clock time, etc)
– Sinks (plots and save output data: “scope”, “to workspace”)
– Continuous (TFs, state-space models, integrators, etc)
– Math Operations (gains, trig functions, summing junctions, etc)
– Discontinuous (nonlinear effects like Coulomb friction, backlash,
saturation, etc)
– Signal Routing (mux, demux, switches, etc)
Simulating Linear Systems
Using Simulink
• System model: m!y! + by! + ky = f (t ) y = position from equilibrium
f(t) = EM force (input)
System is initially at rest
Simulink steps:
1. Set the constant 12-N input force by using the “step” block from the “Sources”
library. Set the “step time” to 0.02 and set the “final value” (magnitude) to 12
2. Click/drag the TF icon from the “Continuous” library. Set the system parameters
(m, b, k) by entering the TF numerator and denominator polynomials as row
vectors in descending powers of “s”. Once the values are applied, the block
will show the TF with powers of s.
Simulation results are the same as previous examples with TF and SSR
Simulating Linear Systems: Summary
• The transfer-function approach is likely the most concise and
easiest method to use. However, by definition, a transfer
function cannot be used when the system has non-zero initial
conditions
Dry friction
3-Way Valve Step Response
Nonlinear and Linear Models
Example
Fem = 0.5 KI 2
Electrical Subsystem (2)
(after enclosing with “bounding box” and creating subsystem)
RL coil dynamics
Fem = 0.5 KI 2
Mechanical Subsystem
% Mechanical parameters
m = 0.03; % armature-valve mass, kg
b = 12; % viscous friction coefficient, N-s/m
k = 6000; % return spring constant, N/m
F_dry = 0.5; % dry friction force, N
% plots
figure(1)
plot(t,1e3*x)
grid
xlabel('Time, s')
ylabel('Armature-valve position, x(t), mm')
figure(2)
plot(t,I)
grid
xlabel('Time, t, sec')
ylabel('Solenoid current, I(t), A')
Valve Position vs. Time
10-V Step Input
Steady-state
position
xss = Fem / k
Solenoid Current vs. Time
10-V Step Input
Steady-state
current
Iss = 10 V / 3 W