Software Design of Control Switch Module

TELKOMNIKA ISSN: 1693-6930  Railway Signal Distributed Computer Control Switch Module Hualin Chen 156 whole module. The circuit uses redundant MCU to control the circuit. The circuit is able to move only when two MCU execute the same command, and when two MCU receive command is not consistent or circuit failure; it needs to ensure that the switch will not miss the action. The controller area network CAN bus interface circuit is composed of 6N137 and TJA1050 devices. Compared with other communication bus, CAN bus have outstanding performance? Because the protocol meets the design requirements of the system, we choose CAN as the communication protocol between the module and the host. In order to improve the availability and reliability of the system, each module of the system is designed with double modules. A switch machine safety control is completed by two modules.

2.4. Software Design of Control Switch Module

Software structure The operation software of the control switch module is divided into the control software and the monitoring software. Control software is running in MCUA and MCUB much, and it is mainly responsible for the hardware control signal acquisition and logic processing and completes the control of switch machine. Control software program needs to carry out safety design. Monitoring software is non-security software, running in the monitoring of MCUC, and it mainly completes the monitoring of MCUA and MCUB status, and passes the information to the maintenance machine, it does not need to carry on the security design. The software adopts the structured design method, and the single task cycle operation mode is adopted. According to different functions, function module can be divided into the main program module, initialization module, synchronization information sending module, synchronization information receiving module, CAN communication processing module, information detection module and switch module action representation. Main functions of control switch module 1 Main program module This module mainly realizes the operation function of each sub function module. After power up, it calls on the electric initialization module, and completes each register configuration and the system on the electric self-check function. After the check without fault, the module calls synchronous information processing module, and compares the MCUA data and MCUB data. If the synchronization information is consistent, the communication information processing module is called, and checks whether the control command is received. Then call the information detection module to analysis and process the results. 2 Device initialization module The module mainly realizes the functions of various initializations and register configuration after power up, including the system power on self-tests, and realizes the function of the module to read and check the address code. It can be specific performance for the port initialization, timer initialization, module self-test and send self-test information, etc... Module self-checking mainly includes MCU self-checking, CAN communication channel self-checking, address code and asynchronous serial port UART communication channel self-checking, relay self-checking, current detection circuit self-checking. The overall process of the initialization module is shown in the following figure:  ISSN: 1693-6930 TELKOMNIKA Vol. 14, No. 3A, September 2016 : 152 – 160 157 Figure 3. Total process of initialization module 3 Synchronous information processing module The synchronization information processing module is to improve the consistency of the output step of the double micro controller. It adopts the method of shaking hands with each other, and at the same time, it detects each others handshake signal in the specified time. If the handshake is successful, the output will be synchronized with the operation or the counter command; Otherwise, it will continue to shake hands, and if synchronization is still not complete within the specified time period 1S, it is indicated a fault, which means that the system needs to alarm and complete the fault-Safety treatment. Synchronous message sending process is as shown in Figure 4. 4 Control module The control flow of turnout is introduced as follows: first of all, the module will resolve the valid control commands received, and determine whether the branch data of the dispatching branch is a symbol or a symbol of the turnout. And if it is, then the module is executed, or exit the module, then according to the effective switch control commands to achieve the switch machine set operation and inverse operation function. 5 Representation information detection module The module mainly realizes the signal detection function of positioning and reverse switch machine. The signal of switch indication circuit carries on the analog signal-digital signal AD collection to the analog quantity through a photo coupler 10 ADC analog-to-digital conversion interface with MCU. The collection period is 20ms, and the data acquisition value is processed after the collection period is finished, and then the signal waveform is judged according to the calculated value, and the obtained level types can be the high level of the pulse signal, stable or stable low level. Then, according to the corresponding logic to to determine TELKOMNIKA ISSN: 1693-6930  Railway Signal Distributed Computer Control Switch Module Hualin Chen 158 whether the switch is in the position, the reverse position, the four open, wiring errors, etc. In other cases, the fault alarm is carried out. 6 CAN communication processing module The module can realize the judgment function of the switch control command issued by the main engine, and it can realize the function of sending state information to the host machine. There is a CAN controller inside the AT90CAN128. Therefore, the software design mainly includes the initialization module of CAN controller, the data receiving module and the data transmission module. Its main program flow chart is shown in Figure 5. Figure 4. Synchronous message sending flow chart Figure 5. CAN communication main program flow chart 3. Results and Discussion 3.1. Calculation of Basic Failure Rate of Components