1 task and timing analysis
1.1 work tasks
As shown in Figure 1, two groups of traffic lights are installed at the intersection in the east-west direction and the north-south direction respectively. The control requirements are as follows: when the start button SB1 is pressed, the signal light starts to work, and the green light in the east-west direction and the red light in the north-south direction are on at the same time. The coordination law between lights (see Figure 2): between 0 and 30 s, the red lights in the north and South are always on, the green lights in the East and West are on for 25 s, flicker for 3 s (once per second), and the yellow lights in the East and West are on for 2 s; Between 30-55 s, the East-West red light is always on, the North-South green light is on for 20 s, flashes for 3 s (once per second), and the North-South yellow light is on for 2 s; Then it returns to the on-off rule between 0 55 s and continues to cycle until the operation ends when the stop button SB2 is pressed.
1.2 time series analysis
By analyzing the timing chart of each signal lamp shown in Figure 2, it can be concluded that the on-off law of each signal lamp is as follows:
(1) The east-west green light starts from time 0 s, lights for 25 s, flashes for 3 s and goes out for 27 s; On again for 25 s, flashing for 3 s and off for 27 s; So cycle.
(2) The East-West yellow light starts from the 28th s. It is on for 2 s and off for 53 s; Re on for 2 s and off for 53 s; So cycle.
(3) The East-West red light is off for 30 s and on for 25 s from time 0 s; Turn off for 30 s and turn on for 25 s; So cycle.
(4) The North-South green light starts from the 30th s, lights for 20 s, flashes for 3 s and goes out for 32 s; Turn on again for 20 s, flash for 3 s and turn off for 32 s; So cycle.
(5) The North-South yellow light is off for 53 seconds and on for 2 seconds from the 0 s time; Turn off for 53 s and turn on for 2 s; So cycle.
(6) The North-South red light is on for 30 s and off for 25 s from the 0 s moment; On for 30 s and off for 25 s; So cycle.
2 PLC custom clock pulse
2.1 PLC clock pulse
PLC clock pulse refers to the square wave signal with periodic change output through the output relay. Periodicity is the basic characteristic of clock pulse signal. It describes that PLC pulse signal has two basic parameters: cycle D and duty cycle D, and two secondary parameters: on period T1 and off period T2. The sum of the on period T1 and the off period T2 is the cycle of the clock pulse, that is, t = T1 T2. Duty cycle refers to the time ratio of on period T1 in one cycle T, that is, duty cycle d = T1 / T = T1 / (T1 T2).
The special auxiliary relays m8011, m8012, m8013 and m8014 of Mitsubishi FX2N PLC provide four clock pulses with cycles of 0.01 s, 0.1 s, 1.0 s and 60 s. The duty cycle is 50% and the output is on first and then off. These PLC fixed clock pulses obviously can not meet the timing control problem of traffic light timing control in this paper, which has requirements for output on / off successively, and the on period T1 and off period T2 can be set arbitrarily. Therefore, it is necessary to develop and design a user-defined clock pulse program with such timing control requirements.
2.2 concept and basic characteristics of PLC custom clock pulse
As shown in Fig. 3, the custom clock pulse refers to the clock pulse that can define cycle T, duty cycle D (i.e. define on period T1 and off period T2) and control the sequence of output on / off signals.
The custom clock program segment should have two basic characteristics: one is the fixity of the program structure, which can be flexibly referenced as a subroutine. The second is the flexibility of program parameter modification, which can quickly set the cycle T, duty cycle D and on / off output sequence by changing the set value without changing the program structure according to the control object.
2.3 PLC custom clock pulse program design
The custom clock pulse program design is shown in Figure 4. Figure 4 (a) shows that the program outputs the on signal first, and Figure 4 (b) shows that the program outputs the off signal first. Comparing Fig. 4 (a) and Fig. 4 (b), it can be found that the auxiliary contact state of timer T0 connected in series with output relay Y000 will determine:
(1) Output on first or off first.
(2) Timers t0 and T1 control the division of labor between on period T1 and off period T2. As shown in Figure 4 (a), when t0 dynamic breaking contact is connected in series with output relay Y000, the on signal is output first, and then the off signal is output. T0 controls on period T1 and T1 controls off period T2. In the figure shown in Fig. 4 (b), when t0 dynamic contact is connected in series with the output relay Y000, the off signal is output first, and then the on signal is output. T0 controls the off period T2 and T1 controls the on period T1.