ВУЗ: Не указан

Категория: Не указан

Дисциплина: Не указана

Добавлен: 14.06.2025

Просмотров: 1801

Скачиваний: 0

ВНИМАНИЕ! Если данный файл нарушает Ваши авторские права, то обязательно сообщите нам.

Experiment #4: Continuous Process Control

to not use Sample and Hold. This can be understood if you consider driving the circuit at 50%. A 50% drive would result in ½ of the supply voltage appearing across the load continually. This is great. Right? Well if half of the supply voltage is across the load continually, the other half must be across the transistor. This collector- to-emitter voltage times the collector current represents power wasted in the transistor. When system response is fast (like the brushless fan) you have no choice but to use this type of linear power control.

The resistor heating element in our model incubator is a good example of a slow responding system. Straight PWM control of the resistor wastes little power in the transistor because it is only operated in an ON/OFF switching mode. As long as the PWM period is much longer (>10x) than the time required to run the rest of the program loop there will little discrepancy in the Duty cycle and expected average voltage.

Page 118 •Industrial Control Version 1.1


Experiment #4: Continuous Process Control

Challenge #3: Analyzing your Open-Loop System

The following program is developed to study the relationship between PWM drive on your heater and the resulting stable temperature. The program will apply PWM drive levels in 10% increments. Each increment will last approximately four minutes. The program will end after 100% drive has been applied. StampPlot Lite will give you a graphical representation of your system’s response, along with time stamp information in the list box. Furthermore, if you are really interested, the StampPlot Lite data file can be imported into a spreadsheet, applied to a graph and analyzed.

Figure 4.11: Screen Shot of PWM Drive vs. Temperature

Industrial Control Version 1.1 •Page 119

Experiment #4: Continuous Process Control

Figure 4.11 is typical of a StampPlot Lite screen shot resulting from this test. Load Program 4.3. Before running the program, be sure your canister has cooled to room temperature. Place the cap on your canister and start the program. When the DEBUG window appears, close it and start StampPlot Lite. Connect using StampPlot Lite and press the restart button to reload the program and begin the test.

'Program 4.3: PWM vs. Temp Test with StampPlot

Interface

'This

program tests the canister's temperature

rise for incremental increases of

'PWM drive. Program runtime is approximately

40 minutes. This can be adjusted

'by 'changing the "tick" and/or "Drive" increments.

'Program assumes that the circuitry is set according to Figure 4.3.

'ADC0831: '"chip select" CS = P3, "clock" 'Clk=P4, & serial data output"Dout=P5.

'Zero

and Span pins: Digital 0 = Vin(-) = .70V

and Span = Vref = .50V.

'Configure Plot

'Allow buffer to clear

Pause

500

DEBUG

"!RSET",CR

'Reset plot to clear data

DEBUG

"!TITL PWM vs. Temp Test",CR

'Caption form

DEBUG

"!PNTS 24000",CR

'24000 sample data points

DEBUG

"!TMAX 6000",CR

'Max 6000 seconds

DEBUG

"!SPAN 70,120",CR

'70-120 degrees

DEBUG

"!AMUL .1",CR

'Multiply data by .1

DEBUG

"!DELD",CR

'Delete Data File

DEBUG

"!SAVD ON",CR

'Save Data

DEBUG

"!TSMP ON",CR

'Time Stamp On

DEBUG

"!CLMM",CR

'Clear Min/Max

DEBUG

"!CLRM",CR

'Clear Messages

DEBUG

"!PLOT ON",CR

'Start Plotting

DEBUG

"!RSET",CR

'Reset plot to time 0

' Define constants & variables

CS CON 3

'

0831 chip select active low from BS2 (P3)

CLK CON 4

'

Clock pulse from BS2 (P4) to 0831

Dout CON 5

'

Serial data output from 0831 to BS2 (P5)

Datain VAR byte

'

Variable to hold incoming number (0 to 255)

Temp VAR word

'

Hold the converted value representing temp

TempSpan VAR word

'

Full Scale input span in tenths of degrees.

TempSpan = 5000

'

Declare span.

Set Vref to .50V and

'

0-255 res. will be spread over 50

'(hundredths).

Offset VAR word

'

Minimum temp.

@Offset, ADC = 0

Offset = 700

'

Declare zero Temp. Set Vin(-) to .7 and

'

Offset will be 700 tenths degrees. At these

'

settings, ADC output will be 0 - 255 for temps

'

of 700 to 1200 tenths of degrees.

LOW 8

'

Initialize heater OFF

Page 120 •Industrial Control Version 1.1


Experiment #4: Continuous Process Control

Drive VAR word

' % Drive

Duty VAR word

' variable for PWM duty cycle

Tick VAR word

Drive = 0

' Initialize variable to 0

Tick = 0

Duty = 0

'Get and display initial starting values.

GOSUB Getdata GOSUB Calc_Temp

DEBUG "Temp = ", DEC Temp, " Duty = ", DEC Duty,CR

DEBUG "!USRS Begining Test! -- Testing at ", DEC Drive, "% Drive.",CR

Main:

' main loop

PAUSE 10

GOSUB Getdata

GOSUB Calc_Temp

GOSUB Control

GOSUB Display

GOTO Main

Getdata: LOW CS LOW CLK

PULSOUT CLK,10

SHIFTIN Dout, CLK, MSBPOST,[Datain\8] HIGH CS

RETURN

Calc_Temp:

Temp = TempSpan/255 * Datain/10 + Offset

RETURN

Display:

DEBUG DEC Temp,CR

RETURN

Control:

PWM 8,Duty,200

Tick = Tick + 1

IF Tick = 2000 Then Increase

RETURN

'Acquire conversion from 0831 'Select the chip

'Ready the clock line.

'Send a 10 uS clock pulse to the 0831 'Shift in data

'Stop conversion

'Convert digital value to 'temp based on Span & 'Offset variables.

'Plot present temperature

'Testing system at different % duty cycles

'PWM

'increment tick variable

'Program cycles per drive level change

Increase:

Drive

+

10

'Bump up the drive

Drive =

'Drive increments = 10%

Duty = (Drive

*

255/100)

'Scale %Drive to

Duty

PWM

If Duty

> 256

Then

Stopit

'Stop test

after

100%

DEBUG "Ending

Temp

= ", DEC Temp, " Now testing at ",

DEC Drive,

"% Drive", CR

DEBUG "!USRS Testing at ", DEC Drive, "% Drive",CR

Industrial Control Version 1.1 •Page 121


Experiment #4: Continuous Process Control

Tick = 0

RETURN

Stopit:

"Test Over. Ending

Temp

'

Stop and print summary

DEBUG

= ", DEC Temp," at 100 % Drive",CR

DEBUG

"!USRS Temperature

= ",

DEC Temp,"Test

Over",CR

END

Page 122 •Industrial Control Version 1.1

Experiment #4: Continuous Process Control

Challenge #4: Open-Loop Control--Desired Setpoint = 101o Fahrenheit

It is our objective to maintain a constant canister temperature of 101o Fahrenheit. Follow these procedures. Record values in the table of Figure 4.12.

1. Study the StampPlot Lite analysis that resulted from running Program 4.2. From the Text Box listing, record in the table the beginning ambient temperature, the temperature at the end of the 50% drive test, and the ending maximum temperature after 100% drive.

2. Use your cursor to find the Drive level that resulted in a temperature of 101 degrees.

3. Next, modify the Control subroutine of Program 4.2 so that the duty cycle remains at the constant value declared initially. Do this by removing the two lines indicated below.

Control:

' Testing system

at different % duty cycles

PWM 8,duty,200

' PWM

tick = tick + 1

' increment tick

variable

IF tick = 2000

Then Increase

' Program cycles

per drive level change

RETURN

4. At the beginning of the program, declare the DutyCycle to be the value that yielded 101o in our test StampPlot Lite. Run the program and allow the system to stabilize. How close was your estimation? Bump it up or down accordingly to find the setting that yields the desired result. In line #5 of the table, record the percent of drive that places the system at or near 101 degrees. Let it run for a moment and take note of the system stability. Once a drive setting has been established, an open-loop system will stabilize; and, as long as the disturbances that affect the process stay constant, so will the output.

5. Plug in the brushless fan across the Vdd supply and aim it directly toward the canister. The moving air represents a change in the disturbance on your process. According to theory, heat will be removed from the process at a greater rate and the new stable temperature will be lower than 101o. With the fan blowing on the canister, try to find the new “correct” drive for this condition. Record your data in line #6 of the table.

Industrial Control Version 1.1 •Page 123


Experiment #4: Continuous Process Control

Figure 4.12: Open-Loop Control Table

Line#

Condition

% Drive

Temp

#1

Desired Temperature

101o

#2

Ambient Temperature

0

#3

50 % Drive Temperature

50%

#4

Full Drive Temperature

100%

#5

Appropriate % Drive for 101o

101o

Without fan disturbance

#6

Appropriate % Drive for 101o

101o

With direct fan disturbance

#7

Appropriate % Drive for 101o

101o

With partial fan disturbance

6.Finally, leaving the proper setting established in line #6, change the position of the fan so it is blowing less directly on the canister. This represents a medium disturbance level on the system. Assess the situation and make your best guess as to the proper drive setting required by this new condition. Program the BASIC Stamp for this drive level. Once the system stabilizes, record your results in line #7 of the table.

Challenge #5: Determining an Open-loop Setting

1.Select a new “desired temperature” for your system. Predict and program an open-loop drive value that will maintain this temperature.

2.Place a couple of glass marbles in your canister. See how increasing the mass of the system affects the response and the drive setting necessary to maintain the new condition. What conclusions can you draw from the system’s behavior?

There are many variables that can affect the relationship of drive level and temperature in your small environment. Given some time to experiment and become familiar with the dynamic relationship between temperature, drive level, and disturbances, you could get pretty good at assessing the conditions and setting the right amount of drive in an open-loop manner. As we see, however, if any condition of our process changes, so will the output. Open-loop control can be useful in some applications. When a process requires that its output remain constant for all conditions, then closed-loop control must be employed. In closed-loop control, action is taken based on an evaluation of the measurement and the desired setpoint. This evaluation results in what is called an “error signal.” Experiment #5 and #6 will guide you through 5 modes of closedloop control.

Page 124 •Industrial Control Version 1.1