Intelligent Traffic Control using PLC Dileep Project.doc (Size: 72.5 KB / Downloads: 754)
Traffic signals are the most convenient method of controlling traffic in a busy junction. But, we can see that these signals fail to control the traffic effectively when a particular lane has got more traffic than the other lanes. This situation makes that particular lane more crowdy than the other lanes. If the traffic signals can allot different time slots to different lanes according to the traffic present in each lane, then, this problem can be solved easily.
We, in this project work, intend to measure the traffic density by counting the number of vehicles in each lane and then allot different time slots to different lanes according to the number of vehicles. Its also difficult for a traffic police to monitor the whole scenario round the clock. So, we use an automated system which counts the number of vehicles in each lane, allots different time slots to different lanes according to the number of vehicles present in each lane.
For automation, we have decided to use a Programmable Logic Controller (PLC). Due to its ruggedness and ease of programming and re programming, PLC is the most suitable controller for the above purpose.
Department of Instrumentation
Cochin University of Science and Technology
Introduction to PLC
A programmable logic controller (PLC) is an industrially hardened computer based unit that performs discrete or continuous control functions in a variety of processing plant and factory environments.
It was invented to replace the necessary sequential relay circuits for machine control. The PLC works by looking at its inputs and depending upon their state, turning on/off its outputs. The user enters a program, usually via software, that gives the desired results.
Compared with electromechanical relay systems, PLCs offer the following additional advantages:
Â¢ Ease of programming and reprogramming the plant
Â¢ A programming language that is based on relay wiring
Â¢ High reliability and minimal maintenance
Â¢ Small physical size
Â¢ Ability to communicate with computer systems in the plant
Â¢ Moderate to low initial investment cost
Â¢ Rugged construction
Â¢ Modular design
PLCs are used in many real world applications like machining, packaging, material handling and automated assembly industries. PLCs can be employed in almost all applications that require some type of electrical control.
For example, letâ„¢s assume that when a switch turns on, we want to turn a solenoid on for 5 seconds and then turn it off regardless of how long the switch is on for. We can do this with a simple external timer. But what if the process included 10 switches and solenoids We would require 10 external timers. What if the process also needed to count how many times the switches individually turned on We need a lot of external counters. As you can see, the bigger the process, the more of a need we have for a PLC. We can simply program a PLC to count its inputs and turn the solenoids on for the specified time.
The Guts Inside
The PLC mainly consists of a CPU, memory areas, and appropriate circuits to receive input/output data. We can actually consider PLC to be a box full of hundreds or thousands of separate relays, counters, timers and data storage locations.
The Parts Inside
Input Relays (Contacts)
These are connected to the outside world. They physically exist and receive signals from switches, sensors and other external signal generators. Typically, they are not relays but rather they are transistors.
Internal Utility Relays (Contacts)
These do not receive any signals from the outside nor do they physically exist. They are simulated relays and are what enables a PLC to eliminate external relays. Some are always on while some are always off. Some are on only once during power-on and are typically used for initializing the data that was stored.
These again do not physically exist. They are simulated counters and they can be programmed to count pulses. Typically, these counters can count up, down or both up and down. Since they are simulated they are limited in their counting speed. Some manufacturers also include high-speed counters that are hardware based. We can think of these as physically existing. Most times, these counters can count up, down or up and down.
These also do not physically exist. They come in many varieties and increments. The most common type is an on-delay type. Others include off-delay type and both retentive and non-retentive types. Increments vary from 1ms to 1s.
These are connected to the outside world. They physically exist and send on/off signals to solenoids, lights, etc. They can be transistors, relays, or triacs, depending upon the model chosen.
Typically, these are registers assigned to simply store data. They are usually used as temporary storage for math or data manipulation. They can also typically be used to store data when power is removed from PLC. Upon power-up, they will still have the same contents as before power was removed.
A PLC works by continually scanning a program. We can think of this scan cycle as consisting of 3 important steps. There are typically more than 3 but we can focus on the important parts and not worry about the others. Typically the others are checking the system and updating the current internal counter and timer values.
A PLC Scan
Step I â€œ Check Input Status
First the PLC takes a look at each input to determine if it is on or off. In other words, is the sensor connected to the first input on How about the second input How about the third... It records this data into its memory to be used during the next step.
Step II â€œ Execute Program
Next the PLC executes your program one instruction at a time. Maybe your program said that if the first input was on, then, it should turn on the first output. Since it already knows which inputs are on/off from the previous step it will be able to decide whether the first output should be turned on based on the state of the first input. It will store the execution results for use later during the next step.
Step III â€œ Update Output Status
Finally, the PLC updates status of the outputs. It updates the outputs based on which inputs were on during the first step and the results of executing your program during the second step. Based on the example in step 2 it would now turn on the first output because the first input was on and your program said to turn on first output when condition is true.
After the third step the PLC goes back to step I and repeats the steps continuously. One scan time is defined as the time it takes to execute the 3 steps listed above.
Basic Instructions of PLC
The load (LD) instruction is normally open contact. It is sometimes also called examine if on (XIO). The symbol for a load Instruction is shown below.
This is used when an input signal is needed to be present for the symbol to turn on. When the physical input is on, we can say that, the instruction is True. We examine the input for an on signal. If the input physically on, then, the symbol is on. An on condition is also referred to as a Logic 1 state.
The Load Bar is a normally closed contact. It is sometimes also called Load Not or Examine if closed (XIC). The symbol for a Load Bar is shown below.
This is used when an input signal does not need to be present for the symbol to turn on. When the physical input is off, we can say that, the instruction is True. We examine the input for an off signal. If the input is physically off, then the symbol is on. An off condition is also referred to as a Logic 0 state.
This symbol normally can be used for internal inputs, external inputs and sometimes, external output contacts. Internal relays donâ„¢t physically exist. They are simulated (software) relays. It is the exact opposite of the Load instruction.
The Out instruction is sometimes also called an Output Energize instruction. The output instruction is like a relay coil. Its symbol looks as shown below.
When there is a path of True instructions preceding this on the ladder rung, it will also be True. When the instruction is True, it is physically On. We can think of this instruction as a normally open output. This instruction can be used for internal coils and external outputs.
The Out bar instruction is sometimes also called an Out Not instruction. Some vendors donâ„¢t have this instruction. The out bar instruction is like a normally closed relay coil. Its symbol is as shown below.
When there is a path of False instructions preceding this on the ladder rung, it will be True. When the instruction is True, it is physically On. We can think of this instruction as a normally closed output. This instruction can be used for internal coils and external outputs. It is the exact opposite of the Out instruction.
A counter is a simple thing â€œ counting. There are three types of counters. Up-counters, Down-counters and Up-Down Counters.
This type of timer simply delays turning on. The output is delayed for some time after getting the input. It is called often called TON (timer on-delay).
This type of timer is the opposite of the on-delay timer listed above. This timer simply delays turning off. After the input signal is high, the output remains on for a particular time and then turns off. It is often called TOF (timer off-delay).
PLC compared with other control systems
PLCs are well-adapted to a range of automation tasks. These are typically industrial processes in manufacturing where the cost of developing and maintaining the automation system is high relative to the total cost of the automation, and where changes to the system would be expected during its operational life. PLCs contain input and output devices compatible with industrial pilot devices and controls; little electrical design is required, and the design problem centers on expressing the desired sequence of operations in ladder logic (or function chart) notation. PLC applications are typically highly customized systems so the cost of a packaged PLC is low compared to the cost of a specific custom-built controller design. On the other hand, in the case of mass-produced goods, customized control systems are economic due to the lower cost of the components, which can be optimally chosen instead of a "generic" solution, and where the non-recurring engineering charges are spread over thousands or millions of units.
For high volume or very simple fixed automation tasks, different techniques are used. For example, a consumer dishwasher would be controlled by an electromechanical cam timer costing only a few dollars in production quantities.
A microcontroller-based design would be appropriate where hundreds or thousands of units will be produced and so the development cost (design of power supplies and input/output hardware) can be spread over many sales, and where the end-user would not need to alter the control. Automotive applications are an example; millions of units are built each year, and very few end-users alter the programming of these controllers. However, some specialty vehicles such as transit busses economically use PLCs instead of custom-designed controls, because the volumes are low and the development cost would be uneconomic.
Very complex process control, such as used in the chemical industry, may require algorithms and performance beyond the capability of even high-performance PLCs. Very high-speed or precision controls may also require customized solutions; for example, aircraft flight controls.
PLCs may include logic for single-variable feedback analog control loop, a "proportional, integral, derivative" or "PID controller." A PID loop could be used to control the temperature of a manufacturing process, for example. Historically PLCs were usually configured with only a few analog control loops; where processes required hundreds or thousands of loops, a distributed control system (DCS) would instead be used. However, as PLCs have become more powerful, the boundary between DCS and PLC applications has become less clear-cut.
PLCs have similar functionality as Remote Terminal Units. An RTU, however, usually does not support control algorithms or control loops. As hardware rapidly becomes more powerful and cheaper, RTUs, PLCs and DCSs are increasingly beginning to overlap in responsibilities, and many vendors sell RTUs with PLC-like features and vice versa. The industry has standardized on the IEC 61131-3 functional block language for creating programs to run on RTUs and PLCs, although nearly all vendors also offer proprietary alternatives and associated development environments.
LOGO!Soft Comfort V5.0
The software we use here is LOGO!Soft Comfort V5.0. It contains a user friendly interface and an in-built simulator to test the programs easily. There is also option for us to enter the program either as a ladder diagram or by functional block diagram method. The software also contains options to convert ladder diagrams to functional block diagrams. The basic programming elements that we have used in writing this program are explained as follows.
There are many in built functions in the LOGO!Soft software which makes us programming the PLC much easier. In addition to the basic input output relays, we have counters, timers and other special functions. In this project work, we use counters and timers in addition to the make contact, break contact and the output relays.
Counters (Up/Down Counter)
An input pulse increments or decrements an internal value, depending on the parameter setting. The output is set or reset when a configured threshold is reached. The direction of count can be changed with a signal at input Dir.
The different inputs to the counter are explained as follows.
Input R You reset the output and the internal counter value to zero with a signal at input R (Reset).
Input Cnt This function counts the 0 to 1 transitions at input Cnt. It does not count 1 to 0 transitions.
Â¢ The inputs I5/I6 for high-frequency counts (only available for certain LOGO! devices, see the LOGO! manual): max. 2 kHz.
Â¢ Any other input or circuit element for low-frequency counts (typical 4 Hz).
Input Dir Input Dir (Direction) determines the direction of count:
Dir = 0: Up
Dir = 1: Down
Parameter On: On threshold
Value range: 0...999999
Off: Off threshold
Value range: 0...999999
Retentivity set (on) = the status is retentive in memory.
Output Q Q is set and reset according to the actual value at Cnt and the set thresholds.
The function increments (Dir = 0) or decrements (Dir = 1) the internal counter by one count with every positive edge at input Cnt.
You can reset the internal counter value to '000000', with a signal at the reset input R. As long as R=1, the output is 0 and the pulses at input Cnt are not counted.
Output Q is set and reset according to the actual value at Cnt and the set thresholds. See the following rules for calculation.
Â¢ If the on threshold >= off threshold, then:
Q = 1, if Cnt >= On
Q = 0, if Cnt < Off.
Â¢ If the on threshold < off threshold, then:
Q = 1, if On <= Cnt < Off.
The output with off delay is not reset until a defined time has expired.
The different inputs to the counter are explained as follows.
Input Trg Start the off delay time with a negative edge (1 to 0 transition) at input Trg (Trigger)
Input R Reset the off delay time and set the output to 0 via the R (Reset) input.
Reset has priority over Trg
Parameter T: The output is switched off on expiration of the delay time T (output signal transition 1 to 0).
Retentivity on = the status is retentive in memory.
Output Q Q is switched on for the duration of the time T after a trigger at input Trg.
Output Q is set to 1 instantaneously with a 0 to 1 transition at input Trg.
At the 1 to 0 transition at input Trg, LOGO! retriggers the current time T, and the output remains set. The output Q is reset to 0 when Ta reaches the value specified in T (Ta=T) (off delay).
A one-shot at input Trg retriggers the time Ta.
You can reset the time Ta and the output via the input R (Reset) before the time Ta has expired.
We place 4 sensors on 4 lanes coming to a junction, one per lane. The sensor is placed at a distance away from the junction so that it doesnâ„¢t get disturbed by the vehicles stopping at the signal. These sensors are connected to the PLC, which counts the pulses coming from the sensors. There are 4 counters per sensor so that the counters can compare the count with 4 different preset values (10, 15, 20, 25).
Normally, if the count is less than 10, the time allotted to that lane is 10 seconds. If the count is between 10 and 15, the time allotted will be 15 seconds. If the count is between 15 and 20 seconds, the time allotted will be 20 seconds. If the count is between 20 and 25, the time allotted will be 25 seconds. If the count is above 25, the time allotted will be 30 seconds.
Each counter gives a high when the count reaches the value assigned to them. So, when the time for giving green signal for a lane comes, each counter is checked for a high value and corresponding timer will be activated. After each green signal, the orange lamp will be on for a time of 2 seconds and then red lamp. The red lamp lights only if both orange and green are off. Thus, an effective solution has been formulated.