- •16. ADVANCED LADDER LOGIC FUNCTIONS
- •16.1 INTRODUCTION
- •16.2 LIST FUNCTIONS
- •16.2.1 Shift Registers
- •16.2.2 Stacks
- •16.2.3 Sequencers
- •16.3 PROGRAM CONTROL
- •16.3.1 Branching and Looping
- •16.3.2 Fault Detection and Interrupts
- •16.4 INPUT AND OUTPUT FUNCTIONS
- •16.4.1 Immediate I/O Instructions
- •16.4.2 Block Transfer Functions
- •16.5 DESIGN TECHNIQUES
- •16.5.1 State Diagrams
- •16.6 DESIGN CASES
- •16.6.1 If-Then
- •16.6.2 Traffic Light
- •16.7 SUMMARY
- •16.8 PRACTICE PROBLEMS
- •16.9 PRACTICE PROBLEM SOLUTIONS
- •16.10 ASSIGNMENT PROBLEMS
- •17. OPEN CONTROLLERS
- •17.1 INTRODUCTION
- •17.3 OPEN ARCHITECTURE CONTROLLERS
- •17.4 SUMMARY
- •17.5 PRACTICE PROBLEMS
- •17.6 PRACTICE PROBLEM SOLUTIONS
- •17.7 ASSIGNMENT PROBLEMS
- •18. INSTRUCTION LIST PROGRAMMING
- •18.1 INTRODUCTION
- •18.2 THE IEC 61131 VERSION
- •18.3 THE ALLEN-BRADLEY VERSION
- •18.4 SUMMARY
- •18.5 PRACTICE PROBLEMS
- •18.6 PRACTICE PROBLEM SOLUTIONS
- •18.7 ASSIGNMENT PROBLEMS
- •19. STRUCTURED TEXT PROGRAMMING
- •19.1 INTRODUCTION
- •19.2 THE LANGUAGE
- •19.3 SUMMARY
- •19.4 PRACTICE PROBLEMS
- •19.5 PRACTICE PROBLEM SOLUTIONS
- •19.6 ASSIGNMENT PROBLEMS
- •20. SEQUENTIAL FUNCTION CHARTS
- •20.1 INTRODUCTION
- •20.2 A COMPARISON OF METHODS
- •20.3 SUMMARY
- •20.4 PRACTICE PROBLEMS
- •20.5 PRACTICE PROBLEM SOLUTIONS
- •20.6 ASSIGNMENT PROBLEMS
- •21. FUNCTION BLOCK PROGRAMMING
- •21.1 INTRODUCTION
- •21.2 CREATING FUNCTION BLOCKS
- •21.3 DESIGN CASE
- •21.4 SUMMARY
- •21.5 PRACTICE PROBLEMS
- •21.6 PRACTICE PROBLEM SOLUTIONS
- •21.7 ASSIGNMENT PROBLEMS
- •22. ANALOG INPUTS AND OUTPUTS
- •22.1 INTRODUCTION
- •22.2 ANALOG INPUTS
- •22.2.1 Analog Inputs With a PLC
- •22.3 ANALOG OUTPUTS
- •22.3.1 Analog Outputs With A PLC
- •22.3.2 Pulse Width Modulation (PWM) Outputs
- •22.3.3 Shielding
- •22.4 DESIGN CASES
- •22.4.1 Process Monitor
- •22.5 SUMMARY
- •22.6 PRACTICE PROBLEMS
- •22.7 PRACTICE PROBLEM SOLUTIONS
- •22.8 ASSIGNMENT PROBLEMS
- •23. CONTINUOUS SENSORS
- •23.1 INTRODUCTION
- •23.2 INDUSTRIAL SENSORS
- •23.2.1 Angular Displacement
- •23.2.1.1 - Potentiometers
- •23.2.2 Encoders
- •23.2.2.1 - Tachometers
- •23.2.3 Linear Position
- •23.2.3.1 - Potentiometers
- •23.2.3.2 - Linear Variable Differential Transformers (LVDT)
- •23.2.3.3 - Moire Fringes
- •23.2.3.4 - Accelerometers
- •23.2.4 Forces and Moments
- •23.2.4.1 - Strain Gages
- •23.2.4.2 - Piezoelectric
- •23.2.5 Liquids and Gases
- •23.2.5.1 - Pressure
- •23.2.5.2 - Venturi Valves
- •23.2.5.3 - Coriolis Flow Meter
- •23.2.5.4 - Magnetic Flow Meter
- •23.2.5.5 - Ultrasonic Flow Meter
- •23.2.5.6 - Vortex Flow Meter
- •23.2.5.7 - Positive Displacement Meters
- •23.2.5.8 - Pitot Tubes
- •23.2.6 Temperature
- •23.2.6.1 - Resistive Temperature Detectors (RTDs)
- •23.2.6.2 - Thermocouples
- •23.2.6.3 - Thermistors
- •23.2.6.4 - Other Sensors
- •23.2.7 Light
- •23.2.7.1 - Light Dependant Resistors (LDR)
- •23.2.8 Chemical
- •23.2.8.2 - Conductivity
- •23.2.9 Others
- •23.3 INPUT ISSUES
- •23.4 SENSOR GLOSSARY
- •23.5 SUMMARY
- •23.6 REFERENCES
- •23.7 PRACTICE PROBLEMS
- •23.8 PRACTICE PROBLEM SOLUTIONS
- •23.9 ASSIGNMENT PROBLEMS
- •24. CONTINUOUS ACTUATORS
- •24.1 INTRODUCTION
- •24.2 ELECTRIC MOTORS
- •24.2.1 Basic Brushed DC Motors
- •24.2.2 AC Motors
- •24.2.3 Brushless DC Motors
- •24.2.4 Stepper Motors
- •24.2.5 Wound Field Motors
plc analog - 22.18
N9:0 |
0 |
|
|
|
|
|
|
|
D1 |
||||||||
|
1 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
D2 |
|||||||||
|
2 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
D3 |
|||||||||
|
3 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
D4 |
|||||||||
|
4 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
f |
|
|
|
s |
s |
s |
s |
s |
s |
s |
s |
p4 |
p3 |
p2 |
p1 |
|
|
5 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
L1 |
|||||||||
|
6 |
|
|
|
|
|
|
|
|
||||||||
|
|
|
|
|
|
|
|
U1 |
|||||||||
|
7 |
|
|
|
|
|
|
|
|
||||||||
|
|
|
|
|
|
|
|
L2 |
|||||||||
|
8 |
|
|
|
|
|
|
|
|
||||||||
|
|
|
|
|
|
|
|
U2 |
|||||||||
|
9 |
|
|
|
|
|
|
|
|
||||||||
|
|
|
|
|
|
|
|
L3 |
|||||||||
|
10 |
|
|
|
|
|
|
|
|
||||||||
|
|
|
|
|
|
|
|
U3 |
|||||||||
|
11 |
|
|
|
|
|
|
|
|
||||||||
|
|
|
|
|
|
|
|
L4 |
|||||||||
|
12 |
|
|
|
|
|
|
|
|
||||||||
|
|
|
|
|
|
|
|
U4 |
|||||||||
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
D - data value words for channels 1, 2, 3 or 4 f - data format bit (1) binary, (0) BCD
s - scaling factor bits
p - data sign bits for the four output channels
L - lower scaling limit words for output channels 1, 2, 3 or 4 U - upper scaling limit words for output channels 1, 2, 3 or 4
Figure 22.14 Configuration Data for a 1771-OFE Output Card
22.3.2 Pulse Width Modulation (PWM) Outputs
An equivalent analog output voltage can be generated using pulse width modulation, as shown in Figure 22.15. In this method the output circuitry is only capable of outputing a fixed voltage (in the figure ’A’) or 0V. To obtain an analog voltage between the maximum and minimum the voltage is turned on and off quickly to reduce the effective voltage. The output is a square wave voltage at a high frequency, typically over 20Khz, above the hearing range. The duty cycle of the wave determines the effective voltage of the output. It is the percentage of time the output is on relative to the time it is off. If the duty cycle is 100% the output is always on. If the wave is on for the same time it is off the duty cycle is 50%. If the wave is always off, the duty cycle is 0%.
plc analog - 22.19
A
Veff
t
A
Veff
t
A
Veff
t
A
Veff
t
A
Veff
t
= A
= |
3A |
------ |
|
|
4 |
A
= --2
A
= --4
= 0
Figure 22.15 Pulse Width Modulated (PWM) Signals
PWM is commonly used in power electronics, such as servo motor control systems. In this case the response time of the motor is slow enough that the motor effectively filters the high frequency of the signal. The PWM signal can also be put through a low pass filter to produce an analog DC voltage.
plc analog - 22.20
Aside: A basic low pass RC filter is shown below. This circuit is suitable for an analog output that does not draw much current. (drawing too much current will result in large losses across the resistor.) The corner frequency can be easily found by looking at the circuit as a voltage divider.
VPWM |
R |
Vanalog |
C |
|
|
|
|
|
1 |
|
|
|
|
|
|
|
|
--------- |
|
|
|
1 |
|
|
|
|
|
jω |
C |
|
|
|
|
Vanalog |
= VPWM |
-------------------- |
|
|
----------------------- |
||||
|
1 |
= VPWM |
jω |
|
|||||
|
|
|
|
R + |
|
|
CR + 1 |
||
|
|
|
|
j---------ω C |
|
|
|
||
|
|
|
|
|
|
|
|||
Vanalog |
= |
1 |
|
|
|
|
|
|
|
---------------VPWM |
j-----------------------ω CR + 1 |
|
|
|
|
|
|||
|
|
|
|
|
|
||||
|
|
1 |
|
|
corner frequency |
|
|||
ω |
|
|
|
|
|
|
|
|
|
------- |
|
|
|
|
|
|
|
||
= CR |
|
|
|
|
|
|
|
As an example consider that the PWM signal is used at a frequency of 100KHz, an it is to be used with a system that has a response time (time constant) of 0.1seconds. Therefore the corner frequency should be between 10Hz (1/0.1s) and 100KHz. This can be put at the mid point of 1000Hz, or 6.2Krad/s. This system also requires the arbitrary selection of a resistor or capacitor value. We will pick the capacitor value to be 0.1uF so that we don’t need an electrolytic.
|
1 |
|
|
|
1 |
|
|
104 |
= 1.59KΩ |
R = |
------- |
= |
-------------------------- |
= |
------- |
||||
Cω |
10 |
–7 |
2π 10 |
3 |
2π |
||||
|
|
|
|
|
|
|
|
Figure 22.16 Converting a PWM Signal to an Analog Voltage
In some cases the frequency of the output is not fixed, but the duty cycle of the output is maintained.
22.3.3 Shielding
When a changing magnetic field cuts across a conductor, it will induce a current
plc analog - 22.21
flow. The resistance in the circuits will convert this to a voltage. These unwanted voltages result in erroneous readings from sensors, and signal to outputs. Shielding will reduce the effects of the interference. When shielding and grounding are done properly, the effects of electrical noise will be negligible. Shielding is normally used for; all logical signals in noisy environments, high speed counters or high speed circuitry, and all analog signals.
There are two major approaches to reducing noise; shielding and twisted pairs. Shielding involves encasing conductors and electrical equipment with metal. As a result electrical equipment is normally housed in metal cases. Wires are normally put in cables with a metal sheath surrounding both wires. The metal sheath may be a thin film, or a woven metal mesh. Shielded wires are connected at one end to "drain" the unwanted signals into the cases of the instruments. Figure 22.17 shows a thermocouple connected with a thermocouple. The cross section of the wire contains two insulated conductors. Both of the wires are covered with a metal foil, and final covering of insulation finishes the cable. The wires are connected to the thermocouple as expected, but the shield is only connected on the amplifier end to the case. The case is then connected to the shielding ground, shown here as three diagonal lines.
Insulated wires
Two conductor shielded cable
cross section |
|
|
|
|
|
|
|
Metal sheath |
|
|
|
|
|
||||
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Insulating cover |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Figure 22.17 Shielding for a Thermocouple
A twisted pair is shown in Figure 22.18. The two wires are twisted at regular intervals, effectively forming small loops. In this case the small loops reverse every twist, so any induced currents are cancel out for every two twists.