Professional Documents
Culture Documents
Lab.--Manual (3
Systems & Control Lab. (3)
At steady state, the water temperature rises by 8°C for every amp of heater
current, and the dynamic response of the heater can be modeled by a
dominant lag ( 1) of 9 seconds and a secondary lag ( 2) of 1 second, plus a
delay time ( d) of 0.1 second. The initial temperature is 20°C. The set point is
50°C. The heater current is 10 amps when the thermostat is energized.
2
G (s) =
S +4
It’s required to:
Simulate this system and hence find the rise time, peak time, settling time,
maximum peak and steady state error if the input is 5u(t), where u(t) is the unit
step function.
Quick start:
You will have the following window, now press on the icon seen in the circle,
this is the button that will help you to have the following window, and it is called the
Library browser.
Example (1):
1. Start by creating new model. This can be done from the main menu of
MATLAB file -> new -> model, or from Simulink file ->new ->model, or
by simply pressing this button . You will have now the following
window.
To have the properties of any block, double click this block, so please:
5. Double click the summation element, you will have the Parameters window
of the summation element, in this window change List of signs to (+++) this
means that you want 3 inputs, all summation “no subtraction”.
6. Now click on the top sin wave and press CTRL key and hold it, and then
press on the sum node, you will find that you connected them together.
7. Make this with all the other sine wave generators, after this make this
between the sum node and the scope, you should now have the following
figure:
8. Now, double click the first Sine wave generator, you will have its
parameters window, change it to be as the follows:
9. Make the same with the other 2 generators, only change the frequency from
(2* *1) to (2* *2) and (2* *3) “the frequency in rad/sec”.
The result of the above configurations will lead to 3 sine wave generators with
frequencies 1,2,3 Hz and a summer for them, and we will have a scope having 4
display windows and 4 input ports, now, we want to connect the signals required
to be monitored to the scope.
11. Connect the output of the summer to the first input of the scope (it should
be already connected. And then click on the line output from the first sine
wave generator, and press CTRL and connect the new line to the 2nd input
of the scope, make this also with the 2 other inputs, as shown:
By now, it is assumed that you became familiar with the Simulink environment,
of course you can save your work from file >save, and you can open an existing
model from file>open, and you can copy, paste and cut from a model, these are
the basic things you want to know to begin working with Simulink.
Now, we will describe in brief some things that we did in the Example (1), I
think you can answer the following questions to discover them yourself.
2- What will happen if you change the number of axis in the scope parameter
window to 5?
3- What will be the change if we checked the check box of “limit data points to
last:” in the scope parameter window number 2? Please try it yourself, you
can catch it, put the number=5000 and run the simulation to see the output
then change it to 3000 then 2000 and test the output, what’s the obvious
observation? What’s the relation between the output of the scope and the
SAMPLING TIME “the last parameter” of the sine wave?? To discover it,
keep one element fixed, say the (limit data points to last 5000) and double
4- the value of the sampling time, what will be the effect, then put it into half
of its value, do you understand now what happens? I think you can get it.
5- Try to click on the word “Sine Wave 1”, now you can edit the name.
6- Double click on any place in the empty parts of the model, and write your
comments there. Just double click in an empty region and start to write.
Example (2):
1- Open the model of the last example, save it with different name “like
exp.mdl”.
2- Select the 3 sine wave generator by the mouse or by clicking on them while
keeping SHIFT key pressed.
3- Right click and choose “create subsystem”, you should have the following
figure:
7- Now switch to 3_sines subsystem and change the name of the output ports
to f1, f2, f3 I hope that you reach the following figure:
9- Go to the main model, and right click the subsystem and choose Edit
mask. You will have the following window:
We think what happens now should be clarified, all what we did is that we
decided to input the three frequencies of our small subsystem by an Edit box, this is
similar to send the arguments of a function in any programming language, if you
double click now on the subsystem, you will have the following dialog box:
Now we want to write short note on the block and we want to call it something,
this is done by right click on the subsystem->edit mask-> documentation tab, then
write the name in the “mask type” part, and the description which will appear
when double clicking the block in the Mask description part, and the help that you
want the user to see in the Mask help part as shown in the following 2 figures: