Short Tutorial on Matlab Part 4 Simulink II
6 pages
English

Short Tutorial on Matlab Part 4 Simulink II

Le téléchargement nécessite un accès à la bibliothèque YouScribe
Tout savoir sur nos offres
6 pages
English
Le téléchargement nécessite un accès à la bibliothèque YouScribe
Tout savoir sur nos offres

Description

Short Tutorial on Matlab(©2004 by Tomas Co)®Part 4. Subsystems in SimulinkSuppose we want to model the control of the temperature and flow rate as shown inFigure 1.TCHotColdFCFigure 1.where the temperature of the flow out is described by the following equation:dT/dt = [ F T + F T – (F + F )T ]/Vhot hot cold cold hot coldand we will control the flow F by manipulating F and control the temperaturecold by manipulating . (For our example, we will use V=0.5).T Fhot 1. Model the temperature mixing process.a) Load the blocks and change their names and parameters as given inTable 1.Remarks:i) To rename a block, double-click the name and then change the text.ii) To change the direction of the ports in Mult3 block, right click andthe select [ ]Format [Rotate block] twice.iii) To change the direction of the outport of block Sum1, right-click andselect [Format] [Rotate block] once.b) Next, layout the blocks and connect the blocks to match Figure 1.1Table 1.Simulink Blocks Name ParametersSublibraryIn1Sources F_hot Port number: 1In1Sources T_hot Port number: 2In1Sources T_cold Port number: 3In1Sources F_cold Port number: 4Out1Sinks T Port number: 1Out1Sinks F Port number: 2ProductMath Ops Mult 1Math Ops Mult 2ProductMath Ops Mult 3GainMath Ops 1/V Gain: 2SumMath Ops Sum List of signs: | + +SumMath Ops Sum1 List of signs: + + -IntegratorContinuous Integrator Initial Cond: 60Figure 1.2. Group the blocks into a subsystem.a) From the menu, ...

Informations

Publié par
Nombre de lectures 126
Langue English

Extrait

1
Short Tutorial on Matlab
(©2004 by Tomas Co)
Part 4. Subsystems in Simulink
®
Suppose we want t
o
m
o
d
el the control of the temperature and flow rate as shown in
Figure 1.
TC
FC
Hot
Cold
Figure 1.
where the temperature of the flow ou
t
is described by the following equation:
d
T
/d
t
= [
F
hot
T
hot
+
F
cold
T
cold
– (
F
hot
+
F
cold
)T ]/V
and we will control the flow
F
by manipulating
F
cold
and control the temperature
T
by manipulating
F
hot
.
(For our example, we will use V=0.5).
1.
Model the temperature mixing process.
a)
Load the blocks and change their names and parameters as given in
Table 1.
Remarks:
i)
To rename a block, double-click the name and then change the text.
ii)
To change the direction of the ports in
Mult3
block, righ
t
click and
the selec
t
[
Format
]
[
Rotate block
] twice.
iii)
To change the direction of the outport of block
Sum1
, right-click and
selec
t
[
Format
]
[
Rotate block
] once.
b)
Next, layou
t
t
he blocks and connec
t
t
he blocks t
o
m
a
t
ch Figure 1.
2
Table 1.
Simulink
Sublibrary
Blocks
Name
Parameters
Sources
In1
F_hot
Por
t
n
u
m
b
e
r: 1
Sources
In1
T_hot
Por
t
n
u
m
b
e
r: 2
Sources
In1
T_cold
Por
t
n
u
m
b
e
r: 3
Sources
In1
F_cold
Por
t
n
u
m
b
e
r: 4
Sinks
Out1
T
Por
t
n
u
m
b
e
r: 1
Sinks
Out1
F
Por
t
n
u
m
b
e
r: 2
Math Ops
Product
Mul
t
1
Math Ops
Product
Mul
t
2
Math Ops
Product
Mul
t
3
Math Ops
Gain
1/V
Gain: 2
Math Ops
Sum
Sum
Lis
t
of signs: | + +
Math Ops
Sum
Sum1
Lis
t
of signs:
+ + -
Continuous
Integrator
Integrator
Initial Cond: 60
Figure 1.
2.
Group the blocks into a subsystem.
a)
From the menu, selec
t
[
Edit
]
[
Select All
].
b)
From the menu again, selec
t
[
Edit
]
[
Create Subsystem
].
c)
Rename the subsystem to be :
Temperature Mixing Subsystem.
3
d)
Resize the subsystem and move the inports and outports so they match
Figure 2.
Figure 2.
Note
: You can “open” the subsystem by double-clicking the subsystem block.
(you can continue to edi
t
t
he subsystem when the subsystem is opens as a
separate window).
3.
Create the PI controller subsystems.
a)
From the Simulink Library Browser, g
o
to the
Ports & Subsystems
subdirectory.
b)
Click-drag the
Atomic Subsystem
block into the Model window.
c)
Rename this block:
PI Temperature Controller
d)
Open the subsystem block (by double-clicking the subsystem block).
e)
Delete the line connecting
In1
block and
Out1
block.
f)
Rename
In1
as
error
, and
Out1
as
u
.
g)
Next, inser
t
b
l
o
c
ks into this subsystem window as prescribed in Table 2.
h)
Fix the block layou
t
a
nd connections between blocks to match Figure 3.
Table 2.
Simulink
Sublibrary
Blocks
Name
Parameters
Sources
Constant
Integral Time
Constan
t
v
a
l
u
e
:10
Sources
Constant
u_bias
Constan
t
v
a
l
u
e
:
0
.
5
Math Ops
Sum
Sum
Lis
t
of signs: | + +
Math Ops
Sum
Sum1
Lis
t
of signs: | + +
Math Ops
Product
Product
Math Ops
Gain
Kc
Gain: 0.05
Math Ops
Math Fcn
Reciprocal
Function: reciprocal
Continuous
Integrator
Integrator
Initial Cond: 0
4
"Go to
Parent"
button
Figure 3.
i)
Click on the "
Go to Parent
"-button.
This w
o
u
ld send you back to the
Model window.
j)
Right-click on "
PI Temperature Controller
" and selec
t
[
Copy
].
Right-click a
t
a differen
t
p
o
s
i
t
i
on in the Model window and select
[
Paste
].
Rename the new subsystem block as "
PI Flow
Controller
".
k)
G
o
back t
o
t
he Simulink Library Browser and add some more blocks into
the Model window as described in Table 3.
5
Table 3.
Simulink
Sublibrary
Blocks
Name
Parameters
Continuous
Transfer
Function
Valve 1
Numerator:[20]
Denominator:
[0.01, 0.14, 1]
Continuous
Transfer
Function
Valve 2
Numerator:[20]
Denominator:
[0.01, 0.14, 1]
Sources
Constant
T_set
Value: 65
Sources
Constant
F_set
Value: 20
Sources
Constant
T_hot
Value: 70
Sources
Constant
T_cold
Value: 50
Sinks
To
Workspace
T
Save Format:
Array
Sinks
To
Workspace
F
Save Format:
Array
Discontinuities
Saturation
Sat1
Upper Limit:
1
Lower Limit:
0
Discontinuities
Saturation
Sat2
Upper Limit:
1
Lower Limit:
0
Math Ops
Sum
Sum1
Lis
t
of Signs:
-+|
Math Ops
Sum
Sum2
Lis
t
of Signs:
|+-
Remark
: This means a valve transfer function which is slightly under-
damped.
l)
Next, delete all
inport
(1,2,3,4) and
outport
(1,2) blocks.
m)
Reposition and connec
t
t
he blocks t
o
m
a
t
ch the Model window shown in
Figure 4.
6
Figure 4.
n)
Run the simulation and plo
t
o
ut the response of T and F.
o)
Change the values for the PI ontrollers t
o
improve the response. One
possible se
t
of tuning variables are:
Temperature
Controller
Flow
Controller
Kc
0.1
0.1
Integral Time
2
5
  • Univers Univers
  • Ebooks Ebooks
  • Livres audio Livres audio
  • Presse Presse
  • Podcasts Podcasts
  • BD BD
  • Documents Documents