Modeling method, device and equipment based on Stateflow, medium and program product

By acquiring Stateflow state data and determining the actual type, a model that meets the conditions is constructed, solving the problem of crude expression in Stateflow's conditional expression processing, and realizing the visualization and reliability improvement of the model.

CN121580595APending Publication Date: 2026-02-27CHERY NEW ENERGY AUTOMOBILE TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202511646263.4
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-11-11
Publication Date
2026-02-27

AI Technical Summary

Technical Problem

Stateflow's crude expression handling results in low visualization of MBD software and poor reliability, readability, and maintainability.

Method used

By acquiring state data from Stateflow, the actual type of state can be determined, and a Stateflow model that meets preset conditions can be built, avoiding complex logical expressions, enabling graphical management, and improving the visualization and reliability of the model.

Benefits of technology

It enhances the visualization of Stateflow models, improves the reliability and maintainability of the software, and increases the readability of the models.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121580595A_ABST
    Figure CN121580595A_ABST
Patent Text Reader

Abstract

The invention relates to the technical field of software development, in particular to a modeling method and device based on Stateflow, equipment, a medium and a program product, and the method comprises the steps: obtaining state data of at least one state in the Stateflow; determining an actual type of the at least one state based on the state data; and based on the Stateflow, the actual type and the at least one state, constructing a Stateflow model meeting a certain condition. Therefore, the problems that the visualization degree of MBD software is relatively low, and the reliability, readability and maintainability of the software are relatively poor due to the fact that Stateflow has a condition of roughly expressing a condition expression in related technologies are solved.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the technical field of software development, and particularly relates to a Stateflow-based modeling method, device, equipment, medium and program product. BACKGROUND

[0002] In the related art, a missile can be modularly split and designed in terms of equipment level and component level from a top-level design angle based on SysML (Systems Modeling Language), and with the aid of Simulink (Simulation Link), component level, component level and equipment level modeling is carried out to form a general model series, and a large number of special models are output by filling in general model parameters according to different design requirements to construct a special model library, and a simulation model is established by combining Stateflow and Simulink to complete final simulation testing; or a power station state monitoring related function service model can be defined by means of Web (World Wide Web) service description language, and power wide area network state monitoring data exchange is realized by simple object access protocol, large-scale data is redundantly stored in a distributed file system and indexed to complete query, a data warehouse is constructed by extraction, conversion and loading, and parallel execution of association rule, classification and clustering data mining algorithms is realized by MapReduce (mapping-reduction) task decomposition and result summarization.

[0003] However, in the related art, Stateflow has a relatively simple and direct expression manner that lacks fine consideration when processing conditional expressions, which results in low visualization of MBD (Model-Based Design) software, and also makes the reliability, readability and maintainability of the software poor, which needs to be improved. SUMMARY

[0004] The present application provides a Stateflow-based modeling method, device, equipment, medium and program product to solve the problem that Stateflow has a rough expression of conditional expressions in the related art, which results in low visualization of MBD software, and also makes the reliability, readability and maintainability of the software poor.

[0005] The first aspect embodiment of the present application provides a Stateflow-based modeling method, comprising the following steps: acquiring state data of at least one state in Stateflow; determining an actual type of the at least one state based on the state data; and constructing a Stateflow model satisfying a preset condition based on the Stateflow, the actual type and the at least one state.

[0006] Optionally, in an embodiment of the present application, before determining the actual type of the at least one state based on the state data, the method further comprises: obtaining target state data of at least one target state in the Stateflow; obtaining a target state identifier of the at least one target state based on the target state data; and constructing a target state type matched with the at least one target state based on the target state identifier.

[0007] Optionally, in an embodiment of the present application, the determining the actual type of the at least one state based on the state data comprises: obtaining a state identifier of the at least one state based on the state data; and determining the actual type based on the state identifier.

[0008] Optionally, in an embodiment of the present application, the determining the actual type based on the state identifier comprises: determining the actual type as a function execution type in a case that the state identifier is an execution identifier; determining the actual type as an exception monitoring type in a case that the state identifier is an exception identifier; and determining the actual type as a transition judgment type in a case that the state identifier is a transition identifier.

[0009] Optionally, in an embodiment of the present application, the constructing the Stateflow model satisfying the preset condition based on the Stateflow, the actual type and the at least one state comprises: determining an execution priority of the at least one state based on the actual type; and constructing the Stateflow model based on the Stateflow, the execution priority, the actual type and the at least one state.

[0010] An embodiment of the second aspect of the present application provides a Stateflow-based modeling device, comprising: a first obtaining module configured to obtain state data of at least one state in a Stateflow; a determining module configured to determine an actual type of the at least one state based on the state data; and a first constructing module configured to construct a Stateflow model satisfying a preset condition based on the Stateflow, the actual type and the at least one state.

[0011] Optionally, in an embodiment of the present application, the device further comprises: a second obtaining module configured to obtain target state data of at least one target state in the Stateflow before determining the actual type of the at least one state based on the state data; a third obtaining module configured to obtain a target state identifier of the at least one target state based on the target state data; and a second constructing module configured to construct a target state type matched with the at least one target state based on the target state identifier.

[0012] Optionally, in an embodiment of the present application, the determining module comprises: an obtaining unit, configured to obtain a state identifier of the at least one state based on the state data; and a first determining unit, configured to determine the actual type based on the state identifier.

[0013] Optionally, in an embodiment of the present application, the first determining unit comprises: a first determining sub-unit, configured to determine the actual type as a function execution type when the state identifier is an execution identifier; a second determining sub-unit, configured to determine the actual type as an exception monitoring type when the state identifier is an exception identifier; and a third determining sub-unit, configured to determine the actual type as a transfer judgment type when the state identifier is a transfer identifier.

[0014] Optionally, in an embodiment of the present application, the first constructing module comprises: a second determining unit, configured to determine an execution priority of the at least one state based on the actual type; and a constructing unit, configured to construct the Stateflow model based on the Stateflow, the execution priority, the actual type and the at least one state.

[0015] An embodiment of the third aspect of the present application provides an electronic device, comprising: a memory, a processor and a computer program stored in the memory and executable on the processor, wherein the processor executes the program to implement the Stateflow-based modeling method as described in the above embodiments.

[0016] An embodiment of the fourth aspect of the present application provides a computer readable storage medium, which stores a computer program, and the program is executed by a processor to implement the Stateflow-based modeling method as described above.

[0017] An embodiment of the fifth aspect of the present application provides a computer program product, comprising a computer program, and the program is executed to implement the Stateflow-based modeling method as described above.

[0018] The embodiment of the application can determine the actual type of the corresponding state according to the state data of at least one state in the Stateflow, and then construct a Stateflow model meeting certain conditions, so as to realize the standardized management of Stateflow modeling, avoid complex logical expressions, facilitate graphical implementation of the logical expressions, improve the visualization degree of the model, and enhance the reliability, readability and maintainability of the model. Thus, the problems in the related art that the Stateflow has rough condition expression expressions, the visualization degree of the MBD software is low, and the reliability, readability and maintainability of the software are poor are solved.

[0019] Additional aspects and advantages of the application will be made apparent by the following description and the appended claims. BRIEF DESCRIPTION OF DRAWINGS

[0020] The above and / or additional aspects and advantages of the application will become apparent and be readily understood by considering the following detailed description, including the accompanying drawings, in which: Figure 1 A flowchart of a modeling method based on Stateflow according to an embodiment of the application; Figure 2 A schematic diagram of a transition process under different transition conditions according to an embodiment of the application; Figure 3 A block schematic diagram of the internal architecture of different state types according to an embodiment of the application; Figure 4 A block schematic diagram of state external transition according to an embodiment of the application; Figure 5 A flowchart of the working principle of a modeling method based on Stateflow according to an embodiment of the application; Figure 6 A block schematic diagram of a modeling apparatus based on Stateflow according to an embodiment of the application; Figure 7 A structural schematic diagram of an electronic device according to an embodiment of the application.

[0021] REFERENCE NUMERALS Among them, 10 is a modeling apparatus based on Stateflow; 100 is a first acquisition module, 200 is a determination module, 300 is a first construction module; 701 is a memory, 702 is a processor, and 703 is a communication interface. DETAILED DESCRIPTION

[0022] Embodiments of the present application are described below in detail, examples of which are shown in the accompanying drawings, in which the same or similar notations represent the same or similar elements or elements having the same or similar functions throughout. The embodiments described below by reference to the drawings are exemplary and are intended to explain the present application, and cannot be understood as limiting the present application.

[0023] The Stateflow-based modeling method, device, equipment, medium and program product of the embodiments of the present application are described below with reference to the accompanying drawings. In view of the fact that Stateflow is expressed roughly in conditional expressions in the background art, which leads to a low degree of visualization of MBD software and also makes the reliability, readability and maintainability of the software poor, the present application provides a Stateflow-based modeling method. In the method, the actual type of a corresponding state can be determined according to the state data of at least one state in Stateflow, and a Stateflow model satisfying certain conditions is constructed, so as to realize the standardized management of Stateflow modeling, avoid complex logical expressions, facilitate graphical implementation of logical expressions, improve the degree of visualization of the model, and enhance the reliability, readability and maintainability of the model. Thus, the problems in the related art, i.e., the fact that Stateflow is expressed roughly in conditional expressions, which leads to a low degree of visualization of MBD software and also makes the reliability, readability and maintainability of the software poor, are solved.

[0024] Specifically, Figure 1 A flowchart of the Stateflow-based modeling method provided according to an embodiment of the present application is shown in FIG. 1.

[0025] As shown in FIG. 1, the Stateflow-based modeling method includes the following steps: Figure 1 In step S101, state data of at least one state in Stateflow is acquired.

[0026] It can be understood that in the embodiments of the present application, the state data can include but is not limited to state basic information, state transition information, state internal logic information, time-related information and interaction information with other elements, etc.

[0027] The state basic information can include but is not limited to state name (each state has a unique name for identifying and distinguishing different states in the model), state number (in order to facilitate programming and data processing, the system can assign a unique number to each state), state type (such as normal state, default state, history state, etc., which are not limited in the present application), etc., which are not limited in the present application.

[0028] ​The state transition information may include, but is not limited to, a transition condition (it can be understood that the transition between states is triggered by a specific condition, which can be a logical expression, a change in variable value, etc., and the present application does not make specific limitations), a transition action (it can be understood that in the state transition process, some specific actions may be performed, such as assignment operation, function call, etc., and the present application does not make specific limitations), a transition target state (it can be understood as the target state entered after the transition from the current state), etc., and the present application does not make specific limitations.

[0029] The state internal logic information may include, but is not limited to, an entry action (it can be understood as used to initialize state-related variables or perform some necessary preparations), an exit action (it can be understood as used to clean up state-related resources or record relevant information at the end of the state), a period action (it can be understood as some actions that will be periodically executed during the state duration), etc., and the present application does not make specific limitations.

[0030] The time-related information may include, but is not limited to, a state duration (recording the time experienced by the state from the entry time to the exit time), a time trigger condition (a condition in which the state transition is triggered by a time-related condition), etc., and the present application does not make specific limitations.

[0031] The interaction with other elements information may include, but is not limited to, interaction with external variables (interaction with model external variables), interaction with sub-states, etc., and the present application does not make specific limitations.

[0032] In the actual execution process, the embodiments of the present application can obtain state data of different states in Stateflow, such as state basic information, state transition information, state internal logic information, time-related information, and interaction with other elements information, etc., and the present application does not make specific limitations.

[0033] Among them, the embodiments of the present application can use MATLAB (Matrix Laboratory) command line, use Stateflow API (Application Programming Interface), use Simulink debugging tools, and obtain state data of different states in Stateflow through script automation.

[0034] Optionally, in an embodiment of the present application, before determining the actual type of at least one state based on the state data, it further includes: obtaining target state data of at least one target state in Stateflow; obtaining a target state identifier of the at least one target state based on the target state data; and constructing a target state type matched with the at least one target state based on the target state identifier.

[0035] It can be understood that the target state identifier in the embodiments of the present application can include, but is not limited to, an execution identifier, an exception identifier and a transfer identifier, and the present application does not make specific limitations, and the target state type of the target state is obtained through the target state identifier.

[0036] Further, the target state type constructed in the embodiments of the present application can include, but is not limited to, a function execution type, an exception monitoring type and a transfer judgment type, and the present application does not make specific limitations.

[0037] The function execution type can be understood as the thing that the state needs to do, and the execution priority is the highest, and it is named as “RUNNING”.

[0038] The exception monitoring type can be used to monitor the running of the state corresponding to the function execution type, and can output a log or not output a log, which can be set according to actual conditions, and the present application does not make specific limitations, and the execution priority is medium, and it is named as “WATCHING”.

[0039] The transfer judgment type is used to detect whether the transfer condition meets the transfer, and the execution priority is the lowest (relative to the function execution type and the exception monitoring type), and if there are multiple states of the transfer judgment type, the priority can be defined according to actual conditions, but the priority cannot be higher than the function execution type and the exception monitoring type, and it is named as “TO_XX”, wherein “XX” represents the state name after the transfer, thereby increasing the readability and maintainability of the model.

[0040] It should be noted that the embodiments of the present application can form independent parallel decomposition of all external transfer conditions of the state, and the condition judgment is performed independently inside the state, instead of being performed on the transfer line outside the state, and the result of the “transfer judgment” used on the external transfer line of the state is used as the condition judgment basis for the mature transfer. In the embodiments of the present application, the in() function can be used as the external transfer condition of the state, and the external transfer priority and the priority of the transfer judgment type are consistent in the execution order.

[0041] In addition, in the embodiments of the present application, a “confirmation” state is set in the transfer judgment type, and the name can be represented as the “CONFIRM” state; and an “unconfirmed” state, and the name can be represented as the “WAIT” state.

[0042] Further, when the transfer condition is mature, the embodiments of the present application can be transferred to the “CONFIRM” state; when the transfer condition is not mature, the embodiments of the present application can be kept or transferred to the “WAIT” state, and cannot be transferred to the “CONFIRM” state, and the schematic diagram is as shown in Figure 2 .

[0043] The embodiment of the application can not only avoid complex logical expressions, but also realize graphical logical expression, reduce modeling complexity and enhance maintainability of the model by naming the transition judgment type as "TO_XX" and using the in() function as an external transition condition.

[0044] As a possible implementation manner, the embodiment of the application can obtain a corresponding target state identifier according to target state data of a target state in the Stateflow before determining a corresponding actual type according to the state data, and then construct a target state type matched with the at least one target state.

[0045] For example, the embodiment of the application can obtain target state data of a target state in the Stateflow, and then obtain a corresponding target state identifier, so as to divide all states into three parallel decompositions, that is, a function execution type, an exception monitoring type and a transition judgment type, and a schematic diagram is as shown in Figure 3 , wherein the function execution type can be represented as "RUNNING", the exception monitoring type can be represented as "WATCHING", and the transition judgment type can be represented as "TO_XX".

[0046] Further, in the transition judgment type, when the transition condition is mature, the transition can be made to the "CONFIRM" state; when the transition condition is not mature, the transition can be kept or made to the "WAIT" state, and the in() function is used as an external transition condition, and a schematic diagram is as shown in Figure 4 , for example, [in(STATE_A.TO_STATE_A.CONFIRM)], which indicates that the condition of STATE_A transition to STATE_A has been mature, and the transition can be executed; [in(STATE_A.TO_STATE_B.CONFIRM)], which indicates that the condition of STATE_A transition to STATE_B has been mature, and the transition can be executed; [in(STATE_A.TO_STATE_C.CONFIRM)], which indicates that the condition of STATE_A transition to STATE_C has been mature, and the transition can be executed.

[0047] In addition, [in(STATE_A.TO_STATE_B.CONFIRM)] if the specific condition of the transition needs to be read or the transition condition needs to be modified, the reading and modification can be performed from the parallel decomposition TO_STATE_B of STATE_A, and there is no need to worry about missing, so as to enhance the readability and maintainability of the model.

[0048] In step S102, an actual type of at least one state is determined based on state data.

[0049] As a possible implementation manner, the embodiment of the application can determine the actual type corresponding to the state data.

[0050] Optionally, in an embodiment of the application, the actual type of the at least one state is determined based on the state data, including: obtaining a state identifier of the at least one state based on the state data; determining the actual type based on the state identifier, wherein, in a case where the state identifier is an execution identifier, the actual type is determined as a function execution type; in a case where the state identifier is an exception identifier, the actual type is determined as an exception monitoring type; and in a case where the state identifier is a transition identifier, the actual type is determined as a transition judgment type.

[0051] As a possible implementation manner, the embodiment of the application can obtain the state identifier of different states according to the state data, and then in a case where the state identifier is an execution identifier, the actual type is determined as a function execution type; in a case where the state identifier is an exception identifier, the actual type is determined as an exception monitoring type; and in a case where the state identifier is a transition identifier, the actual type is determined as a transition judgment type.

[0052] In step S103, a Stateflow model satisfying a preset condition is constructed based on the Stateflow, the actual type and the at least one state.

[0053] In some embodiments, the embodiment of the application can construct a Stateflow model satisfying a certain condition based on the Stateflow and the state, through the actual type of the state. The certain condition can be set by a person skilled in the art according to the actual situation, and the application does not make specific limitations.

[0054] Optionally, in an embodiment of the application, the Stateflow model satisfying the preset condition is constructed based on the Stateflow, the actual type and the at least one state, including: determining the execution priority of the at least one state based on the actual type; and constructing the Stateflow model based on the Stateflow, the execution priority, the actual type and the at least one state.

[0055] It should be noted that when constructing the Stateflow model satisfying the certain condition, the embodiment of the application can first determine the execution priority of different states according to the actual type, and then construct the corresponding Stateflow model.

[0056] The working principle of the Stateflow-based modeling method proposed by the embodiment of the application will be introduced below in combination with a specific embodiment.

[0057] In the embodiment of the application, the Stateflow-based modeling method can be used to construct a Stateflow model satisfying a certain condition. Figure 5 The flow chart of the working principle of the Stateflow-based modeling method provided by an embodiment of the application.

[0058] Step S501: all states are divided into function execution type, abnormal monitoring type and transfer judgment type.

[0059] The function execution type can be understood as the thing that the state needs to do, and the execution priority is the highest, and it is named "RUNNING".

[0060] The abnormal monitoring type can be used to monitor the running of the state corresponding to the function execution type, and can also not output the log, which can be set according to the actual situation, and the application does not make specific limitations, and the execution priority is medium, which is named "WATCHING".

[0061] The transfer judgment type is used to detect whether the transfer condition meets the transfer, and the execution priority is the lowest (relative to the function execution type and the abnormal monitoring type), if there are multiple transfer judgment type states, the priority can be defined according to the actual situation, but the priority cannot be higher than the function execution type and the abnormal monitoring type, and it is named "TO_XX", wherein "XX" represents the state name after the transfer, thereby increasing the readability and maintainability of the model.

[0062] Step S502: The transfer judgment type needs to detect whether the transfer condition is mature.

[0063] Among them, the application embodiment sets a "confirmation" state, which can be represented as a "CONFIRM" state; an "unconfirmed" state, which can be represented as a "WAIT" state.

[0064] Further, the application embodiment can be transferred to the "CONFIRM" state when the transfer condition is mature; when the transfer condition is not mature, it can be kept or transferred to the "WAIT" state, and cannot be transferred to the "CONFIRM" state, and the schematic diagram is as shown in Figure 2 .

[0065] Step S503: Use the in() function as the external transfer condition of the state.

[0066] Among them, the schematic diagram of the external transfer condition of the application embodiment is as shown in Figure 4As shown, for example, [in (STATE_A.TO_STATE_A.CONFIRM)], indicates that the condition for STATE_A to transition to STATE_A has matured, and the transition can be performed; [in (STATE_A.TO_STATE_B.CONFIRM)], indicates that the condition for STATE_A to transition to STATE_B has matured, and the transition can be performed; [in (STATE_A.TO_STATE_C.CONFIRM)], indicates that the condition for STATE_A to transition to STATE_C has matured, and the transition can be performed.

[0067] In addition, [in (STATE_A.TO_STATE_B.CONFIRM)] if the specific conditions of the transition need to be read or the transition conditions need to be modified, it can be read and modified from the parallel decomposition of STATE_A to TO_STATE_B without worrying about missing, thereby enhancing the readability and maintainability of the model.

[0068] According to the Stateflow-based modeling method provided in the embodiments of the present application, the actual type of the corresponding state can be determined according to the state data of at least one state in the Stateflow, and then a Stateflow model satisfying certain conditions is constructed, so as to realize the standardized management of Stateflow modeling, avoid complex logical expressions, and facilitate the graphical implementation of the logical expressions, thereby improving the visualization degree of the model and enhancing the reliability, readability and maintainability of the model. Thus, the problems in the related art that the Stateflow has a rough condition expression expression, which leads to a low visualization degree of the MBD software, and also makes the reliability, readability and maintainability of the software poor, are solved.

[0069] Secondly, the Stateflow-based modeling device provided in the embodiments of the present application is described with reference to the accompanying drawings.

[0070] Figure 6 A block schematic diagram of the Stateflow-based modeling device provided in the embodiments of the present application is shown.

[0071] As Figure 6 shown, the Stateflow-based modeling device 10 includes a first acquisition module 100, a determination module 200 and a first construction module 300.

[0072] The first acquisition module 100 is configured to acquire state data of at least one state in the Stateflow.

[0073] The determination module 200 is configured to determine an actual type of the at least one state based on the state data.

[0074] The first construction module 300 is configured to construct a Stateflow model meeting preset conditions based on the Stateflow, an actual type and at least one state.

[0075] Optionally, the application further includes a second acquisition module, a third acquisition module and a second construction module.

[0076] The second acquisition module is configured to acquire target state data of at least one target state in the Stateflow before determining the actual type of the at least one state based on the state data.

[0077] The third acquisition module is configured to acquire target state identifiers of the at least one target state based on the target state data.

[0078] The second construction module is configured to construct a target state type matching the at least one target state based on the target state identifiers.

[0079] Optionally, the application further includes an acquisition unit and a first determination unit.

[0080] The acquisition unit is configured to acquire state identifiers of at least one state based on state data.

[0081] The first determination unit is configured to determine an actual type based on the state identifiers.

[0082] Optionally, the first determination unit includes a first determination subunit, a second determination subunit and a third determination subunit.

[0083] The first determination subunit is configured to determine the actual type as a function execution type when the state identifier is an execution identifier.

[0084] The second determination subunit is configured to determine the actual type as an abnormal monitoring type when the state identifier is an abnormal identifier.

[0085] The third determination subunit is configured to determine the actual type as a transition judgment type when the state identifier is a transition identifier.

[0086] Optionally, the first construction module 300 includes a second determination unit and a construction unit.

[0087] The second determination unit is configured to determine an execution priority of the at least one state based on the actual type.

[0088] The construction unit is configured to construct a Stateflow model based on the Stateflow, the execution priority, the actual type and the at least one state.

[0089] It should be noted that the foregoing explanation of the embodiment of the modeling method based on Stateflow also applies to the modeling device based on Stateflow of the embodiment, which will not be repeated here.

[0090] The modeling device based on Stateflow provided by the embodiment of the present application can determine the actual type of the corresponding state according to the state data of at least one state in the Stateflow, and then construct a Stateflow model that meets certain conditions, so as to realize the standardized management of Stateflow modeling, avoid complex logical expressions, and facilitate the graphical implementation of the logical expressions, improve the visualization of the model, and enhance the reliability, readability and maintainability of the model. Thus, the problem that the Stateflow in the related art expresses the condition expression roughly, which leads to low visualization of the MBD software, and also makes the reliability, readability and maintainability of the software poor, is solved.

[0091] Figure 7 The structure schematic diagram of the electronic device provided by the embodiment of the present application is shown. The electronic device can include: The memory 701, the processor 702, and the computer program stored in the memory 701 and executable on the processor 702.

[0092] The processor 702 implements the modeling method based on Stateflow provided in the above embodiments when executing the program.

[0093] Further, the electronic device further includes: The communication interface 703 is used for communication between the memory 701 and the processor 702.

[0094] The memory 701 is used to store the computer program executable on the processor 702.

[0095] The memory 701 can include a high-speed RAM memory, and can also include a non-volatile memory, such as at least one disk memory.

[0096] If the memory 701, the processor 702 and the communication interface 703 are implemented independently, the communication interface 703, the memory 701 and the processor 702 can be connected with each other through a bus and complete communication between each other. The bus can be an Industry Standard Architecture (ISA) bus, a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus, etc. The bus can be divided into an address bus, a data bus, a control bus, etc. For convenience of representation, Figure 7 Only one thick line is used to represent the bus in the figure, but it does not mean that there is only one bus or only one type of bus.

[0097] Optionally, in a specific implementation, if the memory 701, the processor 702 and the communication interface 703 are integrated on a chip, the memory 701, the processor 702 and the communication interface 703 can complete communication between each other through an internal interface.

[0098] The processor 702 can be a Central Processing Unit (CPU), or an Application Specific Integrated Circuit (ASIC), or one or more integrated circuits configured to implement one or more embodiments of the present application.

[0099] The embodiment of the present application further provides a computer readable storage medium, which has a computer program stored thereon, and the program is executed by a processor to implement the Stateflow-based modeling method.

[0100] The embodiment of the present application further provides a computer program product, which includes a computer program, and the program is executed to implement the Stateflow-based modeling method.

[0101] In the description of this specification, the references to terms such as "one embodiment," "some embodiments," "example," "specific example," or "some examples," etc., indicate that a specific feature, structure, material, or characteristic described in connection with that embodiment or example is included in at least one embodiment or example of this application. In this specification, the illustrative expressions of the above terms do not necessarily refer to the same embodiment or example. Furthermore, the specific features, structures, materials, or characteristics described may be combined in any suitable manner in one or more embodiments or examples. Moreover, without contradiction, those skilled in the art can combine and integrate the different embodiments or examples described in this specification, as well as the features of different embodiments or examples.

[0102] Furthermore, the terms "first" and "second" are used for descriptive purposes only and should not be construed as indicating or implying relative importance or implicitly specifying the number of technical features indicated. Thus, a feature defined as "first" or "second" may explicitly or implicitly include at least one of that feature. In the description of this application, "N" means at least two, such as two, three, etc., unless otherwise explicitly specified.

[0103] Any process or method described in the flowchart or otherwise herein can be understood as representing a module, segment, or portion of code comprising one or N executable instructions for implementing custom logic functions or processes, and the scope of the preferred embodiments of this application includes additional implementations in which functions may be performed not in the order shown or discussed, including substantially simultaneously or in reverse order depending on the functions involved, as should be understood by those skilled in the art to which embodiments of this application pertain.

[0104] The logic and / or steps represented in the flowchart or otherwise described herein, for example, can be considered as a sequenced list of executable instructions for implementing logical functions, and can be embodied in any computer-readable medium for use by, or in conjunction with, an instruction execution system, apparatus, or device (such as a computer-based system, a processor-included system, or other system that can fetch and execute instructions from, an instruction execution system, apparatus, or device). For the purposes of this specification, "computer-readable medium" can be any means that can contain, store, communicate, propagate, or transmit programs for use by, or in conjunction with, an instruction execution system, apparatus, or device. More specific examples (a non-exhaustive list) of computer-readable media include: an electrical connection having one or more wires (electronic device), a portable computer disk drive (magnetic device), random access memory (RAM), read-only memory (ROM), erasable and editable read-only memory (EPROM or flash memory), fiber optic devices, and portable optical disc read-only memory (CDROM). In addition, computer-readable media can even be paper or other suitable media on which programs can be printed, because programs can be obtained electronically by optically scanning paper or other media, then editing, interpreting or otherwise processing them as necessary, and then storing them in computer memory.

[0105] It should be understood that the various parts of this application can be implemented using hardware, software, firmware, or a combination thereof. In the above embodiments, the N steps or methods can be implemented using software or firmware stored in memory and executed by a suitable instruction execution system. If implemented in hardware, as in another embodiment, it can be implemented using any one or more of the following techniques known in the art: discrete logic circuits having logic gates for implementing logical functions on data signals, application-specific integrated circuits (ASICs) having suitable combinational logic gates, programmable gate arrays (PGAs), field-programmable gate arrays (FPGAs), etc.

[0106] Those skilled in the art will understand that all or part of the steps of the methods in the above embodiments can be implemented by a program instructing related hardware. The program can be stored in a computer-readable storage medium, and when executed, the program includes one or a combination of the steps of the method embodiments.

[0107] Furthermore, the functional units in the various embodiments of this application can be integrated into a processing module, or each unit can exist physically separately, or two or more units can be integrated into a module. The integrated module can be implemented in hardware or as a software functional module. If the integrated module is implemented as a software functional module and sold or used as an independent product, it can also be stored in a computer-readable storage medium.

[0108] The storage medium mentioned above can be a read-only memory, a disk, or an optical disk, etc. Although embodiments of this application have been shown and described above, it is understood that the above embodiments are exemplary and should not be construed as limiting this application. Those skilled in the art can make changes, modifications, substitutions, and variations to the above embodiments within the scope of this application.

Claims

1. A modeling method based on Stateflow, characterized in that, Includes the following steps: Retrieve state data for at least one state in a Stateflow; Based on the state data, determine the actual type of the at least one state; Based on the Stateflow, the actual type, and at least one state, construct a Stateflow model that satisfies preset conditions.

2. The method according to claim 1, characterized in that, Before determining the actual type of the at least one state based on the state data, the method further includes: Obtain target state data for at least one target state in the Stateflow; Based on the target state data, obtain the target state identifier of the at least one target state; Based on the target state identifier, a target state type matching the at least one target state is constructed.

3. The method according to claim 2, characterized in that, Determining the actual type of the at least one state based on the state data includes: Based on the state data, obtain the state identifier of the at least one state; The actual type is determined based on the status identifier.

4. The method according to claim 3, characterized in that, Determining the actual type based on the status identifier includes: If the status identifier is an execution identifier, the actual type is determined to be a function execution type; If the status identifier is an anomaly identifier, the actual type is determined to be an anomaly monitoring type; If the status identifier is a transfer identifier, the actual type is determined to be a transfer judgment type.

5. The method according to claim 1, characterized in that, The step of constructing a Stateflow model that satisfies preset conditions based on the Stateflow, the actual type, and at least one state includes: Based on the actual type, determine the execution priority of the at least one state; The Stateflow model is constructed based on the Stateflow, the execution priority, the actual type, and at least one state.

6. A modeling apparatus based on Stateflow, characterized in that, include: The first acquisition module is used to acquire state data of at least one state in the Stateflow. A determining module is configured to determine the actual type of the at least one state based on the state data; The first construction module is used to construct a Stateflow model that meets preset conditions based on the Stateflow, the actual type, and at least one state.

7. The apparatus according to claim 6, characterized in that, Also includes: The second acquisition module is used to acquire target state data of at least one target state in the Stateflow before determining the actual type of the at least one state based on the state data. The third acquisition module is used to acquire the target state identifier of the at least one target state based on the target state data. The second construction module is used to construct a target state type that matches the at least one target state based on the target state identifier.

8. An electronic device, characterized in that, include: A memory, a processor, and a computer program stored in the memory and executable on the processor, the processor executing the program to implement the Stateflow-based modeling method as described in any one of claims 1-5.

9. A computer-readable storage medium having a computer program stored thereon, characterized in that, The program is executed by the processor to implement the Stateflow-based modeling method as described in any one of claims 1-5.

10. A computer program product, characterized in that, Includes a computer program, which, when executed, is used to implement the Stateflow-based modeling method as described in any one of claims 1-5.