Anda di halaman 1dari 20

or “set-point”) and a sensor input (which

PID Control: ThermoFit


measures the current state of the
Author: Mackenzie Andrews
environment).

Group Members: Kim Hua, The combination of a user input and

Cheng-Chieh Hsu environmental sensors give way to a

closed-loop feedback control system.


INTRODUCTION
The closed-loop controller will compare
Many of the devices and products in
the user input to a value measured from
our everyday life are intended to make
the system. The error between the set-
some modification to their environment.
point and current state will determine the
In order to be able to modify their
output sent to the actuator. In a simple
environment in an accurate and useful
scenario, if the system condition is
way, the instrument must be able to read
below the user set-point, the actuator
information and then use that
will be turned on, if the system condition
information to establish some condition.
is above the user set-point, the actuator
There are two crucial components that
will turn off. More complicated
make this process possible: the actuator
controllers will utilize the current error
(the part that takes the action to establish
measurement as well as the change in
the condition) and the controller (the part
and accumulation of error to better
that determines how hard the actuator
adjust the control system to the desired
must work to achieve the desired
need. Such systems are called
condition). The controller typically takes
proportional-integral-derivative or PID
two inputs: the user or program input
controllers.
(which determines the desired condition
For this project, we built a PID  Calculation of values to plug into

controller in LabView to control a closed-loop PID control

resistor-thermistor coupled element in simulation VI from transfer

order to achieve a desired temperature function coefficients

with the goal of designing a  Testing of various gain values

thermoregulating jacket. We began by and archiving their system

assembling a circuit that could be used response

to heat a resistor and measure it’s  General design of PID controller

temperature. We then acquired step in LabView

response data from the system to create a  Manipulation of gain values to

Laplace-domain model of the heater. We achieve desired system

then used the model to investigate the response

appropriate PID gains and their effect on MATERIALS


system behavior. Finally we created a The following parts, materials
PID controller system in LabView and and equipment was used for this lab
tested the behavior of the system to module:
achieve the desired heating profile for  Breadboard
our application.  Connecting wires
I personally contributed the  Wire insulation
following roles in the project:  Heat-shrink tubing
 Joining of resistor and thermistor  Heat-shrink compound
couple

 Design of general circuit layout


 Power MOSFET (NTD3055- METHODS
094-1G low threshold voltage, Building the Circuit
min 1 A capacity)
We began by assembling a circuit that
 22 Ohm “low-value” resistor
could be used to heat a resistor and
 Thermistor (10 KOhm NTC)
measure it’s temperature. The functional
 10 KOhm resistor
component of this circuit was the
 6 V Power supply
resistor-thermistor couple. The low-
 USB-6008/9 DAQ device
value resistor and thermistor were
 Computer with LabView
electrically insulated then thermally

Figure 1: Circuit Schematic - Shows the set up of the breadboard and software interface through the
data acquisition device (DAQ). The low power resistor acted as the heating element thermally
coupled to the thermistor, which was our temperature sensor.
coupled using heat-shrink compound and Therefore, the farther the

heat-shrink tubing. A voltage divider measured temperature is away from the

was created in which half was the set point, the greater the output value

thermistor and half was the 10 KOhm sent to the actuator. The nature of a

resistor which scaled the output voltage proportional controller causes the system

to be near the center of the DAQ input to always produce an error relative to the

range at room temp. The low-value set point, therefore the desired value will

resistor was then placed in series with never actually be reached. In order to fix

the MOSFET. The DAQ output was then this problem and improve system

connected to the MOSFET gate. The performance, integral and differential

full circuit schematic can be observed in terms can be added such that:

Figure 1. VOUT = K E + K ∫Edt + K dE/dt


P I D

PID Control Theory Where, K , K , and K are the gains of the


P I D

For thermoregulating systems, proportional, integral, and derivative

proportional control utilizes the current control components, respectively. The

error, E, calculated as the difference components of this equation comprise

between the desired and measured the functional units of the controller. The

temperatures: output from the controller feeds into the

E=T -T SET .
MEAS duty cycle which uses pulse width

The proportional controller output will modulation (PWM) to determine the

then be a gain-scaled error: percent on time of the system. The

V OUT = K E.P general block diagram of the feedback

control system can be observed in Figure


2, where X is the set point, Y is the E(t) is the error, G is the controller and

process or measured value of the system, H is the system.

Figure 2: General Feedback Control System Block Diagram – An input, X, is checked against the
current state of the system, Y, to generate an error, E(t). The error is then inputted into the
controller, which uses the PID algorithm. The output of the controller feeds into a duty cycle, which
powers the system.

The ratio between the output and H(s) = β/(s +2ζω s+ω )
2
0 0
2

input (or set point of the system) can be Where ω is the natural frequency and ζ
0

derived from the block diagram of the is the damping factor.

feedback control system. Since, If we plug in the Laplace domain control

E(t) = X - Y and Y = E(t)*G*H, and transfer functions into the ratio

rearranging we can formulate: equation, we yield:

Y/X = H/((1/G)+H). Y/X = β(K s D


2

Taking the Laplace form of the +K s+K )/(s +(2ζω +K β)s +(ω +K β)s+K
P I
3
0 D
2
0
2
P

controller function, we get: s)


I

G(s) = K + K /s + K s = (K s +K s+K )/s


P I D D
2
P I LabView VI’s

We can also derive the transfer function The first VI supplied was the

of the system under control: template VI which had a data acquisition


channel and pulse width modulation function to the response data recorded

output. This VI allowed us to read the previously so that we know how our

system information from the DAQ system responds under control. Finally,

(voltage output from circuit). Using the we rearranged the transfer function and

PWM application VI, we were able to solved for the coefficients needed to be

obtain files of the measured voltage vs. plugged into the pid closed loop step

control voltage. In order to use the PWM response VI. This VI allowed us to

application VI, we also had to use the experiment with the various PID gain

PWM sub VI which implemented a duty values using the transfer function

cycle so that we could observe the effect derived from our system. This was

of a step change to the duty cycle so that helpful later on because it gave us an

we could measure the transfer function idea of how each gain value affects the

of the system. The PWM VIs allowed us system behavior as well as an

to apply a step change to the duty cycle approximate ratio of values needed to

and record both the duty cycle and achieve the response needed for our

output voltages as a function of time. specific application.

Once an equilibrium voltage was Effect of K Values on System Response

reached, the VI process was ended and Using the last VI described above, we

the file was saved to the designated plugged in our transfer function

folder. coefficients and manipulated the various

Then, using the Get TF fom files gain values to observe the effect each

2012 VI, we opened the file saved by the has on the system. Figure 3 shows the

previous VI. This VI fits a transfer front panel of the VI, with the transfer
function coefficients for the numerator of the system response on the lower

and denominator on the upper left, a right. The response shown in Figure 3 is

display of the transfer function on the our baseline comparator where all of the

upper right, entries to manipulate the K values were equal to 100.

gain values on the lower left and a plot

Figure 3: Baseline Gain Value Comparator – We set all of the gain values (Kp, Ki, Kd) equal to 100.
We used this system response as a comparator to observe the effect of changing the individual gain
values.

We then manipulated Kp shown in the figure, is that increasing Kp

(proportional control gain), Ki (integral also increased the error between the final

control gain), and Kd (derivative control value reached by the system and the set

gain) individually by increasing the gain point. Having an integral control gain

value from 100 to 200 and 300 (Figure allows the system to reach the exact set

4). When Kp was increased, the system point, however, when Ki was increased,

rose more rapidly to the set point (Figure the overshoot also increased as well as

4, column 1). Another effect of Kp, not the number and size of the oscillations
before reaching a steady state value the system and damped the oscillations

(Figure 4, column 2). Finally, increasing observed in the Ki column (Figure 4,

the Kd value decreased the overshoot of column 3).

Figure 4: Effect of Changing Gain Values – We manipulated each gain value individually (Left to
Right: Kp, Ki, Kd). We stepped each gain value up to 200 (Top row) then 300 (Bottom row). Kp increased
rise time. Ki increased oscillations and overshoot. Kd damped the oscillations and decreased overshoot.

Finally, using the knowledge oscillations and finally increased Kd to

obtained during the gain value damp any overshoot/oscillations

manipulation experiment, we adjusted generated by the integral control

the K values in order to achieve a component. We achieved the effect

response with a fast rise time, fast desired by using the following K values

settling time (minimal oscillations), and (Figure 5):

minimal overshoot. In order to minimize  Kp = 500

rise time, we increased Kp. We then  Ki = 50

decreased Ki to reduce overshoot and  Kd = 1000


Figure 5: Simulation with Appropriate Gain Values – We aimed to achieve a response with a fast
rise time, minimized overshoot, and no oscillations around the set point. We achieved this effect using a
proportional gain of 500, integral gain of 50 and derivative gain of 1000.

RESULTS loop to be within a set range, then

LabView Block Diagram convert that output into a duty cycle to

In order to build our own PID power the circuit. Figure 6 shows the

controller, we had to convert the voltage fully implemented LabView block

into a temperature, compare that diagram. The red, blue, and green

temperature to our set point, send that rectangles correspond to the components

error into a PID loop, run the PID documented in figures 7, 8, and 9,

calculations, force the output of our PID respectively.


Figure 6: Full LabVeiw Block Diagram – We designed a block diagram to convert the voltage into a
temperature, compare that temperature to our set point, send that error into a PID loop, run the PID
calculations, force the output of our PID loop to be within a set range, then convert that output into a
duty cycle to power the circuit. The red, blue, and green rectangles correspond to the components
documented in figures 7, 8, and 9, respectively.

Conversion to Temperature and Error essentially acts as a resistor in the

Calculation voltage divider, the resistance of the

The first step in building our own PID thermistor could be calculated using the

control was to convert the voltage voltage divider formula. We also know

reading from the DAQ to a temperature. the thermistor equation relating the

Since the thermistor electrically converts current resistance to the current

a temperature to a resistance which temperature of the thermistor (relative to

causes a voltage output from the voltage an calibrates resistance and

divider, we had to derive a formula to temperature). Solving for temperature as

convert the voltage back to a a function of voltage we get:

temperature. Since the thermistor T = [0.00025(ln(6/V - 1)) + 0.00335]


TH
-1
This equation was plugged into the labeled “Measured Temperature.” The

“Formula” block in the block diagram temperature output from the Formula

(Figure 7). The Voltage reading from the block was then subtracted from a user

DAQ was inputted into the Formula controlled set point labeled “Set

block so that the output would be the Temperature (K).” The input for the set

temperature of the thermistor. The point als appears on the front panel. The

current temperature was displayed on the current temperature subtracted from the

front panel (Figure 10) both as a numeric set point gives an error output from the

value and as a time plot using the blocks subtractor block.

Figure 7: Conversion to Temperature and Error Calculation – System data was collected by the
DAQ which passed the current voltage into the formula block which converted the voltage to a current
temperature. The temperature was displayed on the front panel and compared to a set point to
calculate the error.
PID Implementation which outputs an integrated sum of the

We next took the error calculated in previous errors. This integral block

Figure 7 and fed that error into a PID output is converted into a double and

controller. The error branches off as an multiplied by a user controlled gain

input into a proportional control, and labeled “Ki.” Finally, the derivative

integral control, and a derivative control. control was implemented identically to

The proportional control was the integral control, but instead used the

implemented by multiplying the error by “Derivative” block and a user inputed

a user inputed gain value using the block gain of “Kd.” The outputs of the

labeled “Kp” (Figure 8). The integral proportional, integral, and derivative

control was implemented by using the control were then summed using a

error as the input to the “Integral” block multiple input summing block.

Figure 8: PID Implementation – The error was sent into 3 pathways. The first multiplied the error by a
constant, Kp (proportional control). The second was an integrator pathway, which integrated the error
with past error and multiplied by Ki (integral control). The final was a derivative pathway, which
calculated the rate of change of the error and multiplied by Kd (derivative control). The three outputs
were then summed.
greater than 10, it will be converted into
Duty Cycle Implementation a 10, divided by 10, giving 1. Likewise,
The output from the summated PID if the value is negative, it will be
calculation was then inputted into a converted into a 0. This output range
function that forces the value to be in a from 0 to 1 represents a percentage to be
certain range. This is denoted by the fed into the duty cycle. Since the value
block with the integers “0” and “10” represents a “percent ON time,” the
coming off of it (Figure 9). This is value was multiplied by 1000 to be
necessary because the input into the duty converted into milliseconds of ON time
cycle must be in the range of 0 to 1. and fed into a DAQ controller that tells
Since the output from the PID could be the DAQ to power the circuit for the
any range of values, including negative amount of time given as an input. The
values, we must force the output into a remainder of the 1000 milliseconds was
specific range. We used the range from 0 then calculated and sent into the DAQ as
to 10 then divided that range by 10. In an OFF time.
this case, if the output from the PID is
Figure 9: Duty Cycle Implementation – The output from the PID calculation was forced into a range
from 0 to 10 then divided by 10 to give a value from 0 to 1. This value represents a percent ON time
which was passed into the duty cycle and told the DAQ whether to power the system or not.

LabView Front Panel percentage meter which displays the

All of the user controls described percent ON time, and with the CH1 and

above as well as the output readings for CH2 indicator lights indicating whether

the current temperature value and plot the power to the circuit is ON or OFF.

are seen on the front panel (Figure 10). Finally, the current temperature response

Using the front panel, the user is able to of the circuit was displayed as a value

manipulate the gain values by entering indicated in the “Measured

numbers into the entry fields labeled Temperature” box and on the plot.

“Kp,” “Ki,” and “Kd.” The set point for (Note: the control voltage range was

the system can be inputted into the “Set always set at 10 while the program was

Temperature (K)” field. The in use and the STOP button allowed us

functionality of the duty cycle can be to abort the while loop and end the

visualized both with the “Duty Cycle” program.)


Figure 10: LabView Front Panel – User inputs: Kp, Ki, Kd, Set Temperature, Control Voltage Range
(not used). Displays: Duty cycle percentage bar, CH1 and CH2 lights for ON/OFF, Measured Temperature
number and plot. Controls: Stop button to abort program.

o Avoid overheating,
System Response to Alterations in Gain maintain biological safety
Values  Minimal Oscillations
Once we implemented a usable PID o Constant external
controller interface in LabView, we next temperature for user, less
had to experiment with our gain values work for biological
to get the system response appropriate regulator
for our target design. Since we were In order to begin testing which gain
designing a thermoregulating running values gave us our target response we
jacket, we had the following response first tested the baseline values used for
parameters: the K value tests described in the
 Rise time < 30 seconds Methods section, setting Kp = Ki = Kd =
o Respond rapidly but not 100 (Figure 11, Top). Our starting
instantaneously to temperature was 318 K and our target
temperature fluctuations temperature was 330 K. Using those
 Overshoot < 2 degrees values, our system initially took 30
seconds to reach the set point but reduce Kp and Ki from 100, we set the

overshot the set point by 10 degrees. The following gain values:

system then began cooling but continued  Kp = 20

heating again after reaching 337 K  Ki = 2

indicating a large error in the response of  Kd = 40

the system. The system started from 315 K and our

From those results, we knew that we set point was 310 K (Figure 11, Bottom).

had to decrease Kp to reduce the error in Using those gain values, the system took

the system and decrease Ki to reduce the 30 seconds to reach the setpoint but

overshoot. We next tried the same overshot by 4 degrees before returning

proportionality between the gain values back to the set point and reaching a

as we found to be effective in the steady state. The overshoot indicated

original K value test, Kd = 2Kp = 20Ki. that out Ki was still too large, but the

Knowing that we had to significantly ratio used led to the correct rise time.
Figure 11: Altered K Values 1 – (Top) All gain values = 100, too much overshoot, large error. (Bottom)
Kp = 20, Ki = 2, Kd = 40, too much overshoot.

From these results, we knew that Our system started from a temperature of

we needed to reduce Ki, but we wanted 305 K with a set point of 310 K (Figure

to maintain the same ratio of gain values. 12, Top). The system reached the set

Using this information, we decided to point in 10 seconds but overshot by 2

decrease all of our gain values by a degrees, we also observed more abrupt

factor of 2 giving the following gains: changes in temperature indicating

 Kp = 10 reduced damping.

 Ki = 1 From these results, we decided to

 Kd = 20 reduce Kp by a factor of 20 (because rise


time was too fast), reduce Ki by a factor  Kd = 5

of 100 (to remove the overshoot), but Our system started from 304 K with a set

only reduce Kd by a factor of 4 to point of 310 K (Figure 12, Bottom). The

increase the relative damping. This gave system reached the set point after 45

us gain values of: seconds and did not exhibit any

 Kp = 0.5 overshoot. This indicated that our Kp

 Ki = 0.01 was too low.

Figure 12: Altered K Values 1 – (Top) Kp = 10, Ki = 1, Kd = 20, too much overshoot, too fast of rise, too
little damping. (Bottom) Kp = 0.5, Ki = 0.01, Kd = 5, too slow of rise.
Finally, we increased our Kp by Figure 13 shows the response of our

a factor of 2 and increase our Ki by a system, starting at 319 K, rising to the

factor of 2.5, keeping our Kd the set point of 325 K. The system reached

same. This gave us K values of: the set point in 30 seconds with no

 Kp = 1 overshoot indicating that these were the

 Ki = 0.025 appropriate gain values for our

 Kd = 5 application.

Figure 13: Ideal Response - Kp = 1, Ki = 0.025, Kd = 5, rise time = 30 seconds, no overshoot. This was
the ideal response for the thermoregulating jacket application.

controller can be set to have a wide

CONCLUSIONS variety of responses to a step input. An

As observed, implementation of PID understanding of what each component

control allows the implementer to of a PID does is crucial for the ability to

develop a control system that causes a develop a system response profile

device to target a set value. Through appropriate for the device being

manipulation of the gain values, the designed.


The greatest challenge of this lab control, understanding PID controls will

exercise was understanding and also boost my understanding of

implementing the LabView VI’s. I had biological systems as many biological

very minimal LabView experience going systems use PID control to maintain

into this lab, so there was a large homeostasis with their environment.

learning curve for understanding how

each supplies VI worked and how to

implement our own VI. The most

successful and exciting part of this lab

was experimenting with the K values

and observing the system’s response in

real time. I enjoyed being able to

actually touch the resistor-thermistor

couple and feel that our system was

working while watching the change in

system state on the monitor.

On a broader scale, having knowledge

of what PIDs do, understanding their

components, and being aware of their

limits will give me more awareness of

the control systems that surround us in

our everyday life. In addition to having

the ability to implement my own PID

Anda mungkin juga menyukai