Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
SYSTEM
CONTROL
PID Related
Tutorial
ROOT LOCUS Links
Control w/
FREQUENCY
Simulink
STATE-SPACE
DC Motor
DIGITAL Activity
Related
SIMULINK External
Links
MODELING
Simulink
CONTROL Motor
Control
Video
Modeling
Challenges
Video
Contents
Open-loop response
Simulink model of the DC motor system using three different methods. You
can download one of these models by right-clicking here and then selecting
Save link as. In this section, we will employ this model within Simulink to
ctms.engin.umich.edu/CTMS/index.php?example=MotorPosition§ion=SimulinkControl 1/13
5/8/2019 Control Tutorials for MATLAB and Simulink - Motor Position: Simulink Control
Open-loop response
Begin with the above model saved as a subsystem and follow the steps
given below.
ctms.engin.umich.edu/CTMS/index.php?example=MotorPosition§ion=SimulinkControl 2/13
5/8/2019 Control Tutorials for MATLAB and Simulink - Motor Position: Simulink Control
In order to simulate this system, the details of the simulation must first be
set. This can be accomplished by selecting Model Configuration
Parameters from the Simulation menu. Within the resulting menu, define
the length for which the simulation is to run in the Stop time field. We will
enter "0.2" since 0.2 seconds will be long enough for the step response to
reach steady state. Also in the Configuration Parameters dialog box, the
and change the Solver field from the default ode45 (Dormand-Prince) to
the ode15s (stiff/NDF) solver. Since the time scales in this example are
very small, this stiff system integration method is more efficient than the
The physical parameters must now be set. Enter the following commands in
the MATLAB command window.
J = 3.2284E-6;
b = 3.5077E-6;
K = 0.0274;
R = 4;
L = 2.75E-6;
Then run the simulation (press Ctrl-T or select Run from the Simulation
should see the following output which goes unstable and obviously does not
meet our design requirements. Note that this response is consistent with the
ctms.engin.umich.edu/CTMS/index.php?example=MotorPosition§ion=SimulinkControl 3/13
5/8/2019 Control Tutorials for MATLAB and Simulink - Motor Position: Simulink Control
performed from the MATLAB command line using the command dlinmod,
Simulink as we will demonstrate here. We will use the model from above.
The first thing that we need to do is to identify the inputs and outputs of the
Voltage input in the Simulink model. Then choose Linear Analysis Points
> Open-loop Input from the resulting menu. Similarly, right-click on the
signal representing the Position output and select Linear Analysis Points
> Open-loop Output from the resulting menu. The input and output signals
figure below.
ctms.engin.umich.edu/CTMS/index.php?example=MotorPosition§ion=SimulinkControl 4/13
5/8/2019 Control Tutorials for MATLAB and Simulink - Motor Position: Simulink Control
In order to perform the extraction, select from the menus at the top of the
model window Analysis > Control Design > Linear Analysis. This will
cause the Linear Analysis Tool to open. Next follow the steps given below.
From the Linear Analysis Tool window, click the More Options
button. From the resulting window, change the sample time to "0.001"
as shown in the figure below. The rate conversion method can remain
Workspace.
This object can then be used within MATLAB in the same manner as an
(1)
Note that this model is identical to the model generated from the conversion
sense since the same sample time and discretization method were used,
ctms.engin.umich.edu/CTMS/index.php?example=MotorPosition§ion=SimulinkControl 5/13
5/8/2019 Control Tutorials for MATLAB and Simulink - Motor Position: Simulink Control
window. You should see the following plot which is in agreement with the
t = 0:0.001:0.2;
step(linsys1,t);
grid
The extracted discrete models can then be used within MATLAB for various
analysis and controller design tasks. In the following, we directly employ the
(2)
control system in Simulink. Starting from the Simulink model we used above
for extraction, delete the Input and Output ports and add the following:
ctms.engin.umich.edu/CTMS/index.php?example=MotorPosition§ion=SimulinkControl 6/13
5/8/2019 Control Tutorials for MATLAB and Simulink - Motor Position: Simulink Control
Place one Zero Order Hold block on the input of the Motor_pos subsystem
which is a continuous model of the plant. This Zero Order Hold block
The other Zero Order Hold block is placed on the output of the Motor_pos
subsystem and serves to take discrete samples of the output signal of the
plant. Edit the Zero Order Hold blocks such that the Sample time fields are
set to "0.001" (this is fast compared to the desired step response in the
MATLAB tutorial).
Next edit the Discrete Zero Pole block to model the discrete controller
transfer function described above. Specifically, edit the Zeros field to "[0.95
0.80 0.80]", the Poles field to "[-0.98 0.6 1]", the Gain field to "800", and the
Sample time field to "0.001". Then label the block "Controller" and resize it
Next, enter "|+-" to the List of signs field of the Sum block. The character
"|" serves as a spacer between input ports. Now we need to set up the
Attach a Step block to the positve input of the Sum block and attach a
Double-click the Step block and set the Step time to "0".
from the Simulation menu and enter "0.08" in the Stop time field. We
ctms.engin.umich.edu/CTMS/index.php?example=MotorPosition§ion=SimulinkControl 7/13
5/8/2019 Control Tutorials for MATLAB and Simulink - Motor Position: Simulink Control
choose this stop time in order to observe the system long enough to see if it
satisfies the 0.04 seconds settling time requirement. If you have started a
example, then the physical parameters for the simulation must be set again.
J = 3.2284E-6;
b = 3.5077E-6;
K = 0.0274;
R = 4;
L = 2.75E-6;
Now the simulation can finally be run. Recall that this can be accomplished
by pressing Ctrl-T or selecting Run from the Simulation menu. When the
following output.
From the above figure, it appears that the overshoot is less than 16% and
the settling time is less than 0.04 seconds as required. This is consistent
with the analysis employed in designing the digital controller. We have not,
A step disturbance can be added in a similar manner to the way that the
step reference was added as shown in the following figure. Sum the
disturbance between the controller and plant following the Zero Order Hold
ctms.engin.umich.edu/CTMS/index.php?example=MotorPosition§ion=SimulinkControl 8/13
5/8/2019 Control Tutorials for MATLAB and Simulink - Motor Position: Simulink Control
Within the model, set the disturbance Step time to occur at "0.03" seconds.
Then re-run the simulation and observe the scope output as described
From inspection of the above, you can see that there is a slight bump
beginning at 0.03 seconds due to the disturbance, but the system is able to
reject its effect and the steady-state error still goes to zero as required.
If you have not done so already, save your Simulink model. You can also
download our version of this model by right-clicking here and then selecting
ctms.engin.umich.edu/CTMS/index.php?example=MotorPosition§ion=SimulinkControl 9/13
5/8/2019 Control Tutorials for MATLAB and Simulink - Motor Position: Simulink Control
In the above, we extracted a linear sampled model of our plant from our
Simulink model into the MATLAB workspace using the Linear Analysis
Tool. We also, in effect, discretized the plant for the purposes of simulation
using Zero Order Hold blocks within Simulink. In this section, we will
generate a discrete-time model of our plant without the use of the Zero
techniques than can be achieved through Simulink blocks, which are limited
to Zero Order and First Order Hold. This is especially useful in generating a
So far we have chosen to employ the first principles simulink model but we
could have just as easily used the Simscape model or the LTI System
model. One thing to be careful of, however, is that if you were to use the
Simscape model of the plant in the above, the physical Simscape signals
would need to be converted to dimensionless Simulink signals in order to
In the following, we will discretize the LTI System model which can be
downloaded by right clicking here and then selecting Save link as, or you
Recall that the LTI System block imports a model from the MATLAB
command line where it is presumed that values have already been entered
A = [0 1 0
0 -b/J K/J
0 -K/L -R/L];
B = [0 ; 0 ; 1/L];
C = [1 0 0];
D = 0;
ctms.engin.umich.edu/CTMS/index.php?example=MotorPosition§ion=SimulinkControl 10/13
5/8/2019 Control Tutorials for MATLAB and Simulink - Motor Position: Simulink Control
Click on Analysis > Control Design > Model Discretizer and the LTI
The LTI model now is converted to discrete. Let's add a digital controller
and simulate the closed-loop response of this model. Employ the same
controller we used above. The final model should appear as follows.
ctms.engin.umich.edu/CTMS/index.php?example=MotorPosition§ion=SimulinkControl 11/13
5/8/2019 Control Tutorials for MATLAB and Simulink - Motor Position: Simulink Control
previously. This makes sense since the first principles model and the LTI
System block model are equivalent and both Simulink models used a zero-
You can download our version of this model by right-clicking here and then
selecting Save link as.
All contents licensed under a Creative Commons Attribution-ShareAlike 4.0 International License.
ctms.engin.umich.edu/CTMS/index.php?example=MotorPosition§ion=SimulinkControl 12/13
5/8/2019 Control Tutorials for MATLAB and Simulink - Motor Position: Simulink Control
ctms.engin.umich.edu/CTMS/index.php?example=MotorPosition§ion=SimulinkControl 13/13