State machine processing method of quantum optical switch

By designing a state machine processing method in the quantum optical switch, using dog feeding programs and mutex locks, the closed-loop jump and backup link of the state machine are realized, which solves the problems of non-closed-loop state machine processing and lack of timeout judgment in the existing technology. , ensuring that the system automatically recovers and handles abnormal situations, improving system reliability and performance.

CN118632151APending Publication Date: 2024-09-10NAT QUANTUM COMM (GUANGDONG) CO LTD
View PDF 0 Cites 1 Cited by

Patent Information

Application Number
CN202410845395.9
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-06-27
Publication Date
2024-09-10

AI Technical Summary

Technical Problem

The existing quantum switch state machine processing method has state jumps that are not closed loops, and lacks timeout judgment and backup connections, resulting in the system being unable to automatically recover and process under abnormal circumstances.

Method used

Design a state machine processing method for quantum optical switches, use a new thread to design a dog feeding program for the state machine, cycle through the state table according to a time cycle, determine the state type and the state in the state machine structure, and set the state machine mutex lock and The timer implements state transition logic and backup links to ensure that the system automatically switches to the backup server when the main server fails.

Benefits of technology

It realizes the closed-loop jump of the state machine, automatically handles link failure and reconnection, ensures the normal operation of the system, avoids multi-thread conflicts and deadlocks, and improves the reliability and performance of the system.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118632151A
    Figure CN118632151A
Patent Text Reader

Abstract

The invention discloses a state machine processing method of a quantum optical switch. The state machine processing method comprises the following steps: designing multiple state types of a state machine; designing a state structure body conforming to various state types; designing a state machine structural body for scheduling and switching the state types; designing conversion logic for scheduling and switching the state of the state machine; designing an execution function of each state type; when the state type is changed, executing an execution function corresponding to the current state type; and setting a state machine mutual exclusion lock which is used for locking that only one program process can be operated at the same time. The backup link is arranged, when the main server fails, the main server can be automatically connected to the backup server, and it is ensured that the system is in a normal working state; all the functions are driven by the state machine to be started, the state machine is provided with a timer, overtime judgment is conducted on the functions, when operation is executed overtime, the timer jumps out of the state, the overtime is automatically processed and reported to the network management system, and the system is prevented from being stuck.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of state machine processing, and in particular to a state machine processing method for a quantum optical switch. Background Art

[0002] The state machine is composed of state registers and combinational logic circuits. It can transfer states according to pre-set states based on control signals. It is the control center that coordinates related signal actions and completes specific operations. Generally speaking, state machines are divided into Moore-type state machines and Mealy-type state machines.

[0003] Some objects in the system are state-driven, and their behavior is closely related to their state. Generally, such objects are modeled as state machines. When implementing a state machine, it is inevitable to perform a series of state identification, conversion, and processing. If the state machine has enough states, the class that implements the state machine will become quite bloated, and the code will become increasingly difficult to understand. When the requirements change or new functions are added, it becomes very difficult to modify such a class. Testing such a class is very cumbersome, especially after modifying the state class, regression is also very difficult.

[0004] The switch state management method in the SDN controller of the state machine of the quantum switch in the prior art defines 9 switch states including the initial state, TCP connection establishment success state, version negotiation success state, normal working state, unreachable state, connection disconnection state, power-off state, offline state and closed state, and defines a migration method for the above 9 switch states driven by multiple conditions including heartbeat interaction failure, TCP connection disconnection and power-off detection success, and defines multiple events of the anti-switch when different states change.

[0005] At present, most of the existing solutions to this problem use judgment branches or selection branches for processing. The algorithm logic of this solution is relatively simple, but each function jump requires multiple judgments and function calls, which is not conducive to improving performance and does not handle exceptions well. The approach uses the same processing method as the switch in the solution, realizing function jumps by state jumps, and jumping to other states when an exception occurs.

[0006] There are some shortcomings in the existing processing methods of quantum switch state machines: the state jump does not form a closed-loop jump, and the system cannot be automatically restarted after being shut down to ensure the normal operation of the switch; there is no timeout judgment for each state, and corresponding processing may not be possible in the event of an abnormal situation; there is no backup connection in the existing solution.

[0007] Therefore, it is necessary to improve the state machine processing method of the existing quantum switch to solve the defects of the existing technology. Summary of the invention

[0008] In order to solve the above technical problems, a state machine processing method for a quantum optical switch with good effect and high processing result accuracy is proposed.

[0009] To achieve the above purpose, the technical solution adopted by the present invention is as follows: a state machine processing method of a quantum optical switch, using a new thread to design a dog feeding program for the state machine, looping through the state table according to a time period, and judging the state type and the state in the state machine structure. The method includes the following steps:

[0010] Step 1: Design multiple state types of the state machine;

[0011] Step 2: Design a state structure that meets the various state types described in step 1;

[0012] Step 3: Design a state machine structure for scheduling and switching the state type;

[0013] Step 4: Designing conversion logic for scheduling and switching the state of the state machine;

[0014] Step 5: Design the execution function for each state type;

[0015] Step 6: When the state type changes, the latest state type is written into the current state in the state machine structure. The system loops through the state table according to the time period to determine whether the state type is consistent with the state in the state machine structure. If they are consistent, the state jump is completed and the execution function corresponding to the current state type is executed;

[0016] Step 7: Set up a state machine mutex lock that can only operate one program process at a time;

[0017] Step 8: Create a new thread to design a dog feeding program for the state machine and perform the dog feeding process regularly.

[0018] Preferably, the status types in step 1 include but are not limited to: self-check, initialization, connecting to server, logging into server, connecting to backup server, logging into backup server, logging out of server and normal link status;

[0019] Any state includes five sub-states: start, wait, success, failure and timeout.

[0020] Preferably, the state structure in step 2 includes but is not limited to a state name, a state identifier, a state processing function pointer and a timeout period, and each state structure corresponds to a state type.

[0021] Preferably, the state machine structure includes but is not limited to the current state machine name, the current state, the timer id, the heartbeat timer id, the state machine mutex and the state table.

[0022] Preferably, the conversion logic includes initialization jump to connection server startup process conversion logic, main server connection failure jump to connection backup startup process conversion logic, server connection successful jump to server login process conversion logic and backup server connection successful jump to backup server login process conversion logic.

[0023] Preferably, the conversion logic includes initialization jump to the connection server startup process conversion logic content:

[0024] Establish a socket connection to the server and jump to the connection success or connection failure state according to the connection status;

[0025] If the connection is successful, jump to the login startup state to log in to the server;

[0026] Set a timer, the maximum single connection time is T seconds, if the timer is completed and still not reset, it is considered a connection timeout;

[0027] After the connection times out, retry the connection. If the number of retries is greater than N times, the primary server is considered to have failed and the connection to the backup server is jumped.

[0028] Preferably, the logic content of the transition from the primary server connection failure to the backup connection startup process is as follows:

[0029] Establish a socket connection to the backup server and jump to the connection backup success or connection backup failure state according to the connection status;

[0030] If the backup connection is successful, the program will jump to the backup startup state to log in to the backup server;

[0031] The connection status is determined as follows:

[0032] Set a timer, the maximum single connection time is T seconds, if the timer is completed and still not reset, it is considered as a connection backup timeout;

[0033] If the connection to the backup server times out, the connection will be retried. If the number of retries is greater than N times, the backup server is considered to have failed and the connection to the primary server will be redirected.

[0034] Preferably, the connection to the server successfully jumps to the server login process conversion logic content as follows:

[0035] Send a login request message frame to the server and jump to the login waiting state;

[0036] Set a timer to count, the maximum single login time is T seconds, and if no response frame is received from the server at the end of the timer, jump to login timeout;

[0037] When the login times out, the system will automatically re-login. If the number of retries exceeds N, the server is considered unavailable and the system will jump to the backup server.

[0038] If a response frame is received, the state will jump to login success according to the response frame result. If login success, the state will jump to link normal status.

[0039] Preferably, the connection backup server successfully jumps to the login backup server process conversion logic sends a login request message frame to the backup server and jumps to the login backup waiting state;

[0040] Set a timer to count, the maximum single login time is T seconds, and if no response frame is received from the server at the end of the timer, jump to login backup timeout;

[0041] If the backup login times out, the system will automatically re-login. If the login is retried more than N times, the backup server is considered unavailable and the system will be redirected to the main server.

[0042] If a response frame is received, the state will jump to login backup success according to the response frame result. If login backup success, the state will jump to link normal status.

[0043] Preferably, the value range of T is 2-10; the value range of N is 5-10.

[0044] Preferably, the execution function is stored in the structure of each state in the form of a function pointer.

[0045] Beneficial technical effects of the present invention:

[0046] The present invention sets up a backup link, which can automatically connect to the backup server when the main server fails, ensuring that the system is in normal working state. The state machine jumps in a closed loop. When the link fails, the logout operation is automatically performed. After the logout is completed, the server is reconnected to form a link connection closed loop.

[0047] The state machine sets a mutex lock and locks it before querying or setting the status to prevent multiple programs from querying or setting the state machine at the same time, causing confusion in the system's operating status. This ensures the accuracy of the state machine each time, and adds a dog feeding program to monitor the state machine to avoid errors in the entire system. BRIEF DESCRIPTION OF THE DRAWINGS

[0048] Figure 1 This is a flow chart of the steps of a state machine processing method of a quantum optical switch of the present invention;

[0049] Figure 2 It is a principle block diagram of the large state jump logic in the method of the present invention;

[0050] Figure 3It is a principle block diagram of the self-check program startup conversion logic in the method of the present invention;

[0051] Figure 4 It is a principle block diagram of the module initialization conversion logic in the method of the present invention;

[0052] Figure 5 It is a logic principle block diagram of the conversion process of initialization jump to connection server startup in the method of the present invention;

[0053] Figure 6 It is a logic principle block diagram of the conversion process of jumping to the backup connection startup process when the main server connection fails in the method of the present invention;

[0054] Figure 7 It is a logic principle block diagram of the conversion process of successfully connecting to the server and jumping to the server login process in the method of the present invention;

[0055] Figure 8 It is a logic principle block diagram of the conversion process of successfully jumping from connecting to a backup server to logging into a backup server in the method of the present invention;

[0056] Fig. 9 It is a principle block diagram of the startup state of the execution function in the method of the present invention;

[0057] Fig.10 It is a principle block diagram of the waiting state of executing a function in the method of the present invention;

[0058] Fig.11 It is a principle block diagram of the successful state of executing a function in the method of the present invention;

[0059] Fig.12 It is a principle block diagram of the failure / timeout state of executing a function in the method of the present invention. DETAILED DESCRIPTION

[0060] In order to make the purpose, technical solutions and advantages of the present invention more clearly understood, the present invention is further described in detail below in conjunction with embodiments, but the scope of protection claimed in the present invention is not limited to the following specific embodiments.

[0061] In this embodiment, the quantum optical switch uses a state machine to perform state jumps, automatically performs self-checks and initialization operations from the start of power-on, connects the link after confirming that the system is operating normally, and automatically closes and reconnects the link after the link is lost, completing the necessary operations for system operation.

[0062] Specifically, Figure 1 As shown, a state machine processing method of a quantum optical switch comprises the following steps:

[0063] Step 1: Design multiple state types of the state machine;

[0064] Step 2: Design a state structure that meets the various state types described in step 1;

[0065] Step 3: Design a state machine structure for scheduling and switching the state type;

[0066] Step 4: Designing conversion logic for scheduling and switching the state of the state machine;

[0067] Step 5: Design the execution function for each state type;

[0068] Step 6: When the state type changes, the latest state type is written into the current state in the state machine structure. The system loops through the state table according to the time period to determine whether the state type is consistent with the state in the state machine structure. If they are consistent, the state jump is completed and the execution function corresponding to the current state type is executed;

[0069] Step 7: Set up a state machine mutex lock that can only operate one program process at a time;

[0070] Step 8: Create a new thread to design a dog feeding program for the state machine and perform the dog feeding process regularly.

[0071] Specifically, the status types in step 1 include but are not limited to: self-check, initialization, connecting to server, logging into server, connecting to backup server, logging into backup server, logging out of server and normal link status;

[0072] Any state includes five small states: startup, waiting, success, failure and timeout. The above states can realize the self-check of the quantum switch after it is turned on. After the self-check is completed, the device is initialized according to the configuration file, and the server is connected and logged in. The server and other functions will be automatically jumped to the corresponding processing function when an error occurs.

[0073] Preferably, the state structure in step 2 includes but is not limited to a state name, a state identifier, a state processing function pointer and a timeout period, and each state structure corresponds to a state type. It contains important information of each state, and these structure members form an array, i.e., the state table of the state machine, and the state structure is obtained by traversing the state table, thereby obtaining the current state information and the state processing function, etc.

[0074] Preferably, the state machine structure in step 3 includes but is not limited to the current state machine name, current state, timer id, heartbeat timer id, state machine mutex and state table.

[0075] Preferably, the conversion logic in step 4 includes a large state jump logic and a small state jump logic, wherein: Figure 2As shown in the figure, the logic of large state jump is: after the system is turned on, it first enters the self-check state, checks each module, and performs error handling operations such as resetting, repairing, and reporting the module according to the self-check results. After the self-check is completed, it enters the device initialization, reads the corresponding configuration file to initialize each state module. After the initialization is successful, connect and log in to the server to form a stable and reachable link. When the connection and login errors occur, it automatically jumps to the timeout / failure state of its own state. When the link times out, it automatically logs out and reconnects.

[0076] The small state jump logic includes the self-test program startup conversion logic, the module initialization conversion logic, the initialization jump to the connection server startup process conversion logic, the main server connection failure jump to the connection backup startup process conversion logic, the server connection success jump to the server login process conversion logic and the backup server connection success jump to the backup server login process conversion logic.

[0077] Specifically, Figure 3 As shown, the self-test is the first state that the quantum optical switch enters after it is powered on. The small state jump logic of the self-test program starting the conversion logic is as follows:

[0078] After the system is running, it runs in the self-test startup state, notifies the self-test process to perform the self-test procedure, and the state machine jumps to the self-test waiting state. After the self-test is completed, if the self-test is successful, the self-test process controls the jump to the self-test success state, and the self-test success state jumps to the initialization startup state. If it fails, it jumps to the self-test failure and performs corresponding operations on the failed items. At the same time, the timer is set. The maximum self-test time of each module is 3s. The timer is reset after the self-test of each module is completed. If the timer is completed and the timing is not reset, it is judged as a self-test timeout. After the timeout, the switch is reinitialized, and the log is written and reported to the network management system. The self-test is re-performed. The maximum number of self-test retries is 3 times. If it exceeds three times, the switch startup fails, reports to the network management system and suspends the switch.

[0079] like Figure 4 As shown, after the self-test is completed, the module is initialized. The module initialization conversion logic is as follows:

[0080] After the self-check is completed, it jumps to the initialization startup, notifies the initialization process to obtain the configuration file content and initialize the device, and the state machine jumps to the initialization wait, and the initialization process controls the jump to the initialization success or initialization failure. At the same time, the timer is set, and the maximum initialization time is 10s. When the timer is completed and the timing is not reset, it is judged as an initialization timeout. After the timeout, re-initialization is performed and the abnormal situation is reported to the network management system. After the initialization is successful, it jumps to the connection state to connect to the server according to the configuration file.

[0081] Specifically, Figure 5 As shown, the initial jump to the connection server startup process conversion logic content is:

[0082] Establish a socket connection to the server and jump to the connection success or connection failure state according to the connection status;

[0083] If the connection is successful, jump to the login startup state to log in to the server;

[0084] A timer is set, and the maximum single connection time is T seconds. If the timer is not reset after the timer is completed, it is determined that the connection has timed out; after the connection timeout, the connection is retried. If the number of retries is greater than N times, it is considered that the primary server has failed and the connection is jumped to the backup server. In this embodiment, the timer is set, and the maximum single connection time is 3s, and the maximum number of retries is 6 times.

[0085] Specifically, Figure 6 As shown, the logic of the transition from the primary server connection failure to the backup connection startup process is as follows:

[0086] Establish a socket connection to the backup server and jump to the connection backup success or connection backup failure state according to the connection status;

[0087] If the backup connection is successful, the program will jump to the backup startup state to log in to the backup server;

[0088] The connection status is determined as follows: a timer is set, and the maximum value of a single connection time is T seconds. If the timer is not reset after the timer is completed, it is determined that the connection backup has timed out; if the connection backup has timed out, the connection is retried. If the number of retries is greater than N times, it is considered that the backup server has failed and the connection to the main server is re-jumped. In this embodiment, the timer is set, the maximum value of a single connection time is 3s, and the maximum number of retries is 6 times.

[0089] Specifically, Figure 7 As shown, the connection to the server successfully jumps to the server login process conversion logic content is as follows:

[0090] Send a login request message frame to the server and jump to the login waiting state;

[0091] Set a timer to count, the maximum single login time is T seconds, and if no response frame is received from the server at the end of the timer, jump to login timeout;

[0092] When the login times out, the server will be automatically re-logged in. When the login is retried more than N times, the server is considered unavailable, and the connection will be redirected to the backup server. If a response frame is received, the connection will be redirected to the successful login according to the response frame result. If the login is successful, the connection will be redirected to the normal link state. In this embodiment, a timer is set, the maximum single connection time is 3s, and the maximum number of retries is 3 times.

[0093] Specifically, Figure 8As shown, the connection to the backup server successfully jumps to the process of logging into the backup server. The conversion logic content is as follows:

[0094] Send a login request message frame to the backup server and jump to the login backup waiting state;

[0095] A timer is set to count, and the maximum single login time is T seconds. If the response frame returned by the server is not received at the end of the count, the system will jump to the login backup timeout; the login backup timeout will automatically re-login, and when the login is retried for more than N times, the backup server is considered unavailable, and the system will jump to the main server again; if a response frame is received, the system will jump to the login backup success according to the response frame result, and if the login backup is successful, the system will jump to the link normal state. In this embodiment, a timer is set, and the maximum single connection time is 3s, and the maximum number of retries is 3 times.

[0096] Specifically, the value range of the above time T is 2-10; the value range of N is 5-10.

[0097] In the normal link state, the server will continuously send heartbeat frames to the switch. At the same time, the heartbeat timer is set in the normal link state. The timer is reset when a heartbeat frame is received. The heartbeat frame is sent by the server every 3 seconds. The maximum timing time of the heartbeat timer is 3 seconds. When the timer expires and the heartbeat frame is not received and the timer is reset, the link is considered abnormal and the server automatically jumps to the logout server. After jumping to the logout start, a logout request data frame is sent to the server. After receiving the server response frame, the data frame is parsed to obtain the message body. The logout is judged to be successful or failed based on the content of the message body. At the same time, the timer is set for timing. The maximum timing time of the timer is 3 seconds. When the response frame is not received at the end of the timing, the link is considered lost and the server jumps to the logout timeout state. Finally, after performing corresponding socket release, log writing and other operations in each state, a new socket connection server is uniformly re-established.

[0098] Specifically, the state machine encapsulates the content to be executed in each state into a function, called an execution function, which is stored in the structure of each state in the form of a function pointer. When switching to that state, the function is automatically executed to make the system work normally.

[0099] The logic of the same type of small state functions in each state is basically the same except for the main operation function of the state. The specific functions in different devices are somewhat different, but generally follow the following organizational logic:

[0100] Startup status:

[0101] like Fig. 9As shown, after entering the startup state, the current state machine timer is reset, the corresponding execution module is notified (such as notifying a new socket to connect to the server, etc.) to execute the corresponding function, and the state machine state is set to the corresponding waiting state.

[0102] Waiting state:

[0103] like Fig.10 As shown, the waiting state mainly waits for the timer or server message processing module to move out of the state. It is mainly responsible for writing the current information into the log. After entering the waiting state, it obtains the remaining time of the current state machine timer, integrates the state machine and timer related information into the log, and continuously waits for the timer or server message processing module to move out of the waiting state.

[0104] Success status:

[0105] like Fig.11 As shown, after entering the success state, the state machine timer needs to be deleted to avoid being triggered by the timer to the timeout state, and then the state machine state is set to the next stage state.

[0106] Failure / Timeout Status:

[0107] like Fig.12 After entering the failure / timeout state, the current state machine timer is deleted, the number of retries is calculated, and the number of retries is judged. If it is greater than 5 times, the abnormal situation is recorded. According to the abnormal situation, it is determined whether to report to the network management system, and the recovery state is jumped at the same time. If it is less than 5 times, a retry is performed.

[0108] Specifically, for looping through the state table, when the state changes, the latest state is written into the current state in the state machine structure. The system loops through the state table according to the time period to determine whether the state is consistent with the state in the state machine structure. If they are consistent, the state jump is completed and the corresponding function of the current state is executed.

[0109] The application of the mutex lock is as follows: the state of the state machine can be set or queried by the system traversal function, timer, and server message receiving module. When any two or three places are queried or set at the same time, it is easy to cause the state machine to run incorrectly, resulting in an operating logic error in the optical switch. A mutex lock is set for the state machine and locked when setting or querying to ensure that only one program process can query or set at the same time, ensuring state accuracy and avoiding system shutdown due to state machine logic conflicts.

[0110] The method of this embodiment also sets a dog feeding program. A new thread is created to design the dog feeding program for the state machine. The dog is fed regularly. When the state machine is deadlocked and the dog cannot be fed, the watchdog program resets the system and reinitializes the switch to avoid system downtime.

[0111] The present invention sets a backup link, which can automatically connect to the backup server when the main server fails, ensuring that the system is in normal working condition. When the backup server fails, it reports to the network management system and retries to connect to the main server.

[0112] All functions are started by the state machine. The state machine sets a timer to judge the timeout of the function. When the execution operation times out, the timer will jump out of the state and automatically handle the timeout and report it to the network management system to avoid system jamming. The state machine jumps in a closed loop. When the link fails, the logout operation is automatically performed. After the logout is completed, it reconnects to the server to form a closed loop of link connection.

[0113] The state machine sets a mutual exclusion lock. Before querying or setting the state, lock the state machine first to avoid multiple programs querying or setting the state machine at the same time, which may cause the system running state to be disordered. Due to the principle of mutual exclusion lock, if it is locked but not unlocked, it cannot be locked again. Therefore, the next reading / setting can only be done after the last reading or setting of the state, so as to ensure the accuracy of each state machine. However, when an error occurs in the program, a deadlock will be caused, which will cause the entire state machine to be locked, resulting in an error in the entire system. Therefore, a dog feeding program is added to monitor the state machine.

[0114] To handle possible state machine deadlock problems, a watchdog program is set for the state machine to feed the dog regularly. When the state machine deadlocks, the dog cannot be fed, which will cause the watchdog to reset the program, release the deadlock state, and reconfigure and run the switch.

[0115] According to the disclosure and teaching of the above description, those skilled in the art to which the present invention belongs may also make changes and modifications to the above embodiments. Therefore, the present invention is not limited to the specific embodiments disclosed and described above, and some modifications and changes to the invention should also fall within the scope of protection of the claims of the present invention. In addition, although some specific terms are used in this specification, these terms are only for the convenience of description and do not constitute any limitation to the invention.

Claims

1. A state machine processing method for a quantum optical switch, It is characterized in that The method comprises the following steps: Step 1: Design multiple state types of the state machine; Step 2: Design a state structure that meets the various state types described in step 1; Step 3: Design a state machine structure for scheduling and switching the state type; Step 4: Designing conversion logic for scheduling and switching the state of the state machine; Step 5: Design the execution function for each state type; Step 6: When the state type changes, the latest state type is written into the current state in the state machine structure. The system loops through the state table according to the time period to determine whether the state type is consistent with the state in the state machine structure. If they are consistent, the state jump is completed and the execution function corresponding to the current state type is executed; Step 7: Set up a state machine mutex lock that can only operate one program process at a time; Step 8: Create a new thread to design a dog feeding program for the state machine and perform the dog feeding process regularly.

2. A state machine processing method for a quantum optical switch as claimed in claim 1, It is characterized in that The status types in step 1 include but are not limited to: self-check, initialization, connecting to server, logging into server, connecting to backup server, logging into backup server, logging out of server and normal link status; Any state includes five sub-states: start, wait, success, failure and timeout.

3. A state machine processing method for a quantum optical switch as claimed in claim 1, It is characterized in that The state structure in step 2 includes but is not limited to a state name, a state identifier, a state processing function pointer, and a timeout period, and each state structure corresponds to a state type.

4. A state machine processing method for a quantum optical switch as claimed in claim 1, It is characterized in that The state machine structure includes but is not limited to the current state machine name, the current state, the timer id, the heartbeat timer id, the state machine mutex and the state table.

5. A state machine processing method for a quantum optical switch as claimed in claim 1, It is characterized in that The conversion logic includes initialization jump to connection server startup process conversion logic, main server connection failure jump to connection backup startup process conversion logic, server connection successful jump to server login process conversion logic and backup server connection successful jump to backup server login process conversion logic.

6. A state machine processing method for a quantum optical switch as claimed in claim 5, It is characterized in that The conversion logic includes the initialization jump to the connection server startup process conversion logic content: Establish a socket connection to the server and jump to the connection success or connection failure state according to the connection status; If the connection is successful, jump to the login startup state to log in to the server; Set a timer, the maximum single connection time is T seconds, if the timer is completed and still not reset, it is considered a connection timeout; After the connection times out, retry the connection. If the number of retries is greater than N times, the primary server is considered to have failed and the connection to the backup server is jumped.

7. A state machine processing method for a quantum optical switch as claimed in claim 5, It is characterized in that If the primary server connection fails, the process of jumping to the backup connection startup process conversion logic is as follows: Establish a socket connection to the backup server, and jump to the connection backup success or connection backup failure state according to the connection status; If the backup connection is successful, the program will jump to the backup startup state to log in to the backup server; The connection status is determined as follows: Set a timer, the maximum single connection time is T seconds, if the timer is not reset after the timer is completed, it is considered that the connection backup has timed out; If the connection to the backup server times out, the connection will be retried. If the number of retries is greater than N times, the backup server is considered to have failed and the connection to the primary server will be redirected.

8. A state machine processing method for a quantum optical switch as claimed in claim 5, It is characterized in that The connection to the server successfully jumps to the server login process conversion logic content is as follows: Send a login request message frame to the server and jump to the login waiting state; Set a timer to count, the maximum single login time is T seconds, and if no response frame is received from the server at the end of the timer, jump to login timeout; When the login times out, the system will automatically re-login. If the number of retries exceeds N, the server is considered unavailable and the connection will be redirected to the backup server. If a response frame is received, the state will jump to login success according to the response frame result. If login success, the state will jump to link normal status.

9. A state machine processing method for a quantum optical switch as claimed in claim 5, It is characterized in that The connection to the backup server successfully jumps to the conversion logic of logging into the backup server process Send a login request message frame to the backup server and jump to the login backup waiting state; Set a timer to count, the maximum single login time is T seconds, and if no response frame is received from the server at the end of the timer, jump to login backup timeout; If the backup login times out, the system will automatically re-login. If the login is retried more than N times, the backup server is considered unavailable and the system will be redirected to the main server. If a response frame is received, the state will jump to login backup success according to the response frame result. If login backup success, the state will jump to link normal status.

10. A state machine processing method for a quantum optical switch as claimed in any one of claims 9, It is characterized in that The value range of T is 2-10; the value range of N is 5-10; The execution function is stored in the structure of each state in the form of a function pointer.

Citation Information

Cited By

  • Module interlocking starting control system and method based on hardware state machine

    CN122111524A