ВУЗ: Не указан
Категория: Не указан
Дисциплина: Не указана
Добавлен: 14.06.2025
Просмотров: 1799
Скачиваний: 0
Experiment #6: Proportional – Integral – Derivative Control
Figure 6.3: Flowchart of Drive Routine
Drive_Heater: |
'Apply pwm at 220 mSec for each PWMTime repetion |
FOR PWMCount = 1 TO PWMTime |
|
PWM Heater,drive * 255/100,220 |
|
NEXT |
|
RETURN |
|
Calc_Drive: |
'Error calcs |
GOSUB ErrorCalc |
|
GOSUB PropCalc |
'Perform proportional error calcs |
GOSUB IntCalc |
'Perform Integral Calcs |
GOSUB DerivCalc |
'Perform Derivative calcs |
Drive = (B + P + I + D) |
'calculate total drive |
Sign = Drive |
'Sign adjust to max of 100 min 0 |
GOSUB SetSign |
|
Drive = ABS Drive MAX 100 |
|
IF Sign = 1 THEN DriveDone |
|
Drive = 0 |
|
DriveDone: |
|
RETURN |
Page 154 •Industrial Control Version 1.1
Experiment #6: Proportional – Integral – Derivative Control
Exercises
Exercise #1: Bias Drive
As discussed, a system in equilibrium is where the energy gains in a system equal the energy losses. When a system is designed typically the engineers will have determined anticipated average losses on the system. The Bias Drive is the drive needed to compensate for average losses. By designing the system so that a 50% drive is sufficient for average losses, provides the ability to add or subtract up to 50% due to other losses or large disturbances to the system. This affords the maximum amount of control.
Modifying our equation slightly: |
∆E ) |
|
Copid |
= B +(Kp * E) +(Ki * ∫Et) +(Kd * |
|
B = Bias Drive |
∆t |
|
Or: |
%DriveTOTAL = %DriveBIAS + %DrivePROP + %DriveINT + %DriveDERIV
For the eggs in our incubator to hatch healthy chicks, 50% drive on our heater would provide sufficient energy to maintain temperature in the incubator near 101.5F with average losses. Unfortunately, our system is not well engineered. Being a non-insulated plastic canister with a small resistor for a heater, chances are that 50% drive will not be sufficient under most circumstances for our desired setpoint. Some limitations on our experimental incubator are:
•A bias of 50% PWM drive is insufficient to provide a temperature of 101.5F.
•Every incubator will have a different stable temperature for 50% bias drive due to many factors.
•Our incubator is a fragile, steady state system. Factors such as room temperature and vents or fans blowing on the canister will shift the temperature.
•Moving or bumping the incubator will cause air mixing and affect the measured temperature.
Industrial Control Version 1.1 •Page 155
Experiment #6: Proportional – Integral – Derivative Control
We will deviate from our optimum incubator setpoint in order to operate the system around a 50% bias temperature. Note that this bias temperature may fluctuate due to room conditions. It is recommended that the student read through all of the Chapter 6 material first and then try to perform as many hands-on portions consecutively as possible.
Copid = B
%DriveTOTAL = %DriveBIAS
Determining the Bias Temperature:
1)De-energize your system and allow it to cool to room temperature.
2)Verify that the Drive Control Setting matches the following:
'********* PID CONTROL SETTING **************** |
bias Temp in TENTHS |
|||
SP |
CON |
990 |
' Initialize setpoint to YOUR |
|
Range |
CON |
20 |
' Allowable temperature range |
in TENTHS (20=2F) |
B |
CON |
50 |
' Bias drive setting |
|
Kp |
CON |
0 |
' Proportional Gain Setting in TENTHS (10=Gain of 1) |
|
Ki |
CON |
0 |
' Integral gain constant in TENTHS (1=Gain of .001) |
|
Ti |
CON |
24 |
' Interal Reset time (1=~5 seconds |
|
Kd |
CON |
0 |
' Derivative gain constant |
|
MinA |
CON |
75 |
' Minimum analog Y axis value |
|
MaxA |
CON |
120 |
' Maximum analog X axis value |
|
MaxT |
CON |
600 |
' Maximum time in seconds X Axis |
|
Note that Kp, Ki and Kd are all 0 providing 0 drive from these evaluations allowing only bias drive of 50% to the heater.
3)Energize your system and download the program to the BASIC Stamp 2.
4)Close the debug window and connect on StampPlot Lite.
5)Reset your BASIC Stamp 2 by pressing “reset” on the Board of Education.
6)Allow the incubator temperature to stabilize to the find the 50% bias temperature.
7)Round your stabilized temperature to the nearest whole degree and set it as your SP (setpoint) constant (98.8 = 990).
Figure 6.4 is the plot of our test incubator stabilizing.
Page 156 •Industrial Control Version 1.1
Experiment #6: Proportional – Integral – Derivative Control
Figure 6.4: Bias Temperature at 50% Drive
Note the amount of time it took the temperature to stabilize. In our test, approximately 450 seconds. In a system with a first-order response, such as our incubator, the system requires 5 time-constants (5TCs) to stabilize (or reach 99% of the new value) following a step-change in conditions, in this case going from 0% to 50% drive. 1 time-constant (1TC) for our system would be 450/5 or 90 seconds. The response time of the system is important in tuning a system as you will see later.
Record for your system: |
50% Bias Temperature: ______ |
Time for 5TCs: _____ |
|
Time for 1TC: _____ |
Industrial Control Version 1.1 •Page 157
Experiment #6: Proportional – Integral – Derivative Control
Expercise #2: Proportional Control
Copid = B +(Kp*E)
%DriveTotal = %DriveBIAS +% DrivePROP
The next evaluation in the PID equation is proportional control of the system. The amount of drive from proportional control is a direct relationship to how much error exists in the system. The greater the error the greater the amount of proportional drive.
Let’s say our setpoint is 101.5F, and a bias of 50% PWM is sufficient to maintain this temperature. If the temperature drops to 101.0F, giving a -0.5F error, do we want to drive at 100% PWM, or something lower, to bring the temperature back to the setpoint?
For our incubator example, we want to maintain a temperature of 101.5F. The steadier we maintain this temperature, the healthier our eggs will be. It is allowable, though, to go 0.5F above or below this setpoint. So our setpoint will be 101.5 with an allowable band of +/- 0.5F, or 101.0F to 102.0F degrees.
If any error correction reaches the upper or lower limits, we want to take full action to return temperature back to the setpoint. Any error between the setpoint and the limits will provide a proportional amount of drive action. Figure 6.5 is a graphical representation of the incubator temperature verses the amount of drive needed for the given band.
Figure 6.5: Temperature vs. Drive
110 |
|||||||
100 |
|||||||
90 |
|||||||
|
% |
80 |
||||||
70 |
|||||||
|
Drive |
|||||||
60 |
% Drive |
||||||
50 |
|||||||
|
PWM |
|||||||
40 |
|||||||
30 |
|||||||
20 |
|||||||
10 |
|||||||
0 |
|||||||
100 |
100.5 |
101 |
101.5 |
102 |
102.5 |
103 |
|
Temperature |
|||||||
Page 158 •Industrial Control Version 1.1
Experiment #6: Proportional – Integral – Derivative Control
From Figure 6.5, if the temperature is at 101.5F, 50% drive will be used to add heat energy to our system. If the temperature drops to 101 F, 100% drive will be used to increase the temperature, and any temperature in between will result in a proportional amount of drive.
If the temperature rises above 101.5F, the drive will proportionally decrease to lower the temperature until, at 102F, %drive has decreased to 0%.
From the graph, what would the drive be at 101.2 degrees? ______; at 101.7 degrees? _______.
Now let’s look at it mathematically. The error of our system is calculated by subtracting the current temperature from the setpoint:
Error = Setpoint-Actual
The percent error is found by dividing the error value by the full temperature range and multiplying by 100%:
%Error = |
Error |
x100% |
|
FullRange |
|||
For our incubator the full temperature range is:
102.0-101.0 = 1.0F.
If the temperature is 101.2:
Error = 101.5 – 101.2 = .3 %Error (E) = .3/1.0*100% = 30%
The general gain formula is:
Gain = ∆∆OutputInput
For our example, we are changing 100% of the drive over 100% of the allowable temperature range:
Gain(Kp) = ∆∆OutputInput = 100100%% =1
Our system would have a proportional gain (Kp) of 1.
Industrial Control Version 1.1 •Page 159
Experiment #6: Proportional – Integral – Derivative Control
The amount of proportional drive at 101.2 degrees would be: %DrivePROP = Kp*E = 1 * 30% = 30%
The total drive of our system would then be:
%DriveTOTAL = B+(Kp*E)= 50%+30% = 80%.
Does this values match what you read from the Figure 6.3 for a temperature of 101.2F?
Calculate the total drive for a temperature of 101.7: __________
Compare your value to Figure 6.3. Do they match? ________.
One more term to consider is Proportional Band. Figure 6.3 is termed a 100% Proportional Band because the full range of drive covers 100% of our allowable band (101.0-102.0). Does this mean the temperature will not exceed our high and low limits? No. This simply means that at those limits our system will be taking full action to get the temperature back to the setpoint.
What if we wanted tighter temperature control of our system? Our allowable band for healthy eggs is still 101.0 to 102.0, but we can adjust our values to take full control over half the allowable range. Figure 6.6 is a plot of this control.
Page 160 •Industrial Control Version 1.1
Experiment #6: Proportional – Integral – Derivative Control
Figure 6.6: Temperature vs. Drive Over 50% of Range
Temperature vs. Drive |
|||||||
110 |
|||||||
100 |
|||||||
90 |
|||||||
|
% |
80 |
||||||
70 |
|||||||
|
Drive |
|||||||
60 |
% Drive |
||||||
50 |
|||||||
|
PWM |
|||||||
40 |
|||||||
30 |
|||||||
20 |
|||||||
10 |
|||||||
0 |
|||||||
100 |
100.5 |
101 |
101.5 |
102 |
102.5 |
103 |
|
Temperature |
|||||||
In Figure 6.6 the system is driving twice as hard for any deviation from the setpoint. What would be the proportional gain for this system?
Gain(Kp) = ∆∆OutputInput = 10050%% = 2
Note from the equation the system is driving the full range of output over only 50% of the allowable temperature range. This is also known as a 50% Proportional Band because full control action happens over 50% of the allowable range.
Use the equations to calculate the following at 101.7F:
Error = __________
%Error = _________ (Hint: The allowable band is still 1.0) Proportional Drive = ________
Total Drive = _________.
Note the relationship between proportional gain and proportional band:
Industrial Control Version 1.1 •Page 161