This paper uses PLC to simulate the control of traffic lights at intersections, so as to have a deeper understanding of the real traffic light control system at intersections. We use light-emitting diodes instead of traffic lights as the controlled object, and supply power to light-emitting diodes through 24V conversion power supply. The program is written into PLC by computer software, and the on-off of the corresponding intermediate relay is controlled by the 16 output signal of PLC, and then the on-off and flashing state of the light-emitting diode is controlled by the intermediate relay. Finally, through effective layout, the corresponding equipment is installed in the corresponding place to form a simulated intersection traffic light control system. Through the simulation of the real intersection traffic light control system, we have a deeper understanding of the working process of the real intersection traffic light control system and more understanding of the traffic lights. This control system can effectively solve the problems of road congestion and traffic disorder in existing traffic.
Keywords: traffic lights PLC control intermediate relay
catalogue
Chapter I Preface 1
1. 1, background and significance of the topic 1
1.2, project status, development trend and problems to be solved
Chapter II Control Scheme Design 4
2. 1, technical control requirements 4
2.2, the overall plan to determine 4
2.2. 1, principle of scheme 4
2.2.2. Features of Scheme 5
2.2.3, scheme selection basis 5
Chapter III Hardware, Software Selection and Hardware Connection 7
3. 1, distribution of input points and output points 7
3.2, hardware selection 7
3.3, software selection 8
3.4, hardware connection 9
The fourth chapter software programming 10
4. 1, programming flow chart 10
4.2. Write ladder diagram 1 1.
The fifth chapter system debugging 13
5. 1, system program debugging 13
5.2, system hardware debugging 13
5.3. Online debugging 14
Chapter VI Summary 16
Thank you 17
Reference 18
Attachment: 19
Program ladder diagram: 19
List of program instructions: 22
Power diagram: 25
PLC input terminal wiring diagram 26
Wiring diagram of PLC output terminal: 27
Electrical schematic diagram: 29
The first chapter preface
1. 1, background and significance of the topic.
With the rapid development of China's economy, the urban population is increasing, the number of trips by residents and the number of motor vehicles are increasing, and the problems of urban road congestion and unbalanced traffic flow are becoming more and more serious. People often worry about urban traffic problems such as road congestion, chaotic traffic order and long travel time. For example, there are almost no vehicles in the green light direction, but there are long queues waiting to pass in the red light direction. Therefore, it is urgent to improve the capacity of urban road network and realize the scientific management of road traffic. How to keep urban traffic safe, convenient, efficient, smooth and green has become a key issue in government policy planning.
Through the design and production of traffic light control system at crossroads, the understanding of basic theory, basic skills and professional knowledge has been further consolidated and deepened. At the same time, it also cultivates our ability to analyze and solve practical problems by comprehensively applying the basic theory, basic knowledge and basic skills we have learned, so that we can get comprehensive training in the development of PLC system, enable us to design and realize, and master the working principle and design idea of typical automatic control systems. More importantly, through the actual production of each link of the traffic light system at the crossroads, we have exercised our work style of studying hard, being brave in exploration, seeking truth from facts and being good at cooperating with others, so that our future practice has been fully utilized.
1.2, project status, development trend and problems to be solved.
In recent years, with the development of large-scale integrated circuits, the programmable controller (PLC) with microprocessor as the core has developed rapidly. In the early days, PLC was mainly used for sequence control. Nowadays, PLC has been applied to closed-loop control, motion control and complex distributed control system, and has gradually developed into an effective and convenient way to solve automation problems. Because PLC itself has the advantages of perfect function, modular structure, easy development, convenient operation, stable performance, high reliability and high cost performance, it has broad application prospects in industrial production and is known as one of the three pillars of modern industrial production automation. Moreover, with the development of integrated circuits and the arrival of the network era, PLC will certainly be able to gain greater development space. The main body of PLC consists of three parts, including CPU, storage system and input/output interface. The basic structure of PLC is shown in figure 1- 1:
Figure 1- 1 PLC composition block diagram
Part of the system power supply is in the CPU module, which is also a single unit. Programmers are generally considered as peripherals of PLC. PLC adopts bus structure to transmit data and instructions. External switch signals, analog signals and various sensor detection signals are used as input variables of PLC, and enter the input memory of PLC through the input end of PLC to collect and temporarily store the actual running state information and data of the controlled object; After the internal calculation of PLC, the output result is generated according to the actual action requirements of the controlled object; The output result is sent to the output terminal as an output variable to drive the actuator. All parts of PLC coordinate and control the field equipment. PLC adopts circular scanning mode, and system task management and application program execution are completed by circular scanning mode. The working process of the programmable controller includes two parts: the fixed process of self-diagnosis and communication response and the user program execution process, as shown in figure 1-2:
Figure 1-2 PLC working process block diagram
Before each user program is executed, PLC executes internal fixed programs, such as fault self-diagnosis program, reset, monitoring and timing. If the self-diagnosis is normal, it will continue to scan downwards, and then PLC will check whether there is a communication request with the programmer, computer, etc. If there is a communication request with the computer, and so on. , will do the corresponding processing. When the PLC is stopped, there are only the first two process cycles. When the PLC is running, it works circularly from five working stages: internal processing, communication operation, input scanning, user program execution and output refresh. The time required to complete more than five stages becomes a scanning cycle. A scanning cycle can also be simply divided into three stages: input processing, program execution and output processing.
In order to improve the processing capacity of PLC, it is required that PLC has better response speed and larger storage capacity. At present, the scanning speed of some PLCs can reach about 0. 1ms/k steps. The scanning speed of PLC has become a very important performance index. In terms of storage capacity, some PLCs can reach tens of megabytes. In order to expand the storage capacity, some companies use bubble memory or hard disk. There are many small and medium-sized PLCs at present. In order to meet the needs of the market, PLC will develop in a variety of directions in the future, especially in two directions: super-large and super-small. At present, there is a very large PLC with 14336 I/O points, which uses a 32-bit microprocessor, works in parallel with multiple CPUs, and has a large capacity of memory. The development of small PLC from integral structure to small modular structure makes the configuration more flexible. In order to meet the needs of the market, a variety of simple and economical ultra-small PLCs have been developed, with at least 8 ~ 16 I/O points to meet the needs of single machine and small automatic control. In order to meet the requirements of various automatic control systems, many functional modules have been continuously developed in recent years, such as high-speed counting module, temperature control module, remote I/O module, communication and man-machine interface module. These intelligent I/O modules with CPU and memory not only expand the functions of PLC, but also are flexible and convenient to use, and expand the application scope of PLC. Strengthening the networking communication ability of PLC is the trend of PLC technology progress. In addition, the ability to detect and deal with PLC external faults is also increasing. With the continuous development of PLC system structure, the programming language of PLC is becoming richer and richer, and its functions are constantly improving. In addition to the ladder diagram language used by most PLC, in order to meet various control requirements, there are also stepping programming languages oriented to sequence control, flow chart languages oriented to process control, and advanced languages compatible with computers (BASIC, C language, etc.). ). The coexistence, complementarity and development of multiple programming languages is the development trend of PLC. Therefore, it is the general trend to control the traffic lights at intersections through PLC.
Because the traffic light control system of PLC intersection is more stable and efficient than the original relay-contactor control system, and the use of many external relays and contactors is reduced, the reliability and safety are higher, and the control effect is more obvious, which makes up for the shortcomings of the original control system and effectively solves the problems of traffic congestion, unbalanced traffic flow and long driving time in the existing intersection traffic control. Therefore, we use PLC control system to control the traffic lights at intersections, which makes the traffic management at intersections more scientific and orderly, and also makes the traffic more convenient and smooth.
Chapter II Design of Control Scheme
2. 1, technical control requirements
Using the knowledge learned, a circuit of traffic light control system at intersections is designed, which needs Mitsubishi PLC control, and can command vehicles to turn left at intersections and go straight at different intersections, and a physical model of traffic light control system at intersections is designed.
Function: ① Two sets of lights, east, west, north and south, are used to indicate turning and going straight. As shown in the following table. (2) When the yellow light is on, it should blink once every second. ③ Set the crosswalk red light and green light synchronously. See table 2- 1 for the specific traffic light control circuit status:
Table 2- 1 traffic light control circuit status table
State straight light (north-south) left turn light (north-south) straight light (east-west) straight light (east-west) duration
(s)
Red, yellow, green, red, yellow, green, red, yellow and green.
s0 0 0 1 1 0 0 1 0 0 1 0 0 27
s 1 0 1 0 0 1 0 1 0 0 1 0 0 3
S2 1000 100 100 100027
S3 1 0 0 0 1 0 0 1 0 1 0 0 0 3
S4 1 0 0 1 0 0 0 1 1 0 0 0 27
S5 1 0 0 1 0 0 0 1 0 0 1 0 0 1 0 3
S6 1 0 0 1 0 0 1 0 0 0 0 1 27
S7 0 1 0 1 0 0 1 0 0 0 1 0 3
s0 0 0 1 1 0 0 1 0 0 1 0 0 27
Note: 0 means the light is off, 1 means the light is on.
2.2. Determination of the overall plan
2.2. 1 principle of the scheme
The purpose of this scheme is to simulate the operation of traffic lights at intersections, and use PLC to control traffic lights at intersections: there are two input points and 16 output points. The two inputs are the on and off of the system. The lights are divided into east-west group and north-south group, each with three kinds of red, yellow and green, which are used to indicate left turn and green light respectively. Firstly, according to the control requirements, a scientific and reasonable program is written by computer programming software and input into PLC. The PLC gives the output according to the input program, and controls the hardware circuit through the external intermediate relay in the corresponding logical order, so that the traffic lights can be turned on, off and flashing according to the control requirements, and the scientific traffic control requirements can be fulfilled.
2.2.2, the characteristics of the scheme
The application of PLC and traffic light control system has strong advantages, which can be mainly described from the following four aspects.
Long service life: From the current feedback, the service life of most control circuits is less than five years, which is related to factors such as circuit design, component selection, working environment, control mode, etc., and is an inherent shortcoming that cannot be overcome by itself. As an industrial control unit, PLC is used in various control environments and has excellent internal circuit and mechanical structure design. All the devices used are standard industrial products, and their service life can generally be guaranteed for more than ten years. Therefore, this characteristic of PLC can make the PLC control system of intersection traffic lights run normally for a long time.
Stable and reliable performance, good anti-interference: Because PLC can be used in various industrial control sites, its software and hardware design takes into account various production environments, and its voltage application range is very wide, with strong anti-electromagnetic interference, anti-vibration, high temperature and high humidity characteristics, and its performance is extremely stable and reliable. Therefore, the PLC control system of traffic lights at intersections also has certain advantages because of the application of PLC.
Because of its powerful function, flexible implementation and good expansibility, PLC can change the control process and mode of functions according to actual needs, and can develop new control functions on the basis of not adding or adding less hardware according to user requirements, with good cost performance. Compared with the original traffic light control system, the PLC control system of intersection traffic lights is more flexible and has more functions.
2.2.3, scheme selection basis
Compared with relay-contactor control system, using PLC to control traffic lights at intersections saves a lot of relays and contactors, which not only saves costs, but also has high transmission rate, more convenience and stability, and strong anti-interference ability, so we choose PLC to control traffic lights system.
We choose the intermediate relay as the external execution equipment, which is mainly used to protect the contacts of PLC from accidental burning, because PLC is much more expensive than the intermediate relay after all, and one input can control several output actions, reducing the number of output points of PLC.
We use light emitting diodes instead of traffic lights. The voltage drop of this diode is only 2V.
Chapter III Hardware, Software Selection and Hardware Connection
3. 1, distribution of input points and output points
According to the previous control requirements, plus the signal light control of the sidewalk, after careful consideration, this system adopts two input points of PLC and 16 output points. The specific distribution of input/output points is shown in Table 3- 1:
Table 3- 1 Input/Output Point Allocation
Input-output point allocation
Input signal output signal
Name Code Input Point Number Name Code Output Point Number
Start button SBI X0 Go straight for red light (north-south direction) HL 1 Y0.
Stop button SB2 X 1 straight yellow light (north-south direction) HL2 Y 1
Go straight green (north and south) HL3 Y2
Turn left red light (north and south) HL4 Y3
Turn left yellow light (north and south) HL5 Y4
Turn left, green (north and south) HL6 Y5
Straight red light (east-west) HL7 Y6
Straight yellow light (east-west) HL8 Y7
Go straight green (east-west) HL9 Y 10
Turn left at the red light (east-west) HL 10 Y 1 1
Turn left, yellow light (east and west) HL 1 1 Y 12.
Turn left and turn green (east-west) HL 12 Y 13
Cross the street at a red light (north and south) HL 13 Y 14
Cross the street with a green light (north and south) HL 14 Y 15
Cross the street at a red light (east-west) HL 15 Y 16
Green light for crossing the street (east-west) HL 16 Y 17
Note: All straight lights and left-turn lights in the table are made up of 9 LEDs and a related resistor in series, and all street lights are made up of 5 LEDs and a related resistor in series (in order to ensure 24V voltage drop).
3.2, hardware selection
This control system adopts the small PLC of Mitsubishi FX2N-48MR PLC. FX2N-48MR is a miniaturized, high-speed and high-performance device with 48 input and output points, but we only need 2 input points, 16 output points, which is quite enough. In addition, this type of PLC is also suitable for special purposes, such as the connection between several basic components, analog control, positioning control and so on. Moreover, the system configuration is both fixed and flexible, and it is a set of PLC that can meet a wide range of needs. Therefore, this type of PLC is selected for this system.
Intermediate relay This system selects an intermediate relay (*** 16) with a capacity of 220V and 5A, with four normally open contacts on the top and four normally closed angular contacts on the bottom. When the coil is energized, the moving armature is pulled down by electromagnetic force, so that the upper four normally open angle contacts are closed and the lower four normally closed angle contacts are separated. An intermediate relay is a relay that converts an input signal into one or more output signals. Its input signal is the connection or disconnection of the coil. Its output is the action of the contact (normally open point closed, normally closed point open). Its contacts are connected with other control circuits, and the control circuit changes (for example, on or off) by changing the contacts. The intermediate relay is characterized by a large number of contacts and can complete multi-loop control; Contact capacity is large, generally 220V, 5 A; Sensitive action, the action time is not more than 0.05S .. The difference between it and contactor is that contactor has no main part and auxiliary part, so when the rated current of motor does not exceed 5A, it can also be used instead of contactor, which means it can be considered as a small-capacity contactor. The characteristics of the above intermediate relay are exactly what we need. Other hardware options of the system: DZ47-60 C 10 low-voltage circuit breaker and RT 18-32 32A-380V fuse combined protection circuit, and the circuit power supply is 220VAC~24DC switching power supply of Shanghai Wei Ming Electronics Co., Ltd. Because these low-voltage electrical appliances are all existing things, we must make full use of them. Replace the traffic lights with light-emitting diodes (connected in series with corresponding resistors to ensure 24V voltage drop). See Table 3-2 for specific hardware selection:
Table 3-2 Specific Hardware Selection Table
Hardware name and model
Mitsubishi FX2N-48MR 1 PLC
Intermediate relay 220v, 5A
16
Low voltage circuit breaker DZ47-60 C 10 1.
Fuse RT 18-32 32A-380V 1.
220VAC~24DC 1 switching power supply
LED 2V multi-quantity
3.3, software selection
As for the programming software, the design of this system uses mitsubishi electric's SWOPC-FXCP/WIN-C programming software, which is a Chinese programming software specially designed for FX series PLC and can run on Windows9x and Windows3. 1 operating systems. The software can use ladder diagram, instruction list and sequence function diagram symbols to create PLC programs, and can save the programs as files and print them out with a printer. You can create comments and set register data for programming elements and program blocks. Through serial port, user programs can communicate with PLC and transmit files, and realize various monitoring and testing functions. So we use ladder diagram and instruction list to program. And what we have been learning is this software, which we are familiar with and easy to use. As for the drawing software, AutoCAD 2004, which we are familiar with and can skillfully use, is also selected in this system.
3.4, hardware connection
Hardware connection needs to be connected according to the drawings in the appendix. First of all, we should make a general hardware layout plan according to the layout diagram and install the corresponding devices in the corresponding places. Then according to the input and output terminal wiring diagram of PLC, the switching power supply is connected with PLC according to the switching power supply diagram, and finally the control circuit is connected with other parts according to the electrical schematic diagram of the control circuit. At the same time, try to make the line laying straight, the fixed point position correct, the line cutting standard, the line installation correct, the pressure welding standard, and the components installation neat and tight.
Chapter IV Software Programming
4. 1, write the program flow chart
Writing program flow chart is a step that must be done seriously before writing a good program. Only by writing the program control flow chart step by step according to the control requirements of the system will there be no confusion in thinking when writing the program, which will lead to big mistakes in the written program. Therefore, before writing the intersection traffic light control system, we also wrote the program control flow as shown in Figure 4- 1: Figure 4- 1 program control flow chart.
First, press the start button X0 to enter step M0, and output signals: Y 17, Y 14, Y2, Y3, Y6, y1(green light for crossing the street (east-west direction), green light for crossing the street (north-south direction) and straight green light (north-south direction). ), after 27 seconds, enter step M 1 and output signals: Y 14, Y6, Y 1, y1,Y4, Y 17 (the green light crosses the street (north and south), and the red light goes straight.
4.2, write ladder diagram
We use the programming method of step instruction to write ladder diagram, STL is the step start instruction and RET is the step end instruction. STL and RET commands must be used with the status relay to have stepping function. STL is also a step contact instruction (1 step), and the trapezoidal symbol of STL is called STL contact, and there is no moving contact. STL S20 and STL S2 1 are both STL electric shocks. In the ladder diagram, STL is connected to the bus by electric shock. After using STL command, the bus moves to the right of the contact, and then commands such as LD, LDI and OUT are needed until the next STL command or RET command appears. STL command sets a new state relay, while the previous state relay is automatically reset and its contacts are disconnected. Step command RET is also called step return command. RET command must be used after a series of STL commands, indicating that the step command function is over and the bus is restored to its original position. When we use step-by-step instructions to write a sequence control program, we first determine the flow of the whole intersection traffic light control system, then decompose the complex task or process into several processes (states), and finally find out the establishment conditions, transfer conditions and transfer directions of each process, so that we can draw the flow chart of the program work. Finally, according to the control requirements, the corresponding program is written by using various step-by-step sequential control methods of STL and RET instructions. The specific program design is shown in Figure 4-2, Figure 4-3 and Figure 4-4:
Figure 4-2 System Startup Procedure
As shown in Figure 4-2, M8002 is a special auxiliary relay, which is turned on instantly at the beginning of operation to generate initial pulse. When X0 is turned on, M8002 starts the initial pulse program and goes to the next step. Coils Y 17, Y 14, Y2, Y3, Y6, Y 1 1 are open (that is, the east-west sidewalk is bright, the north-south sidewalk is bright, and the north-south sidewalk is bright on the left). After being turned on for 27S (the setting time of the time relay), the normally open contact T0 of the time relay is closed, and the next step is entered (step S2 1 setting).
Figure 4-3m 80 13 Control Pulse Output Program
As shown in Figure 4-3, M80 13 is a special clock relay inside PLC. When PLC is running, this relay continuously sends out pulses with the time width of 1S, and the on-off time is 0.5S. When a signal passes through relay M80 13, its output is alternately turned on and off, so that Y 1, Y4, Y 17 are alternately turned on and off for 0.5s, that is, the north-south yellow light and the south-north yellow light. When Y 14, Y6, Y 1 1, Y 1, Y4, Y 17 are turned on (that is, the north-south green light is on, the east-west straight red light is on, the east-west left red light is on, the north-south yellow light is flashing, and the east-west sidewalk is flashing. The following procedure is similar to that here, just follow the previous flowchart.
Figure 4-4 Zero Setting and Cycle Ending Procedure
As shown in Figure 4-4, the purpose here is to enable the system to start and close at any time: when X 1 is closed, zero point is set in steps S0 to S30, so that all coils of the system are powered off, and then the system is closed. When X0 is closed, step S20 is set, and the PLC starts cyclic scanning from step S20, and the system starts running.
Chapter V System Debugging
5. 1, system program debugging
For the PLC control system, the analog switch installed on the PLC can be used to simulate the state of the input signal, the indicator light at the output point can be used to simulate the controlled object, and the software program with the design number can be transmitted to the PLC, so that the program can be debugged. Before debugging the program of the system, we should first check the external wiring, power supply system, actuator, detection elements and switch operation of PLC. (1) External wiring inspection includes correctness inspection of input/output wiring. (2) The power supply system includes PLC power supply wiring correctness check, voltage check and external power supply check. (3) The operation check of the actuator includes the response time of the actuator to the input signal and the check of the forward and backward operation. Sometimes, it should be carried out together with the operation inspection of detection elements and switches to know whether the detection elements and switches have corresponding output signals after the operation of the actuator. (4) Detection elements and switches are the sources of PLC input signals. It is necessary to check the responses of signals such as detection elements, switches and buttons after the operation to see whether their states have changed accordingly.
The formal debugging method is to manually open and close the input points according to the execution sequence of the program, and check whether the program acts according to the requirements of process control, whether the corresponding output signal exists and whether the delay time is correct. For the feedback signals of some output channels, the corresponding feedback input signals should be given manually according to whether there is system output or not until the whole running program runs correctly.
5.2, system hardware debugging
The hardware debugging of the system is mainly to debug the control circuit hardware system of the intersection traffic light control system.
Due to the limited conditions, we mainly use multimeter to test and debug the hardware:
(1) What we need to do is to check whether the solder joints on the electrical circuit are complete and tight, whether there is looseness, heat and discoloration, and keep the electrical circuit in good contact.
(2) When there is no electricity, use a multimeter to set resistance to measure the resistance between the two contacts of each line and both ends of the hardware to see if there is resistance display. If there is a resistance value, it means that the line is connected and the hardware is good. If there is no resistance value, it means there is no connection or the hardware is not good. Need to carefully check the cause and solve the problem.
5.3, online debugging
First, turn on all power supplies, then input the correct program into the PLC of the external control circuit, and debug it according to the method of debugging the previous program, but the original analog switch becomes a real switch and the indicator light becomes a real controlled object led. According to the device action of each part, see if it meets its own control purpose. If it does not, modify and debug it until the program runs correctly.
Problems, causes and solutions in the specific debugging process;
(1) After connecting 220V power supply, the whole system has no indicator light, including 24V switching power supply. This problem was finally checked with a multimeter because the 220V external power line of the 24V conversion power supply was not properly connected (ineffective). The solution is to reconnect the impassable places.
(2) After the operation, the north-south straight green light and the east-west sidewalk below the red light do not light up. After inspection, the reason is that one of the series LEDs that make up the two signal lights is broken. The solution is to replace the damaged LED.
(3) The green light of two things to the sidewalk is not bright, but the action requires the same green light of the westbound sidewalk. After inspection, the reason is that the green lights of the two sidewalks in the east are connected to the same contact of the intermediate relay, and the connection between the terminal and the relay contact is not good (impassable). The solution is to reconnect the two wires.
(4) The two green lights on the southbound sidewalk in the north-south direction are not bright, while the two sidewalks in the north direction are bright. This problem seems to be the same as item (3). After our careful inspection, the reason is not the reason of item (3), because the relay is in good contact with the wire ends of the corresponding two wires, and there is no impassability. The real reason is that the contact between the intermediate relay and the green lights of the two sidewalks in the south is broken, and there is no coil that attracts the intermediate relay. The solution is to replace the square box with coil and contact armature on other intermediate relays with this intermediate relay, and of course, it is required that the replaced intermediate relay does not use this pair of contacts in the control system. Similarly, it is also possible to reconnect these two signal lights to other contacts of the disconnected intermediate relay, but this is a bit troublesome, so we adopted the above method to solve it. The actual overall completion figure is shown in figure 5- 1, and the partial completion figure is shown in figure 5-2: