Rail transit safety relay simulation method, device and teaching system
Through the controller that can be configured with the pin signal direction, the relay simulation device is dynamically configured, which solves the problem of cumbersome and low efficiency in rail transit signal teaching and training, and realizes the simulation and fault simulation of multiple relays, improves teaching efficiency and quality, and reduces equipment costs.
Patent Information
- Application Number
- CN202510490483.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-04-18
- Publication Date
- 2025-06-10
AI Technical Summary
In rail transit signal teaching and training, the existing relay combination equipment is cumbersome to use, low teaching efficiency, large and expensive equipment, making it difficult to conduct after-school training.
A controller that can be configured with pin signal directions can be read or configured to detect the terminal level status of the socket connection in real time by reading or configuring the target relay type, dynamically configure the terminal group to form a closed loop, simulate different types of relays, including inverted, biased and pole relays, and has fault simulation functions.
It realizes the rail transit safety relay that simulates multiple models, saves investment in teaching equipment, improves teaching efficiency and quality, and is light and portable, reducing the cost of teaching equipment.
Smart Images

Figure CN120126359A_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the field of rail transit signal teaching and training, and particularly relates to a method for simulating a railway safety type relay. Background Art
[0002] The railway safety type relay is a core component of the rail transit signal control system. The relay combination composed of multiple safety type relays is a key design in the rail transit signal system. Through the logical interconnection and redundant configuration between relays, complex safety control functions are realized, such as the safety control of rail transit signal devices such as turnouts, signal lamps, and track circuits.
[0003] In the field of rail transit signal teaching and training, students use relay combinations to learn the control principles of rail transit signal devices, wiring construction, and fault handling. Currently, the relay combinations used in this field are to insert multiple different types of safety type relays on a combination rack equipped with multiple relay sockets according to teaching needs. One side of the relay socket is a jack into which the relay can be inserted, and the other side is a terminal block for wiring welding. This method has the following disadvantages:
[0004] 1) According to different control principle circuits required for teaching and training, multiple combination racks need to be configured or the required type of relays need to be replaced, resulting in large investment or cumbersome operation.
[0005] 2) After students perform wiring construction on the relay combination, if the action result after power-on does not match the expectation, it is necessary to check each relay and each wiring contact point one by one according to the circuit principle, which is time-consuming and laborious, and the teaching efficiency is low.
[0006] 3) When students learn fault handling, since the safety type relay is protected by a dust-proof housing, it is difficult to create relay contact faults, and only external wiring faults can be created, reducing the fault difficulty and also reducing the teaching quality.
[0007] 4) The weight of the safety type relay is about 1.5 - 2 kg. Each set of relay combination racks usually installs 11 rail transit signal relays. Adding the weight of the combination rack itself, each set of relay combination racks is not less than 20 kg. Such teaching and training equipment can only be fixedly placed on the desktop, and it is difficult for students to carry it to other locations for learning and training after class.
[0008] 5) According to different models, the price of the rail transit signal relay is about 600 - 1000 yuan. Adding the price of the combination rack itself, that is, the price of each set of relay combination racks is not less than 10,000 yuan. Rail transit signal teaching and training often need to purchase multiple sets of relay combination racks, resulting in large investment. Summary of the Invention
[0009] In view of this, the present invention aims to provide a simulation method, device and teaching system for rail transit safety relays, so as to solve the problems of low efficiency in rail transit signal teaching and training, difficulty in after-class practical training and high cost of teaching equipment.
[0010] To achieve the above object, the present invention adopts the following technical solutions: A simulation method for rail transit safety relays, which is implemented by a controller with configurable pin signal directions, and includes the following steps:
[0011] Read from inside the controller or through the internal configuration switch of the simulator or receive the target relay type through the communication unit;
[0012] Real-time detect the level states of N insertion terminal pins connected to the relay socket, where N≥22;
[0013] According to the excitation determination rule corresponding to the target relay type, judge whether the electrical connection state of the coil terminal meets the excitation condition;
[0014] Based on the excitation determination result, dynamically configure the middle contact of the terminal group to form a closed loop with the front contact or the rear contact:
[0015] When the excitation condition is met, control the middle contact of the terminal group to form a closed loop with the front contact;
[0016] When the excitation condition is not met, control the middle contact of the terminal group to form a closed loop with the rear contact;
[0017] The initial states of the two terminals of the closed loop are both input. When any one of the terminals inputs a high level, the direction of the other terminal is configured as output and a high level is output.
[0018] Furthermore, a preferred method is also proposed. The excitation determination rule includes:
[0019] For non-polar relays, detect whether there is an effective potential difference between the coil terminals;
[0020] For polarized relays, verify the consistency between the polarity direction of the coil terminal and the preset direction;
[0021] For polarized relays, judge the bistable trigger condition and maintain the current contact state.
[0022] Furthermore, a preferred method is also proposed. The method further includes a fault simulation function for forcibly setting the open or short circuit state of a specific contact in response to an external instruction.
[0023] Based on the same inventive concept, the present invention also provides a simulation device for rail transit safety relays, including:
[0024] A controller with configurable input or output direction, comprising: a microcontroller MCU, a digital signal processor DSP, a system-on-chip SOC, and a programmable logic chip FPGA or CPLD;
[0025] A communication unit connected to the controller, supporting CAN, RS485, IIC or SPI protocols;
[0026] N insert terminals physically matching the relay socket, where N≥22;
[0027] A power supply unit providing multi-voltage rail power conversion;
[0028] The controller is used to dynamically switch the signal direction of the insert terminals; and implement the logic simulation of at least five types of relays, including non-polar, non-polar slow start, non-polar slow release, polarized and polar relays.
[0029] Furthermore, a preferred method is also proposed. The number of the insert terminals is 28, and their arrangement corresponds exactly to the jack layout of the standard relay socket.
[0030] Furthermore, a preferred method is also proposed. The communication unit integrates a fault injection module, which can simulate at least three fault modes including coil open circuit, contact adhesion, and abnormal contact resistance.
[0031] Based on the same inventive concept, the present invention also proposes a rail transit signal teaching system, which includes:
[0032] A programmable combination rack configured with a rail transit safety type relay simulation device as described in any one of the above;
[0033] An upper computer teaching platform for sending relay type matching instructions and fault simulation instructions to the simulation device;
[0034] The programmable combination rack and the upper computer teaching platform are connected through a CAN bus or an RS485 bus.
[0035] Based on the same inventive concept, the present invention also proposes a computer device, including a memory and a processor. A computer program is stored in the memory. When the processor runs the computer program stored in the memory, the processor executes a rail transit safety type relay simulation method as described in any one of the above.
[0036] Based on the same inventive concept, the present invention also proposes a computer-readable storage medium. A computer program is stored on the computer-readable storage medium. When the computer program is run by a processor, it executes the steps of a rail transit safety type relay simulation method as described in any one of the above.
[0037] Compared with the prior art, the beneficial effects of the present invention are as follows:
[0038] (1) The method proposed by the present invention can simulate all models of railway safety relays, such as common non-polar relays, non-polar slow-acting relays, non-polar slow-release relays, polarized relays, and polarized relays. Multiple simulators installed on a set of combination racks can simulate different safety relays according to different control principle circuits required for teaching and training, saving investment and improving teaching efficiency.
[0039] (2) It can obtain the wiring contact status on the combination rack in real time. After the trainee conducts wiring construction on the relay combination, if the action result after power-on does not match the expectation, the fault point can be quickly found, improving teaching efficiency.
[0040] (3) It can simulate faults such as non-operation of relays and poor contact of contacts caused by internal damage of relays, improving the teaching quality of fault handling learning.
[0041] (4) The safety relay simulator implemented by the present invention weighs no more than 50 g, greatly reducing the overall weight of the combination rack and facilitating trainees to move and carry the combination rack for practice after class.
[0042] (5) The safety relay simulator implemented by the present invention has a low cost, greatly reducing the investment in teaching equipment. BRIEF DESCRIPTION OF THE DRAWINGS
[0043] The drawings constituting a part of the present invention are used to provide a further understanding of the present invention. The schematic embodiments and descriptions thereof of the present invention are used to explain the present invention and do not constitute an improper limitation of the present invention. In the drawings:
[0044] Figure 1 is a schematic diagram of a railway safety relay simulation device described in Embodiment 10;
[0045] Figure 2 is a flowchart of the simulation method for non-polar, non-polar slow-acting, non-polar slow-release, and polarized relays described in Embodiment 10;
[0046] Figure 3 is a flowchart of the simulation method for polarized relays described in Embodiment 10;
[0047] Figure 4 is a wiring diagram of a non-polar, non-polar slow-acting, non-polar slow-release, and polarized relay with two coils and 8 sets of contacts described in Embodiment 10;
[0048] Figure 5 is a wiring diagram of a polarized relay with two coils and 6 sets of contacts described in Embodiment 10. DETAILED DESCRIPTION OF THE EMBODIMENTS
[0049] The following will clearly and completely elaborate on the technical solutions in the embodiments of the present invention in conjunction with the accompanying drawings in the embodiments of the present invention. It should be noted that, without conflict, the embodiments in the present invention and the features in the embodiments may be combined with each other. The described embodiments are only a part of the embodiments of the present invention, rather than all the embodiments.
[0050] Embodiment 1. A method for simulating a railway safety relay described in this embodiment is implemented through a controller with configurable pin signal directions, and includes the following steps:
[0051] Dynamically configure the middle contact of the terminal group to form a closed loop with the front contact or the rear contact based on the excitation determination result:
[0052] When the excitation condition is met, control the middle contact of the terminal group to form a closed loop with the front contact;
[0053] When the excitation condition is not met, control the middle contact of the terminal group to form a closed loop with the rear contact;
[0054] The initial states of both terminals of the closed loop are input. When a high level is input to any one of the terminals, the direction of the other terminal is configured as output and a high level is output.
[0055] The method for simulating a railway safety relay described in this embodiment can simulate a fixed type of relay, that is, no configuration is required; or the type of relay to be simulated can be set through the on-board DIP switch; or the type of relay to be simulated can be received from the outside through the communication unit. If multiple simulators are independent of each other, that is, each simulator only simulates a fixed type of relay, or the type of relay is set through the on-board DIP switch. The status can be reported without passing through the communication unit, only for simulation.
[0056] Embodiment 2. This embodiment further limits the method for simulating a railway safety relay described in Embodiment 1, and the excitation determination rules include:
[0057] For non-polar relays, detect whether there is an effective potential difference between the coil terminals;
[0058] For polarized relays, verify the consistency between the polarity direction of the coil terminals and the preset direction;
[0059] For polarized relays, judge the bistable trigger condition and maintain the current contact state.
[0060] Embodiment 3. This embodiment further limits the method for simulating a railway safety relay described in Embodiment 1, and the method further includes a fault simulation function for forcibly setting the open or short circuit state of a specific contact in response to an external instruction.
[0061] Embodiment 4. A railway traffic safety type relay simulation device described in this embodiment includes:
[0062] A controller with configurable input or output directions, including: a microcontroller MCU, a digital signal processor DSP, a system-on-chip SOC, and a programmable logic chip FPGA or CPLD;
[0063] A communication unit connected to the controller, supporting CAN, RS485, IIC or SPI protocols;
[0064] N insertion terminal pieces that are physically matched with the relay socket, N≥22;
[0065] A power supply unit that provides multi-voltage rail power conversion;
[0066] The controller is used to dynamically switch the signal directions of the insertion terminal pieces; and implement the logic simulation of at least five types of relays, including non-polar, non-polar slow-moving, non-polar slow-releasing, polarized and polar relays.
[0067] Embodiment 5. This embodiment further limits a railway traffic safety type relay simulation device described in Embodiment 4. The number of the insertion terminal pieces is 28, and its arrangement mode completely corresponds to the jack layout of the standard relay socket.
[0068] Embodiment 6. This embodiment further limits a railway traffic safety type relay simulation device described in Embodiment 4. The communication unit integrates a fault injection module, and can simulate at least three fault modes including coil open circuit, contact adhesion, and abnormal contact resistance.
[0069] Embodiment 7. A railway traffic signal teaching system described in this embodiment, the system includes:
[0070] A programmable combination rack, which is configured with a railway traffic safety type relay simulation device described in any one of claims 4-7;
[0071] An upper computer teaching platform, which is used to send relay type matching instructions and fault simulation instructions to the simulation device;
[0072] The programmable combination rack and the upper computer teaching platform are connected through a CAN bus or an RS485 bus.
[0073] Embodiment 8. A computer device described in this embodiment includes a memory and a processor. A computer program is stored in the memory. When the processor runs the computer program stored in the memory, the processor executes a railway traffic safety type relay simulation method described in any one of Embodiments 1-3.
[0074] Embodiment 9. A computer-readable storage medium described in this embodiment stores a computer program, and when the computer program is run by a processor, it executes the steps of a method for simulating a railway safety-type relay as described in any one of Embodiments 1 to 3.
[0075] Embodiment 10. Refer to Figures 1 to 5 This embodiment is described. This embodiment provides a specific example for the method for simulating a railway safety-type relay described in Embodiment 1, and is also used to explain Embodiments 2 to 3. Specifically:
[0076] Refer to Figure 1 A railway safety-type relay simulation device proposed in this embodiment is described. It includes a controller with configurable pin signal directions, a communication unit, N (N>1) plug terminals, and a power supply unit.
[0077] The controller with configurable pin signal directions can be a microcontroller (MCU), a digital signal processor (DSP), a system-on-chip (SOC), and a programmable logic chip (FPGA / CPLD). The controller is used to dynamically switch the signal directions of the plug terminals and implement logical simulations of at least five types of relays, including non-polar, non-polar slow-acting, non-polar slow-releasing, polarized, and polarized relays.
[0078] The communication unit is connected to the controller and is used for communicating with external devices. The communication unit is a serial bus communication circuit capable of connecting multiple devices and can be a CAN communication circuit, an RS485 communication circuit, an IIC communication circuit, or an SPI communication circuit.
[0079] The N plug terminals are connected to the pins of the controller with configurable signal directions and are used to connect the present invention to a relay socket.
[0080] The power supply unit provides working power for the controller and the communication unit.
[0081] Non-polar relays, non-polar slow-acting relays, non-polar slow-releasing relays, and polarized relays are monostable non-latching relays. As long as the coil meets the excitation condition, the front contact closes; otherwise, the back contact closes. The simulation method for this type of relay is as Figure 2 shown.
[0082] For a polarized relay, according to the different directions of the current in the coil, the positioning contact closes or the reverse position contact closes, and after the current in the coil disappears, the closed state remains unchanged, that is, the polarized relay is a bistable latching relay. The simulation method for this type of relay is as Figure 3 shown.
[0083] In this embodiment, a non-polar relay with double coils and 8 sets of contacts, a non-polar slow-acting relay with double coils and 8 sets of contacts, a non-polar slow-release relay with double coils and 8 sets of contacts, a polarized relay with double coils and 8 sets of contacts, and a polarized relay with double coils and 6 sets of contacts are respectively described.
[0084] The non-polar relay with double coils and 8 sets of contacts described in this embodiment. The typical representative of this type of relay is the JWXC-1700 non-polar relay. The wiring diagram of this type of relay is as Figure 4 . The coils of the non-polar relay have no polarity, and it can be magnetized and attracted by sufficient current. When the coil is not magnetized, the rear contact (normally closed contact) is closed, and the front contact (normally open contact) is open; when the coil is magnetized, the front contact is closed and the rear contact is open.
[0085] Pins 1 and 2 of this type of relay are one coil, and pins 3 and 4 are one coil. The two coils can be used in series, in parallel, or separately. When used in series or in parallel, it should be noted that the same-name ends of the coils need to be the same. For example, when pins 2 and 3 are used in series, if either of the two pins 1 and 4 is at a high level and the other is at a low level, the relay coil is magnetized, and the front contacts of the 8 sets of contacts are closed and the rear contacts are open; otherwise, the front contacts are open and the rear contacts are closed. When pins 1 and 4 are used in series, if either of the two pins 2 and 3 is at a high level and the other is at a low level, the relay coil is magnetized, and the front contacts of the 8 sets of contacts are closed and the rear contacts are open; otherwise, the front contacts are open and the rear contacts are closed. When pins 1, 3 and pins 2, 4 are used in parallel, if either side of the coil is at a high level and the other side is at a low level, the relay coil is magnetized, and the front contacts of the 8 sets of contacts are closed and the rear contacts are open; otherwise, the front contacts are open and the rear contacts are closed. When the coil formed by pins 1 and 2 or the coil formed by pins 3 and 4 is used separately, if either of the two pins of the coil is at a high level and the other is at a low level, the relay coil is magnetized, and the front contacts of the 8 sets of contacts are closed and the rear contacts are open; otherwise, the front contacts are open and the rear contacts are closed. The analog embodiment of this type of relay is as follows.
[0086] The controller is a microcontroller (MCU), the communication unit is a CAN communication circuit composed of a CAN controller inside the MCU and a CAN transceiver outside the MCU, and the power supply unit converts the externally provided power into the power rails required for the operation of the MCU and the RS485 transceiver.
[0087] At least 28 insertion terminals are welded on the circuit board at positions corresponding to the 28 jacks of the relay socket. The MCU, CAN transceiver, and power supply unit are also welded on this circuit board. The 28 insertion terminals are connected to 28 GPIO of the microcontroller. The circuit board is inserted into the relay socket in a manner corresponding to the insertion terminals and the relay socket jacks.
[0088] The MCU is powered on, and the GPIO connected to 28 blade terminals is set to input. The MCU obtains from other devices via the CAN bus that the type of safety relay to be simulated is a non-polar relay with double coils and 8 sets of contacts. The method for the controller to simulate this type of relay is as follows:
[0089] 1) Determine the pin states of the GPIO pins connected to the two coil terminals 1, 2, 3, and 4: If the levels of 1 and 4 are different, and 2 and 3 are low levels, then set the MCU pin connected to terminal 2 or terminal 3 to output a high level. If the MCU pin connected to terminal 3 or terminal 2 returns a high level, it indicates that 2 and 3 are short-circuited, and it is judged that the coils are used in series and meet the coil excitation condition; If the levels of terminals 1 and 2 are different and the levels of 3 and 4 are the same, or the levels of terminals 3 and 4 are different and the levels of 1 and 2 are the same, it is judged that the coils are used separately and meet the coil excitation condition; If the levels of terminals 1 and 2 are different, the level of 3 is the same as that of 1, and the level of 4 is the same as that of 2, it is judged that the coils are used in parallel and meet the coil excitation condition. Other states do not meet the coil excitation condition.
[0090] 2) If the simulated relay does not meet the coil excitation condition, if any one of the controller pins connected to the relay contacts x1 and x3 (x = 1 to 8, the same below) is in a high-level input state, the other is set to output and outputs a high level, then jump to step 1); If the pin that once input a high level is converted to input a low level, the pin that outputs a high level is set to input, or the pin that outputs a high level is set to output, then jump to step 1).
[0091] 3) If the simulated relay meets the coil excitation condition, if any one of the controller pins connected to the relay contacts x1 and x2 is in a high-level input state, the other is set to output and outputs a high level, then jump to step 1); If the pin that once input a high level is converted to input a low level, the pin that outputs a high level is set to input, or the pin that outputs a high level is set to output, then jump to step 1).
[0092] This embodiment describes a non-polar slow-moving relay with double coils and 8 sets of contacts. The wiring diagram of this type of relay is the same as that of the non-polar relay, and the typical representative is the JWXC-H310 non-polar slow-moving relay. The non-polar slow-moving relay is derived from the non-polar relay and combines the non-polar magnetic circuit and the slow-moving characteristic. After the coil is energized and excited, the front contact closes and the rear contact disconnects after a delay of more than 0.3 seconds; After the coil is powered off, after a delay of more than 0.3 seconds, the rear contact closes and the front contact disconnects.
[0093] The simulation embodiment of this type of relay is as follows.
[0094] The controller is a digital signal processor (DSP). The communication unit is an RS485 communication circuit composed of a UART / USART controller inside the DSP and an RS485 transceiver outside the DSP. The power supply unit converts the externally provided power into the power rails required for the operation of the DSP and the RS485 transceiver.
[0095] At least 28 blade terminals are soldered onto the circuit board at positions corresponding to the 28 jacks of the relay socket. The DSP, the RS485 transceiver, and the power supply unit are also soldered onto this circuit board. The 28 blade terminals are connected to 28 GPIO of the DSP. The circuit board is inserted into the relay socket in a manner where the blade terminals correspond to the jacks of the relay socket.
[0096] The DSP is powered on, and the GPIO connected to the 28 blade terminals is set to input. The DSP obtains, via the RS485 bus, from other devices that the type of safety relay to be simulated is a non-polar slow-acting relay with double coils and 8 sets of contacts. The method for the DSP to simulate this type of relay is as follows:
[0097] 1) Determine the pin states of the GPIO connected to the two coil terminals 1, 2, 3, and 4: If the levels of 1 and 4 are different, and 2 and 3 are low levels, then set the MCU pin connected to terminal 2 or terminal 3 to output a high level. If the MCU pin connected to terminal 3 or terminal 2 returns a high level, it indicates that 2 and 3 have been short-circuited, and it is determined that the coils are used in series and meet the coil excitation condition; If the levels of terminals 1 and 2 are different and the levels of 3 and 4 are the same, or the levels of terminals 3 and 4 are different and the levels of 1 and 2 are the same, it is determined that the coils are used separately and meet the coil excitation condition; If the levels of terminals 1 and 2 are different and the level of 3 is the same as that of 1, and the level of 4 is the same as that of 2, it is determined that the coils are used in parallel and meet the coil excitation condition. Other states do not meet the coil excitation condition.
[0098] 2) If the simulated relay does not meet the coil excitation condition, after a delay of more than 0.3 seconds, determine: If any one of the controller pins connected to the relay contacts x1 and x3 (x = 1 - 8, the same below) is in a high-level input state, set the other one to output and output a high level, then jump to step 1); If the pin that once input a high level converts to an input low level, set the pin that outputs a high level to input, or set the pin that outputs a high level to output, then jump to step 1).
[0099] This step can also be: If the simulated relay does not meet the coil excitation condition, if any of the controller pins connected to the relay contacts x1 and x3 (x = 1 to 8, the same below) is in a high-level input state, after a delay of more than 0.3 seconds, the other is set to output and a high level is output, then jump to step 1); if the pin that has ever input a high level is converted to a low-level input, after a delay of more than 0.3 seconds, the pin that outputs a high level is set to input, or the pin that outputs a high level is set to output, then jump to step 1).
[0100] 3) If the simulated relay meets the coil excitation condition, after a delay of more than 0.3 seconds, judge: If any of the controller pins connected to the relay contacts x1 and x2 is in a high-level input state, the other is set to output and a high level is output, then jump to step 1); if the pin that has ever input a high level is converted to a low-level input, the pin that outputs a high level is set to input, or the pin that outputs a high level is set to output, then jump to step 1).
[0101] This step can also be: If the simulated relay meets the coil excitation condition, if any of the controller pins connected to the relay contacts x1 and x2 is in a high-level input state, after a delay of more than 0.3 seconds, the other is set to output and a high level is output, then jump to step 1); if the pin that has ever input a high level is converted to a low-level input, after a delay of more than 0.3 seconds, the pin that outputs a high level is set to input, or the pin that outputs a high level is set to output, then jump to step 1).
[0102] The non-polarity slow-release relay with double coils and 8 groups of contacts described in this embodiment, the wiring diagram of this type of relay is the same as that of the non-polarity relay, and the typical representative is the JWXC-H600 type non-polarity slow-release relay. The non-polarity slow-release relay is derived from the non-polarity relay and combines the non-polar magnetic circuit and the slow-release characteristic. After the coil is energized and excited, the front contact closes and the rear contact opens; after the coil is powered off, after a delay of more than 0.3 seconds, the rear contact closes and the front contact opens.
[0103] The simulation embodiment of this type of relay is as follows.
[0104] The controller is a microcontroller (MCU), the communication unit is an RS485 communication circuit composed of a UART / USART controller inside the MCU and an RS485 transceiver outside the MCU, and the power supply unit converts the externally provided power into the power rails required for the operation of the MCU and the RS485 transceiver.
[0105] At least 28 inserted terminal pins are soldered onto the circuit board at positions corresponding to the 28 jacks of the relay socket. The MCU, RS485 transceiver, and power supply unit are also soldered onto this circuit board. The 28 inserted terminal pins are connected to 28 GPIO pins of the MCU. The circuit board is inserted into the relay socket in a manner where the inserted terminal pins correspond to the jacks of the relay socket.
[0106] The MCU is powered on, and the GPIO pins connected to the 28 inserted terminal pins are set to input. The MCU obtains from other devices via the RS485 bus that the type of the safety relay to be simulated is a non-polar slow-release relay with double coils and 8 sets of contacts. The method for the MCU to simulate this type of relay is as follows:
[0107] 1) Determine the pin states of the GPIO pins connected to the two coil terminals 1, 2, 3, and 4: If the levels of 1 and 4 are different, and 2 and 3 are at low levels, then set the MCU pin connected to terminal 2 or terminal 3 to output high level. If the MCU pin connected to terminal 3 or terminal 2 returns a high level, it indicates that 2 and 3 are short-circuited, and it is judged that the coils are used in series and meet the coil excitation condition; If the levels of terminals 1 and 2 are different and the levels of 3 and 4 are the same, or the levels of terminals 3 and 4 are different and the levels of 1 and 2 are the same, it is judged that the coils are used separately and meet the coil excitation condition; If the levels of terminals 1 and 2 are different, the level of 3 is the same as that of 1, and the level of 4 is the same as that of 2, it is judged that the coils are used in parallel and meet the coil excitation condition. Other states do not meet the coil excitation condition.
[0108] 2) If the simulated relay does not meet the coil excitation condition, after a delay of more than 0.3 seconds, judge: If any one of the controller pins connected to the relay contacts x1 and x3 (x = 1 - 8, the same below) is in a high-level input state, set the other one to output and output high level, then jump to step 1); If the pin that once input a high level converts to input a low level, set the pin that outputs high level to input, or set the pin that outputs high level to output, then jump to step 1).
[0109] This step can also be: If the simulated relay does not meet the coil excitation condition, if any one of the controller pins connected to the relay contacts x1 and x3 (x = 1 - 8, the same below) is in a high-level input state, after a delay of more than 0.3 seconds, set the other one to output and output high level, then jump to step 1); If the pin that once input a high level converts to input a low level, after a delay of more than 0.3 seconds, set the pin that outputs high level to input, or set the pin that outputs high level to output, then jump to step 1).
[0110] 3) If the simulated relay meets the coil excitation condition, if any of the controller pins connected to the relay contacts x1 and x2 is in the high-level input state, the other is set to output and outputs a high level, then jump to step 1); if the pin that once input a high level is converted to input a low level, the pin that outputs a high level is set to input, or the pin that outputs a high level is set to output, then jump to step 1).
[0111] The polarized relay with two coils and 8 sets of contacts described in this embodiment. The wiring diagram of this type of relay is the same as that of the non-polarized relay. The typical representative is the JPXC-1000 type polarized relay. The non-polarized relay has no requirement for the current direction in the coil, while for the polarized relay, only when the current direction in the coil is forward (coil 1: 1 positive and 2 negative, coil 2: 3 positive and 4 negative), the front contacts can be closed and the rear contacts can be opened. Otherwise, the rear contacts are closed and the front contacts are opened.
[0112] The simulation embodiment of this type of relay is as follows.
[0113] The controller is a microcontroller (MCU). The communication unit is a CAN communication circuit composed of a CAN controller inside the MCU and a CAN transceiver outside the MCU. The power supply unit converts the externally provided power into the power rails required for the operation of the MCU and the CAN transceiver.
[0114] At least 28 insertion terminals are soldered on the circuit board at positions corresponding to the 28 jacks of the relay socket. The MCU, CAN transceiver, and power supply unit are also soldered on this circuit board. The 28 insertion terminals are connected to 28 GPIO of the microcontroller. The circuit board is inserted into the relay socket in a manner corresponding to the insertion terminals and the relay socket jacks.
[0115] The MCU is powered on, and the GPIO connected to the 28 insertion terminals is set to input. The MCU obtains the type of the safety relay to be simulated as a polarized relay with two coils and 8 sets of contacts from other devices through the CAN bus. The method for the controller to simulate this type of relay is as follows:
[0116] 1) Judge the pin states of the GPIO connected to the two coil terminals 1, 2, 3, and 4: If 1 is high level and 4 is low level, and 2 and 3 are low levels, then set the MCU pin connected to terminal 2 or terminal 3 to output a high level. If the MCU pin connected to terminal 3 or terminal 2 returns a high level, it indicates that 2 and 3 are short-circuited, and it is judged that the coils are used in series and meet the coil excitation condition; if 1 is high level and 2 is low level and 3 and 4 are at the same level, or 3 is high level and 4 is low level and 1 and 2 are at the same level, it is judged that the coils are used separately and meet the coil excitation condition; if 1 is high level and 2 is low level and 3 is at the same level as 1 and 4 is at the same level as 2, it is judged that the coils are used in parallel and meet the coil excitation condition. Other states do not meet the coil excitation condition.
[0117] 2) If the simulated relay does not meet the coil excitation condition, and any one of the controller pins connected to the relay contacts x1 and x3 (x = 1 to 8, the same below) is in the high-level input state, the other is set to output and outputs a high level, then jump to step 1); if the pin that has ever input a high level is converted to input a low level, the pin that outputs a high level is set to input, or the pin that outputs a high level is set to output, then jump to step 1).
[0118] 3) If the simulated relay meets the coil excitation condition, and any one of the controller pins connected to the relay contacts x1 and x2 is in the high-level input state, the other is set to output and outputs a high level, then jump to step 1); if the pin that has ever input a high level is converted to input a low level, the pin that outputs a high level is set to input, or the pin that outputs a high level is set to output, then jump to step 1).
[0119] The polarized relay with two coils and 6 groups of contacts described in this embodiment, the wiring diagram of this type of relay is as Figure 5 , and the typical representative is the JYXC-660 type polarized relay. Pins 1 and 2 of this type of relay are one coil, and pins 3 and 4 are one coil. The two coils can be used in series, in parallel, or separately. When used in series or in parallel, it should be noted that the same-named ends of the coils need to be the same. For example, when connecting 2 and 3 in series and 1 is high level and 4 is low level, the relay is positioned and attracted; when 1 is low level and 4 is high level, the relay is in the reverse position and drops. For example, when connecting 1 and 4 in series and 3 is high level and 2 is low level, the relay is positioned and attracted; when 3 is low level and 2 is high level, the relay is in the reverse position and drops. When connecting 1 and 3 and connecting 2 and 4 in parallel, when 1 and 3 are high level and 2 and 4 are low level, the relay is positioned and attracted; when 1 and 3 are low level and 2 and 4 are high level, the relay is in the reverse position and drops. When using coil 1 and 2 or using coil 3 and 4 separately, when 1 or 3 is high level and 2 or 4 is low level, the relay is positioned and attracted; when 1 or 3 is low level and 2 or 4 is high level, the relay is in the reverse position and drops. If the level states on the two coils do not meet the conditions for being positioned and attracted nor the conditions for being in the reverse position and dropping, the 6 groups of contacts maintain the current state.
[0120] The simulation embodiment of this type of relay is as follows.
[0121] The controller is a microcontroller (MCU), the communication unit is a CAN communication circuit composed of a CAN controller inside the MCU and a CAN transceiver outside the MCU, and the power supply unit converts the externally provided power into the power rails required for the operation of the MCU and the AN transceiver.
[0122] At least 22 insert terminals are soldered onto the circuit board at positions corresponding to the 22 jacks of the relay socket. The MCU, CAN transceiver, and power supply unit are also soldered onto this circuit board. The 22 insert terminals are connected to 22 GPIOs of the microcontroller. The circuit board is inserted into the relay socket in a manner where the insert terminals correspond to the jacks of the relay socket.
[0123] The MCU is powered on, and the GPIOs connected to the 22 insert terminals are set to input. The MCU obtains from other devices via the CAN bus that the type of safety relay to be simulated is a polarized relay with double coils and 6 sets of contacts. The method for the controller to simulate this type of relay is as follows:
[0124] 1) Determine the pin states of the GPIOs connected to the two coil terminals 1, 2, 3, and 4: If pin 1 is at high level and pin 4 is at low level, and pins 2 and 3 are at low level, then set the MCU pin connected to terminal 2 or terminal 3 to output high level. If the MCU pin connected to terminal 3 or terminal 2 returns high level, it indicates that 2 and 3 are short-circuited, and it is judged that the coils are used in series and meet the positioning and pulling-up conditions; If pin 1 is at high level and pin 2 is at low level and pins 3 and 4 are at the same level, or pin 3 is at high level and pin 4 is at low level and pins 1 and 2 are at the same level, it is judged that the coils are used separately and meet the positioning and pulling-up conditions; If pin 1 is at high level and pin 2 is at low level and pin 3 is at the same level as pin 1, and pin 4 is at the same level as pin 2, it is judged that the coils are used in parallel and meet the positioning and pulling-up conditions.
[0125] If pin 1 is at low level and pin 4 is at high level, and pins 2 and 3 are at low level, then set the MCU pin connected to terminal 2 or terminal 3 to output high level. If the MCU pin connected to terminal 3 or terminal 2 returns high level, it indicates that 2 and 3 are short-circuited, and it is judged that the coils are used in series and meet the reverse-position and knocking-down conditions; If pin 1 is at low level and pin 2 is at high level and pins 3 and 4 are at the same level, or pin 3 is at low level and pin 4 is at high level and pins 1 and 2 are at the same level, it is judged that the coils are used separately and meet the reverse-position and knocking-down conditions; If pin 1 is at low level and pin 2 is at high level and pin 3 is at the same level as pin 1, and pin 4 is at the same level as pin 2, it is judged that the coils are used in parallel and meet the reverse-position and knocking-down conditions.
[0126] The pin states of the MCU pins connected to terminals 1, 2, 3, and 4 do not meet the positioning and pulling-up conditions nor the reverse-position and knocking-down conditions, and the 6 sets of contacts maintain their current states.
[0127] 2) If the simulated relay meets the positioning and pulling-up conditions, if any one of the controller pins connected to the relay contacts y1 and y2 (y = 11 - 16, the same below) is in the high-level input state, the other is set to output and outputs high level, and then jump to step 1); If the pin that once input high level is converted to input low level, the pin that outputs high level is set to input, or the pin that outputs high level is set to output, and then jump to step 1).
[0128] 3) If the simulated relay meets the condition of falling off in the reverse position, if any of the controller pins connected to the relay contacts y1 and y3 is in the high-level input state, the other is set to output and outputs a high level, and then jumps to step 1); if the pin that has ever input a high level is converted to input a low level, the pin that outputs a high level is set to input, or the pin that outputs a high level is set to output, and then jumps to step 1).
[0129] The specific embodiments of the present invention disclosed above are only used to help explain the present invention. The specific embodiments do not describe all the details in detail, nor limit the invention to the specific embodiments described. According to the content of this specification, many modifications and changes can be made. These embodiments are selected and specifically described in this specification to better explain the principle and practical application of the present invention, so that those skilled in the art can well understand and utilize the present invention.
Claims
1. A rail transit safety relay simulation method, characterized in that: The method is implemented by a controller with configurable pin signal directions, and comprises the following steps: Read from inside the controller or configure the switch inside the simulator or receive the target relay type via the communication unit; Real-time detection of the level status of N plug-in terminals connected to the relay socket, where N ≥ 22; According to the excitation determination rule corresponding to the target relay type, determine whether the electrical connection state of the coil terminal meets the excitation conditions; Based on the excitation determination result, the middle contact of the terminal group is dynamically configured to form a closed loop with the front contact or the rear contact: When the excitation conditions are met, the middle contact of the control terminal group and the front contact form a closed loop; When the excitation conditions are not met, the middle contact of the control terminal group and the rear contact form a closed loop; The initial state of the two terminals in the closed loop is input. When a high level is input to any terminal, the other terminal is configured as output and outputs a high level.
2. A rail transit safety relay simulation method according to claim 1, characterized in that: The excitation determination rules include: For non-polar relays, check whether there is an effective potential difference between the coil terminals; For polarity-biased relays, verify that the polarity direction of the coil terminals is consistent with the preset direction; For polar relays, determine the bistable trigger condition and maintain the current contact state.
3. A rail transit safety relay simulation method according to claim 1, characterized in that: The method further comprises a fault simulation function for forcibly setting an open circuit or short circuit state of a specific contact in response to an external instruction.
4. A rail transit safety relay simulation device, characterized in that: include: Controllers with configurable input or output directions, including: microcontrollers MCU, digital signal processors DSP, system-on-chips SOC, and programmable logic chips FPGA or CPLD; The communication unit connected to the controller supports CAN, RS485, IIC or SPI protocols; N plug-in terminals physically matching the relay socket, N ≥ 22; Power supply unit, providing multi-voltage rail power conversion; The controller is used to dynamically switch the signal direction of the plug-in terminal; and realize the logic simulation of at least five types of relays, including stepless, stepless slow action, stepless slow release, polarized and polarized relays.
5. A rail transit safety relay simulation device according to claim 4, characterized in that: The number of the plug-in terminals is 28, and their arrangement completely corresponds to the layout of the sockets of a standard relay socket.
6. A rail transit safety relay simulation device according to claim 4, characterized in that: The communication unit integrates a fault injection module, which can simulate at least three fault modes including coil open circuit, contact adhesion, and abnormal contact resistance.
7. A rail transit signal teaching system, characterized in that: The system comprises: A programmable combination rack, wherein the programmable combination rack is provided with a rail transit safety relay simulation device according to any one of claims 4 to 7; A host computer teaching platform is used to send relay type matching instructions and fault simulation instructions to the simulation device; The programmable combination frame and the upper computer teaching platform are connected via a CAN bus or an RS485 bus.
8. A computer device, characterized in that: It comprises a memory and a processor, wherein the memory stores a computer program, and when the processor runs the computer program stored in the memory, the processor executes a rail transit safety relay simulation method according to any one of claims 1-3.
9. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps of a rail transit safety relay simulation method as described in any one of claims 1-3 are executed.