122-28176 Parallax Inc, 122-28176 Datasheet - Page 273

GUIDE STUDENT PROCESS CONTROL

122-28176

Manufacturer Part Number
122-28176
Description
GUIDE STUDENT PROCESS CONTROL
Manufacturer
Parallax Inc
Datasheets

Specifications of 122-28176

Accessory Type
Manual
Product
Microcontroller Accessories
Lead Free Status / RoHS Status
Contains lead / RoHS non-compliant
For Use With/related Products
Propeller Education (PE) Kit
Lead Free Status / RoHS Status
Lead free / RoHS Compliant, Contains lead / RoHS non-compliant
The code reveals how the error is calculated and the proportional output calculated:
The total output is the sum of the P, I, and D outputs, but in this case, Integral and
Derivative will be zero since those calculations are not being performed. Since the limit
of the BASIC Stamp calculations is +/− 32,000, code has been added to ensure the
maximum does not exceed 25,000. The BASIC Stamp can't perform all math operations
on negative numbers and provide results we would recognize. When working with
division, MIN, MAX, and some other operations, they need to be performed on positive
values only. To do this, the sign of the value is saved (Bit 15 = 1 if negative), the
absolute value is used, and the sign re-applied.
Currently, the proportional control is simply equal to the error: P = E. In actuality, the
error is multiplied by some constant, gain (K
set amount of error: P = K
CalcError:
RETURN
CalcProp:
RETURN
CalcTotal:
RETURN
Error in Error? In the classical PID formula, as illustrated in Figure 8-1, error is calculated
as:
However, for this program we are using the expression
In effect, errors that would be negative in the classical formula, are positive in our PIDEval
program. This was done only for this activity, in order to show the output drive increasing as
the photoresistor readings increase.
setpoint, we would like to see a positive output drive, for which we need a positive error.
In the next activity, using the incubator model, we will again use the classical formula, which
will produce a negative error when the temperature is greater than the setpoint.
Prop = Error
Total = Prop + Integ + Deriv
SignBit = Total.BIT15
Total = ABS(Total) MAX 25000
IF signBit = 1 THEN Total = Total * -1
Error = PhotoVal - SetPoint
Error = Photoval – Setpoint
Error = Setpoint – MeasuredValue
P
E
That is, for photoresistor values greater than the
P
), to adjust how much drive is applied for a
' Error per Figure 8-1
' Error used in PIDEval.bs2

Related parts for 122-28176