Software complexity balanced distribution system and method

By balancing the software logic complexity to the input module, state machine and output module, the problem of large logic decoupling and adaptation workload during software reuse and transplantation in the prior art is solved, and the universality and portability of the module are improved.

CN120216198APending Publication Date: 2025-06-27GAC COMPONENT CO LTD
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202510371599.8
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-03-27
Publication Date
2025-06-27

AI Technical Summary

Technical Problem

When existing electronic control solutions face changes in demand or software reuse or transplantation between projects, they will face a large number of input processing and decoupling of state machine logic, resulting in lower versatility.

Method used

By evenly allocating the logic complexity of the software to the input module, state machine and output module, using data flow and control flow, the logical decoupling and adaptation workload during module porting is reduced, and the universality of the module is improved.

Benefits of technology

It realizes the workload of logical decoupling and adaptation of input modules, state machines and output modules when changes in requirements or software reuse or transplantation between projects, and improves the universality and portability of modules.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120216198A_ABST
    Figure CN120216198A_ABST
Patent Text Reader

Abstract

The invention discloses a software complexity balanced distribution system and method.The system comprises an input module, a state machine and an output module which are in communication connection, and the system distributes the logic complexity of software in the input module, the state machine and the output module in a balanced mode based on data flow and control flow; the input module is used for processing an input signal; the state machine is used for executing state jump or controlling output according to current data and events; and the output module is used for performing output processing on the signal. According to the invention, the logic complexity of the software is distributed to the input module, the state machine and the output module in a balanced manner, so that the logic complexity of the input module, the state machine and the output module is balanced; the logic decoupling work and the adaptive workload of the input module, the state machine and the output module are reduced, and the universality of the input module, the state machine and the output module is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the field of state machines, and particularly relates to a system and method for balanced distribution of software complexity. Background Art

[0002] In existing electronic control solutions, the currently widely used "input-state machine-output" framework system in the industry focuses on input processing or state machine implementation with emphasis or trade-offs to avoid some implementation difficulties. For example, it is simplified to a "producer-consumer" model, that is, there is only input processing, and the processing result is directly used to drive the load or actuator, or the "multi-input-state machine" is converted into multiple parallel state machines. However, when facing requirement changes, software reuse or transplantation between projects, this implementation method will face a large amount of work and adaptation for decoupling the input processing and state machine logic, and may even not be able to complete the relevant tasks on time in short-cycle projects.

[0003] In the prior art, a patent document with the publication number CN101309254A discloses a device and method for controlling multiple groups of functions of a communication device with an associated parallel state machine, which solves the defects such as complex logic implementation in a single state machine, state machine explosion, and difficulty in maintenance and upgrade through the parallel state machine method. However, when facing requirement changes, software reuse or transplantation between projects, this method will increase the work and adaptation workload for decoupling the state machine logic, and has low generality. Summary of the Invention

[0004] Aiming at the problems in the prior art, the present invention proposes a system and method for balanced distribution of software complexity. By evenly distributing the logical complexity of the software to the input module, state machine, and output module, when requirement changes or software reuse or transplantation between projects occur, the work and adaptation workload for decoupling the logic of the input module, state machine, and output module are reduced, and the generality of the input module, state machine, and output module is improved.

[0005] The present invention is implemented as follows: A system for balanced distribution of software complexity includes an input module, a state machine, and an output module that are sequentially communicatively connected. The system evenly distributes the logical complexity of the software among the input module, state machine, and output module based on data flow and control flow; wherein, the logical complexity of the software includes control flow, data processing, etc. By evenly distributing the logical complexity of the software to the input module, state machine, and output module, when any one of the input module, state machine, and output module needs to be reused or transplanted, the work and adaptation workload for decoupling the logic during module transplantation are reduced, and the generality of the input module, state machine, and output module is improved.

[0006] The input module is used to process input signals, including but not limited to one or a combination of the reception and processing of communication signals, reading stored data, sensor data processing, and inter-module input processing; compared with existing input-focused framework systems, the input module only performs simple processing on input signals, reducing the logical complexity of the input module, thereby reducing the workload during transplantation of the input module and improving the versatility of the input module.

[0007] The state machine is used to perform state jumps or control outputs according to current data and events; when the state machine executes a task, it will cyclically call the execution function in the current state; by means of the state machine execution function, the logical complexity of the input module is further reduced to balance the logical complexity of the input module and the state machine, thereby reducing the workload during transplantation of the state machine and improving the versatility of the state machine.

[0008] The output module is used to perform output processing on signals, including but not limited to one or a combination of the transmission of communication signals, writing stored data, function diagnosis, and inter-module output processing. The output module corresponds to the input module. When the state machine sends the function execution result to the output module, the output signal is processed by the output module, enabling the state machine to only execute functions, thereby balancing the logical complexity of the state machine and the output module, reducing the workload during transplantation of the state machine and the output module, and improving the versatility of the state machine and the output module.

[0009] Preferably, the input module also performs arbitration processing on communication signals, uses a first-in-first-out type queue to sort the same type of control commands from different sources, arbitrates the execution instructions given to the state machine according to the reception time, and only takes the latest command as the state machine input. The input module only performs arbitration processing on communication signals, simplifies the operation load and data processing volume of the input module, avoids excessive concentration of the operation load and data processing volume of the software on the input module, and thereby reduces the workload during transplantation of the input module.

[0010] Specifically, the input module further includes a first port aggregation, which is compatible with multiple signal sources. When it is necessary to add or reduce signal sources, the new signal source can be directly communicatively connected to the first port aggregation, or the signal source to be disconnected can be directly disconnected from the first port aggregation. Through the first port aggregation, the input module can be quickly expanded and trimmed without a large amount of modification to the existing logic, further reducing the workload during transplantation of the input module and improving the versatility of the input module.

[0011] Specifically, the communication signal processing of the input module includes: edge detection, signal verification, signal frame splicing and integrity verification, and level detection;

[0012] The described read storage data includes initialization read, trigger read, and periodic read of the EEPROM;

[0013] The described sensor data processing includes acquisition, conversion, and preprocessing of sensor data, and the preprocessing includes median filtering, mean filtering, and jump detection.

[0014] Preferably, the state machine includes an event processor, which is used to perform conditional extension or conditional trimming on the functions of the state machine. When transplanting the state machine, it usually involves the extension or trimming of the state machine. Through the event processor, conditional extension or conditional trimming can be directly performed on the original execution functions, so as to complete the extension or trimming of the state machine without significantly modifying the original execution functions, thereby reducing the workload during the transplantation of the state machine and improving the generality of the state machine.

[0015] Specifically, among the functions executed by the state machine, there is an interrupter function between signal sources. By processing the interrupter between signal sources through the state machine, when adding or reducing signal sources to the input module, it is not necessary to significantly modify the operation logic of the input module, further reducing the workload during the transplantation of the input module and improving the generality of the input module.

[0016] Preferably, the output module further includes second port aggregation, which is compatible with multiple actuators. When adding or reducing actuators, the new actuator can be directly communicatively connected to the second port aggregation, or the actuator to be disconnected can be directly disconnected from the second port aggregation. Through the second port aggregation, the extension and trimming of the output module can be quickly realized without significantly modifying the existing logic, further reducing the workload during the transplantation of the output module and improving the generality of the output module.

[0017] Preferably, the transmission of the communication signal of the output module includes CAN communication, LIN communication, Bluetooth communication, SPI communication, IIC communication, Ethernet communication, event-based signal transmission and recovery, periodic signal transmission, and long data frame sub-packaging;

[0018] The write storage data includes initialization write, trigger write, and periodic write of the EEPROM;

[0019] The described functional diagnosis includes diagnosis and failure handling of communication functions, diagnosis and failure handling of storage functions, diagnosis and failure handling of loads, and diagnosis and failure handling of each function of subtasks.

[0020] A method for balanced allocation of software complexity, applied to the above-mentioned system for balanced allocation of software complexity, includes the following steps:

[0021] S1: After the input module receives an input signal, it determines the signal type and performs different operations according to the signal type;

[0022] S1-1: When the input signal received by the input module is a communication signal, use a first-in-first-out queue to sort the same type of control commands from different sources, arbitrate according to the receiving time, and only take the latest command as the input of the state machine; when there is an interruption operation in the signal source, execute the interruption operation through the state machine;

[0023] S1-2: When the input signal received by the input module is a storage signal, perform initialization reading, trigger reading, or periodic reading on the EEPROM;

[0024] S1-3: When the input signal received by the input module is sensor data, collect, convert, and preprocess the sensor data, where the preprocessing includes median filtering, mean filtering, and jump detection;

[0025] S1-4: When the input signal received by the input module is inter-module input processing, the input module applies the data queue mechanism of data enqueue, data dequeue, and queue length management to the data and status input between different sub-modules within the task or to the data and status input between each sub-task;

[0026] S2: After the state machine receives an input signal, according to the internal logic of the state machine, execute a function with state events and sensor data as judgment conditions;

[0027] S3: The output module performs output processing on the signal according to the signal type and the function execution result of the state machine;

[0028] S3-1: When the output signal is a communication signal, send the communication signal through the following logic: event-type signal sending and recovery, periodic signal sending, and long data frame sub-packaging;

[0029] S3-2: When the output signal is a storage signal, perform initialization writing, trigger writing, or periodic writing on the EEPROM;

[0030] S3-3: When the output signal is for diagnosis, output diagnosis and failure handling for communication, diagnosis and failure handling for storage, diagnosis and failure handling for the load, and diagnosis and failure handling for each function of the sub-task;

[0031] S3-4: When the output signal is inter-module output processing, refresh the data and status that need to be read by the module or task.

[0032] Specifically, step S2 specifically includes the following steps:

[0033] S2-1: The state machine is initially in the idle state. When the state machine receives an input signal from the input module, it enters the execution state to execute the function.

[0034] S2-2: The state machine defines execution functions for different states and events. When the state machine triggers a state and an event during the execution of the function, it executes the corresponding function.

[0035] S2-2-1: The state machine executes the function through the event queue and the data queue. When the state machine executes the function through the event queue, in a first-in, first-out manner, the events generated by the input module and the events generated inside the state machine form an event queue and are executed in sequence. When the state machine executes the function through the data queue, the sensor data from the sensor forms a data queue and is executed in sequence.

[0036] S2-2-2: When the state machine executes the function according to the event queue, the length of the event queue in the real-time operating system does not exceed 3, and the length of the event queue in the non-real-time operating system does not exceed 30. When the state machine executes the function according to the data queue function, the length of the data queue does not exceed 30.

[0037] Advantages of the present invention:

[0038] The present invention proposes a system and method for balanced distribution of software complexity. Based on the data flow and control flow, the logical complexity of the software is evenly distributed to the input module, the state machine, and the output module. When the requirements change, or there is software reuse or transplantation between projects, the work of logical decoupling and the adaptation workload of the input module, the state machine, and the output module are reduced, and the generality of the input module, the state machine, and the output module is improved. Description of the Drawings

[0039] Figure 1 It is the overall schematic diagram of the system for balanced distribution of software complexity of the present invention;

[0040] Figure 2 It is the schematic diagram of the input module expansion and trimming of the system for balanced distribution of software complexity of the present invention;

[0041] Figure 3 It is the schematic diagram of the state machine expansion and trimming of the system for balanced distribution of software complexity of the present invention. Detailed Embodiment

[0042] Next, the technical solutions in the embodiments of the present invention will be clearly and completely described in conjunction with the accompanying drawings in the embodiments of the present invention. Obviously, the described embodiments are only a part of the embodiments of the present invention, rather than all the embodiments. All other embodiments obtained by those of ordinary skill in the art based on the embodiments of the present invention without creative efforts belong to the scope of protection of the present invention.

[0043] Embodiment 1

[0044] As Figures 1 - 3 shown, a system for balanced distribution of software complexity includes an input module, a state machine, and an output module that are communicatively connected in sequence. The system evenly distributes the logical complexity of the software among the input module, the state machine, and the output module based on data flow and control flow. By evenly distributing the logical complexity of the software to the input module, the state machine, and the output module, when any one of the input module, the state machine, and the output module needs to be reused or transplanted, the work of logical decoupling and the workload of adaptation during module transplantation are reduced, and the generality of the input module, the state machine, and the output module is improved.

[0045] The input module is used to process input signals, including receiving and processing communication signals, reading stored data, processing sensor data, and inter-module input processing. Compared with the existing input-focused framework system, the input module only performs simple processing on the input signals, reducing the logical complexity of the input module, thereby reducing the workload during transplantation of the input module and improving the generality of the input module.

[0046] In this embodiment, the input module also performs arbitration processing on communication signals, uses a first-in-first-out queue to sort the same type of control commands from different sources, and arbitrates the execution instructions given to the state machine according to the receiving time, only taking the latest command as the input of the state machine. The input module only performs arbitration processing on communication signals, simplifies the operation load and data processing volume of the input module, avoids excessive concentration of the operation load and data processing volume of the software on the input module, and thus reduces the workload during transplantation of the input module.

[0047] Specifically, the input module further includes a first port aggregation, which is compatible with multiple signal sources. When adding or reducing signal sources, the new signal source can be directly communicatively connected to the first port aggregation, or the signal source to be disconnected can be directly disconnected from the first port aggregation. Through the first port aggregation, the input module can be quickly expanded and trimmed without a large amount of modification to the existing logic, further reducing the workload during transplantation of the input module and improving the generality of the input module.

[0048] Specifically, the reception of communication signals by the input module includes: CAN communication and LIN communication; the processing of communication signals by the input module includes: edge detection, signal verification, signal frame splicing and integrity verification, and level detection.

[0049] In this embodiment, through the first port aggregation, communication signals can be extended. On the basis of CAN communication and LIN communication, BT communication can be extended, and the ports of CAN communication can also be extended; conversely, the ports of BT communication and CAN communication can be trimmed through the first aggregation port.

[0050] The reading of stored data includes the initialization reading, trigger reading, and periodic reading of EEPROM.

[0051] The processing of sensor data includes the acquisition, conversion, and preprocessing of sensor data. The preprocessing includes median filtering, mean filtering, and jump detection.

[0052] In this embodiment, the acquisition of sensor data includes NTC temperature. Through the first port aggregation, on the basis of the acquisition of NTC temperature data by the sensor, the preprocessing of sensor data processing can be extended, such as temperature filtering; conversely, temperature filtering can be trimmed through the first aggregation port.

[0053] The state machine is used to perform state jumps or control outputs according to the current data and events; when the state machine executes tasks, it will call the execution function in the current state periodically; by means of the state machine execution function, the logical complexity of the input module is further reduced to balance the logical complexity of the input module and the state machine, thereby reducing the workload during the transplantation of the state machine and improving the versatility of the state machine.

[0054] In this embodiment, the state machine includes an event processor, and the event processor is used to perform conditional extension or conditional trimming on the functions of the state machine. When the state machine is transplanted, it usually involves the extension or trimming of the state machine. Through the event processor, conditional extension or conditional trimming can be directly performed on the original execution function, thereby completing the extension or trimming of the state machine without significantly modifying the original execution function, and thus reducing the workload during the transplantation of the state machine and improving the versatility of the state machine.

[0055] In this embodiment, the state machine jumps to different states by triggering different events, including the idle state, the executing state, the paused state, and the execution completed state. By the event processor adding the triggering events and restoring the states of the state machine, the function execution routes of the state machine are increased, and the expansion of the state machine can be completed without significantly modifying the original execution functions. On the contrary, by the event processor deleting the triggering events and restoring the states of the state machine, the function execution routes of the state machine are simplified, and the trimming of the state machine can be completed without significantly modifying the original execution functions, thereby reducing the workload during the transplantation of the state machine.

[0056] Specifically, among the functions executed by the state machine, there is also an inter - interruption function between signal sources. By the state machine handling the inter - interruption between signal sources, when the input module adds or reduces signal sources, it is not necessary to significantly modify the arithmetic logic of the input module, further reducing the workload during the transplantation of the input module and improving the versatility of the input module.

[0057] The output module is used for output processing of signals, including but not limited to the sending of communication signals, writing of stored data, functional diagnosis, and inter - module output processing. The output module corresponds to the input module. When the state machine sends the function execution result to the output module, the output module takes care of the output signal, enabling the state machine to only execute functions, thereby balancing the logical complexity of the state machine and the output module, reducing the workload during the transplantation of the state machine and the output module, and improving the versatility of the state machine and the output module.

[0058] In this embodiment, the output module further includes a second port aggregation, which is compatible with multiple actuators. When adding or reducing actuators, the new actuator can be directly communicatively connected to the second port aggregation, or the actuator to be disconnected can be directly disconnected from the second port aggregation. Through the second port aggregation, the expansion and trimming of the output module can be quickly achieved without significantly modifying the existing logic, further reducing the workload during the transplantation of the output module and improving the versatility of the output module.

[0059] In this embodiment, the sending of the communication signal by the output module and the receiving of the communication signal by the input module include: CAN communication, LIN communication, Bluetooth communication, event - type signal sending and restoration, periodic signal sending, and long data - frame sub - packetization.

[0060] The written storage data includes the initialization write, trigger write, and periodic write of the EEPROM; the function diagnosis includes the diagnosis and failure handling of the communication function, the diagnosis and failure handling of the storage function, the diagnosis and failure handling of the load, and the diagnosis and failure handling of each function of the subtasks.

[0061] Embodiment 2

[0062] A method for balanced allocation of software complexity, applied to a system for balanced allocation of software complexity described in Embodiment 1, includes the following steps:

[0063] S1: After the input module receives an input signal, it determines the signal type and performs different operations according to the signal type;

[0064] S1-1: When the input signal received by the input module is a communication signal, use a first-in-first-out type queue to sort the same type of control commands from different sources, arbitrate according to the receipt time, and only take the latest command as the input of the state machine; when there is an interrupt operation from the signal source, execute the interrupt operation through the state machine;

[0065] S1-2: When the input signal received by the input module is a storage signal, perform initialization reading, trigger reading, or periodic reading on the EEPROM;

[0066] S1-3: When the input signal received by the input module is sensor data, collect, convert, and preprocess the sensor data, where the preprocessing includes median filtering, mean filtering, and jump detection;

[0067] S1-4: When the input signal received by the input module is inter-module input processing, the input module applies the data queue mechanism of data enqueue, data dequeue, and queue length management to the data and status input between different sub-modules within the task or to the data and status input between each subtask;

[0068] S2: After the state machine receives the input signal, according to the internal logic of the state machine, execute functions with state events and sensor data as judgment conditions;

[0069] S3: The output module sends different signals to the actuator according to the signal type and the execution result of the function of the state machine;

[0070] S3-1: When the output signal is a communication signal, send the communication signal through the following logic: event-based signal sending and recovery, periodic signal sending, and long data frame packetization;

[0071] S3-2: When the output signal is a storage signal, perform initialization write, trigger write, and periodic write on the EEPROM;

[0072] S3-3: When the output signal is for diagnosis, output diagnosis and failure handling for communication, diagnosis and failure handling for storage, diagnosis and failure handling for the load, and diagnosis and failure handling for each function of the subtasks.

[0073] S3-4: When the output signal is for inter-module output processing, refresh the data and status that need to be read by the module or task.

[0074] Specifically, step S2 specifically includes the following steps:

[0075] S2-1: The state machine is initially in the idle state. When the state machine receives the input signal from the input module, it enters the execution state to execute the function.

[0076] S2-2: The state machine defines the execution functions for different states and events. When the state and events are triggered during the execution of the function by the state machine, the corresponding functions are executed.

[0077] S2-2-1: The state machine executes the function through the event queue and the data queue. When the state machine executes the function through the event queue, in a first-in-first-out manner, the events generated by the input module and the events generated inside the state machine form an event queue and are executed in sequence; when the state machine executes the function through the data queue, the sensor data from the sensor forms a data queue and is executed in sequence.

[0078] S2-2-2: When the state machine executes the function according to the event queue, the length of the event queue in the real-time operating system does not exceed 3, and the length of the event queue in the non-real-time operating system does not exceed 30; when the state machine executes the function according to the data queue function, the length of the data queue does not exceed 30.

[0079] Based on the disclosure and teachings of the above specification, those skilled in the art to which the present invention pertains can 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 protection scope of the claims of the present invention. In addition, although some specific terms are used in this specification, these terms are only for convenience of description and do not constitute any limitation to the present invention.

Claims

1. A system for balancing software complexity, comprising an input module, a state machine and an output module which are sequentially connected in communication, characterized in that: The system evenly distributes the logic complexity of the software among the input module, the state machine and the output module based on data flow and control flow; The input module is used to process input signals, including receiving and processing communication signals, reading stored data, sensor data processing and inter-module input processing, or a combination of these. The state machine is used to execute state jump or control output according to current data and events; when the state machine executes a task, it will periodically call the execution function in the current state; The output module is used to perform output processing on the signal, including sending of communication signals, writing of storage data, functional diagnosis and output processing between modules, or a combination of several of them.

2. A system for balancing software complexity according to claim 1, characterized in that: The input module also performs arbitration processing on the communication signal, uses a first-in-first-out queue to sort similar control commands from different sources, arbitrates the execution instructions given to the state machine according to the receiving time, and only takes the latest command as the state machine input.

3. A system for balancing software complexity according to claim 1, characterized in that: The input module also includes a first port aggregation, which is compatible with multiple signal sources. When it is necessary to add or reduce signal sources, the new signal source is directly connected to the first port aggregation for communication, or the signal source to be disconnected is directly disconnected from the first port aggregation.

4. A system for balancing software complexity according to claim 1, characterized in that: The communication signal reception of the input module includes: CAN communication, LIN communication, Bluetooth communication, SPI communication, IIC communication, Ethernet communication; the communication signal processing of the input module includes: edge detection, signal verification, signal frame splicing and integrity verification, level detection; The reading of stored data includes initialization reading, trigger reading, and periodic reading of EEPROM; The sensor data processing includes the collection, conversion and preprocessing of sensor data, and the preprocessing includes median filtering, mean filtering and jump detection.

5. The system for balancing software complexity distribution according to claim 1, characterized in that: The state machine includes an event processor, and the event processor is used to conditionally expand or conditionally tailor the function of the state machine.

6. A system for balancing software complexity distribution according to claim 5, characterized in that: The functions executed by the state machine include mutual interruption functions between signal sources.

7. A system for balancing software complexity distribution according to claim 1, characterized in that: The output module also includes a second port aggregation, which is compatible with multiple actuators. When the actuator needs to be added or reduced, the new actuator is directly connected to the second port aggregation for communication, or the actuator that needs to be disconnected is directly disconnected from the second port aggregation.

8. The system for balancing software complexity distribution according to claim 1, characterized in that: The transmission of communication signals of the output module includes CAN communication, LIN communication, Bluetooth communication, SPI communication, IIC communication, Ethernet communication, event-type signal transmission and recovery, periodic signal transmission, and long data frame packetization; Writing storage data includes EEPROM initialization writing, trigger writing, and periodic writing; The functional diagnosis includes the diagnosis and failure processing of the communication function, the diagnosis and failure processing of the storage function, the diagnosis and failure processing of the load, and the diagnosis and failure processing of each function of the subtask.

9. A method for balancing software complexity, characterized in that: A system for balancing software complexity as claimed in any one of claims 1 to 8, comprising the following steps: S1: After receiving the input signal, the input module determines the signal type and performs different operations according to the signal type; S1-1: When the input signal received by the input module is a communication signal, a first-in-first-out queue is used to sort similar control commands from different sources, and arbitration is performed according to the receiving time, and only the latest command is taken as the state machine input; when there is an interrupt operation at the signal source, the interrupt operation is performed through the state machine; S1-2: When the input signal received by the input module is a storage signal, initialization reading, trigger reading or periodic reading is performed on the EEPROM; S1-3: When the input signal received by the input module is sensor data, the sensor data is collected, converted and preprocessed, wherein the preprocessing includes median filtering, mean filtering and jump detection; S1-4: When the input signal received by the input module is for inter-module input processing, the input module applies data and status input between different sub-modules within the task or applies data and status input between each sub-task according to the data queue mechanism of data enqueue, data dequeue and queue length management; S2: After receiving the input signal, the state machine executes the function according to the internal logic of the state machine and the state event and sensor data as the judgment conditions; S3: the output module performs output processing on the signal according to the signal type and the function execution result of the state machine; S3-1: When the output signal is a communication signal, the communication signal is sent through the following logic: event-type signal sending and recovery, periodic signal sending, and long data frame packetization; S3-2: When the output signal is a storage signal, the EEPROM is initialized, triggered, or periodically written; S3-3: when the output signal is a diagnosis, outputting the diagnosis and failure processing of communication, the diagnosis and failure processing of storage, the diagnosis and failure processing of load, and the diagnosis and failure processing of each function of the subtask; S3-4: When the output signal is inter-module output processing, refresh the data and status that need to be read by the module or task.

10. A method for balancing software complexity distribution according to claim 9, characterized in that: Step S2 specifically includes the following steps: S2-1: The state machine is initially in the idle state. When the state machine receives the input signal from the input module, it enters the execution state to execute the function. S2-2: The state machine defines execution functions for different states and events. When the state machine triggers states and events during the execution of functions, the corresponding functions are executed; S2-2-1: The state machine executes functions through the event queue and the data queue. When the state machine executes functions through the event queue, the events generated by the input module and the events generated inside the state machine are formed into an event queue and executed in sequence in a first-in-first-out manner; when the state machine executes functions through the data queue, the sensor data from the sensor are formed into a data queue and executed in sequence; S2-2-2: When the state machine executes a function according to the event queue, the length of the event queue in the real-time operating system shall not exceed 3, and the length of the event queue in the non-real-time operating system shall not exceed 30; when the state machine executes a function according to the data queue function, the length of the data queue shall not exceed 30.

Citation Information

Patent Citations

  • Device and method for controlling multiple function of communication apparatus by related parallel state machine

    CN101309254A