A Control System of PLC's Stereo Garage Based on Photoelectric Sensor

In order to design a vertical lifting three-dimensional garage control system, and to achieve the mechanical three-dimensional garage of the university automatic operation, the photoelectric sensors, hall pressure sensors and programmable logic controller (PLC) are used. The results show that the three-dimensional garage control system can run safely and reliably, and each sensor can perform fault self-diagnosis and carry out certain treatment on the fault. In conclusion, the three-dimensional garage control system designed is feasible, and it can get wide extension and application.


Introduction
As we all know, with the popularization of the car, parking becomes a big problem [6]. As a new wave of people flood cities to live, work and play, many arrive on four wheels-cars, which are creating massive headaches for city planners and drivers. Smart cities are looking into reducing parking issues that cause street congestion and wasted time for drivers searching for spaces [7]. Off-street parking isn't a solution: it is costly to build and takes space that could be used for other, more interesting uses. If we cannot solve the problem of urban parking, the car production will become empty and impractical. Therefore, the pursuit of a space saving garage has become the common aspiration of the automotive industry as well as mechanical, electrical, automation and control industry. In this context, the proposed intelligent three-dimensional garage has practical significance. Mechanical stereo garage, which is an effective solution to the problem of parking difficulty in cities, has become an inevitable trend in the development of garage [8].
Mechanical three-dimensional garage can be divided into vertical lifting type, roadway stacking type, vertical circulation type, circular horizontal type, box type horizontal circulation type and so on [1]. Among them, the vertical lifting type stereo garage can be provided with 2 or more parking spaces on each floor, and it works similarly to elevator. The vehicle is lifted to the target floor by the lifting device, and then the traverse mechanism is started to store the vehicle in the berth. As a kind of mechanical parking equipment, vertical circulation parking equipment can solve effectively the difficult-to-park problem due to shortage of parking area. The mechanical structure and control of this kind of three-dimensional garage are relatively complex, but the energy consumption is relatively less and has good development prospect. However, the degree of automation of mechanical three-dimensional garage is not high, and this problem has become the bottleneck of restricting the development and popularization of mechanical three-dimensional garage [2]. In order to realize the efficient and automatic operation of the mechanical three-dimensional garage, this paper uses photoelectric sensor and programmable logic controller (PLC) to achieve the design of the three-dimensional garage control system, which contributes to the promotion and popularization of the mechanical three-dimensional garage.

State of the Art
The structure of the three-dimensional garage is generally located on both sides of the middle of the road parking spaces [3]. The bottom of the garage is defined as a zero floor, which is used for vehicles out of the library. The middle of the hoistway is the car platform of the lift channel, parking spaces located on both sides of the shaft, and each car is corresponding to a car plate. When the garage is running, there is a situation such as the car parking board on the lift. If the user needs to save the car at this time, the system will default the car to the vehicle board. If the user needs to take the car, the system will deposit the car carrying board in the parking space and then take the car.
The entire garage control system can be divided into mechanical transmission components, control components and detection devices. Mechanical transmission components including steel frame, parking spaces, car plate, lift motor and reduction mechanism, traverse motor, electromagnets, wire rope, lifting platform, brake, weight and so on. The lifting motor and the speed reducing mechanism drive the lifting platform by the steel wire rope. The traverse motor is installed directly on the elevator, when the motor is energized, the traverse motor can be moved to the left and right of the surface of the elevator, and then the electromagnet and the photoelectric sensor are added to the surface of the elevator, so it can achieve cross-motor reset, access to car board and other functions. The control objects are the auxiliary equipment of elevator, traverse motor and garage, including PLC, inverter, host computer and so on, among which PLC is the core of the whole control system. In addition, the control system cannot be separated from a variety of detection devices, including photoelectric sensors, Hall sensors, pressure sensors, buttons, proximity switches, rotary encoders and so on [4].
When the user saves the car, the system first determines whether there is a car board on the platform. If there is a car carrying board, the elevator platform will directly drop to the zero floor. If there is no car carrying board, the elevator platform will select a parking space and remove the corresponding car board. When the elevator is landing to the zero floor, the user can get the car into the space. The zero floor photoelectric switch sensor and the pressure sensor cannot only detect whether the vehicle meets the parking standards, but also can detect whether the vehicle is parked in place. After the vehicle stops, the user presses the "Confirm Stop" button, and the lift starts to rise. When the vehicle stops at the target level, the traversing motor will drive the carriage along the rail into the parking space. When the vehicle is parked in place, the traverse motor moves back, and the lift platform is to carry out leveling treatment.

Methods
The three-dimensional parking garage in this study consists of 4 floors and 8 parking spaces, which can be used for testing. The product can be conveniently extended horizontally or vertically. Taking into account the three-dimensional garage on the lifting and traverse system start and stop, positioning accuracy, speed control and other areas have higher requirements, this study uses variable frequency drive as the motor drive. In operation, the PLC dynamically generates the speed reference value according to the current running distance, and introduces the speed PI link to form the speed closed-loop control system, which effectively improves the system's response capability. The ideal speed given curve is shown in Figure 1. As can be seen from Figure 1, the speed curve includes the acceleration section, uniform speed section, deceleration section and crawling section, we can see that the acceleration of the acceleration and deceleration segments is constant, so that the variation of the speed is more stable. In addition, in order to improve the positioning accuracy, the study should set a crawl distance (fixed value) before reaching the target position, and given a very low creep speed to ensure reliable stop in place.
The positioning of the lifting platform and the traverse mechanism adopts reflection type photoelectric switch sensor, each floor has a special reflection mirror in-stalled in the leveling position, and the photoelectric switch moves with the lifting platform. A car in the lifting platform moves one location every time unit, PLC detects the input signal changes, thereby updating the current floor value. If the target level has been reached, the supply is stopped and the brake is closed.

3.1
Hardware design of control system of mechanical stereo garage PLC is a programmable controller. It is composed of a microprocessor, an input / output device, protection and anti-interference isolation circuit with the advantages of high reliability, small volume, good versatility and easy to use. It is very suitable for this kind of stereo garage equipment that requires high reliability applications [5]. S7-300 series PLC of Siemens can meet the requirements of the application of medium-performance, especially for the very fast process or the data processing capabilities which have special requirements of small and medium-sized automated control system. Therefore, the PLC of this study selects Siemens S7-300 series products. In order to save costs, the system of serial communication and high speed counter function shared by S7-200 PLC, so the module structure of S7-300 PLC is relatively simple, it is composed of power module, CPU module, digital input module and digital output expansion module. CPU model uses 313C-2DP, comes with digital input and digital output of 16 points, its processing speed and computing power can meet the system requirements. In order to achieve a high degree of automation and can be safe and reliable operation, the control system block diagram is shown in Figure 2. S7-300 PLC as the core of the entire control system, it is responsible for the task of communication with the host computer, a variety of switch signal access, the use of switch output relay control peripheral switch, control inverter operation, communication with the S7-200 PLC to obtain the rotary encoder signal changes and the realization of the data exchange and peripheral devices.
Since the control system does not have an analog input, the signal module requires only digital input / output. In determining the input / output points, it should be based on actual needs and reserve a certain number of points as a backup. Because the number of garage design layers, the need for the input / output points are different, so the expansion of the number of points can easily realize the horizontal or vertical expansion of the three-dimensional garage system. The input / output allocation table of the garage control system of the 2 floor and 4 parking spaces is shown in Table 1 and  Table 2.  The inverter uses Siemens SINAMICS G120, which adopts modular structure, integrated security protection function, communication capability and feedback energy function. It can provide various driving schemes such as V / f, FCC, vector control and so on. In this control system, G120 and S7-300 PLC through PROFI�BUS-DP to communication. G120 is from the station, S7-300 PLC is the master station. The master station can control the running, stop, forward (reverse), output frequency of the inverter by sending the control word and the given frequency.
The communication between S7-200 PLC and S7-300 PLC is realized through EM 277 module, and the same way used in PROFIBUS-DP. In this control system, S7-200 PLC mainly has two functions: The internal high-speed counter is used to acquire the rotary encoder signal. The count value is passed to the S7-300 PLC to obtain position and velocity information.
Using its serial communication function as a message transfer station. The IC card reader card number and keyboard input password passed to the S7-300PLC, while the S7-300 PLC send a message to the LED display and voice equipment.
Of course, S7-200 PLC and these peripherals are not directly connected, but through multi-level communication interface board to achieve. In order to ensure the real-time data transmission and reliability, S7-200 PLC and communication interface board between the communication protocol is more complex.

3.2
The software design of the control system of the three-dimensional garage This control system software development uses Semen's STEP-7 programming software, this software can monitor the PLC internal variable, and it has the very strong maneuverability. According to the control requirements of the garage, this study uses modular programming, the program consists of the initialization of the organization, the main program and a number of subroutines. Subroutine including reset subroutine, subroutine, car parking, cancel function, subroutine sensor fault selfdiagnosis and alarm subroutine, lifting motion control, sliding movement control and receiving message processing, send messages, read the time and date and so on. When the PCL is connected to the three-phase power, there is always the order cycle execute the main program, the main program continues to call the subroutine and it repeats itself again and again.
When the garage starts running, the initial state is unknown, it must call the reset subroutine to establish a new initial state, the program flow chart is shown in Figure  3.
Parking and vehicle operation cannot be carried out at the same time, the lifting mechanism and the sliding mechanism is also not allowed to run at the same time. The program flow chart of parking is shown in figure 4.
Dimensional garage involves the safety of people and vehicles, so in software design, in addition to achieving the required functionality, but also must have the appropriate security measures. The control system is mainly equipped with the following types of security protection: Sensor fault diagnosis and alarm subroutine by scanning all parking spaces on the photoelectric sensors and Hall sensors can detect the initial state of the garage, and provide alarms and fault indications in case of failure. Zero floor with ultra long, ultra wide, ultra high detection device for detecting vehicle parking standards and whether to park in place. In the motion control, this study uses photoelectric sensors and rotary encoder mutual checking method to prevent errors, for example, because of a sensor failure caused by the collision and reach the target location continues to move and so on. Because once this error occurs, it will cause a great impact on the garage. In addition, the system is also equipped with time protection, a variety of calibration and other measures.

Fig. 4. Flow chart of parking subroutine Results and Analysis
After the design of the hardware and software system of the mechanical threedimensional garage control system based on photoelectric sensor and PLC is finished, it is debugged. At last, the function of stop, cancel, sensor fault self-diagnosis and other functions of the three-dimensional garage are tested, and the interaction between the control system and the equipment such as upper computer, IC card reader, keyboard and LED display are tested.
The test results of the three-dimensional garage control system based on photoelectric sensor and PLC are shown in Table 3. As can be seen from table 3, after debugging, the stereo garage has been able to achieve any parking stop, cancel, self-diagnosis and treatment as well as a variety of safety protection and fault sensor, and it can interaction with host computer, IC card reader, keyboard, LED prompt screen and other equipment. The maximum operating speed of the lifting mechanism can reach 1.0m / s, and the maximum speed of the traverse mechanism can reach 0.8m / s. According to the daily experience and the safety of the system, the lift and the speed of the traverse agencies do not have to reach the maximum in normal operation. Therefore, we can set the maximum speed of the system up and down 0.6 m/s, creep speed 0.02 m/s, acceleration 0.2 m/s 2 , the maximum speed of traverse running 0.5 m/s, and creep speed 0.04m/s. The S7-200 PLC reads the high-speed counter value every 5 ms and the S7-300 PLC computes the PI every 50 ms.

Conclusion
A vertical lifting garage control system based on the traverse device is studied and analyzed. The experiment proves that the speed closed loop control system based on photoelectric sensor and PLC not only meets the real-time requirement of control, but also has the characteristics of high automatic level, high reliability and good expansi-bility. Mechanical stereo garage, which is an effective solution to the problem of parking difficulty in cities, has become an inevitable trend in the development of garage. The results show that the garage system in this study can provide a new type of design scheme. While the system still has its defects so that it is not widely used. As a result, the uncertainties of the system remained to be further explored, which has great significance in making the exploration of the system complete.