Lab 2

Download as pdf or txt
Download as pdf or txt
You are on page 1of 37

Introduction to control theory

LAB 2: SPEED CONTROL OF A DC MOTOR

Author : Sonia GHRAB


Cursus : EENG3
UE : Introduction to control theory
Version : 1.0
Date : 17/05/2024

ecam.fr
Objectives

• Determination of the different parts that constitute the considered LAB system
depicted in Figure 1 (DC Motor)

• Sketch of the functional block of a the considered system (functional block


means the determination of the sensors, actuators, process, controller,
system‟s input, system‟s output, disturbances, etc)

• Identification of the DC motor system

• Model Validation (Comparison between the response of the real system and
the response of the proposed model)

• Control of the DC motor speed and evaluation of the performances :


 Using the real system (The DC Motor)
 Using the proposed model

ecam.fr 17/05/2024 2
1. Setup of the device with Matlab

Figure 1: The considered LAB process


ecam.fr 17/05/2024 3
• The DC motor depicted in Figure 1, is connected to an acquisition card
NIDAQ which allows to give a power supply voltage order to the motor and
measure the motor rotation speed using the tachometric dynamo

1.1. The device

Question 1

• Using Table 1, identify the elements of the considered device (Use the Figure
1 to circle each part)

ecam.fr 17/05/2024 4
Table 1: The LAB process components

Number Device name


1 Motor
2 Motor input
3 Speedometer
4 Speedometer output
5 Data acquisition card (DAQ)
6 Card terminal block
7 Card input
8 Card output
9 1rst order filter
10 2nd order filter
11 Ground

ecam.fr 17/05/2024 5
Question 2

Sketch the functional block diagram of the system depicted in Figure 1. To do


so, first you have to determine the following blocks: the sensor, the actuator, the
disturbance, the output, the reference input and second, you should plot the
functional block diagram (In Lecture 1, you can find some examples of
functional block diagrams)

1.2. Construct a simulink diagram


1.2.1. Setup of Simulink

• Using Simulink, Create a “Blank Model”, this model should be entitled


“Model1.mdl” and should be saved in T:\Control_Lab_2\GR_Y), « Y » stands
for your LAB Group

ecam.fr 17/05/2024 6
• Using the Simulink file “Model1.mdl”, click on File Menu ->Model Properties

• By selecting model properties, a new window will appear (see Figure 2)


• Click on “Callbacks”, the screen will be split into two parts:

 On the left side, choose the stop function called “StopFcn”,


 On the right side, under the box « simulation stop function » write the
following:

sim(„T:\Control_Lab2\stopXi.mdl‟)

where 𝑖 = 01,02, … , 12 represents the label number of the LAB computer


(check the top of the central unit and replace i by the suitable number)

ecam.fr 17/05/2024 7
sim(„T:\Control_Lab2\stopXi.mdl‟)

This instruction should be


written here

Figure 2: Model properties-Callbacks functions

ecam.fr 17/05/2024 8
1.2.2. Data Aquisition Toolbox

• In the “Simulink Library Browser”, under the tab “Data Acquisition Toolbox”,
you will find the blocks:

 Analog Input (single sample)


 Analog Output (single sample)

• The Data Acquisition Card installed on the LAB computer motherboard is


automatically recognized
• Drag and drop these blocks in your simulink model “Model1.slx”
A. Analog input parameters setting

Question 3
3.1. What does input means for the DAQ Card?
Double-click on the analog input block to set its parameters, select only “ai0”
then choose the property “SingleEndedNonReferenced” and verify that the
range is +/- 10 Volt
3.2. Why the DAQ Card input is in Volt and why should it have a limited range?
3.3. Enter 0.001 for the sample time. Comment this parameter

ecam.fr 17/05/2024 9
B. Analog output configuration

Question 4

4.1. What does output means for the DAQ Card?


Double-click on the analog output block, then select only “ao0” and verify that
the range of +/- 10Volt
4.2. Why the DAQ Card output is in Volt and why should it have a limited
range?
4.3. Enter 0.001 for the sample time. Comment this parameter
1.2.3. Protection of the DAQ card

Remark:
If the DAQ Card receives a command that exceeds its voltage range, it will shut
down or gives wrong measurement. To avoid errors and not to damage the
DAQ Card, a “Saturation” block should be used and the range of limitation
should be set from -9.99 to 9.99 volt
The saturation block could be found within the category “Discontinuities”
of the “Simulink Library Browser”

ecam.fr 17/05/2024 10
1.2.4. Simulation parameters

• We want to plot the step response of the DC motor, the amplitude of the
applied step should be 6 Volt.
• The signal that we want to observe will be an image of the motor rotation
velocity, to do so, in the same file “Model1.slx” plot the block diagram of the
figure 3

Figure 3: Simulink design to test the step response of DC Motor

ecam.fr 17/05/2024 11
Question 5

5.1. In Menu Simulation->Configuration Parameters, enter the following:

 Stop time = 3s
 Solver options “Fixed-step”
 Fixed-step size = 0.001s (under “Solver details tab”)
 Solver “auto”

5.2. Place a scope to plot the step (input reference ) and the motor rotation
speed (output) in the same figure. Turn the switch of the LAB system on
position “ON” (the motor supply) and Launch the simulink simulation

5.3. Observe and comment


5.4. The open-loop system is it stable? Justify

ecam.fr 17/05/2024 12
1.2.5. Filtering of the measure

• From Figure 1, you can observe that the device integrate a low-pass filter

• In order to visualize the unfiltered measure, follow these steps:


• In the same file “Model1.slx”, copy and paste the “Analog input (single
sample)” block
• Double-click on this block to set the new parameters: Select only “ai1”
(different than “ai0” ) however keep the same property
“SingleEndedNonReferenced” and the same range +/- 10 Volt

Question 6
6.1. Place a scope to plot the unfiltered measure signal, the filtered measure
signal as well as the input reference on the same figure

6.2. Comment the obtained result

In the remaining, you have to use only the filtered measure, i.e. “ai0”

ecam.fr 17/05/2024 13
STEP 1: Identification

ecam.fr 17/05/2024 14
2. DC Motor model identification
2.1. Open-loop system identification from a step response test

• Graphical methods are known to be convenient and precise for identification.


They can deduce the model directly from process response
• A step is applied to the process and the resulting data from the process is
examined to deduce the required information
• The model obtained is a parametric model
• In the following, we used the Broida method to identify the model
parameters (open-loop system identification method)

𝐔(𝐬) Process 𝐘(𝐬)


(Real system)

Figure 4: Diagram of the open-loop system


Question 7
7.1. Why are we considering here that we are working with an open loop system?
7.2. What is the purpose of a model?

ecam.fr 17/05/2024 15
• The Broïda method is a graphical approach that can be applied to the
identification of open-loop stable process. The system can be approximate
to a first order with a pure time delay

• The transfer function of this model is

𝒀(𝒔) 𝑲 𝒆−𝒅 𝒔
𝑮 𝒔 = =
𝑼(𝒔) 𝟏 + 𝝉 𝒔

• The different parameters of the transfer function 𝐺 𝑠 are defined in Table 2

ecam.fr 17/05/2024 16
𝐲
𝒚(+∞)

∆𝐲
∆𝐲𝟐 ∆𝐲𝟏 𝐭𝟎 𝐲𝟎

𝒕
𝐭𝟏
𝐭𝟐

Figure 5 : Parameters for the Broïda method

ecam.fr 17/05/2024 17
Table 2: Variables used for the Identification (Broida method)

Variable Physical meaning


y The measured value
𝑈(𝑠) The step input
∆𝑦 The process gain
𝐾=
∆𝑢
𝑡1 = 𝑡 ∆𝑦1 = 𝑡 28% ∆𝑦 The time that corresponds to 28% ∆y
𝑡2 = 𝑡 ∆𝑦2 = 𝑡 40% ∆𝑦 The time that corresponds to 40% ∆y
𝜏 = 5.5 𝑡2 − 𝑡1 The time constant
𝑑 = 2.8 𝑡1 − 1.8 𝑡2 The time delay

Remark:
The time delay might be negligible for some DC motor, but it is good practice to
include it in the model

ecam.fr 17/05/2024 18
• From the step response displayed in Figure 5, it is necessary to determine
the steady-state gain 𝐾, the time-constant 𝜏 and the pure time-delay 𝑑 . The
procedure is as follows:
1. Find the final and initial values of the response and of the step. Deduce 𝐾
from
𝑦 ∞ − 𝑦(0)
𝐾=
𝑢 ∞ − 𝑢(0)
2. Find ∆𝑦1 = 0.28 ∆𝑦 and ∆𝑦2 = 0. 4 ∆𝑦 , deduce 𝑡1 and 𝑡2
𝑡1 = 𝑡 ∆𝑦1 = 𝑡 28% ∆𝑦
𝑡2 = 𝑡 ∆𝑦2 = 𝑡 40% ∆𝑦
3. Calculate 𝜏 and 𝑑
𝜏 = 5.5 𝑡2 − 𝑡1
𝑑 = 2.8 𝑡1 − 1.8 𝑡2
𝑲 𝒆−𝒅 𝒔
Model obtained by Broida Method 𝑮 𝒔 =
𝟏+𝝉𝒔
ecam.fr 17/05/2024 19
7.3. Follow the aformentioned procedure to determine the gain 𝐾 , the time
constant 𝜏 and the time delay 𝑑 and deduce the broida Model
7.4. What is the objective behind approximating real system to a mathematical
model (the model obtained via the Broida method)

ecam.fr 17/05/2024 20
STEP 2: Validation

ecam.fr 17/05/2024 21
2.2. Model validation

• Every model must be validated in order to confirm that it fits well enough the
reality (Comparison between the output of the process (real system) and the
output of model (virtual)) (see Figure 6)
• Open a new simulink file and plot a new block diagram using the model
obtained in 7.3, the new model should be entitled “Broida_Model”
𝐾
• To define the simulink block 𝐺 𝑠 = 1+𝜏𝑠 × 𝑒 −𝑑𝑠 you have to use:

• Both the transport delay and the transfer function can be found within the
category “continuous” of the library browser

ecam.fr 17/05/2024 22
Question 8
In this part you have to realize a simulink block diagram that has the same
principle as the figure 6

Step of 𝛚𝐦𝐞𝐚𝐬𝐮𝐫𝐞𝐝 (𝐭) The output of


𝐮(𝐭) Process
amplitude the real system
6 volts (Real system)

Experimental Part

Model 𝛚𝐁𝐫𝐨𝐢𝐝𝐚 𝐌𝐨𝐝𝐞𝐥 (𝐭) The output of


Broida Model
(Virtual)

Simulation Part
Figure 6: Validation of the open loop model

ecam.fr 17/05/2024 23
8.1. Apply a step response of amplitude 6 volts on “Broida_Model” then place a
scope to plot the output of the Broida model
8.2. Copy and paste “Model1” into “Broida_Model” and run the simulink
simulation. Compare the step response of the Broida model (the output of the
model) to the step response of the real device (the output of the real system)

8.3. Based on the results obtained in 8.2, Adjust the parameters of the
“Broida_model” (propose suitable optimal values for the gain 𝐾𝑜𝑝𝑡𝑖𝑚𝑎𝑙 , the time
constant 𝜏𝑜𝑝𝑡𝑖𝑚𝑎𝑙 and the pure time delay 𝑑𝑜𝑝𝑡𝑖𝑚𝑎𝑙 so that the output of the
model tracks perfectly the output of the real system, (superposition of the two
graphs))
8.4. Based on these proposed values give the expression of
𝐾𝑜𝑝𝑡𝑖𝑚𝑎𝑙 −𝑑𝑜𝑝𝑡𝑖𝑚𝑎𝑙 𝑠
𝐺𝐵𝑟𝑜𝑖𝑑𝑎 𝑜𝑝𝑡𝑖𝑚𝑎𝑙 𝑠 = 1+𝜏 × 𝑒
𝑜𝑝𝑡𝑖𝑚𝑎𝑙𝑠
In the remaining, the used model should be the one described by
𝑮𝑩𝒓𝒐𝒊𝒅𝒂 𝒐𝒑𝒕𝒊𝒎𝒂𝒍 (𝒔)

ecam.fr 17/05/2024 24
STEP 3: Control

ecam.fr 17/05/2024 25
3. The feedback control and Evaluation of the performances

• The Broida model (with the optimal parameters values) and the real system
will be placed in a unitary feedback loops

• The objective is to control the motor speed Ω to a target speed value. To do


so, a controller block (P, PI, PID) is inserted into both the real system as
well as the Broida Model (see Figure 7)

• In the remaining, the controller‟s parameters (P-I-D) will be tuned using


empirical methods and the performances will be evaluated

ecam.fr 17/05/2024 26
𝐮(𝐭) 𝛚𝐬𝐲𝐬𝐭𝐞𝐦 (𝐭)
Process
+ Controller
− (Real system)

𝛚𝐁𝐫𝐨𝐢𝐝𝐚 𝐌𝐨𝐝𝐞𝐥 (𝐭)


Broida Model
+ Controller
− (Virtual)

Figure 7: The system and the Broida Model in a Unitary feedback loop

ecam.fr 17/05/2024 27
3.1. Empirical method for PID tuning

• We suggest to use empirical methods for tuning the gains of a PID


controller (Table 3)
• Empirical means that no explicit knowledge of the process is needed

• These methods are always better and faster than individual gain tuning with
a trial-and-error approach (the tuning problem you have faced in LAB 1)

• However, those methods require some vigilance as the tuning performance


will be tested directly on the real system

• It is therefore very convenient to have a virtual model to test your design


first (the virtual model here is the Broida optimal model)

ecam.fr 17/05/2024 28
Variable description (from Table 3)
• 𝑇: time constant (should be replaced by 𝜏)
• 𝐿: delay (it stands for 𝑑)
• 𝑘𝑝 : Steady state gain ( corresponds to 𝐾)
100
• 𝑃𝐵: Proportional Border (𝑃𝐵% = 𝑘𝑐
)

Table 3: Empirical methods for PID Tuning parameters

ecam.fr 17/05/2024 29
3.1.1. Impact of the proportional action

Question 9
9.1. Open a new simulink model, copy-paste the optimal “Broïda model”. Save
the file as “Real_Vs_Broida_Controller_P.slx”

9.2. Add a proportional controller 𝒌𝒄 and complete the simulink design to get a
unitary feedback. Plot in the same figure the step response of the model as
well as the step input. Explain the impact of the proportional action and
illustrate it with plots

9.3. In the same file “Real_Vs_Broida_Controller_P.slx”, copy and paste


“Model1” and Repeat the 9.2 (using the real system not the broida model)
and comment the obtained results

ecam.fr 17/05/2024 30
3.1.2. Impact of the Integral action

Question 10

10.1. Open a new simulink design, copy and paste


“Real_Vs_Broida_Controller_P.slx”, the new file should be entitled
“Real_Vs_Broida_Controller_PI.slx

• The objective is to evaluate the system‟s performances when a PI is applied

1
𝑃𝐼 𝑠 = 𝑘𝑐 1+
𝑇𝑖 𝑠

10.2. The Table 4 is used to calculate a PI controller using the empirical


approach (Table 4 is deduced from Table 3 the line colored in pink)

ecam.fr 17/05/2024 31
10.3. Reproduce the block diagram of Figure 8, and use the Table 4, to write a
Matlab script in order to compute the values of the PI parameters (𝑘𝑐 𝑎𝑛𝑑 𝑇𝑖 )

Figure 8 : Mixed PI corrector


Table 4: The used approach for computing the PI parameters (Hrones‟s method)

𝒌𝒄 𝑻𝒊 Optimum
conditions
Hrones PI 100 𝜏 𝑇𝑖 = 1.2 𝜏  No overshoot
-Type A 𝑘𝑐 =
286 𝐾 𝑑  Minimum
response time

ecam.fr 17/05/2024 32
10.4. Create a feedback loop with the virtual model
10.5. Prove that the system answer to the following specifications:
 Zero-overshoot
 Gain = 1
 No steady-state error for a step input
 Response time = 0.2s

3.1.3. Test on the real system

Question 11
11.1. Implement the same controller PI on the real device

Make sure that the DAQ Protection is in place with the Saturation block
(section 1.2.3)

ecam.fr 17/05/2024 33
11.2. Run the simulation and eventually refine the tuning of the values
11.3. Observe and comment

11.4. Plot on the same figure the virtual model response and the real device
response after correction
11.5. Adjust parameters in order to superpose the two curves

ecam.fr 17/05/2024 34
3.1.4. Impact of the Derivative action

Question 12

12.1. Save your previous model and save again as


“Real_Vs_Broida_Controller_PID.slx
12.2. Add a derivative term (in Librairy Browser->Continuous->derivative) in
your controller (See Figure 9)
12.3. Use the Table 5, to write a Matlab script in order to compute the values of
the PID parameters (𝑘𝑐 𝑇𝑖 𝑎𝑛𝑑 𝑇𝑑 )
12.4. Is the derivative term useful for our device?

1
𝑃𝐼𝐷 𝑠 = 𝑘𝑐 1+ + 𝑇𝑑 𝑠
𝑇𝑖 𝑠

ecam.fr 17/05/2024 35
Figure 9 : Mixed PID cotroller

Table 5: The used approach for computing the PID parameters (Reswick‟s method)

𝒌𝒄 𝑻𝒊 𝑻𝒅 Optimum
conditions
Reswi  No
ck- PID 100 𝜏 𝑇𝑖 = 𝜏 𝑇𝑑 = 0.5 𝑑 overshoot
Type A 𝑘𝑐 =
167 𝐾 𝑑  Minimum
response
time

12.5. Choose a final design for the controller and justify your choice. Give its
block diagram

ecam.fr 17/05/2024 36
3.2. Disturbances analysis

Question 13

13.1. Propose a simulation method using the Broida model to analyze the
impact of a perturbation

13.2. Insert the same type of disturbances on the real system and comment
the system‟s behaviour in the presence of these disturbances

13.3. Insert a physical disturbances on the system and comment

13.4. Evaluate the performance of the real system and the Broida optimal
Model in terms of precision and rapidity

13.5. if the obtained results are not satisfactory you could use the the table 3
(the line colored in blue to tune the PID parameters)

ecam.fr 17/05/2024 37

You might also like