Sie sind auf Seite 1von 64

Advanced Instructions and Concepts: Control and Computation

Programmable Logic Controllers

Programmable Logic Controllers Components and Functions Module 3

Page 1

Advanced Instructions and Concepts: Control and Computation

Programmable Logic Controllers

3.0 Control and Computation


In the previous modules the inputs were always a switch or similar device that provided an on or off condition to the PLC. Similarly the outputs either turned devices on or off. This digital Input/ Output allows for a great deal of control. However, the world has a great deal of analog quantities in it. The temperature of a fluid vat or a baking oven may be critical to the proper operation of the process. The optical level reflected by a panel may indicate the quality of the finish. These type applications need a numerical value to represent the measured quantity. In the modern manufacturing environment such physical quantities are measured with a variety of electronic sensors. An electronic sensor is a device to measure one physical quantity and convert it into an electrical quantity, preferably voltage or current. PLCs are able to read the voltage or current output of these sensors and place a numerical value in the data register. In this module we will study the way these values can be manipulated with comparison commands, mathematical operations, and logical operations. These techniques will expand the realm of control over which the PLC can operate.

3.1.1 Exploration: Analog Input


Part One: Figure 3.1a is a picture of the analog input to a typical PLC (here a Micrologix 1500). The device has 4 voltage inputs that are settable by the software over a -10 to +10 volts range. Table 3.1a lists the terminal connections. Analog

Input Module

Input Terminals

Figure 3.1a: Analog Input Terminals


Page 2

Advanced Instructions and Concepts: Control and Computation

Programmable Logic Controllers

Terminal Number 1 2 3 4 5 6 7 8 9

Description V/I in (or -V0 connection) Analog Common V/I in (or -V1 connection) Analog Common V/I in (or -V2 connection) Analog Common V/I in (or -V3 connection) Analog Common DC neutral for external

Terminal Number 18 17 16 15 14 13 12 11 10

Description +V0 in +I0 in +V1 in +I1 in +V2 in +I2 in +V3 in +I3 in External +24 V Optional

Table 3.1a: Terminal Function Chart

Connect a variable resistor or potentiometer as shown in Figure 3.1b to apply voltage between the +V0 and Analog Common. Connect a digital multimeter to the same terminals.

Analog Input Module

Multimeter

Battery

Potentiometer

Page 3

Advanced Instructions and Concepts: Control and Computation

Programmable Logic Controllers

Figure 3.1b: Potentiometer connected to Analog Input Module

It will be necessary to set up the configuration of the Analog port for the maximum input voltage expected, the format to record the data, and which channels we wish to record. This is done through the configuration menus. Select the I-O Configuration from the menu shown in figure 3.1b.

Figure 3.1b: Files Menu

Page 4

Advanced Instructions and Concepts: Control and Computation

Programmable Logic Controllers

Figure 3.1c: First I/O Screen On the first screen, you should find the Analog units available for your system displayed. If they are not, you may need to select them from the right. In the Micrologix 1500 used for figure 3.1c, the analog input is assigned as Input #1. The four analog inputs will be designated as I:1/0, I:1/1, I:1/2 and I:1/3. Select the button shown as Adv Config. This will produce the next screen figure 3.1d.

Page 5

Advanced Instructions and Concepts: Control and Computation

Programmable Logic Controllers

Figure 3.1d: I/O Screen Two Select the Analog Input Configuration shown. This will bring up the last screen needed for configuration. On this screen three setting are made, Input range, Filter setting, and data format. Also there is a check box to enable the individual analog inputs. This screen can be considered the equivalent of the selector switch on a multimeter with one input but several functions.

Page 6

Advanced Instructions and Concepts: Control and Computation

Programmable Logic Controllers

Figure 3.1.e: Analog Input Configuration Set you screen as shown above. The possible settings are shown in the chart below. Since we are using a 9V battery as our input source we will select the 0 to 10VDC max range. Input Range 10 to +10 VDC 0 to 5 VDC 0 to 10 VDC 4 to 20 mA +1 to +5 VDC 0 to 20 mA Filter 50 Hz 60 Hz 250 Hz 500 Hz Data Format Raw/Proportional Engineering Units Scaled for PID Percentage Value

Table 3.1b: Analog Settings The analog input will transfer the digitally converted value of the voltage to the Input file. By clicking on the Input file icon on the file menu it its possible to monitor the value the PLC has placed into its memory. The Converter will continuously update this value similar to the way a digital voltmeter updates it's display. Figure 3.1f is a possible screen of the Input file.

Page 7

Advanced Instructions and Concepts: Control and Computation

Programmable Logic Controllers

Figure 3.1f: Input Data File with Analog Value on I:1.0

Figure 3.1g: Input Data File with Decimal Output on I:1.0

Page 8

Advanced Instructions and Concepts: Control and Computation

Programmable Logic Controllers

Place the following ladder program into the PLC. Download and run the program on the PLC and by observing the Input File contents, fill in the data table below.

Reading 1 2 3 4 5 6

Digital Multimeter Reading

Input File Reading (I:1.0)

Multimeter/ Input file

Divide the digital multimeter reading by the decimal value listed in the Input file and place the result in the far right column.

Questions: 1. Can you get a zero voltage on your digital meter? If so, does the Analog Input register zero as well?

2. Refer to the far right column and comment on the value from your computation.

3. Change the data display format to Percent and comment on how it relates to the input voltage.

Page 9

Advanced Instructions and Concepts: Control and Computation

Programmable Logic Controllers

Part Two: To use the values of the analog input it is necessary to transfer these values from the Input file to other devices or files. The MOV instruction can be used for this purpose. In the exploration below, the input voltage will be used to set the amount of delay on a TOF (off-delay) timer unit. The ladder diagram in figure 3.1h is a variable time delay circuit for the PLC. Run the program and adjust the variable resistor to set the delay time interval. As presented, one volt is equal to a 10 second delay.

Figure 3.1h: Exploration, Part Two - Variable Delay Timer Questions: 1. Explain the operation and function of I:0.0/0 in this circuit.

2. What is the time base of the TOF unit? What is the ratio of volts/sec. How accurate can the timer be set?

3. Open the Input file window and comment on the relation between when the MOV instruction changes and the Input value changes.

Page 10

Advanced Instructions and Concepts: Control and Computation

Programmable Logic Controllers

3.1.2 Dialog - Analog Inputs


The values of the analog inputs are placed in the appropriate input file during every scan of the PLC ladder program. The time between updates of the analog information is therefore variable, depending on the length of the program and the speed of the PLC. The access time of the data value is faster than most digital multimeters, but is slower than a dedicated PC based analog to digital converters. The particular analog input module used in this exercise has four inputs, but only one converter. The four inputs are connected in sequence, to the analog converter and then read into the Input file. The resolution of a converter is the size of each voltage step. The formal equation for the resolution is given by

The analog converter in the Micrologix 1500 is a 14-bit converter. In Part One the volts/number ratio was 0.001 (to three decimal places). This suggests that the converter has a 16.384 Volt internal reference and 16,384 possible digital values. The Vref is one millivolt per bit change. This is comparable to most digital multimeters or panel meters used in industry. Notice that operation of the analog converter did not require any action from the ladder program. It is an action that is built into the PLC operating system. It is only necessary to activate the converter with the configuration screens to make the values available in the Input file. In the second exploration the MOV instruction was used to move the value from the input file to the timer file as the preset value. Notice the way the MOV instruction addresses the Timer to identify the register of the timer to have the value moved into, in this case the Preset or PRE. Instructions to be learned later will allow computations to be made with the analog input numbers. In the exploration, the analog voltage was provided by a variable resistor or potentiometer. Such devices can be used for capture of rotational information. Most potentiometers have about 270o of rotation. There are special potentiometers that will allow full 10 or 20 rotations. It is also possible to obtain potentiometers with a linear (slider) design with a 3 to 5 cm travel. These units can be

Page 11

Advanced Instructions and Concepts: Control and Computation

Programmable Logic Controllers

used for linear position information. The potentiometer forms a common electrical circuit called a voltage divider. The general circuit for this is shown in figure 3.1i. The output voltage is measured from Ground (or common) to the point between the two resistor values. The output voltage is governed by the equation below.

The resistors can be replaced with a variety of sensors. For example a photoresistor can be used for R2 and the output voltage will be related to level of illumination. If a thermistor, or temperature dependent resistor, is used, the voltage will be proportional to the temperature. Once the analog value is known to the PLC, it can be used in a program. To accomplish this, a decision-making instruction is needed. A decision instruction asks a question, for example, are two quantities equal, or is one greater or less than the other. The modern PLC has these instructions among its set of operations. The GRT instruction is useful to compare two values from two inputs or compare an input value against a known constant. Figure 3.1j shows the GRT (greater than) instruction. This instruction goes on the left side of the Rung as input information. If the value specified for A is greater than the second value labeled B, then rung is true. If, however, B becomes greater than A the rung will go false. The companion instruction to GRT is LES (less than). The LES does the A < B comparison.

Figure 3.1j: The GRT and LES instructions The value for A must be a device or word length file address. The value for B can be a word length file address or a constant. In control language the B constant would be called a "set point". Both values could be variable, based on outside sensors. The GRT or LES would be selected based on which comparison is needed.

Page 12

Advanced Instructions and Concepts: Control and Computation

Programmable Logic Controllers

3.1.3 Application: The Light Controller


It is common to see streetlights that come one at night when the background lighting decreases. We need a similar system to control the lighting in our energy efficient factory. We use large skylights to provide lighting during the day but near the end of the shift the outside light drops and the factory gets dim. We wish to have a control system that reads the light level and turns on lights as needed. It will also turn off lights when not needed. Develop a control program with the following parameters: a) Photoresistor to sense the analog value of the illumination (use a voltage divider circuit with R2 the photoresistor. Establish a range of from less that one volt to over 5 volts.) b) If the room is two dim, turn on the lights. If too bright, turn off the lights. c) Use a delay in turning on or off the lights to prevent temporary shadowing from "tripping" the circuit. d) Establish a manual override switch to allow the plant manager to turn on lights when he/she desires. e) All lights are to be controlled by a single output. You can use a panel light to indicate that lights are on or off. Develop the concept and your possible ladder program, wiring diagram, and key decisions (for example, what is dim and dark?). Put this information on a Project Planning Sheet. It should be approved by the plant manager (your instructor), before it is wired into the PLC.

Questions: 1. What analog number will represent the transition from light to dark? Why?

2. Are there standards or recommendations for the amount of illumination on a factory floor? We want to stay within any OSHA guidelines.

Page 13

Advanced Instructions and Concepts: Control and Computation

Programmable Logic Controllers

Application:

Section ____________ Project Planning Sheet

Description of Project Requirements: _________________________

Inputs
Device Name Device Type Function Device Name

Outputs
Device Type Function

Page 14

Advanced Instructions and Concepts: Control and Computation

Programmable Logic Controllers

3.2.1 Exploration: Analog Output


The modern PLC has the ability to output analog voltage and analog current. A common means of transferring analog data between sensors and measurement & control equipment in industry is to represent the physical parameter as a current that varies from a low of 4 mA to a high of 20 mA. By using these current levels to send the information, should the line be broken the lack of current signals a problem. Further the current does not decrease for long wire runs as the voltage would. For further information on current based signals see Johnson, Process Control Instrumentation Technology. On the Allen Bradley systems the analog outputs occupy a rack number and appear on the output table. As a result, analog outputs are updated at the same time as the on-off digital outputs. As with the analog inputs it is necessary to configure the outputs for range, filter, and output format (see Table 3.2a). In figure 3.2a is the output terminal pattern for the 1769OF2 analog output module for the Micrologix 1500.

Analog Input Module

Analog Output Module

Figure 3.2a: Analog Output Module

Output Terminal

Page 15

Advanced Instructions and Concepts: Control and Computation

Programmable Logic Controllers

Terminal Number 1 2 3 4 5 6 7 8 9

Description No Connection No Connection +I out for Output 0 No Connection +I out for Output 1 No Connection DC Neutral No Connection No Connection

Terminal Number 18 17 16 15 14 13 12 11 10

Description No Connection No Connection +V output 0 Analog Common +V output 1 Analog Common +24 VDC No Connection No Connection

Table 3.2a: Terminal Function Chart - Output Module To explore the operation of the Analog output, run the ladder program in figure 3.2b. In this program the input voltage will be read by the PLC and transferred to the output. Turn potentiometer to several positions and read the values. Fill out the data table below and then transfer the data to the graph. This graph represents the transfer function between the input and output. Plot the input voltage horizontal. Label all axes with the appropriate quantity and units. Configure the output port as in figure 3.2c.

Figure 3.2b: Analog Input/ Output Project

Reading 1 2 3 4 5 6

Voltage In

Voltage Out

Page 16

Advanced Instructions and Concepts: Control and Computation

Programmable Logic Controllers

Figure 3.2c: Output Port Configuration

Page 17

Advanced Instructions and Concepts: Control and Computation

Programmable Logic Controllers

Graph Paper for Transfer Function


Questions: 1. Is the Transfer Function Graph linear or curved? If straight what is the slope of the graph?

2. What is the function of the Input switch in the program?

Page 18

Advanced Instructions and Concepts: Control and Computation

Programmable Logic Controllers

The advantage of having analog values is that mathematical operations can be preformed on the values. All calculations are done in integer value ranging from _32,768 to +32, 767. Beyond these values an error bit will be set. PLCs have the functions shown below:

Function MUL DIV

ADD SUB

Description Source A x Source B, either may be a constant, but not both, result is 32 bits Source A/ Source B with the result in the Destination- usually an N7 file address value limitations as for MUL Source A +Source B with the result in the destination -usually an N7 file address Source A - Source B with the result in the Destination- usually an N7 file address.

There are many other features related to the math functions as well as additional cautions against overflow and underflow error that can cause problems in the PLC. Read the Help files for your specific PLC model to determine what precautions should be taken. Set up the following new program and repeat the data table below. Plot the data on the same graph as the first table.

Figure 3.2d: Division of Analog Numbers

Page 19

Advanced Instructions and Concepts: Control and Computation

Programmable Logic Controllers

Reading 1 2 3 4 5 6 Questions:

Voltage In

Voltage Out

3. What is the slope of the new data graph? How does this relate to the division process?

4. If a second two port analog output were added to the PLC, what would be the addresses of this new output?

3.2.2 Dialog: Analog Outputs


From the graph it is clear that there is a direct relationship between the output voltage and the number moved into the output file. The conversion from number to voltage is again based on the same formula as the input. So the voltage output will be given by

The value N is the number in the output file. The value of Vres is dependent on the reference voltage. For the Micrologix 1500 and the 1769 OF2, this is about one millivolt as in the analog input module. With the PLC analog voltage output, the key factor to consider is the maximum output current. According to the manufacturers specifications, the maximum current is 10 mA. If we need more current then some form of power drive circuit will be needed. (The structure of these circuits is beyond the scope of this module. See Johnsons text mentioned earlier.) Use Ohms Law and the power formula to confirm you are within the current limits before connecting the output to the load or you will damage the output circuits.

Page 20

Advanced Instructions and Concepts: Control and Computation

Programmable Logic Controllers

In the exploration we used several of the mathematics functions available on the PLC. In Table 3.2a are a listing of several these commands. Those commands with an asterisk are available only on the SLC5/02 and above and on none of the fixed PLCs. Command MUL DIV Description Source A x Source B, either may be a constant, but not both, result is 32 bits Source A/ Source B with the result in the Destination- usually an N7 file address value limitations as for MUL Source A +Source B with the result in the destination -usually an N7 file address Source A - Source B with the result in the Destination- usually an N7 file address. Double divide Change sign of number Clear all bits of word to zero Convert integer to binary coded decimal (BCD) Convert BCD to integer Multiplex data Square Root* Scale values* Test if A = B Test if A not equal to B Test if A < B Test if A <= B Test if A > B Test if a part on A = a part of B Test if C < A < B *

ADD SUB DDV NEG CLR TOD FRD DCD SQR SCL EQU NEQ LES LEQ GRT MEQ LIM

Chart 3.2 a: Math Operations and Functions

When using these files it is common to place the answers in the N7 or numbers data file until needed. Intermediate values may also be stored in N7 file and then used in additional calculations.

Page 21

Advanced Instructions and Concepts: Control and Computation

Programmable Logic Controllers

3.2.3 Application: Maintaining an Average


This application involves two voltage inputs ranged from 0 to 5 Volts. The average of these voltages must be held to 3.0 volts =/- 10%. If the average goes 10% above 3 Volts a green light must come on. If the average goes 10% below the 3 Volts a red light must come on. The data signal is coming from a load cell output monitoring the flow of material going into a hopper. The optimum is for each conveyor to send equal amounts to the hopper, however for production reasons that does not always happen. In those times the second feed can be run heavy to compensate. Use your Project Planning Sheet to develop a wiring diagram, and an appropriate ladder program to accomplish this. Use two 10 Kohm variable resistors for the two input voltage sources and monitor the output with a digital voltmeter.

Page 22

Advanced Instructions and Concepts: Control and Computation

Programmable Logic Controllers

Application:

Section ____________ Project Planning Sheet

Description of Project Requirements: _________________________

Inputs
Device Name Device Type Function Device Name

Outputs
Device Type Function

Page 23

Advanced Instructions and Concepts: Control and Computation

Programmable Logic Controllers

3.2.4 Exploration: Measuring Process Temperature


Often it is necessary to control the physical parameters of a system. Quantities, such as flow rate, motor speed, pressure, or temperature, are only a few of the potential parameters necessary to control in a manufacturing process. We will explore the control of the temperature of a system using our analog Input and output features of the PLC. The first step in control is the ability to measure the quantity we wish to control. The AD590 chip is designed to measure the temperature of its surroundings. It has a range from 55oC to 125oC and can output the temperature in degrees Kelvin. Electrically it is a Norton constant current source. This means that when a voltage is connected it allows a constant current to flow through the circuit. The AD590 is calibrated so that the current varies with temperature at 1 A per degree Kelvin. So at room temperature (25oC) the AD590 allows 298 A to flow regardless of voltage. (if we dont exceed its maximum operating voltage.) The value represents the value of absolute zero on the Kelvin scale to the Celsius scale. Hence, the 273oC (ice point) + 25oC (room temperature) results in a reading of 298 A. When placed in the circuit of Figure 3.2f the one K resistor will have 298 mV across it. This is a number our PLC can easily read.

Figure 3.2f: the AD590 Temperature Measurement Circuit If we read the voltage into the computer and subtract 273, the amount remaining will represent the temperature in Celsius degrees with an accuracy of 1 to 2 percent.. The AD590 chip has three leads. Each lead has a unique function in the device. When viewed from the bottom the leads can be identified as shown in figure 3.2g.

Figure 3.2g: The AD590 Pin Outs

Page 24

Advanced Instructions and Concepts: Control and Computation

Programmable Logic Controllers

In the circuit of figure 3.2f only leads 1 and 2 are used. The third lead if for safety ground and noise suppression. This will not be a problem in our application. The AD590 allows us to measure the temperature and express the value in degrees Celsius. We can easily monitor those values with the Input file or the N7 file. Since the AD590 outputs a reading in mV that is directly proportional to degrees Kelvin we need to subtract 273 from the reading to obtain degrees Celsius. This can be done with the SUB instruction. Figure 3.2jhshow a rung that will accomplish this task.

Figure 3.2h: Scaling AD590 Reading to Celsius Degrees Input the program rung above and measure the temperature of several objects. Examine the N7 file to read the temperature value. Object Room Air Your Fingers Lab Partners Fingers Top of Computer Monitor Temperature (N7:1)

3.2.5 Exploration: Analog Output Control We have seen above how we can measure the temperature, but to control the temperature of a chamber we need a source of thermal energy. In an industrial setting this may be an elaborate control circuit to regulate the current into a resistor bank wrapped around a furnace chamber. For our experimental purposes we need something less complex (and cheaper). For our experiment we will use a power transistor. The power transistor will allow up to 15 Amperes to flow and 115 W to be dissipated. We can control the amount of dissipation by the current into the base connection of the transistor. The current in the base will in turn be controlled by the output of our Digital-to-Analog (DAC) converter. Because our particular DAC has a 10 mA high limit we will use a driving transistor to isolate the larger currents needed by the power transistor from the DAC. (In electronics this circuit is called a Darlington pair.) Figure 3.2ishows this circuit connected to the DAC output of the PLC.

Page 25

Advanced Instructions and Concepts: Control and Computation

Programmable Logic Controllers

Connect this circuit and the program in figure 3.2b and confirm that the DAC can control the amount of current into the power transistor. Be sure to place an ammeter in series with the power transistor.

Figure 3.2i: Power Transistor Circuit

Warning: Keep the power transistor current under 250 mA in this part of the experiment to prevent the temperature exceeding 125oC.

Fill in the table below: Data Point 1 2 3 4 5 6 7 8 9 10 Voltage from DAC, Vd Current in Power Transistor, Ic

Page 26

Advanced Instructions and Concepts: Control and Computation

Programmable Logic Controllers

Using your data draw a graph of the Current Vs voltage on the chart below.

Temperature Control Questions: 1. Looking at your graph, would you characterize the relationship as linear or nonlinear?

2. In the exploration the value of voltage was set by the potentiometer. List at least two different sources that could be used for the output voltage value.

3. If we placed the transistor on an aluminum heat sink, the temperature will be lower in our experiment. How could we increase temperature of the system under these new conditions?

Page 27

Advanced Instructions and Concepts: Control and Computation

Programmable Logic Controllers

3.2.6 Dialog: Process Temperature Control The explorations above have show how we can input measured information, such as temperature, as a analog number. We can perform complex mathematical operations on this data and we can output the data to accomplish new tasks. On task that is important to industry is maintaining a constant temperature. A meat packing plant must have its refrigerators maintain a constant low temperature to preserve the meat for safety. A soup making company must bring its product to a specific temperature, hold it for cooking and then lower the temperature for canning. A brick kiln must fire the bricks at a known and controllable temperature year round regardless of it being a cold or hot day. All of these are examples of controlling temperature. We have all the necessary pieces in our system above to control the temperature of a device - in this case our transistor. To control any system requires that we have the ability to first measure the quantity we wish to control. Determine if it is over, under or equal to the desired amount (the set point). Then to take action to effect a change in the desired quantity add heat, subtract heat, turn on a fan, etc. Control of our transistor temperature could be achieved by turning on and off the power supply providing the current to the transistor. This on-off control is used in a vide variety of situations. To accomplish this we would input the temperature and use a compare instruction to turn on or off the power to an output.

Figure 3.2j: On-Off Control Program Although this type of control is used in many applications, we can do better with our PLC. With the math instructions available we can implement a control equation based on the difference between the measured input value and the desired set point value.

Page 28

Advanced Instructions and Concepts: Control and Computation

Programmable Logic Controllers

Figure 3.2k: Process Control Loop The process control loop (figure 3.2k) exemplifies what needs to be done. It is important that the error signal that is fed back to the controlling element is opposite to the controlling signal. That is, if the control signal is too large, the error must reduce it in value. If too small, it must increase it in value. The equation below will accomplish that with our input temperature. Vout = m * (Tm Tsp) Here Vout is the output from the DAC going to our power transistor to control the current flow and the resulting heating. Tsp is the set point or the desired temperature of the device, and Tm is the measured temperature or input reading to our ADC. The factor m is a gain or proportionality factor. A value will need to be selected for this that establishes how much the transistor responds to off temperature behavior. The control equation can be accomplished with the instruction set we have available on our PLC. A table of defining files will help in this process. Each file will be filled by the use of either a MOV command or a math operation.

Page 29

Advanced Instructions and Concepts: Control and Computation

Programmable Logic Controllers

Line Number 1 2 3 4 5 6 7 8 9

File Name I:1.2 I:1.0 N7:0 N7:1 N7:2 N7:3 N7:4 N7:5 N7:6

Function Input file for Tm Analog pot for set point value Proportional gain value, m Set point voltage value N7:1 value /100 Measured value, Tm N7:3 273 N7:2 N7:4 (error) N7:5 * N7:0

Table 3.2: File Definitions When the value of file N7:6 is output as a DAC voltage it will cause the transistor to conduct current and raise the case temperature. As the temperature reaches the set point value in N7:1 the error value will approach zero. At zero error the output to the transistor should shut the transistors conduction off. When the transistor again cools the temperature drop will produce an error value and the transistor will again begin to heat. The value of the gain will need to be set by trial and error attempting to get a gain factor that will allow quick response, but with out increasing so fast that the temperature will go significantly over the set point value. This tuning of the system gain is common for Proportional control systems of this type. 3.2.7 Application: Building and Testing the Process Control Loop Develop a ladder logic program to implement the values shown in Table 3.2. The program will take in the temperature from the AD590 system as a voltage, convert to degrees Celsius, and develop a voltage value to output to the DAC. This output will control the current through the transistor. Use the chart developed in the exploration to set the initial gain to provide about 100 mA of transistor current with a 10 C error. This will be your starting value; you may change it as you progress through the experiment. Use a Project Planning Sheet to document files used, input/output tables and connections, wiring diagrams and ladder logic program. Establish the set point at 75 C. When the system begins to operate, record the temperature every minute and graph your results. This graph represents a picture of the system response to control. You may wish to run the experiment with different values of gain and compare the resulting graphs of response time. At no time should the temperature exceed 125 C or 398 mV from the temperature sensor. Write a summary of how well you were able to control the system temperature.

Page 30

Advanced Instructions and Concepts: Control and Computation

Programmable Logic Controllers

Application: Process Temperature Control Project Planning Sheet

Section 3.2.7

Description of Project Requirements: _________________________

Inputs
Device Name Device Type Function Device Name

Outputs
Device Type Function

Schematic Diagrams of Sensor and Output Device

Page 31

Advanced Instructions and Concepts: Control and Computation

Programmable Logic Controllers

PLC Wiring Diagram

Ladder Logic Program

Page 32

Advanced Instructions and Concepts: Control and Computation

Programmable Logic Controllers

Graph of Process Control Response

Time in minutes

Summary of Process Control Behavior ______________________________________________________ ______________________________________________________ ______________________________________________________ ______________________________________________________ ______________________________________________________


Page 33

Advanced Instructions and Concepts: Control and Computation

Programmable Logic Controllers

3.3 Sequencer Operations


Many times what needs to be implemented is a linear sequence of events. First A occurs, then B then C and so on until the process is complete. The PLC has the ability to do this type of operation by using its sequence Instruction called SQO. 3.3.1 Exploration: Turning on a Sequence of Lights with Timers Develop a program to turn on the lights in the sequence red, yellow, and green. A single push button should start the sequence. It is up to you to define the time between lights are on and the time between lights coming on. However, they should all go off when the sequence is completed. You should record below the inputs and outputs being used. Also, any timers used should be documented as well. Include your initial ladder logic program and print out a copy of your final ladder logic program.

Inputs
Device Name Device Type Function Device Name

Outputs
Device Type Function

Timer Number

Type of timer

Preset

Initial Ladder Program

Page 34

Advanced Instructions and Concepts: Control and Computation

Programmable Logic Controllers

Questions: 1. The exploration did not specify if the three lights are each on alone or if all three should be on at the finish. How did you decide on this option?

2. Depending on which method of light sequence above you used, how easy would it be to change to another sequence?

3. Speculate on methods you could use to select between two different sequences for the same three lights, for example green, red, yellow or yellow green, yellow.

3.3.2 Dialog: Sequencer Operation In the exploration to change the sequence of lights would require rewriting the ladder logic program. Additionally changing the timing of the lights could require a delicate set of changes to the timer presets. Most PLCs have the ability to simplify the execution of a sequence of operations. Think of the lights as a set of patterns. The table below would represent the sequence of red, yellow and green. Here a 1 represents an ON light and a 0 represents an OFF light.

Red 1 0 0 0

Yellow 0 1 0 0

Green 0 0 1 0

If we then place each pattern into the output file in order, the lights would come on in the pattern shown. To change the lighting sequence we could change the pattern file. For example for a yellow, green, yellow sequence we would use a pattern as below.

Page 35

Advanced Instructions and Concepts: Control and Computation

Programmable Logic Controllers

Red 0 0 0 0

Yellow 1 0 1 0

Green 0 1 0 0

Well, this is exactly what the SQO instruction does. A pattern file is created by the program designer and is transferred to the output file based on a false to true transition on the rung with the SQO (Sequencer Output) instruction. In figure 3.3c is a rung with a push button and an SQO instruction. Every time the push button goes true (high) the SQO instruction will move to a new line of the pattern file. Although simple in concept, the SQO instruction has several setup requirements to assure proper operation.

Figure 3.3c: Simple SQO Instruction 3.3.4. Exploration: Setting up a Sequence File For the single line program above to sequence through the lights a good deal of file set up is necessary. The SQO relies on the contents of the referenced files for operation. A BIT file must define the patterns necessary on the output. Although the B3 file could be used for this operation, because it is commonly used for so many functions, it is best to create a new binary file specifically for your sequencer. To create a new file, double click on the files icon and select new as shown in figure 3.3d. After clicking New the File Creation Screen will pop-up as shown in figure 3.3e. Name the file as shown in the figure. There must be one more element in the BIT line than the number of patterns in your pattern file. We have 4 patterns in our light sequence so we need 5 elements. The zeroth element is never used.

Page 36

Advanced Instructions and Concepts: Control and Computation

Programmable Logic Controllers

Double Click

Figure 3.3d: New BIT File

File number must be

Change to 5 for this j t

Names and description s are your h i

Figure 3.3e: New Data File Creation

Page 37

Advanced Instructions and Concepts: Control and Computation

Programmable Logic Controllers

Next create a new Control File (labeled with an R in RSLogix). Again double click on the file icon and select New. However, this time use file number 11 and file type Control. We need only one element for this file.

Page 38

Advanced Instructions and Concepts: Control and Computation

Programmable Logic Controllers

Figure 3.3f: Creation of the Control File

Page 39

Advanced Instructions and Concepts: Control and Computation

Programmable Logic Controllers

Figure 3.3g: Control Data File

Lights Pattern Data

Neede d Blank

Figure 3.3h: Bit Data File with the Pattern Information

At this point you should have the B10 file with the pattern data as shown in 3.3h, and the control file R11 with room for one element. We are now ready to enter the program with the SQO instruction. Start a new program and enter the input switch on rung one as in figure 3.3c. In figure 3.3i is the selection menue showing the SQO instruction. Click and drag the SQO to the fight side of rung 1.

Select SQO instruction, click and drag to the necessary

Sequencer instructions are to the far right th t b

Page 40

Advanced Instructions and Concepts: Control and Computation

Programmable Logic Controllers

Figure 3.3i: Selection of SQO Instruction

The SQO instruction will produce the output box shown in figure 3.3j. Each item must be inserted into the instruction for proper operation. The figure shows the data to place in each section.

The B10 and R11 were created for the sequence The number of lines in you pattern

The mask value is The destination is the output file controlling

Figure 3.3j: The SQO Instruction Data Mask The term mask is used her to define the locations that the sequencer will effect. Only those bit locations with a 1 in the mask value can be influenced by data in the pattern file. If the mask value is a 0, when the pattern is transferred to the output those bit locations will be unchanged. This process will assure only those devices necessary to the control operation are affected by your sequencer, and allow the remaining output locations to be used by other parts of the program. For example, suppose we wish to control bits 0, 1, 2, 5 and 6 with a sequence pattern, but do nothing to the other outputs. 15 14 13 12 11 10 9 8 7 6 1 5 1 4 3 2 1 1 1 0 1

The mask below would accomplish this task.

Page 41

Advanced Instructions and Concepts: Control and Computation

Programmable Logic Controllers

Number system Binary Hexadecimal Decimal

Mask value %0000 0000 0110 0111 0067h 103

With the data entered into the B10 and R11 and those file referenced by the SQO file the program in Figure 3.3c can now be run. Run the program and comment below on what occurs.

This program is not quite what we want as it requires you to press the button each time. We can automate the stepping through the sequence by using timers. Input the program shown below using a timer and a start button. Run the program and comment on how it is different than the previous program and on its operation compared to your original light sequence program in section 3.3.1.

Figure 3.3k: Timer Based Sequencer

Page 42

Advanced Instructions and Concepts: Control and Computation

Programmable Logic Controllers

A few comments are in order regarding this new program. The timer circuit is made free running by using the Timer Done (DN) bit to momentarily drop the input to the timer circuit. As soon as the timer is done the DN bit goes false causing the timer input to go false. This restarts the timer, bringing the DN bit true again. It is the true to false transition that starts the timer.

3.3.3 Application: Drag Strip Light Tree


A common sight at the Drag Strip is the vertical light tree to start each race. At our new PLC Drag Strip we will have a light tree with the following specifications: 1. Light Sequence: Red, yellow, 2nd yellow, Green 2. The red comes on when we push the start button, warning the drivers the race is about to begin. 3. Fifteen seconds later the first yellow light comes on and the red goes off 4. Fifteen seconds later the second yellow comes on and the first yellow stays on! 5. Fifteen second later the green comes on, starting the race. The green will remain on until the stop button is pressed to reset the operation, with all lights off. Develop you pattern data file and transfer to the B10 file. Make necessary changes to the timed sequence program figure 3.3k and document those changes with a printed copy of the ladder logic program. Questions: 1. What is the length of the sequencer file compared to the example in figure 3.3k.

2. If an alternate light sequence is necessary at some point describe steps necessary to implement the new sequence. (Assume timing and other factors remain the same.)

3. Were you successful in producing a no light state when the stop (or reset) button was pressed? How did you accomplish that action?

Page 43

Advanced Instructions and Concepts: Control and Computation

Programmable Logic Controllers

4. What impact did the program changes have on the mask value used in your program?

3.3.4 Exploration: Paint Booth A small cabinet manufacturer has installed an automated painting booth to prime and finish coat his cabinets. A blocked picture of the paint both layout is show in figure 3.3l. A single conveyor moves the cabinet through the booths where paint is applied and the cabinet is dried in the trip from primer to finish coat.

Figure 3.3l: Paint Booth Physical Layout In this exploration you will analyze the PLC program, determine key features of the operation and document the performance of the program. Many of these things have been done in previous programs so the individual activities should be familiar. First a process list of what actions the program should perform needs to be developed. This is listed below for you to use as a reference. 1. Part is placed on conveyor belt and presence is determined by sensor. Conveyor does not move it no part is present. 2. Part is moved into the primer section. This takes 3 seconds. 3. Primer is sprayed for 8 seconds. 4. Part is moved to finish section. This takes 5 seconds. 5. Finish coat is applied to part. This takes 10 seconds. 6. Finished part is moved out for pickup. This takes 3 seconds.

Page 44

Advanced Instructions and Concepts: Control and Computation

Programmable Logic Controllers

From this information we can develop a timing diagram of the events. In figure 3.3m is a diagram showing the conveyor belt motion. Fill in the remaining timing for the primer and finish coat operations.

Figure 3.3m: Timing Diagram for Paint Booth Program From the timing diagram you can determine the sequencer pattern data necessary for the program. You will need to know the Input/ Output assignments being used by the program. Look at the program listing carefully and fill out the Input/Output Assignment table below. Function in Program Input Designation number Output Designation number

Table 3.3.1: Input/Output Assignments

Page 45

Advanced Instructions and Concepts: Control and Computation

Programmable Logic Controllers

Based on your knowledge of the timing and the I/O assignments, develop a sequence pattern file for this process. Compare your file to the contents shown for the B10 file (Figure 3.3p). In what ways are the pattern file and the B10 file alike and different?

The program for this section is shown in figure 3.3n. Enter this program into your PLC and run the program. The program uses a series of TON timers to achieve the various intervals. In the table below, you should document each timer and its preset value. Purpose of Timer Timer Number Preset Value Time interval

Table 3.3.2: Paint Booth Timers Questions: 1. What is the total cycle time for this process? (How long does it take to paint a cabinet?)

2. A new paint vendor has offered us a paint that will prime in 4.5 seconds. How could we incorporate that into our process? ( Hint we dont wish to spray longer that necessary.)

3. List at least three manufacturing processes that would use a timed sequence similar to this program.

Page 46

Advanced Instructions and Concepts: Control and Computation

Programmable Logic Controllers

4. Discuss the similarities and differences in the three timers used for conveyor control.

Page 47

Advanced Instructions and Concepts: Control and Computation

Programmable Logic Controllers

Figure 3.3n: Paint Booth Program, Part 1

Page 48

Advanced Instructions and Concepts: Control and Computation

Programmable Logic Controllers

Figure 3.3o: Paint Booth Program, Part 2

Figure 3.3p: The Paint booth B10 File

3.3.5 Dialog: Automatic Step Sequences An Improved Paint Booth

Page 49

Advanced Instructions and Concepts: Control and Computation

Programmable Logic Controllers

The Paint Booth program is typical of many operations in which two or more processes must follow each other in a timed sequence. Painting a cabinet, washing a car, filling and capping bottles are just three examples. The program in figure 3.3n and 3.3o has some unique features. The first rung of the program is a common technique to initialize the condition of one ore more files. In a sequencer the R11 control file determines where the sequencer starts its first operation. This may or may not be the first line of the sequence. To be sure that the sequence starts on line one and thus transfers all zeros from the B10 to the output we Move a 1 into the Position (POS) control of R11. The S:1/15 value is taken from the Status file S2. In figure 3.3q the value of S:1/15 is shown to be NO. When the program is started, or on First Pass, this value will go true making Rung one true and moving the Value 1 into the R11 POS location. In subsequent runs this rung will not be needed and will not operate.

Figure 3.3q: Status File for First Pass Operation

Page 50

Advanced Instructions and Concepts: Control and Computation

Programmable Logic Controllers

Figure 3.3r: R11 File with POS For the following discussion refer to Figure 3.3n. When we press the start button (I:0.0/1), the SQO in rung one will activate moving the first line of B10 to the output file (O:0.0). At the same time Rung two will start timer T4:0 running for 3 seconds. Notice the Enable, EN, of T4:0 seals in I:0.0/1. When T4:0 is finished, it will change the state of the T4:0 DN bit. When the DN bit goes high, it will open Rung two; cause Rung one to go true; step the SQO instruction (making the Primer Light come on); and start timer T4:1 in Rung three. Notice that each of the Rungs 3, 4, 5, and 6 have a similar logical structure. Pair with another student and each of you describe in the space below the sequence of events controlled by Rung Three and Rung Four. Then verbally describe to each other what the events will be. Rung Three:

Rung Four:

Improving the Paint Booth Program While this process works it is not the only way to accomplish this task. The same output behavior can be achieved with only one timer and two sequence operations. Figure 3.3s shows a typical program to accomplish the Paint Booth with minimum instructions.

Page 51

Advanced Instructions and Concepts: Control and Computation

Programmable Logic Controllers

Figure 3.3s1: Automatic Step Sequencer Program Control

Figure 3.3s2: Dual Sequencers with Timer In this program notice that we have two sequencers. The first sequencer references the B10 file sending that data to the output file O:0.0 as in our previous program. The second sequencer references B9. This second set of data is sent to timer T4:4 and placed in the preset location. The effect of this is to provide a different time to the timer each step of the sequence. In figure 3.3t the data values for B9 are shown. These values represent the times for each operation.
Page 52

Advanced Instructions and Concepts: Control and Computation

Programmable Logic Controllers

Figure 3.3t: Timer Data Stored in B9 File For example, on the third step of the sequence a preset time of 5 seconds will be placed in the T4:4 timer. This will allow a single timer to be used for each of the different time delays required by the process. This second sequencer provides for a reduction of five timers to one timer. Each element of the B9 file is keyed to an element in B10 because both sequencers are controlled by the same R11 control file. This file is identical to the prior program. One change has been made in the B10 file and the First Pass Rung of the program. The B10 file begins with the first process of moving the conveyor (turning on O:0.0/0). If we started the sequence at the beginning this would cause the conveyor to run immediately. So to prevent this from happening, the First Pass Rung sets the control file at the end of the sequence on step six. Then, as the sequence is stepped by the part being in place, the conveyor starts and the time is set to fiv seconds. For this change we needed to move the pattern file in B10 up one element position so that the zeros are at position 6 instead of position1. On rung two we also added an emergency stop In case we need to halt the line for any reason. This new solution to the same problem demonstrates how easily we con accomplish the very same physical movements and processes with a variety of completely correct and functional programs. The variety of solutions possible is limited more by the creativity and knowledge level of the programmer than by the language or the PLC. You could load and run this program if you wish. Your instructor may have this available as a file that can be loaded into your system.

Page 53

Advanced Instructions and Concepts: Control and Computation

Programmable Logic Controllers

3.3.6 Application: The Automatic Car Wash


A good example of a sequence operation is a drive through car wash. A typical installation is shown in Figure 3.3t. In this car wash the driver will see a green light to tell him to pull the car forward until a red light signals him to stop. At this point the cars front wheels will be held on a chain drive for forward movement. A set op flaps will come up in front and behind the wheels. The car must be placed in neutral. The wash pump will force soapy water all over the car from a series of nozzles on the sides and ceiling. When the process is done, the chain drive motor pulls the car forward to the next station. This time, rinse water will spray over the car. When rinsing is completed, the chain drive motor will pull the car into the blower section. The blower will come on to blow the car dry. When the drying process is done, the chain drive will release the wheels, and a green light will signal the driver to move forward. (Of course, it is the drivers responsibility to put the top up before driving into the car wash.)

Figure 3.3t: The Automatic Car Wash

Using a Project Planning Sheet to define the necessary Inputs and Outputs for the Car Wash described above. Assume the times shown below for each wash cycle. Wash 45 sec Rinse 30 sec Dry 60 sec

Time

Table 3.3.3: Car Wash Process Times

Page 54

Advanced Instructions and Concepts: Control and Computation

Programmable Logic Controllers

Inputs Limit Switch wash Limit switch rinse Limit switch dry

Outputs Wash pump Rinse pump Blower Chair drive Wheel clamps Stage one Red light Stage one Green light Stage Three Red Light Stage Three Green light

Table 3.3.4: Input and Output Features Using the techniques presented in section 3.3.5 for a dual sequencer, develop a solution to this application. You should have a PPS with the I/O designations for your PLC, the values to place in the B10 file and the B9 file for timers. Develop a sample ladder program (on paper) before you begin to write the program into your computer.

Page 55

Advanced Instructions and Concepts: Control and Computation

Programmable Logic Controllers

Project Planning Sheet The Automatic Car Wash Statement of Problem:

Process Steps Necessary:

Page 56

Advanced Instructions and Concepts: Control and Computation

Programmable Logic Controllers

PPS: Continued Input and Output: Input


Device Name Function

Output
Device Name Function

B10 Pattern

B9 Pattern

Number of elements in R11 file _________ Initial Ladder Diagram on reverse side.

Page 57

Advanced Instructions and Concepts: Control and Computation

Programmable Logic Controllers

3.3.7 Exploration: Sequencers with Feedback


In previous sections we have looked at a variety of applications of PLC to both industry and business. Use the Internet to search for additional applications of PLC use. Many of the manufacturers place such applications on their web sites. Some possible locations would be: www.ab.com www.omron.com www.seimens.com www.mitsubishi.com www.mrplc.com www.geindustrial.com/gefannuc/hardware_solutions.htm Find two applications and describe each application in a short paragraph. During class you will be ask to share one of the applications with your group.

3.3.8 Dialog: Real World Applications


There are many applications in the world of business and industry that require sequential processes. However, we have to this point, been dependent on timing to control the stepping through the sequence. It is possible to implement a control scheme in which the stepping of the sequence is controlled by the occurrence of specific combinations of logic events. For example, you may not want to apply heat to a vat unless it had fluids in it. Then rather than heat for a time period, it may be more appropriate to heat to a specific temperature. A traffic light may need a pedestrian walk button or an on demand left turn lane. Any of these events are unpredictable in their occurrence. However, sensors can be used to tell the PLC that these events have occurred. The sequence instructions also offer an excellent solution to use of these inputs to control of the sequence stepping operation. The Sequence with Compare of SGC instruction will allow a line by line control of when the next step of a sequence can occur.

Page 58

Advanced Instructions and Concepts: Control and Computation

Programmable Logic Controllers

Figure 3.3u: The Sequencer with Compare Instruction The SQC instruction is shown in Figure 3.3u. Each of the files referred to in the instruction will be discussed. The File is the set of conditions or events that must occur to step through each event. This file has been created based on what we expect to have happen. These values will be compared to the values in the Source. Here the Source is the Input values being read by the PLC. If the Contents of the B15 file is the same as the I:0.0 file then the SQC instruction will allow the next step to occur. For this reason the value of Mask used is very important. By setting the numeric value of specific mask bits to zero they will not be used in the compare operation. If some inputs are not used for the SQC they can be masked off by this process. For example, B15 B14 B13 B12 B11 B10 B9 0 0 0 0 0 0 0 B8 1 B7 1 B6 0 B5 0 B4 0 B3 1 B2 1 B1 1 B0 1

In the chart above bits 4, 5, 6, and 9 through 15 would not be considered in the compare with B15 and the I:0.0 files. These inputs could be any value. However, the remaining bits 0,1,2,3,7,8,must match the values found in the B15 file. This is not to say they values are logic one, but are the same as those recorded in the B15 pattern file. We can enter this into the program in any number system that is convenient. The value shown is binary 000 0001 1000 1111B or 018FH or 399 in decimal. The B or H is used to identify the number system being used. As before with the SQO instruction a control file is needed. Her we indicate the control is R12:0. We could also use the same control file and designate this new control as R11:1 or R11:2 by increasing the number of elements in the R11 file.

Page 59

Advanced Instructions and Concepts: Control and Computation

Programmable Logic Controllers

Suppose we wish to have a sequence advance only when two inputs are jointly true. We would establish a pattern file for inputs as below: Input Number I:0.0/0 I:0.0/1 Description Switch 1 Switch 2

B15 B14 B13 B12 B11 B10 B9 0 0 0 0 0 0 0

B8 0

B7 0

B6 0

B5 0

B4 0

B3 0

B2 0

B1 1

B0 1

This value of decimal 3 would be placed into the Mask to allow only the joint pressing of the I:0.0/0 and I:0.0/1 to allow the advancement of the sequence.

3.3.9 Application: Palletizing Robot


In a previous project you constructed a program to prime and finish coat a series of small cabinets. The manufacturer is now asking for you to add a robot palletizing operation to stack the finished product in cartons for shipping. In figure 3.3v is the layout of the newly designed work cell. Your existing paint booth line has not been changed in any way, but the robot was added to handle the finished product.

Figure 3.3v: Palletizing Work Cell

Page 60

Advanced Instructions and Concepts: Control and Computation

Programmable Logic Controllers

The basic operation is detailed in the steps below: 1. Robot picks up finished cabinet by extending its arm moving down and closing gripper then moving up 2. It then and moves along the gantry to either Eye1 or Eye2 positions. 3. The cabinet is then placed in one of the four bins numbered 1 through 4. You will need to determine what order to fill the bins when you write the program. 4. To place the cabinet in the bin will require the robot to reverse the pick-up procedure of extend or retract (front or back bins) down, release, and up. The robot will then return to the spray booth and wait until the next part is ready to be picked up. 5. This process will need to be repeated four times to fill the bins. Each of the completed actions will be signaled to the PLC. The B15 file will contain the conditions necessary for moving to the next step of the sequence. The available I/O is shown in Table 3.3.5.

Table 3.3.5: Input and Output for Palletizing Project It will be necessary to develop the pattern file for the output (using the notation of the previous project) the B10 file. This is the sequence of events that are to happen. At the same time consider the input pattern necessary for each of the actions to be initiated this will be you B15 file for the new SQC instruction. A helpful way to set up the pattern files is to develop a spread sheet based on the events to occur. Mark a one or zero for each output and for each input value. This pattern list will be quite long, but you do basically the same thing four times. We are not using all inputs so remember to set the Mask accordingly - 0ffffh will not work

Page 61

Advanced Instructions and Concepts: Control and Computation

Programmable Logic Controllers

Refer to the program in figure 3.3s. The First Pass rung will need to set the R11 control files to the starting points for each sequencer. You can accomplish this with a pair of MOV instructions. Note that the SQC and SQO need a false-to true transition to step to the next line of the file.

Page 62

Advanced Instructions and Concepts: Control and Computation

Programmable Logic Controllers

Project Planning Sheet Robot Palletizing Project


Description of Project:

Input/Output Assignments: Input Number Description Output Number Description

Input Pattern File:

Output Pattern File:

Page 63

Advanced Instructions and Concepts: Control and Computation

Programmable Logic Controllers

Possible Initial Ladder Program:

Page 64

Das könnte Ihnen auch gefallen