Master-slave task synchronization method and device, controller and rail train
By identifying the master and slave status on the railcar chassis, determining the system master control status, and generating or receiving interrupt requests, the problem of poor task synchronization accuracy in the railcar redundancy system is solved, achieving high-precision master-slave task synchronization and reducing synchronization errors.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- CRRC ZHUZHOU ELECTRIC LOCOMOTIVE RESEARCH INSTITUTE CO LTD
- Filing Date
- 2023-10-16
- Publication Date
- 2026-05-05
AI Technical Summary
The existing redundant systems for rail trains suffer from poor accuracy and large errors during task synchronization, especially when synchronizing master and slave controllers, where clock loss or failure to achieve strict synchronization can easily occur.
By identifying the master and slave status on the railcar chassis, the current system master status of the controller is determined, and interrupt requests are generated or received based on the master and slave status to perform synchronization tasks, ensuring that all controllers synchronize according to the interrupt requests of the system master controller. Hardware timers are used to reduce accuracy errors.
It achieves high-precision master-slave task synchronization in redundant systems, reduces synchronization errors, and improves system reliability and synchronization accuracy.
Smart Images

Figure CN119846935B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of rail transit technology, and in particular to a master-slave task synchronization method, device, controller, and rail train. Background Technology
[0002] Currently, redundant high-reliability communication systems for rail trains such as locomotives, urban rail transit, subways, and high-speed trains often rely on individual timers for synchronization of each controller during task synchronization. This approach results in poor synchronization accuracy and introduces significant errors. For example, in the synchronization process of two controllers in a 2x2 redundancy configuration, two clocks are generated from the same clock source. If the clocks are acquired simultaneously at the clock edge, clock loss can easily occur, leading to synchronization anomalies. Conversely, acquiring the clock at the high or low level will prevent strict synchronization, resulting in the two controllers acquiring data from different moments.
[0003] Therefore, how to achieve high-precision master-slave task synchronization in redundant systems is an urgent problem to be solved. Summary of the Invention
[0004] The purpose of this invention is to provide a master-slave task synchronization method, device, controller, and track train to achieve high-precision master-slave task synchronization in redundant systems.
[0005] To address the aforementioned technical problems, this invention provides a master-slave task synchronization method, comprising:
[0006] The current controller identifies the master and slave status on the chassis of the railcar; wherein, the controller status includes the status of the controllers at each preset controller position on the chassis and the preset controller position where the current controller is located, and the current controller is any of the aforementioned controllers;
[0007] Based on the master-slave status, determine the system master status corresponding to the current controller;
[0008] If the system master control is in master control state, an interrupt request is generated at a first preset time interval, a synchronization task is processed according to the interrupt request, and the interrupt request is sent to other controllers in place so that the other controllers in place can process the synchronization task according to the interrupt request.
[0009] If the system master controller is in slave controller state, it receives an interrupt request sent by the system master controller at a second preset time interval and performs synchronization task processing according to the received interrupt request; wherein, the system master controller is any other controller in place.
[0010] In some embodiments, the current controller identifies the master-slave presence status on the railcar chassis, including:
[0011] The current controller identifies the presence status of the controllers at each of the preset controller positions;
[0012] Identify the preset controller location of the current controller based on the current controller's hardware identification number.
[0013] In some embodiments, determining the system master control status corresponding to the current controller based on the master-slave status includes:
[0014] Based on the master-slave status and the master selection priority corresponding to each preset controller position, the system master status corresponding to the current controller is determined.
[0015] In some embodiments, determining the system master control status corresponding to the current controller based on the master-slave status and the master control selection priority corresponding to each of the preset controller positions includes:
[0016] Determine whether the highest priority among the master control selection priorities corresponding to the current controller is the same as the master control selection priority corresponding to the preset controller position.
[0017] If so, then the system master control status is determined to be master control state;
[0018] If not, then it is determined that the system master control status is slave control status.
[0019] In some embodiments, the number of preset controller positions is 2, and determining whether the highest priority among the master control selection priorities corresponding to the in-place controller is the master control selection priority corresponding to the preset controller position where the current controller is located includes:
[0020] Determine whether the controllers at the two preset controller positions are both in place;
[0021] If all are in place, then determine whether the current controller's preset controller position is the preset master control position;
[0022] If it is the preset master control position, then the system master control status is determined to be master control state;
[0023] If the position is not the preset master control position, then the system master control status is determined to be slave control status;
[0024] If not all are in place, then the system master control status is determined to be master control state.
[0025] In some embodiments, the first preset time interval is the preset time interval corresponding to the preset controller position where the current controller is located; the second preset time interval is the preset time interval corresponding to the preset controller position with the highest priority among the preset controller positions corresponding to the in-place controllers.
[0026] In some embodiments, the preset time intervals corresponding to each preset controller position are different.
[0027] In some embodiments, the master control selection priority corresponding to the first preset controller position is higher than the master control selection priority corresponding to the second preset controller position, and the preset time interval corresponding to the first preset controller position is less than the preset time interval corresponding to the second preset controller position; wherein, the first preset controller position and the second preset controller position are any two preset controller positions.
[0028] In some embodiments, all the preset controller positions are sorted in descending order of their corresponding master control selection priority, and the preset time interval corresponding to the i-th preset controller position in the sorting of all the preset controller positions is (i*X) milliseconds, where X is a preset value.
[0029] In some embodiments, the preset controller position includes a preset master control position and a preset slave control position, wherein the preset master control position corresponds to a preset time interval of X milliseconds, and the preset slave control position corresponds to a preset time interval of 2X milliseconds.
[0030] In some embodiments, the signal duration of the interrupt request is 1 ns.
[0031] In some embodiments, the receiving system main controller sends an interrupt request at a second preset time interval, and performs synchronization task processing according to the received interrupt request, including:
[0032] Determine whether no interrupt request sent by the system main controller has been received within a preset time period; wherein the preset time period is greater than or equal to the second preset time interval;
[0033] If no interrupt request is received from the system main controller within the preset time period, an interrupt request is generated according to the first preset time interval, and the synchronization task is processed according to the generated interrupt request.
[0034] The present invention also provides a master-slave task synchronization device, applied to the current controller, comprising:
[0035] The presence identification module is used to identify the master and slave presence status on the chassis of the rail train; wherein, the controller presence status includes the presence status of the controllers at each preset controller position on the chassis and the preset controller position where the current controller is located, and the current controller is any of the controllers;
[0036] The master control determination module is used to determine the system master control status corresponding to the current controller based on the master-slave status.
[0037] A generation control module is used to generate an interrupt request at a first preset time interval if the system master control is in the master control state, perform synchronization task processing according to the interrupt request, and send the interrupt request to other controllers in place so that the other controllers in place can perform synchronization task processing according to the interrupt request.
[0038] The receiving control module is used to receive interrupt requests sent by the system master controller at a second preset time interval if the system master controller is in a slave controller state, and to perform synchronization task processing according to the received interrupt requests; wherein, the system master controller is any other controller in place.
[0039] The present invention also provides a controller, comprising:
[0040] Memory, used to store computer programs;
[0041] A processor is used to implement the steps of the master-slave task synchronization method as described above when executing the computer program.
[0042] In addition, the present invention also provides a rail train, including: a chassis; wherein, a controller as described above is provided at each preset controller position within the chassis.
[0043] The present invention provides a master-slave task synchronization method, comprising: the current controller identifying the master-slave presence status on the chassis of a railcar; wherein, the controller presence status includes the presence status of controllers at preset controller positions on the chassis and the preset controller position where the current controller is located, and the current controller is any controller; determining the system master control status corresponding to the current controller based on the master-slave presence status; if the system master control status is master control state, generating an interrupt request at a first preset time interval, performing synchronization task processing according to the interrupt request, and sending the interrupt request to other present controllers so that the other present controllers can perform synchronization task processing according to the interrupt request; if the system master control status is slave control state, receiving an interrupt request sent by the system master controller at a second preset time interval, and performing synchronization task processing according to the received interrupt request; wherein, the system master controller is any other present controller;
[0044] As can be seen, this invention determines the system master controller status corresponding to the current controller based on the identified master-slave status, thereby achieving automatic identification of master and slave controllers in a redundant system. By having one controller (acting as the system master controller) generate and send interrupt requests to other controllers (acting as system slave controllers), all controllers can strictly synchronize master and slave tasks according to the interrupt requests of the system master controller, improving the accuracy of master-slave task synchronization. Furthermore, this invention also provides a master-slave task synchronization device, controller, and track train, which also possess the aforementioned beneficial effects. Attached Figure Description
[0045] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on the provided drawings without creative effort.
[0046] Figure 1 A flowchart illustrating a master-slave task synchronization method provided in an embodiment of the present invention;
[0047] Figure 2 A schematic diagram of the chassis configuration for another master-slave task synchronization method provided in an embodiment of the present invention;
[0048] Figure 3 A schematic diagram of an interruption request signal for another master-slave task synchronization method provided in an embodiment of the present invention;
[0049] Figure 4 This is a structural block diagram of a master-slave task synchronization device provided in an embodiment of the present invention;
[0050] Figure 5 This is a schematic diagram of the structure of a controller provided in an embodiment of the present invention;
[0051] Figure 6 This is a schematic diagram of the structure of a computer-readable storage medium provided in an embodiment of the present invention. Detailed Implementation
[0052] To make the objectives, technical solutions, and advantages of the embodiments of the present invention clearer, the technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0053] Please refer to Figure 1 , Figure 1 This is a flowchart illustrating a master-slave task synchronization method provided in an embodiment of the present invention. The method may include:
[0054] Step 101: The current controller identifies the master and slave status on the railcar chassis; wherein, the controller status includes the status of the controllers at each preset controller position on the chassis and the preset controller position where the current controller is located, and the current controller can be any controller.
[0055] It is understood that the current controller in this embodiment can be any controller inserted and connected to any of the preset controller positions within the railcar chassis, such as... Figure 2 A controller (either main controller 1 or main controller 2) is inserted into one of two preset controller positions (main controller 1 position and main controller 2 position). In this embodiment, the preset controller positions can be positions pre-set inside the railcar chassis for setting (e.g., inserting and connecting) controllers, and one controller can be set in each preset controller position.
[0056] Correspondingly, in this embodiment, the master-slave presence status identified by the current controller can be information used to identify the master and slave controllers (i.e., the system master controller and the system slave controller) of the redundant system of the rail train. The specific content of the master-slave presence status identified by the current controller in this embodiment can be set by the designer according to the practical scenario and user requirements. For example, the master-slave presence status can include the presence status of controllers at each preset controller position on the chassis, i.e., whether the controllers at each preset controller position are in place (e.g., in place or not), to determine the number and position of controllers inserted on the chassis. The master-slave presence status can also include the preset controller position where the current controller is located, i.e., the preset controller position where the current controller itself is located, so that the current controller can determine whether it is the system master controller. The master-slave presence status can also include other information such as the identification information (e.g., hardware identification number) of each in-place controller. As long as the current controller can use the identified master-slave presence status to determine whether it is the system master controller or the system slave controller, this embodiment does not impose any restrictions on this.
[0057] It should be noted that the specific method by which the current controller identifies the master-slave presence status on the railcar chassis in this step can be set by the designer according to the practical scenario and user needs. For example, the current controller can identify the presence status of the controllers at each preset controller position; or identify the preset controller position where the current controller is located based on the hardware identification number of the current controller. For example, the current controller can compare the hardware identification number corresponding to each preset controller position (i.e., the hardware identification number of the controller in place) with the hardware identification number stored in the current controller itself, and determine the preset controller position corresponding to the stored hardware identification number as the preset controller position where the current controller is located.
[0058] Step 102: Determine the system master control status corresponding to the current controller based on the master-slave status.
[0059] In this embodiment, the system master control status corresponding to the current controller can be whether the current controller is the system master controller; that is, the system master control status can include master control status and slave control status. If the system master control status is master control status, then the current controller can be the system master controller; if the system master control status is slave control status, then the current controller can be any system slave controller.
[0060] Correspondingly, the specific method by which the current controller determines the system master status based on the master-slave status in this embodiment can be set by the designer according to the practical scenario and user needs. For example, in this embodiment, the master selection priority corresponding to each preset controller position can be preset. The current controller can determine the system master status based on the master-slave status and the master selection priority corresponding to each preset controller position. For example, if the master selection priority corresponding to the preset controller position of all present controllers is the highest, then the system master status corresponding to the current controller can be determined to be the master state, that is, the current controller is the system master controller; if the master selection priority corresponding to the preset controller position of the current controller is not the highest, then the system master status corresponding to the current controller can be determined to be the slave state, that is, the current controller is the system slave controller.
[0061] Correspondingly, the specific method for determining the system master control status of the current controller based on the master / slave status and the master control selection priority corresponding to each preset controller position can be set by the designer according to the practical scenario and user needs. For example, the current controller can determine whether the highest priority among the master control selection priorities of the in-situ controllers is the master control selection priority corresponding to the preset controller position where the current controller is located; if so, the system master control status is determined to be master control; if not, the system master control status is determined to be slave control. For example, if the number of preset controller positions is 2, that is, the preset controller positions include preset master control positions and preset slave control positions, and the master control selection priority corresponding to the preset master control position is higher than the master control selection priority corresponding to the preset slave control position, the current controller can determine whether the controllers at both preset controller positions are in place; if both are in place, it determines whether the preset controller position where the current controller is located is the preset master control position; if it is the preset master control position, it determines that the system master control status is master control state; if it is not the preset master control position (i.e., the preset slave control position), it determines that the system master control status is slave control state; if neither is in place, it determines that the system master control status is master control state, or directly generates an interrupt request according to the first preset time interval, and performs synchronization task processing according to the generated interrupt request.
[0062] Correspondingly, the current controller can also communicate with other in-place controllers and randomly select one as the system master controller. If the current controller is the system master controller, then the system master status corresponding to the current controller is determined to be master control; if the current controller is the system slave controller, then the system master status corresponding to the current controller is determined to be slave control. This embodiment does not impose any restrictions on this.
[0063] Step 103: If the system master control is in master control mode, an interrupt request is generated at the first preset time interval, the synchronization task is processed according to the interrupt request, and the interrupt request is sent to other controllers in place so that the other controllers in place can process the synchronization task according to the interrupt request.
[0064] It is understandable that in this step, the current controller can be in the master state when the system is in master control mode, that is, when the current controller is the master controller of the system, it generates an interrupt request according to the first preset time interval and sends the interrupt request to the other controllers in place (that is, the controllers in place other than the current controller), so that all controllers in place can perform synchronous task processing according to the interrupt request triggered by the first preset time interval, that is, the other controllers in place act as system slave controllers.
[0065] Correspondingly, the specific value of the first preset time interval in this embodiment can be set by the designer according to the practical scenario and user needs. For example, in this embodiment, the preset time interval corresponding to each preset controller position can be preset, that is, the first preset time interval can be the preset time interval corresponding to the preset controller position where the current controller is located; for example, the preset time interval corresponding to each preset controller position can be set according to the master control selection priority corresponding to each preset controller position. If the master control selection priority is higher, the preset time interval is smaller; that is, when the master control selection priority corresponding to the first preset controller position is higher than the master control selection priority corresponding to the second preset controller position, the preset time interval corresponding to the first preset controller position can be less than the preset time interval corresponding to the second preset controller position; where the first preset controller position and the second preset controller position are any two preset controller positions.
[0066] Correspondingly, the preset time interval corresponding to each preset controller position can be an integer multiple of X milliseconds. For example, if the preset time intervals corresponding to all preset controller positions are different, all preset controller positions are sorted in descending order of their corresponding master control selection priorities. The preset time interval corresponding to the i-th preset controller position in the sorted sequence is (i*X) milliseconds, where X is a preset value (e.g., 5), and i is a positive integer greater than or equal to 1. That is, the preset time interval of the preset controller position corresponding to the highest priority master control selection priority can be X milliseconds, the preset time interval of the preset controller position corresponding to the second highest priority master control selection priority can be 2X milliseconds, and the preset time interval of the preset controller position corresponding to the third highest priority master control selection priority can be 3X milliseconds.
[0067] like Figure 2 and Figure 3 As shown, the preset controller position is 2, meaning that when the preset controller position includes the preset master control position (master control 1 position) and the preset slave control position (master control 2 position), the preset time interval corresponding to the preset master control position is X milliseconds, and the preset time interval corresponding to the preset slave control position is 2X milliseconds. If the current controller (master control 1) is set at the master control 1 position, master control 1 can act as the system master controller, and the time interval of the IRQ (Interrupt Request) of master control 1 (i.e., the first preset time interval) can be X ms. When the current controller (master control 2) is set at the master control 2 position and master control 1 is not set at the master control 1 position, master control 2 can act as the system master controller, and the time interval of the IRQ of master control 2 (i.e., the first preset time interval) can be 2X ms.
[0068] Accordingly, this embodiment does not limit the specific signal timing of the interrupt request, such as Figure 3 As shown, the signal time for the interrupt request is 1 nanosecond (ns) so that the interrupt time can be on the order of nanoseconds; the signal time for the interrupt request is 1 microsecond (µs), and this embodiment does not impose any restrictions on this.
[0069] It should be noted that the specific method by which the current controller performs synchronization task processing according to the interrupt request in this embodiment, that is, the specific synchronization task processing process performed by the current controller each time a generated interrupt request is generated, can be set by the designer. If the same or similar method as the synchronization task processing method of the controller in the prior art is used, this embodiment does not impose any restrictions on this.
[0070] Furthermore, in this embodiment, the first preset time interval can be the time of hardware timing, such as the time of the current controller using its hardware timer to time the interrupt interval using hardware, thereby reducing the accuracy error of master-slave task synchronization and making the accuracy error less than 30ns.
[0071] Step 104: If the system master controller is in slave controller state, then receive the interrupt request sent by the system master controller at the second preset time interval, and perform synchronization task processing according to the received interrupt request; wherein, the system master controller is any other controller in place.
[0072] It is understandable that in this step, the current controller can be in a slave state when the system is in master control mode, that is, when the current controller is the system slave controller, it can receive the interrupt request sent by the system master controller at the second preset time interval, so that all controllers in place can perform synchronous task processing according to the interrupt request triggered at the second preset time interval.
[0073] Correspondingly, the specific value of the second preset time interval in this embodiment can be set in a similar manner to the first preset time interval. For example, in this embodiment, a preset time interval can be preset for each preset controller position. The preset time interval for each preset controller position is set according to the master control selection priority corresponding to each preset controller position. If the master control selection priority is higher, the preset time interval is smaller. Therefore, the second preset time interval can be the preset time interval corresponding to the preset controller position with the highest master control selection priority among the preset controller positions of the in-situ controllers. Figure 2 and Figure 3 As shown, when the current controller (master controller 2) is set at the master controller 2 position and the master controller 1 is set at the master controller 1 position, the current controller can act as a system slave controller, receive IRQs sent by the master controller 1 at intervals of Xms (i.e., the second preset time interval), and perform synchronization task processing according to the IRQs received every Xms.
[0074] Furthermore, in this embodiment, the current controller, acting as a system slave controller, receives interrupt requests sent by the system master controller at a second preset time interval. During the synchronization task processing based on the received interrupt requests, it can also detect whether the synchronization signal (i.e., interrupt request) of the system master controller is abnormal. If the interrupt request of the system master controller is abnormal, it can use its own generated interrupt request to complete the synchronization task processing. For example, the current controller can determine whether it has not received an interrupt request sent by the system master controller within a preset time period. If it has not received an interrupt request sent by the system master controller within the preset time period, it generates an interrupt request at a first preset time interval and performs synchronization task processing based on the generated interrupt request. The preset time period is greater than or equal to the second preset time interval. For example, the preset time period can be Y times the second preset time interval. That is, if the current controller does not detect an interrupt request sent by the system master controller for Y consecutive second preset time intervals, it can determine that the interrupt request of the system master controller is abnormal and generate an interrupt request at the first preset time interval, performing synchronization task processing based on the generated interrupt request. Figure 2 and Figure 3 As shown, when the current controller (master controller 2) is set to the master controller 2 position and the master controller 1 is set to the master controller 1 position, if the current controller does not detect the interrupt request of the master controller 1 for Y consecutive Xms (e.g., 5ms), the current controller can no longer trust the interrupt request of the master controller 1 and can generate interrupt requests at intervals of 2Xms (e.g., 10ms). At this time, the synchronization of the master and slave controllers of the redundant system will no longer be strict synchronization, but master controller 1 and master controller 2 will synchronize at regular intervals.
[0075] Correspondingly, when the number of in-situ controllers is greater than or equal to 3, the current controller can also perform synchronization task processing according to the interrupt request of the third preset time interval when an abnormality occurs in the interrupt request of the system master controller; the third preset time interval can be the preset time interval corresponding to the preset controller position with the second highest priority among the preset controller positions corresponding to the in-situ controllers. This embodiment does not impose any limitations on this.
[0076] In this embodiment, the present invention determines the system master controller status corresponding to the current controller based on the identified master-slave status, thereby achieving automatic identification of master-slave controllers in a redundant system. By having one controller acting as the system master controller generate and send interrupt requests to other controllers acting as system slave controllers, all controllers can perform strict master-slave task synchronization according to the interrupt requests of the system master controller, thus improving the accuracy of master-slave task synchronization.
[0077] Corresponding to the above method embodiments, this invention also provides a master-slave task synchronization device. The master-slave task synchronization device described below and the master-slave task synchronization method described above can be referred to in correspondence.
[0078] Please refer to Figure 4 , Figure 4 This is a structural block diagram of a master-slave task synchronization device provided in an embodiment of the present invention. The device is applied to a current controller and may include:
[0079] The presence identification module 10 is used to identify the master and slave presence status on the chassis of the rail train; wherein, the controller presence status includes the presence status of the controllers at each preset controller position on the chassis and the preset controller position where the current controller is located, and the current controller is any controller.
[0080] The master control determination module 20 is used to determine the system master control status corresponding to the current controller based on the master and slave status.
[0081] The generation control module 30 is used to generate an interrupt request at a first preset time interval if the system master control is in the master control state, perform synchronization task processing according to the interrupt request, and send the interrupt request to other controllers in place so that the other controllers in place can perform synchronization task processing according to the interrupt request.
[0082] The receiving control module 40 is used to receive interrupt requests sent by the system master controller at a second preset time interval if the system master controller is in a slave controller state, and to perform synchronization task processing according to the received interrupt requests; wherein, the system master controller is any other controller in place.
[0083] In some embodiments, the in-situ identification module 10 may include:
[0084] The in-situ identification submodule is used by the current controller to identify the in-situ status of the controllers at each preset controller position;
[0085] The location identification submodule is used to identify the preset controller location of the current controller based on the hardware identification number of the current controller.
[0086] In some embodiments, the master control determination module 20 may be specifically used to determine the system master control status corresponding to the current controller based on the master and slave status and the master control selection priority corresponding to each preset controller position.
[0087] In some embodiments, the master control determination module 20 may include:
[0088] The priority judgment submodule is used to determine whether the highest priority among the master control selection priorities corresponding to the current controller is the same as the master control selection priority corresponding to the preset controller position. If yes, the system master control status is determined to be master control state; otherwise, the system master control status is determined to be slave control state.
[0089] In some embodiments, the number of preset controller positions is 2. The priority determination submodule can be specifically used to determine whether the controllers at the two preset controller positions are both in place; if both are in place, then determine whether the preset controller position where the current controller is located is a preset master control position; if it is a preset master control position, then determine that the system master control status is master control state; if it is not a preset master control position, then determine that the system master control status is slave control state; if neither is in place, then determine that the system master control status is master control state.
[0090] In some embodiments, the first preset time interval is the preset time interval corresponding to the preset controller position where the current controller is located; the second preset time interval is the preset time interval corresponding to the preset controller position with the highest priority among the preset controller positions corresponding to the in-place controllers.
[0091] In some embodiments, the preset time intervals corresponding to each preset controller position are different.
[0092] In some embodiments, the master control selection priority corresponding to the first preset controller position is higher than the master control selection priority corresponding to the second preset controller position, and the preset time interval corresponding to the first preset controller position is less than the preset time interval corresponding to the second preset controller position; wherein, the first preset controller position and the second preset controller position are any two preset controller positions.
[0093] In some embodiments, all preset controller positions are sorted in descending order of their corresponding master control selection priority. The preset time interval corresponding to the i-th preset controller position in the sorting of all preset controller positions is (i*X) milliseconds, where X is a preset value.
[0094] In some embodiments, the preset controller position includes a preset master control position and a preset slave control position, the preset time interval corresponding to the preset master control position is X milliseconds, and the preset time interval corresponding to the preset slave control position is 2X milliseconds.
[0095] In some embodiments, the signal duration for the interrupt request is 1 ns.
[0096] In some embodiments, the receiving control module 40 may include:
[0097] The anomaly detection submodule is used to determine whether an interrupt request sent by the system main controller has not been received within a preset time period; wherein the preset time period is greater than or equal to a second preset time interval.
[0098] The abnormal synchronization submodule is used to generate an interrupt request at a first preset time interval if no interrupt request is received from the system main controller within a preset time period, and to perform synchronization task processing according to the generated interrupt request.
[0099] In this embodiment, the present invention uses the master control determination module 20 to determine the system master control status corresponding to the current controller based on the identified master and slave status, thereby realizing the automatic identification of master and slave controllers in a redundant system. By having one controller acting as the system master controller generate and send interrupt requests to other controllers acting as system slave controllers, all controllers can perform strict master-slave task synchronization according to the interrupt requests of the system master controller, thus improving the accuracy of master-slave task synchronization.
[0100] Corresponding to the above method embodiments, this invention also provides a controller. The controller described below and the master-slave task synchronization method described above can be referred to in correspondence.
[0101] Please refer to Figure 5 , Figure 5 This is a schematic diagram of a controller provided in an embodiment of the present invention. The controller may include:
[0102] Memory D1 is used to store computer programs;
[0103] Processor D2 is used to implement the steps of the master-slave task synchronization method provided in the above method embodiments when executing a computer program.
[0104] Corresponding to the above method embodiments, this invention also provides a rail train, and the master-slave task synchronization method described above for the rail train described below can be referred to in correspondence with each other.
[0105] A rail train includes: a chassis; wherein, controllers as provided in the previous embodiment are installed at each preset controller position within the chassis.
[0106] Corresponding to the above method embodiments, this invention also provides a computer-readable storage medium. The computer-readable storage medium described below can be referred to in conjunction with the master-slave task synchronization method described above.
[0107] Please refer to Figure 6 , Figure 6This is a schematic diagram of a computer-readable storage medium provided in an embodiment of the present invention. The computer-readable storage medium 50 stores a computer program 51, which, when executed by a processor, implements the steps of the master-slave task synchronization method provided in the above-described method embodiment.
[0108] The computer-readable storage medium 50 can be any storage medium capable of storing program code, such as a USB flash drive, portable hard drive, read-only memory (ROM), random access memory (RAM), magnetic disk, or optical disk.
[0109] The various embodiments in this specification are described in a progressive manner, with each embodiment focusing on its differences from other embodiments. Similar or identical parts between embodiments can be referred to interchangeably. For the apparatus, controller, railcar, and computer-readable storage medium disclosed in the embodiments, since they correspond to the methods disclosed in the embodiments, the descriptions are relatively simple; relevant parts can be referred to in the method section.
[0110] The foregoing has provided a detailed description of a master-slave task synchronization method, apparatus, controller, and rail train provided by the present invention. Specific examples have been used to illustrate the principles and implementation methods of the invention. The descriptions of the embodiments above are merely for the purpose of helping to understand the method and core ideas of the present invention. It should be noted that those skilled in the art can make various improvements and modifications to the present invention without departing from its principles, and these improvements and modifications also fall within the protection scope of the claims of the present invention.
Claims
1. A master-slave task synchronization method, characterized in that, include: The current controller identifies the master and slave status on the chassis of the railcar; wherein, the controller status includes the status of the controllers at each preset controller position on the chassis and the preset controller position where the current controller is located, and the current controller is any controller inserted and connected at each preset controller position inside the chassis of the railcar. Based on the master-slave status, determine the system master status corresponding to the current controller; If the system master control is in master control state, an interrupt request is generated at a first preset time interval, a synchronization task is processed according to the interrupt request, and the interrupt request is sent to other controllers in place so that the other controllers in place can process the synchronization task according to the interrupt request. If the system master controller is in slave controller state, then the system master controller receives an interrupt request sent at a second preset time interval and performs synchronization task processing according to the received interrupt request; wherein, the system master controller is any other controller in place. The first preset time interval is the preset time interval corresponding to the preset controller position where the current controller is located; the second preset time interval is the preset time interval corresponding to the preset controller position with the highest master control selection priority among the preset controller positions corresponding to the in-place controllers; the preset time intervals corresponding to each preset controller position are different; the master control selection priority corresponding to the first preset controller position is higher than the master control selection priority corresponding to the second preset controller position, and the preset time interval corresponding to the first preset controller position is less than the preset time interval corresponding to the second preset controller position; wherein, the first preset controller position and the second preset controller position are any two preset controller positions.
2. The master-slave task synchronization method according to claim 1, characterized in that, The current controller identifies the master-slave presence status on the railcar chassis, including: The current controller identifies the presence status of the controllers at each of the preset controller positions; Identify the preset controller location of the current controller based on the current controller's hardware identification number.
3. The master-slave task synchronization method according to claim 1, characterized in that, The step of determining the system master control status corresponding to the current controller based on the master-slave status includes: Based on the master-slave status and the master selection priority corresponding to each preset controller position, the system master status corresponding to the current controller is determined.
4. The master-slave task synchronization method according to claim 3, characterized in that, The step of determining the system master control status corresponding to the current controller based on the master-slave status and the master control selection priority corresponding to each of the preset controller positions includes: Determine whether the highest priority among the master control selection priorities corresponding to the current controller is the same as the master control selection priority corresponding to the preset controller position. If so, then the system master control status is determined to be master control state; If not, then it is determined that the system master control status is slave control status.
5. The master-slave task synchronization method according to claim 4, characterized in that, The number of preset controller positions is 2. The step of determining whether the highest priority among the master control selection priorities corresponding to the currently located controller is the same as the master control selection priority corresponding to the preset controller position includes: Determine whether the controllers at both preset controller positions are in place; If all are in place, then determine whether the current controller's preset controller position is the preset master control position; If it is the preset master control position, then the system master control status is determined to be master control state; If the position is not the preset master control position, then the system master control status is determined to be slave control status; If not all are in place, then the system master control status is determined to be master control state.
6. The master-slave task synchronization method according to claim 1, characterized in that, All the preset controller positions are sorted in descending order of their corresponding master controller selection priority. The preset time interval corresponding to the i-th preset controller position in the sorting of all the preset controller positions is (i X) milliseconds, where X is a preset value.
7. The master-slave task synchronization method according to claim 6, characterized in that, The preset controller position includes a preset master control position and a preset slave control position. The preset time interval corresponding to the preset master control position is X milliseconds, and the preset time interval corresponding to the preset slave control position is 2X milliseconds.
8. The master-slave task synchronization method according to claim 1, characterized in that, The signal duration for the interrupt request is 1 ns.
9. The master-slave task synchronization method according to any one of claims 1 to 8, characterized in that, The receiving system main controller sends interrupt requests at a second preset time interval, and performs synchronization task processing according to the received interrupt requests, including: Determine whether no interrupt request sent by the system main controller has been received within a preset time period; wherein the preset time period is greater than or equal to the second preset time interval; If no interrupt request is received from the system main controller within the preset time period, an interrupt request is generated according to the first preset time interval, and the synchronization task is processed according to the generated interrupt request.
10. A master-slave task synchronization device, characterized in that, Applied to the current controller, including: The presence identification module is used to identify the master and slave presence status on the chassis of the rail train; wherein, the controller presence status includes the presence status of the controllers at each preset controller position on the chassis and the preset controller position where the current controller is located, and the current controller is any controller inserted and connected at each preset controller position in the chassis of the rail train. The master control determination module is used to determine the system master control status corresponding to the current controller based on the master-slave status. A generation control module is used to generate an interrupt request at a first preset time interval if the system master control is in the master control state, perform synchronization task processing according to the interrupt request, and send the interrupt request to other controllers in place so that the other controllers in place can perform synchronization task processing according to the interrupt request. The receiving control module is used to receive interrupt requests sent by the system master controller at a second preset time interval if the system master controller is in a slave controller state, and to perform synchronization task processing according to the received interrupt requests; wherein, the system master controller is any other controller in place; The first preset time interval is the preset time interval corresponding to the preset controller position where the current controller is located; the second preset time interval is the preset time interval corresponding to the preset controller position with the highest master control selection priority among the preset controller positions corresponding to the in-place controllers; the preset time intervals corresponding to each preset controller position are different; the master control selection priority corresponding to the first preset controller position is higher than the master control selection priority corresponding to the second preset controller position, and the preset time interval corresponding to the first preset controller position is less than the preset time interval corresponding to the second preset controller position; wherein, the first preset controller position and the second preset controller position are any two preset controller positions.
11. A controller, characterized in that, include: Memory, used to store computer programs; A processor, configured to implement the steps of the master-slave task synchronization method as described in any one of claims 1 to 9 when executing the computer program.
12. A rail train, characterized in that, include: A chassis; wherein, the controller as described in claim 11 is provided at each preset controller position within the chassis.
Citation Information
Patent Citations
Wireless synchronization method, wireless slave, wireless host and wireless synchronization system
CN109586832A
Double-control master-slave switching implementation method based on VPX architecture
CN114385254A
Master / slave system, control device, master / slave switching method and master / slave switching program
JP2013025765A