A method for smooth switching of output data based on a two-by-two safety platform
By defining the serial number and dual-system CRC check of the output data on the two-by-two security platform, smooth switching is achieved, which solves the communication delay and redundancy problems caused by master-slave switching, and improves the stability and stability of the system. efficiency.
Patent Information
- Application Number
- CN202111571712.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-12-21
- Publication Date
- 2024-09-27
- Estimated Expiration
- 2041-12-21
AI Technical Summary
The two-by-two security platform easily causes communication delays or interruptions during the master-slave switching process, reducing the availability of the system. The existing technology avoids delays by outputting data at the same time but increases communication redundancy and processing difficulty.
A smooth switching method of output data is designed. By defining a sequence number for the output data of each cycle, the master system sends a smooth switching message to the slave system, and the slave system determines whether to perform the switching task, ensuring that only one system outputs data to avoid data loss. and retransmission, using dual-system CRC check to ensure data consistency.
It achieves smooth switching without data loss or data retransmission, reduces communication redundancy, improves system stability and efficiency, and avoids communication interruptions caused by main system failures.
Smart Images

Figure CN114253771B
Abstract
Description
Technical Field
[0001] The present invention relates to the field of rail transit signal transmission, and in particular to an output data smooth switching method based on a two-by-two-out-of-two safety platform. Background Art
[0002] The two-by-two-out-of-two safety platform is a widely used typical safety platform structure that can meet the high safety and high real-time requirements of rail transit signal control systems. The two-by-two-out-of-two safety platform adopts a dual-system redundant system structure. The dual systems operate in a master-slave mode, that is, they include a master system and a slave system. When any system detects a fault or a manual shutdown, the master-slave system can be switched. Each system of the safety platform contains two independent safety CPU units. The platform can only output to the outside when the dual CPUs are relatively consistent in each cycle.
[0003] During the operation of the two-by-two-out-of-two safety platform, a master-slave switch may occur due to a master system failure. Master-slave control switching is usually a major cause of external communication interruption. Due to the uncertainty of the failure point of the master system, if the master system fails during data output, the original slave system will be converted to the master system, which will cause the loss of messages that were not output by the original master system in the current cycle, thereby causing communication delays or even interruptions, reducing the availability of the system. In order to overcome the communication problem during the master-slave conversion process, the existing technology is that the platform uses a master-slave system to output data to the outside at the same time. Although this method avoids communication delays or interruptions during the master-slave conversion process, it increases unnecessary communication redundancy and data processing difficulty. Summary of the invention
[0004] The purpose of the present invention is to overcome the communication delay or interruption problem commonly existing in the master-slave switching process of the above-mentioned existing two-by-two-out-of-two platform, and to design a smooth switching method without data loss and data retransmission.
[0005] To achieve the above-mentioned purpose, the present invention provides an output data smooth switching method based on a two-by-two-out-of-two security platform, wherein the two-by-two-out-of-two security platform includes a master system and a slave system that are communicatively connected, and both are communicatively connected to external devices, and can respectively send output data from a data storage module that is communicatively connected to the external device; the data storage module contains output data of multiple cycles, and each cycle contains multiple output data, and is characterized in that sending output data in each cycle includes the following steps: step S1, defining a sequence number for each output data in each cycle; step S2, initializing a smooth switching task for each cycle; step S3, the master system sends output data to the external device, and sends a smooth switching message containing the sequence number of the output data to the slave system; step S4, the slave system determines whether to execute the smooth switching task based on whether it receives the smooth switching message sent by the master system; if the slave system receives the smooth switching message sent by the master system, the master system sends the output data to the external device; if the slave system does not receive the smooth switching message sent by the master system, the slave system executes the smooth switching task.
[0006] Preferably, in step S1, the sequence number is defined according to the following rule: according to the order in which each output data is sent in each cycle, the sequence number is assigned to each output data in ascending order.
[0007] Preferably, the initialization of the smooth switching task per cycle in step S2 includes: step S201, initializing smooth switching task parameters; step S202, obtaining a double-system comparison result Bsame.
[0008] Preferably, the initialization of smooth switching task parameters described in step S201 includes: step S211, the slave system obtains the maximum sequence number Nmax of output data in each cycle; step S212, the receiving sequence number Nsend in the slave system is set to zero.
[0009] Preferably, the receiving sequence number Nsend is the maximum sequence number of the output data sent by the master system and received by the slave system.
[0010] Preferably, the dual-system two-by-two comparison described in step S202 is to perform the following operations on each output data in turn: the master system and the slave system respectively calculate the CRC of the currently processed output data, and the two CRCs of the output data are respectively input from the master system and the slave system to the logic board for verification; if the CRC results of the master system and the slave system are the same, the dual-system comparison result Bsame of the output data is recorded as true; if the CRC results of the master system and the slave system are different, the dual-system comparison result Bsame of the output data is recorded as false.
[0011] Preferably, in each sending cycle, a dual-system fetch-two operation is performed on each output data in the cycle to ensure consistency of the output data sent by the master system and the slave system.
[0012] Preferably, the specific steps of step 3 are: divide all output data in each cycle into M groups, each group includes m output data; the master system sends one group of output data in each cycle to the external device in turn; send the smooth switching message of the sequence number Nseq corresponding to the mth output data in the group to the slave system, and the time for the master system to send m output data is t.
[0013] Preferably, the judgment criteria used in step S4 are: whether the slave system receives the smooth switching message sent from the master system within time T; if the slave system receives the smooth switching message, the master system sends output data to the external device; if the slave system does not receive the smooth switching message, the smooth switching task is executed.
[0014] Preferably, the value range of the time T is t≤T≤2t.
[0015] Preferably, the master system sends output data including the following steps: step S402, restart the calculation of time T, and update the receiving sequence number Nsend in the slave system to the output data sequence number Nseq in the smooth switching message; step S403, determine whether the output data sequence number Nseq in the smooth switching message is equal to the maximum output data sequence number Nmax in the slave system; if they are equal, it means that the output data of this cycle has been sent; if not equal, return to step S3.
[0016] Preferably, the execution of the smooth switching task includes: step S404, the slave system starts to send output data to the external device, the slave system reads the output data to be sent, and obtains the serial number Ncur of the current output data. If the output data serial number Ncur is not greater than Nsend or Bsame is false, the slave system does not send the transmission data to the external device; otherwise, the slave system sends the transmission data to the external device.
[0017] Preferably, the execution of the smooth switching task also includes: step S405, judging whether there is output data to be sent within the cycle; if yes, returning to step S404 until the remaining output data to be sent within the cycle is sent; if no, ending the smooth switching task.
[0018] Preferably, the judgment criterion described in step S405 is: whether the output data sequence number Ncur of step S404 is equal to the maximum output data sequence number Nmax; if the output data sequence number Ncur is not equal to the maximum data sequence number Nmax, it means that there is still output data to be sent in this cycle; otherwise, it means that there is no output data to be sent in this cycle.
[0019] In summary, compared with the prior art, the output data smooth switching method based on the two-by-two-out-of-two safety platform provided by the present invention has the following beneficial effects:
[0020] 1. The present invention uses a slave system to determine whether data needs to be output, ensuring that only one system outputs data at the same time, thus overcoming the problem of excessive redundancy of communication volume in the prior art.
[0021] 2. The present invention numbers the output messages and ensures that the output messages will not be repeated or lost through the sequence number, thus overcoming the problem of communication interruption or delay caused by master-slave switching due to a master system failure at any time;
[0022] 3. The principle of the present invention is simple and easy to understand, and is easy to implement. It ensures the stability and efficiency of the main external communication of the two-by-two-out-of-two platform from a practical point of view. BRIEF DESCRIPTION OF THE DRAWINGS
[0023] Figure 1 It is a master-slave system smooth switching message interaction structure of the present invention;
[0024] Figure 2 This is a flow chart of the slave system executing the smooth switching task in the present invention. DETAILED DESCRIPTION
[0025] The following will be combined with the attached embodiment of the present invention Figure 1 ~Attached Figure 2 , the technical solutions, structural features, objectives achieved and effects in the embodiments of the present invention are described in detail.
[0026] It should be noted that, in the present invention, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only the elements explicitly listed, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device.
[0027] The present invention provides a method for smoothly switching output data based on a two-by-two-out-of-two safety platform, wherein the two-by-two-out-of-two safety platform adopts a dual-system redundant system structure such as Figure 1 As shown, it includes a master system 1 and a slave system 2, the master system 1 and the slave system 2 are connected in communication, and messages can be sent between the two; the master system 1 and the slave system 2 are both connected in communication with an external device 4, and can send output data from a data storage module 3 connected in communication to the external device 4; the data storage module 3 contains output data of multiple cycles, and each cycle contains multiple output data; the output data smooth switching method based on the two-by-two-out-of-two safety platform includes the following steps:
[0028] Step S1, defining a sequence number for each output data in each cycle;
[0029] This step is specifically as follows: according to the order in which each output data is sent in each cycle, a sequence number is assigned to each output data in ascending order, so that each output data corresponds to a unique sequence number.
[0030] Step S2, initializing the smooth switching task per cycle;
[0031] This step specifically includes: step S201, initializing smooth switching task parameters; step S202, obtaining a dual-system comparison result Bsame.
[0032] Further, executing step S201 includes the following steps: step S211, obtaining the maximum sequence number Nmax of the output data in each cycle from system 2; step S212, setting the received sequence number Nsend in slave system 2 to zero; wherein the received sequence number Nsend is the maximum sequence number of the output data sent by the master system 1 and received by slave system 2.
[0033] Specifically, in S202, the two-system comparison is to perform the following operations on each output data in turn: the master system 1 calculates the CRC (cyclic redundancy check code) of the output data currently being processed, and similarly, the slave system 2 also calculates the CRC of the output data, and the two CRCs of the output data are respectively input from the master system 1 and the slave system 2 to the logic board for verification; if the CRC results of the master system 1 and the slave system 2 are the same, that is, the CRC check passes, then the two-system comparison result Bsame of the output data is recorded as true; on the contrary, if the CRC results of the master system 1 and the slave system 2 are different, that is, the CRC check fails, indicating that the output data is inconsistent, then the two-system comparison result Bsame of the output data is recorded as false. The above two-system comparison operation is performed on each output data in each sending cycle to ensure the consistency of the output data sent by the master system and the slave system.
[0034] Step S3, the master system 1 sends the output data to the external device 4, and sends a smooth switching message including the maximum sequence number of the output data to the slave system 2;
[0035] This step is specifically as follows: all output data in each cycle are divided into M groups, each group includes m output data; the master system 1 sends a group of output data to the external device 4 in sequence, and the group of output data includes m data; a smooth switching message containing the sequence number Nseq corresponding to the mth output data in the group is sent to the slave system 2; wherein the time for the master system 1 to send each m output data is t.
[0036] Step S4: The slave system 2 determines whether to execute the smooth switching task according to whether the smooth switching message sent by the master system 1 is received.
[0037] Wherein, the step S4 specifically includes the following steps:
[0038] Step S401, determine whether the slave system 2 receives the smooth switching message sent from the master system 1 within the time T; if the slave system 2 receives the smooth switching message, it means that the master system 1 sends the output data normally, and then enter step S402; otherwise, it means that the master system 1 fails, and then enter step S404 to perform the smooth switching task; wherein the value range of time T is t≤T≤2t;
[0039] Step S402, restart the calculation of time T, and update the received sequence number Nsend in the slave 2 to the output data sequence number Nseq in the smooth switching message, and then go to step S403;
[0040] Step S403, determine whether the output data sequence number Nseq in the smooth switching message is equal to the maximum output data sequence number Nmax in the slave system 2; if they are equal, it means that each group of output data in this cycle has been sent; if they are not equal, return to step S3 to send the next group of output data until the output data sequence number Nseq in the smooth switching message is equal to the maximum output data sequence number Nmax in the slave system 2;
[0041] Step S404, slave system 2 starts to send output data to external device 4, slave system 2 reads the output data to be sent, and obtains the sequence number Ncur of the current output data. If the sequence number Ncur of the current output data is not greater than Nsend or Bsame is false, it means that the output data has been sent by master system 1 or the two results are inconsistent, then slave system 2 does not send the transmission data to external device 4; otherwise, slave system 2 sends the transmission data to external device 4 and enters step S405;
[0042] Step S405, determine whether there is any output data to be sent within the cycle; if the output data sequence number Ncur of step S404 is not equal to the maximum output data sequence number Nmax, it means that there are still messages to be sent within this cycle, and step S404 is repeated until the remaining output data to be sent within this cycle is sent; otherwise, the smooth switching task is terminated.
[0043] In one embodiment, assuming that there are 100 output data to be sent in each cycle, the master system 1 divides the 100 output data to be sent into 10 groups for sending, each group contains 10 output data, and sends a smooth switching message to the slave system 2 every time a group of output data is sent, that is, the master system 1 sends a smooth switching message to the slave system 2 every time it sends 10 output data, and the time for sending each 10 output data is 10ms. The output data smooth switching method is used to send output data, including the following steps:
[0044] Step S1, sorting 100 output data to be sent, and assigning sequence numbers 1 to 100 from small to large in the order of sending;
[0045] Step S2, initializing the smooth switching task; specifically comprising: step S211, obtaining the maximum sequence number Nmax=100 of the output data from system 2; step S212, setting the maximum sequence number Nsend in system 2 to zero; and step S202, obtaining the comparison result Bsame of the two systems;
[0046] Step S3, the master system 1 sends the first group of output data to the external device 4, the group of output data includes 10 output data, and at the same time sends a smooth switching message including the sequence number Nseq corresponding to the 10th output data in the group to the slave system 2 through the inter-system network or bus, and the output data sequence number Nseq in the first group of smooth switching messages sent is 10;
[0047] Assuming that slave 2 receives the smooth switching message sent in step S3 at time T=15ms, the following steps are performed:
[0048] S402, restart the calculation of time T, and update the received sequence number Nsend in the slave 2 to the output data sequence number Nseq=10 in the smooth switching message, that is, Nsend=Nseq=10, and enter step S403;
[0049] Step S403: Since the output data sequence number Nseq=10 in the smooth switching message is not equal to the maximum output data sequence number Nmax=100 in the slave system 2, return to step S3, i.e. continue to send the next group of 10 output data and the sequence number Nseq corresponding to the 10th output data of the group, until the output data sequence number Nseq is equal to the maximum output data sequence number Nmax=100, i.e. the master system 1 completes sending one cycle of output data;
[0050] Assume that after the master system 1 sends 3 sets of output data, the slave system 2 does not receive the smooth switching message sent by the master system 1 for more than 15ms. At this time, the receiving sequence number Nsend in the slave system 2 is 30, and the smooth switching task is executed, such as Figure 2 As shown, the following steps are included:
[0051] Step S404, slave system 2 starts to send output data to external device 4, and reads a piece of output data from the output data expected to be sent this week. The sequence number Ncur of the output data is 31, which is greater than Nsend=30 and Bsame is true, that is, the output data is a message that has not been sent by master system 1 and the sending order is correct, so slave system 2 sends the transmission data to external device 4;
[0052] Since there are still messages to be sent in this cycle, step S404 is repeated until the remaining output data to be sent in this cycle is sent, and the smooth switching task is completed.
[0053] In summary, compared with the prior art, the output data smooth switching method based on the two-by-two-out-of-two security platform provided by the present invention has the advantages of high transmission efficiency, good transmission stability, and accurate transmission data.
[0054] Although the content of the present invention has been described in detail through the above preferred embodiments, it should be appreciated that the above description should not be considered as a limitation of the present invention. After reading the above content, it will be apparent to those skilled in the art that various modifications and substitutions of the present invention will occur. Therefore, the protection scope of the present invention should be limited by the appended claims.
Claims
1. A method for smoothly switching output data based on a two-by-two-out-of-two safety platform, wherein the two-by-two-out-of-two safety platform comprises a master system and a slave system connected in communication, and both are connected in communication with an external device, and output data is sent to the external device from a data storage module connected in communication; the data storage module contains output data of multiple cycles, and each cycle contains multiple output data, characterized in that: Sending output data in each cycle includes the following steps: Step S1, defining a sequence number for each output data in each cycle; Step S2, initializing the smooth switching task per cycle; Step S2 specifically includes: Step S201, initializing the smooth switching task parameters; Step S202, obtaining the double-system comparison result Bsame; The initialization smooth switching task parameters described in step S201 include: step S211, the slave system obtains the maximum sequence number Nmax of the output data in each cycle; step S212, the receiving sequence number Nsend in the slave system is set to zero; the receiving sequence number Nsend is the maximum sequence number of the output data sent by the master system received by the slave system; The dual-system comparison described in step S202 is to perform the following operations on each output data in sequence: the master system and the slave system respectively calculate the CRC of the currently processed output data, and input the two CRCs of the output data from the master system and the slave system to the logic board for verification. If the CRC results of the master system and the slave system are the same, the dual-system comparison result Bsame of the output data is recorded as true; if the CRC results of the master system and the slave system are different, the dual-system comparison result Bsame of the output data is recorded as false. Step S3, the master system sends output data to the external device, and sends a smooth switching message including the sequence number of the output data to the slave system; Step S4, the slave system determines whether to execute the smooth switching task according to whether it receives the smooth switching message sent by the master system; if the slave system receives the smooth switching message sent by the master system, the master system sends the output data to the external device; if the slave system does not receive the smooth switching message sent by the master system, the slave system executes the smooth switching task; The judgment criteria used in step S4 are: whether the slave system receives the smooth switching message sent from the master system within time T; if the slave system receives the smooth switching message, the master system sends the output data to the external device; if the slave system does not receive the smooth switching message, the smooth switching task is executed; the value range of the time T is t≤T≤2t; The main system sending output data comprises the following steps: Step S402, restart the calculation of time T, and update the receiving sequence number Nsend in the slave system to the output data sequence number Nseq in the smooth switching message; Step S403, determine whether the output data sequence number Nseq in the smooth switching message is equal to the maximum output data sequence number Nmax in the slave system; if they are equal, it means that the output data of this cycle has been sent; if they are not equal, return to step S3; The performing of the smooth switching task includes: step S404, the slave starts to send output data to the external device, the slave reads the output data to be sent, and obtains the sequence number Ncur of the current output data; if the sequence number Ncur of the output data is not greater than Nsend or Bsame is false, the slave does not send the output data to the external device; otherwise, the slave sends the output data to the external device; The execution of the smooth switching task further includes: step S405, determining whether there is output data to be sent in the cycle; if yes, returning to step S404 until the remaining output data to be sent in the cycle is sent; if no, ending the smooth switching task; Among them, the judgment criterion for whether there is any output data to be sent within the judgment cycle described in step S405 is: whether the output data sequence number Ncur of step S404 is equal to the maximum output data sequence number Nmax; if the output data sequence number Ncur is not equal to the maximum data sequence number Nmax, it means that there is still output data to be sent within this cycle; otherwise, it means that there is no output data to be sent within this cycle.
2. The method for smooth switching of output data based on a two-by-two safety platform according to claim 1, characterized in that: In step S1, the sequence number is defined according to the following rule: according to the order in which each output data is sent in each cycle, the sequence number is assigned to each output data in ascending order.
3. The method for smooth switching of output data based on a two-by-two safety platform according to claim 1, characterized in that: In each sending cycle, a dual-system fetch-two operation is performed on each output data in the cycle to ensure the consistency of the output data sent by the master system and the slave system.
4. The method for smooth switching of output data based on a two-by-two safety platform according to claim 1, characterized in that: The specific steps of step S3 are: Divide all output data in each cycle into M groups, each group includes m output data; The main system sends one set of output data in each cycle to the external device in turn; A smooth switching message of sequence number Nseq corresponding to the mth output data in the group is sent to the slave system, and the time for the master system to send each m output data is t.
