State machine diagram conversion method and device, electronic equipment and storage medium
By parsing the nodes, connecting edges, and common components of the UML state machine diagram, and generating automata description text, the problem of low efficiency in running and verifying on different professional model checking tools is solved, and efficient state machine diagram conversion and verification is achieved.
Patent Information
- Application Number
- CN202411690996.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-25
- Publication Date
- 2025-03-07
AI Technical Summary
The lack of existing methods to convert UML state machine diagrams into general automata description text leads to low efficiency in running and validating them on different specialized model checking tools.
A method for converting state machine diagrams is provided. By obtaining the nodes, connecting edges, and common components of the UML state machine diagram, parsing their attribute information, and generating corresponding automata description text, the method ensures that it can be recognized and run on different professional model detection tools.
It enables efficient conversion between multiple runs and verifications on different professional model testing tools, reducing the learning cost and operational complexity for software designers and improving modeling and verification efficiency.
Smart Images

Figure CN119578374A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of trusted software formal design, and in particular to a state machine diagram conversion method, device, electronic device and storage medium. Background Art
[0002] The modern information society is increasingly dependent on computer systems, and a large part of computer system defects are caused by software problems. For security software, traditional testing methods are difficult to achieve zero defects and high reliability standards. To solve this problem, formal methods propose to design high-reliability software through mathematical modeling and rigorous mathematical proofs, but different professional model detection tools have their own set of syntax and rules. Whether it is modeling or proof, the learning cost is very high.
[0003] In order to improve the efficiency of modeling, it has become a trend in the industry to use automated tools to assist in modeling and verification. The current modeling in the industry is mainly carried out on the integrated development environment of large commercial software, which has a high degree of graphics and supports rich semantics, but the operation process is complex, the graphical description is not universal, and the platform is highly dependent. It only supports specific professional model detection tools. If you want to switch to other tools, you need to re-model in other integrated development environments, and the efficiency of modeling and verification is low.
[0004] Therefore, it is an urgent problem to be solved in the field of formal design of trusted software to develop a state machine diagram conversion method, device, electronic device and storage medium that can convert UML state machine diagrams into a general automaton description text, thereby realizing multiple runs and verifications on different professional model detection tools and improving software modeling and verification efficiency. Summary of the invention
[0005] In order to solve the above technical problems, the present application provides a state machine diagram conversion method, device, electronic device and storage medium, which can solve the current lack of a state machine diagram conversion method that can convert UML state machine diagrams into general automaton description texts, thereby realizing operation and verification on different professional model detection tools, and improving software modeling and verification efficiency.
[0006] The technical solutions provided by this application are as follows:
[0007] On the one hand, the present application provides a state machine diagram conversion method, the state machine diagram conversion method comprising:
[0008] Obtaining a UML state machine diagram, wherein the UML state machine diagram includes a plurality of nodes, a plurality of connection edges between the nodes, and a plurality of general components, wherein the connection edges represent state transition events, the nodes represent any one of a state machine, a state of the state machine, and a connection relationship between the connection edges, and the general components represent a context declaration of the state machine;
[0009] Based on the attribute information of the UML state machine diagram, an overall description is obtained;
[0010] Parsing the context declaration of the state machine represented by the general component in the UML state machine diagram to obtain a static description;
[0011] Parsing the nodes, the connection edges and the general components in the UML state machine diagram to obtain a dynamic behavior description;
[0012] Based on the overall description, the static description and the dynamic behavior description, an automaton description text corresponding to the UML state machine diagram is generated.
[0013] In some optional implementations, the method for constructing the UML state machine diagram includes:
[0014] Setting a plurality of the nodes, and configuring each of the nodes to represent any one of a state machine, a state of the state machine, and a connection relationship between the connection edges;
[0015] Connecting a plurality of the nodes to obtain connection edges between the plurality of the nodes, and configuring each of the connection edges to represent a state transition event;
[0016] Set up a number of the general components, configure each of the general components to represent any one of the context declaration of the state machine, the constant conditions of the state machine, the guard conditions of the state transition event, and the effects of the state transition event, to obtain the UML state machine diagram.
[0017] In some optional implementations, the plurality of nodes include a state machine node, a state node, and an intermediate state node, and the plurality of nodes are set and each of the nodes is configured to represent any one of a state machine, a state of the state machine, and a connection relationship between the connection edges, including:
[0018] Setting a state machine node and configuring the state machine node so that it represents the state machine;
[0019] Setting a state node, and configuring the state node so that it represents the state of the state machine;
[0020] An intermediate state node is set, and the input end and the output end of the intermediate state node are configured so that the intermediate state node represents the connection relationship between the plurality of connection edges.
[0021] In some optional implementations, the plurality of intermediate nodes include a connection node, a split node, a merge node, and a selection node, and the setting of the intermediate node configures the input end and the output end of the intermediate node to represent the connection relationship between the plurality of connection edges, including:
[0022] Setting a connection node, configuring an input end and an output end of the connection node so that the input end of the connection node is connected to a plurality of the connection edges, and so that the output end of the connection node is connected to a plurality of the connection edges;
[0023] Setting a split node, configuring the input end and the output end of the split node so that the input end of the split node is connected to one of the connection edges, and so that the output end of the split node is connected to a plurality of the connection edges;
[0024] Setting a merging node, and configuring an input end and an output end of the merging node so that the input end of the merging node is connected to a plurality of the connecting edges, and so that the output end of the merging node is connected to one of the connecting edges;
[0025] A selection node is set, and an input end and an output end of the selection node are configured so that the input end of the selection node is connected to a plurality of the connection edges, and the output end of the selection node is connected to a plurality of the connection edges.
[0026] In some optional implementations, the plurality of general components include a record component, a constraint component, an information component, and an activity component. The plurality of general components are set, and each general component is configured to represent any one of a context declaration of the state machine, a constant condition of the state machine, a guard condition of the state transition event, and an effect of the state transition event, to obtain the UML state machine diagram, including:
[0027] Setting a recording component, configuring the recording component to represent a context statement of the state machine;
[0028] Setting a constraint component, configuring the constraint component to represent a constant condition of the state machine;
[0029] Setting an information component, configuring the information component to represent the guard condition of the state transition event;
[0030] An active component is set and configured to represent the effect of the state transition event.
[0031] In some optional implementations, constructing an overall description based on the attribute information of the UML state machine diagram includes:
[0032] Acquire the attribute information; the attribute information includes at least one of the name of the UML state machine diagram, the format version mark, and the tool compatibility information;
[0033] The attribute information is determined as the overall description.
[0034] In some optional implementations, after constructing the overall description based on the attribute information of the UML state machine diagram, the method further includes:
[0035] Respectively connect and process the state transition events represented by the connection edges connected to the connection nodes, split nodes, merge nodes, and selection nodes to obtain a new UML state machine diagram;
[0036] The new UML state machine diagram is used to obtain the automaton description text after parsing.
[0037] In some optional implementations, parsing the context declaration of the state machine represented by the general component in the UML state machine diagram to obtain a static description includes:
[0038] Parsing the context declaration represented by the record component in the new UML state machine diagram to obtain a context declaration parsing result of the state machine;
[0039] Based on the context declaration parsing result, a static description is generated.
[0040] In some optional implementations, parsing the nodes, the connection edges, and the general components in the UML state machine diagram to obtain a dynamic behavior description includes:
[0041] Parsing the state of the state machine represented by the state node of the new UML state machine diagram and the state transition event represented by the connection edge to obtain a first dynamic behavior parsing result;
[0042] Parsing the constant conditions of the state machine represented by the constraint component of the new UML state machine diagram to obtain a second dynamic behavior parsing result;
[0043] Parsing the guard condition of the state transition event represented by the information component of the new UML state machine diagram to obtain a third dynamic behavior parsing result;
[0044] Analyze the effect of the state transition event represented by the active component of the new UML state machine diagram to obtain a fourth dynamic behavior analysis result;
[0045] A dynamic behavior description is generated based on the first dynamic behavior analysis result, the second dynamic behavior analysis result, the third dynamic behavior analysis result, and the fourth dynamic behavior analysis result.
[0046] In some optional embodiments, the method further comprises:
[0047] Acquire mathematical symbol conversion information, wherein the symbol conversion information represents a correspondence between mathematical symbols and identifier keywords;
[0048] Determine, according to the mathematical symbol conversion information, an identifier keyword corresponding to the mathematical symbol in the content represented by the universal component in the new UML state machine diagram;
[0049] In the process of parsing the general component in the new UML state machine diagram, the mathematical symbols in the content represented by the general component are converted into corresponding identifier keywords to generate the automaton description text corresponding to the new UML state machine diagram.
[0050] On the other hand, the present application proposes a state machine diagram conversion device, the device comprising a state machine diagram acquisition module and an automaton description text conversion module;
[0051] The state machine diagram acquisition module is used to acquire a UML state machine diagram, wherein the UML state machine diagram includes a plurality of nodes, a plurality of connection edges between the nodes, and a plurality of general components, wherein the connection edges represent state transition events, the nodes represent any one of a state machine, a state of the state machine, and a connection relationship between the connection edges, and the general components represent a context declaration of the state machine;
[0052] The automaton description text conversion module is used to obtain an overall description based on the attribute information of the UML state machine diagram; and is used to parse the context declaration of the state machine represented by the general component in the UML state machine diagram to obtain a static description; and is used to parse the nodes, the connection edges and the general components in the UML state machine diagram to obtain a dynamic behavior description; and is used to generate an automaton description text corresponding to the UML state machine diagram based on the overall description, the static description and the dynamic behavior description.
[0053] On the other hand, the present application proposes an electronic device for a state machine diagram conversion method, the electronic device comprising a processor and a memory, the memory storing at least one instruction or at least one program, the at least one instruction or at least one program being loaded and executed by the processor to implement the state machine diagram conversion method as described in any one of the above embodiments.
[0054] On the other hand, the present application proposes a computer-readable storage medium, which stores at least one instruction or at least one program, and the at least one instruction or the at least one program is loaded and executed by a processor to implement a state machine diagram conversion method as described in any of the above embodiments.
[0055] The state machine diagram conversion method provided by the present application obtains a UML state machine diagram, wherein the UML state machine diagram includes a plurality of nodes, a plurality of connecting edges between the nodes, and a plurality of general components, wherein the connecting edges represent state transition events, wherein the nodes represent any one of the state machine, the state of the state machine, and the connection relationship between the connecting edges, and the general components represent the context declaration of the state machine; based on the attribute information of the UML state machine diagram, an overall description is obtained; the context declaration of the state machine represented by the general component in the UML state machine diagram is parsed to obtain a static description; the nodes, the connecting edges, and the general components in the UML state machine diagram are parsed to obtain a dynamic behavior description; based on the overall description, the static description, and the dynamic behavior description, an automaton description text corresponding to the UML state machine diagram is generated. By designing a construction method for a UML state machine diagram, a state machine can be modeled according to the construction method, and it can be ensured that all state machine diagrams follow the same construction method, so as to facilitate subsequent conversion into automaton description texts that can be recognized and run by different professional model detection tools, thereby improving the efficiency of software modeling and verification. BRIEF DESCRIPTION OF THE DRAWINGS
[0056] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.
[0057] Figure 1 is a flow chart of a state machine diagram conversion method proposed according to an embodiment of the present invention;
[0058] Figure 2 is a flow chart of a method for constructing a UML state machine diagram according to an embodiment of the present invention;
[0059] Figure 3 This is an example of a simplest UML state machine diagram according to an embodiment of the present invention;
[0060] Figure 4 is an example of a UML state machine diagram of a state machine according to an embodiment of the present invention;
[0061] Figure 5This is an example of a UML state machine diagram of a state-embedded sub-state machine according to an embodiment of the present invention;
[0062] Figure 6 is an example of an SND embedded sub-state machine proposed according to an embodiment of the present invention;
[0063] Figure 7 It is an example of a RECV embedded sub-state machine according to an embodiment of the present invention.
[0064] Figure 8 is an example of an automaton description text proposed according to an embodiment of the present invention. DETAILED DESCRIPTION
[0065] The technical solutions in the embodiments of the present application will be described clearly and completely below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.
[0066] The term "one embodiment" or "embodiment" as used herein refers to a specific feature, structure or characteristic that may be included in at least one implementation of the present application. In the description of the present application, it should be understood that the orientation or positional relationship indicated by the terms "upper", "lower", "top", "bottom", etc. is based on the orientation or positional relationship shown in the accompanying drawings, which is only for the convenience of describing the present application and simplifying the description, rather than indicating or implying that the device or element referred to must have a specific orientation, be constructed and operated in a specific orientation, and therefore cannot be understood as a limitation on the present application. In addition, the terms "first" and "second" are used only for descriptive purposes, and cannot be understood as indicating or implying relative importance or implicitly indicating the number of technical features indicated. Thus, the features defined as "first" and "second" may include one or more of the features explicitly or implicitly. Moreover, the terms "first", "second", etc. are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchangeable where appropriate, so that the embodiments of the present application described herein can be implemented in an order other than those illustrated or described herein.
[0067] When a numerical range is disclosed herein, the above range is deemed to be continuous and includes the minimum and maximum values of the range, as well as each value between such minimum and maximum values. Further, when a range refers to an integer, each integer between the minimum and maximum values of the range is included. In addition, when multiple ranges are provided to describe features or characteristics, the ranges can be merged. In other words, unless otherwise indicated, all ranges disclosed herein should be understood to include any and all sub-ranges included therein. For example, a specified range from "1 to 10" should be deemed to include any and all sub-ranges between a minimum of 1 and a maximum of 10. Exemplary sub-ranges of ranges 1 to 10 include, but are not limited to, 1 to 6.1, 3.5 to 7.8, 5.5 to 10, etc.
[0068] Since there is currently a lack of a state machine diagram conversion method that can convert UML state machine diagrams into a universal automaton description text, so that it can run on different professional model detection tools after adaptation, thereby improving software modeling and verification efficiency, therefore, in order to convert UML state machine diagrams into a universal automaton description text, so that it can run on different professional model detection tools after adaptation, thereby improving software modeling and verification efficiency, the present application provides a state machine diagram conversion method.
[0069] See also Figure 1 , Figure 1 1 is a flow chart of a state machine diagram conversion method proposed according to an embodiment of the present invention. The present application provides a state machine diagram conversion method, the state machine diagram conversion method comprising:
[0070] S101. Obtain a UML state machine diagram, wherein the UML state machine diagram includes a plurality of nodes, a plurality of connecting edges between the nodes, and a plurality of general components, wherein the connecting edges represent state transition events, the nodes represent a state machine, the state of the state machine, or any one of the connection relationships between the connecting edges, and the general components represent a context declaration of the state machine.
[0071] Optionally, the UML state machine diagram has a diagram name.
[0072] Alternatively, a UML state machine diagram is a diagram in the Unified Modeling Language used to describe all states that a state machine goes through and transitions between states.
[0073] Optionally, the number of nodes, the number of connection edges, and the number of general components in the UML state machine diagram can be set according to actual business requirements and are not limited here.
[0074] Optionally, the state machine is a core component of a UML state machine diagram, which defines the behavior of an object, and the state of the state machine represents the behavior or property of the object at a specific time point.
[0075] Optionally, the context declaration of the state machine is a declaration that specifies an object to which the state machine is associated, and defines that the state machine is an object of the application and the role of the state machine.
[0076] Optionally, the connecting edge is a state transition arrow, which is used to represent a state transition event. A state transition event is a connection between two states, indicating that an object migrates from one state to another. The state transition arrow has a name and a direction. The state transition arrows in a state machine cannot have the same name, and the state transition arrow has a source node and a target node. The source node and the target node can be the same node.
[0077] See also Figure 2 , Figure 2 is a flow chart of a method for constructing a UML state machine diagram according to an embodiment of the present invention. In an optional embodiment, the method for constructing a UML state machine diagram includes:
[0078] S201. Set a plurality of the nodes, and configure each of the nodes to represent any one of a state machine, a state of the state machine, and a connection relationship between the connection edges.
[0079] Optionally, the nodes of the UML state machine diagram include: state nodes, state machine nodes, initial nodes, end nodes, connection nodes, fork nodes, and selection nodes.
[0080] In an optional embodiment, the plurality of nodes include a state machine node, a state node, and an intermediate state node, and the plurality of nodes are set and each of the nodes is configured to represent any one of a state machine, a state of the state machine, and a connection relationship between the connection edges, including:
[0081] Setting a state machine node and configuring the state machine node so that it represents the state machine;
[0082] Setting a state node, and configuring the state node so that it represents the state of the state machine;
[0083] An intermediate state node is set, and the input end and the output end of the intermediate state node are configured so that the intermediate state node represents the connection relationship between the plurality of connection edges.
[0084] Optionally, the intermediate state node is connected to several connection edges, indicating the relationship between several state transition events.
[0085] Optionally, the number of state machine nodes, state nodes, and intermediate state nodes can be set according to actual business needs and is not limited here.
[0086] Optionally, the UML state machine diagram is further provided with an initial node, the initial node represents the starting point of the UML state machine diagram, the state transition event starting from the initial node is named INITIALISATION, and the state transition event starting from the initial node is used to set the initial value of the state variable.
[0087] Optionally, the end node of the UML state machine diagram may be set according to actual business requirements, or the end node may not be set.
[0088] See also Figure 3 , Figure 3 is an example of the simplest UML state machine diagram proposed according to an embodiment of the present invention. Figure 4 The initial node and the state node are set in it. The state node can be OFF. The state transition event from the initial node to the state node is INITIALISATION, and the effect is init_safe.
[0089] See also Figure 4 , Figure 4 It is an example of a UML state machine diagram of a state machine proposed according to an embodiment of the present invention. Figure 4 The initial node, end node, state node 1, and state node 2 are set in it. State node 1 can be OFF, and state node 2 can be ON. The state transition event from the initial node to state node 1 is INITIALISATION, and the effect is init_safe. The state transition event from state node 1 to state node 2 is on, and the state transition event from state node 2 to state node 1 is off. The state transition event from state node 2 to the end node is powerDown, and the state transition event from state node 1 to itself is changeSafe, and the state transition event from state node 2 to itself is doSomething. Figure 4 Information component, activity component 1 and activity component 2 are also provided. The effect of the state transition event from the initial node to the state node 1 is represented by activity component 1, and the effect is safe=FALSE. The guard condition of the state transition event from the state node 1 to the state node 2 is represented by the information component, and the guard condition is safe=TRUE. The effect of the state transition event from the state node 1 to itself is represented by activity component 2, and the effect is safe=TRUE.
[0090] By setting state machine nodes, state nodes and intermediate state nodes and configuring them respectively, any one of the state machine, the state of the state machine, and the connection relationship between the connection edges is represented. The state node clearly defines the different states of the system, making the behavior pattern of the system clearer; the connection edges can accurately describe the migration conditions and triggering events between states, which helps to understand the logic of state transitions; the intermediate state node provides a description of the complex relationship between states, which can reduce ambiguity in the state migration path, ensure the correctness of the system behavior, and reduce the complexity of understanding.
[0091] In an optional embodiment, the plurality of intermediate nodes include a connection node, a split node, a merge node, and a selection node, and the setting of the intermediate node configures the input end and the output end of the intermediate node to represent the connection relationship between the plurality of connection edges, including:
[0092] Setting a connection node, and configuring an input end and an output end of the connection node so that the input end of the connection node is connected to a plurality of the connection edges, and the output end of the connection node is connected to a plurality of the connection edges;
[0093] Setting a split node, and configuring the input end and the output end of the split node so that the input end of the split node is connected to one of the connection edges, and the output end of the split node is connected to a plurality of the connection edges;
[0094] Setting a merging node, and configuring an input end and an output end of the merging node so that the input end of the merging node is connected to a plurality of the connecting edges, and the output end of the merging node is connected to one of the connecting edges;
[0095] A selection node is set, and an input end and an output end of the selection node are configured so that the input end of the selection node is connected to a plurality of the connection edges, and the output end of the selection node is connected to a plurality of the connection edges.
[0096] Optionally, the connection node is used to connect the state transition event of the input end with the state transition event of the output end. The source node and the target node of the connection node can be a state node or another connection node, but cannot be itself.
[0097] Optionally, the splitting node is used to split the state transition event of the input end into a plurality of state transition events of the output end, and the state transition events output by the splitting node have no guard conditions.
[0098] Optionally, the merge node is used to merge several state transition events at the input end into several state transition events, each input must come from several parallel sub-states of the same parent state, and the sub-state refers to another state node set in a state node.
[0099] Optionally, both the source node and the target node of the split node and the merge node are state nodes.
[0100] Optionally, the selection node is used to select a state transition event to be executed according to the guard condition of the state transition event. The state transition events of each output of the selection node may have different guard conditions. The source node and target node of the selection node may be state nodes, fork nodes or selection nodes.
[0101] Nodes are used to represent the connection relationship between state transition events and state transition events. Connecting nodes can merge multiple transition paths into one, which can simplify the representation of the state machine. Splitting nodes and merging nodes can trigger multiple parallel execution states at the same time, which helps to describe concurrent behavior. Selecting nodes allows the state machine to take different paths according to different conditions, which improves the expressiveness of the state machine. Using a structured layout of nodes helps to quickly convey complex state logic. UML provides a set of standardized graphic elements so that nodes and connecting edges follow this set of standards, improving modeling efficiency.
[0102] S202. Connect several of the nodes to obtain connection edges between the nodes, and configure each of the connection edges to represent a state transition event.
[0103] Optionally, an information component representing a guard condition and an activity component representing an action effect are set for the connection state transition event.
[0104] Optionally, the guard condition represents a condition for the state transition event to occur, which is expressed as a Boolean expression. The state transition event will actually occur only when the condition is true. The guard condition may also be a combination of multiple Boolean expressions.
[0105] Optionally, the action effect represents the effect produced by the occurrence of an event, which may be an assignment to a variable or a combination of multiple effects.
[0106] By associating state transition events with connection edges, the specific events that trigger state changes can be clearly defined, making the system's response behavior clearer. When the system state changes, the event that triggered the transition can be quickly tracked through the event configuration of the connection edge, which facilitates problem location and debugging. Separating events from state transitions helps to achieve modular design. Each module can handle specific events independently, improving the maintainability of the system.
[0107] S203. Set up a number of the general components, configure each of the general components to represent at least one of the context declaration of the state machine, the constant conditions of the state machine, the guard conditions of the state transition event, and the effects of the state transition event, to obtain the UML state machine diagram.
[0108] In an optional embodiment, the plurality of general components include a record component, a constraint component, an information component, and an activity component. The plurality of general components are set, and each general component is configured to represent at least one of a context declaration of the state machine, a constant condition of the state machine, a guard condition of the state transition event, and an effect of the state transition event, to obtain the UML state machine diagram, including:
[0109] Setting a recording component, configuring the recording component to represent a context statement of the state machine;
[0110] Setting a constraint component, configuring the constraint component to represent a constant condition of the state machine;
[0111] Setting an information component, configuring the information component to represent the guard condition of the state transition event;
[0112] An active component is set and configured to represent the effect of the state transition event.
[0113] Optionally, the context declaration of the state machine includes collections, constants, and axioms used by the state machine. A state machine has a record component that carries the context declaration of the state machine.
[0114] Optionally, an example of a record component whose UML state machine diagram name is "brp" according to an embodiment of the present invention is as follows:
[0115] brp:
[0116] [SET]
[0117] DATA
[0118] [CONST]
[0119] n,
[0120] file_orig
[0121] [AXIOM]
[0122] 0 <n;
[0123]
[0124] As can be seen from the above example, the first line of the record component writes the state machine diagram name and ends with a colon. The second line starts with SET, CONST and AXIOM. The content in SET is the set used by this state machine, which is DATA. Multiple sets are separated by commas and carriage returns. The content in CONST is the constants used by this state machine. Multiple constants are separated by commas and carriage returns, which are n and file_orig. The content in AXIOM is the axioms used by this state machine. Axioms generally contain constraints on constants and the types to which constants belong. Multiple axioms are separated by semicolons and carriage returns, which are 0.<n、file_orig∈1··n-> DATA.
[0125] Optionally, an example of a constraint component named "constraint1" proposed according to an embodiment of the present invention is as follows:
[0126] 《invariant》
[0127]
[0128] As can be seen from the above example, the constraint component is used to carry the invariants of the state machine. The constant condition of the state machine refers to the property or condition that should remain true under any circumstances. It is an invariant, expressed in a mathematical formula. Multiple invariants are separated by semicolons and carriage returns. The constraint component named "constraint1" has two invariants: And SND=SND_SUCCESS→RECV=RECV_SUCCESS, which means that RECV=RECV_SUCCESS and recv_ptr=n are equivalent, and from SND=SND_SUCCESS it can be deduced that RECV=RECV_SUCCESS.
[0129] Optionally, an example of an information component named "grdA" proposed according to an embodiment of the present invention is as follows:
[0130] file∈FilesType\Files;
[0131] parent∈Folders;
[0132] name∈Names;
[0133]
[0134] As can be seen from the above example, the information component is used to carry the guard condition indicating the occurrence of the event. The name of the information component represents the name of the guard condition, and the component content is the predicate expression of the guard condition. To set the guard condition in the state transition event is to find the information component by name and extract each predicate expression from the component content. The guard condition represented by the information component named "grdA" is: file belongs to the FilesType collection, but not to the Files collection; parent belongs to the Folders collection; name belongs to the Names collection; if any x belongs to the definition domain of FileSystem, then the result of combining the parent of x with the name of x is not in the file system FileSystem.
[0135] Optionally, an example of an active component named "init_brp" proposed according to an embodiment of the present invention is as follows:
[0136] oct_flag = TRUE;
[0137] snd_ptr = 1;
[0138] recv_ptr = 1;
[0139] data = file_orig(1);
[0140] file_dst={}
[0141] As can be seen from the above example, the activity component is used to express the actions and effects produced after the state transition event occurs. It is expressed as a mathematical expression, and multiple expressions can be written, separated by semicolons and carriage returns. The effects represented by the activity component named "init_brp" include the above 5 assignments and attributes.
[0142] By recording the context declaration, it helps to track the environment and context of the state machine operation; by representing constant conditions, the constraint component can ensure that the state machine is always in a valid state and prevent the system from entering an unstable or invalid state; the information component helps to define the conditions of the state transition event, ensuring that the state transition event is triggered only when specific conditions are met, providing clear conditions that must be met before the state transition occurs, and increasing the readability and comprehensibility of the state machine; the activity component represents the effect of the state transition event, clearly defines the actions that need to be performed when the state changes, making the function of the state machine clearer, improving the responsiveness and efficiency of the system, and, through event configuration, polymorphism can be more easily achieved, that is, the same event can trigger different state transitions of different state machines, thereby supporting the scalability of the system.
[0143] Optionally, a sub-state machine can be nested inside a state node. A sub-state refers to another state node set in a state node. A sub-state machine cannot have the same name as a parent state machine. The drawing of a sub-state machine must comply with the above-mentioned UML state machine diagram construction method like the parent state machine. The sub-state machine and the parent state machine can have the same initial node and end node, or different initial nodes and end nodes, which are not limited here.
[0144] See also Figure 5 , Figure 5 This is an example of a UML state machine diagram of a state embedded sub-state machine proposed according to an embodiment of the present invention. As can be seen from the figure, an initial node, an end node, a parent state machine node, a sub-state machine node 1, and a sub-state machine node 2 are provided in the UML state machine diagram. The parent state machine node can be set to BRP, the sub-state machine node 1 can be set to SND, and the sub-state machine node 2 can be set to RECV. The state transition event from the initial node to the parent state machine node BRP is INITIALISATION, and the effect is init_brp. The state transition events from the parent state machine node BRP to the end node are finish_succ and finish_fail. A record component and an activity component are also provided in the UML state machine diagram. The record component is used to represent the context declaration of the state machine, and the content is set to: the content in SET is the set used by this state machine, which is DATA; the content in CONST is the constant used by this state machine, and multiple constants are separated by commas and carriage returns, which are n and file_orig; the content in AXIOM is the axioms used by this state machine, and multiple axioms are separated by semicolons and carriage returns, which are 0<n、file_orig∈1··n-> DATA; The effect of the state transition event from the initial node to the parent state machine node BRP is represented by an active component, and the effect is: oct_flag = TRUE; snd_ptr = 1; recv_ptr = 1; data = file_orig (1); file_dst = {}, which assigns and defines values to 5 variables and sets respectively.
[0145] See also Figure 6 , Figure 6This is an example of the SND embedded sub-state machine proposed according to an embodiment of the present invention. As can be seen from the figure, the SND embedded sub-state machine diagram is provided with an initial node, an end node, state node 1, state node 2, and state node 3. State node 1 can be set to SND_WORKING, state node 2 can be set to SND_SUCCESS, and state node 3 can be set to SND_FAILURE; the state transition event from the initial node to state node 1 is INITIALISATION, the state transition event from state node 1 to state node 2 is snd_succ, and the guard condition is SND_guardC; the state transition event from state node 1 to state node 3 is snd_fail, the state transition event from state node 1 to itself is snd_send_data and snd_receive_data_ack, the guard condition of snd_send_data is SND_guardB, the effect of snd_send_data is SND_actionB, the guard condition of snd_receive_data_ack is SND_guardA, and the effect of snd_receive_data_ack is SND_actionA; the state transition event from state node 2 to the end node is finish_succ, and the state transition event from state node 3 to the end node is finish_fail. The SND embedded sub-state machine diagram is also provided with information component 1, information component 2, information component 3, activity component 1, and activity component 2. The guard condition of the state transition event snd_receive_data_ack from state node 1 to itself is characterized by information component 1, and the guard condition is: oct_flag = FALSE; snd_ptr + 1 < n; recv_ptr = snd_ptr + 1; the effect of the state transition event snd_receive_data_ack from state node 1 to itself is characterized by activity component 1, and the effect is: oct_flag = TRUE; snd_ptr = snd_ptr + 1; the guard condition of the state transition event snd_send_data from state node 1 to itself is characterized by information component 2, and the guard condition is: oct_flag = TRUE; the effect of the state transition event snd_send_data from state node 1 to itself is characterized by activity component 2, and the effect is: data = file_orig(snd_ptr + 1); oct_flag = FALSE; the guard condition of the state transition event from state node 1 to state node 2 is characterized by information component 3, and the guard condition is: oct_flag = FALSE; snd_ptr + 1 = n; recv_ptr = snd_ptr + 1.
[0146] Please refer to Figure 7 , Figure 7 which is an example of the RECV embedded sub-state machine proposed according to an embodiment of the present invention. As can be seen from the figure, the RECV embedded sub-state machine diagram is provided with an initial node, an end node, state node 1, state node 2, and state node 3. State node 1 can be set to SND_WORKING, state node 2 can be set to SND_SUCCESS, and state node 3 can be set to SND_FAILURE; the state transition event from the initial node to state node 1 is INITIALISATION, the state transition event from state node 1 to state node 2 is recv_succ, the guard condition is RECV_guardB, and the effect is RECV_actionB; the state transition event from state node 1 to state node 3 is recv_fail, and the guard condition is RECV_guardC; the state transition event from state node 1 to itself is recv_receive_current_data, the guard condition is RECV_guardA, and the effect is RECV_actionA. The state transition event from state node 2 to the end node is finish_succ, and the state transition event from state node 3 to the end node is finish_fail. The SND embedded sub-state machine diagram is also provided with information component 1, information component 2, information component 3, activity component 1, and activity component 2. The guard condition of the state transition event from state node 1 to itself is characterized by information component 1, and the guard condition is: oct_flag = FALSE; recv_ptr + 1 < n; recv_ptr + 1 < n; the effect of the state transition event from state node 1 to itself is characterized by activity component 1, and the effect is: recv_ptr = recv_ptr + 1; The guard condition of the state transition event from state node 1 to state node 2 is characterized by information component 2, and the guard condition is: oct_flag = FALSE; recv_ptr = snd_ptr; recv_ptr + 1 = n; the effect of the state transition event from state node 1 to state node 2 is characterized by activity component 2, and the effect is: recv_ptr = recv_ptr + 1; The guard condition of the state transition event from state node 1 to state node 3 is characterized by information component 3, and the guard condition is: SND = SND_FAILURE.
[0147] By designing a construction method for the UML state machine diagram, designers can perform UML modeling of the state machine in the software including mathematical formulas according to this specification, so as to be subsequently converted into a format that can be recognized and run by different professional model detection tools.
[0148] S102. Obtain an overall description based on the attribute information of the UML state machine diagram.
[0149] In an optional embodiment, constructing an overall description based on the attribute information of the UML state machine diagram includes:
[0150] Acquire the attribute information, wherein the attribute information includes at least one of a name of the UML state machine diagram, a format version mark, and tool compatibility information;
[0151] The attribute information is determined as the overall description.
[0152] Optionally, the content of the attribute information can be set according to actual business needs, which is not limited here. Exemplarily, the attribute information includes the name of the UML state machine diagram, the format version mark, and the tool compatibility information.
[0153] Optionally, the diagram name of the UML state machine diagram is the diagram identifier, which is usually used to uniquely identify the state machine diagram in a document collection, the format version tag indicates the version of the UML specification or graphical representation followed by the state machine diagram, and the tool compatibility information describes the name and version of the software tool used to create or edit the state machine diagram.
[0154] The name, format version tag, and tool compatibility information of the UML state machine diagram are generally described, which helps to ensure the standardization of the document. The format version tag can help track different versions of the state machine diagram so that the description text can reflect the latest design changes and facilitate version control and change management. The tool compatibility information ensures that the automaton description text can be migrated between different tools and platforms. Therefore, the automaton description text containing all necessary attribute information is more complete, which improves traceability.
[0155] In an optional embodiment, after constructing the overall description based on the attribute information of the UML state machine diagram, the method further includes:
[0156] Respectively connect and process the state transition events represented by the connection edges connected to the connection nodes, the fork nodes, and the selection nodes to obtain a new UML state machine diagram;
[0157] The new UML state machine diagram is used to obtain the automaton description text after parsing.
[0158] Optionally, after obtaining the UML state machine diagram, the state transition events connecting the connection nodes, fork nodes and selection nodes are processed accordingly, and the connection nodes, fork nodes and selection nodes are identified and processed. The processing method is to regard the connection, fork and selection nodes as intermediate states of state transition, copy the transition arrows containing intermediate states and semantically reused, and assemble them with another part of the transfer arrows in the same direction that are not semantically reused, and then generate new transfer arrows without intermediate states, replace the original state transition events containing intermediate states with new state transition events, iteratively scan and process the new diagram composed of new state transitions until all intermediate states are eliminated, and obtain a new UML state machine diagram, which does not contain the above three intermediate state nodes.
[0159] Intermediate state nodes may increase the complexity of the state machine. Eliminating these nodes can reduce the complexity, making the state machine diagram easier to manage and maintain. By removing intermediate state nodes, it can ensure that all state transitions are direct, thereby improving the consistency of the state machine diagram.
[0160] S103. Parse the context declaration of the state machine represented by the general component in the UML state machine diagram to obtain a static description.
[0161] In an optional embodiment, the parsing of the context declaration of the state machine represented by the general component in the UML state machine diagram to obtain a static description includes:
[0162] Parsing the context declaration represented by the record component in the new UML state machine diagram to obtain a context declaration parsing result of the state machine;
[0163] Based on the context declaration parsing result, a static description is generated.
[0164] Optionally, the context declaration parsing results include sets, constants, and axioms, constructed as a static description.
[0165] Optionally, a collection is a group of related elements, which can be states, events, variable values, etc.
[0166] Optionally, constants are values that remain constant during the execution of the state machine. They are used to represent fixed configuration parameters or fixed states.
[0167] Optionally, an axiom is a set of basic rules for the design of an automaton, which can contain constraints on constants and the types they belong to.
[0168] Static descriptions provide clear and precise semantics for the state and transitions of state machines by defining sets, constants, and axioms, reducing ambiguity. When the definition of a state machine needs to be modified, the static description provides a clear starting point, making changes easier to track and maintain. The axioms and constants in the static description provide a basis for correctness verification of the state machine, which can be used to check whether the state machine satisfies specific properties.
[0169] S104. Parse the nodes, the connection edges and the general components in the UML state machine diagram to obtain a dynamic behavior description.
[0170] In an optional embodiment, the parsing of the nodes, the connection edges and the general components in the UML state machine diagram to obtain a dynamic behavior description includes:
[0171] Parsing the state of the state machine represented by the state node of the new UML state machine diagram and the state transition event represented by the connection edge to obtain a first dynamic behavior parsing result;
[0172] Parsing the constant conditions of the state machine represented by the constraint component of the new UML state machine diagram to obtain a second dynamic behavior parsing result;
[0173] Parsing the guard condition of the state transition event represented by the information component of the new UML state machine diagram to obtain a third dynamic behavior parsing result;
[0174] Analyze the effect of the state transition event represented by the active component of the new UML state machine diagram to obtain a fourth dynamic behavior analysis result;
[0175] A dynamic behavior description is generated based on the first dynamic behavior analysis result, the second dynamic behavior analysis result, the third dynamic behavior analysis result, and the fourth dynamic behavior analysis result.
[0176] Optionally, identify and process the invariants in the state nodes, information components, constraint components, and activity components in the graph, identify the state variables and common variables, where the state variables refer to the state in the state machine, and the common variables refer to the variables used in the state nodes, and add the variables and invariants to the dynamic behavior description. Different components may use the same variables or invariants, so it is necessary to determine whether the variables or invariants have been added before storage. If the variables or invariants have been added, they will not be added again.
[0177] Optionally, the states of the state machine represented by the state nodes and the state transition events represented by the connection edges are parsed to add dynamic behavior descriptions. Parsing the state nodes helps to clarify all the legal states that the system may be in, providing a clear framework for system design and behavior. By parsing the connection edges, it is possible to understand how different states are converted through events, as well as the logical conditions of these conversions. Parsing the state of the state machine and the state transition events can prevent design errors, thereby improving the accuracy of system design.
[0178] Optionally, the constant conditions of the state machine are parsed to add dynamic behavior descriptions. The constant conditions of the state machine are invariants in the state machine, which are conditions that must always be satisfied in the state machine. Parsing the constant conditions of the state machine can ensure that the state machine maintains consistent behavior in all states and does not violate the basic rules of system design, thereby improving reliability.
[0179] Optionally, the guard conditions of the state transition events are parsed and added to the dynamic behavior description. The guard conditions ensure that the state transition will occur only when specific conditions are met, which can prevent the occurrence of state transition events that do not meet the requirements and maintain the stability of the system. Through the guard conditions, complex migration logic can be defined so that the state machine can respond appropriately according to different runtime situations, avoid unnecessary state migration, reduce computing and resource consumption, and thus optimize system performance.
[0180] Optionally, the effects of the state transition events are parsed and added to the dynamic behavior description. The effects define the actions that must be performed when the transition occurs, ensuring that the state transition is not only a change of state, but also includes the execution of related behaviors. The effects can ensure that the state transition events are executed as expected, improving the reliability of the system.
[0181] S105. Based on the overall description, the static description and the dynamic behavior description, generate an automaton description text corresponding to the UML state machine diagram.
[0182] In an optional embodiment, the method further includes:
[0183] Acquire mathematical symbol conversion information, wherein the symbol conversion information represents a correspondence between mathematical symbols and identifier keywords;
[0184] Determine, according to the mathematical symbol conversion information, an identifier keyword corresponding to the mathematical symbol in the content represented by the universal component in the new UML state machine diagram;
[0185] In the process of parsing the general component in the UML state machine diagram, the mathematical symbols in the content represented by the general component are converted into corresponding identifier keywords to generate the automaton description text corresponding to the new UML state machine diagram.
[0186] Optionally, the overall description, static description and dynamic behavior description are integrated to form an automaton description text.
[0187] Optionally, the sub-state machine also needs to be parsed. A sub-state machine is drawn nested inside a state machine, and the sub-state machine is processed in the same way as above. If the sub-state machine contains another state machine, the same approach is taken.
[0188] Please refer to Table 1, which is a table of correspondence between mathematical symbols and identifier keywords. Optionally, the mathematical symbols in the mathematical expression are correctly identified and converted into identifier keywords. Because different UML tools may support different character sets, both mathematical symbols and identifier keywords are allowed to be used directly in mathematical expressions.
[0189] Table 1
[0190]
[0191]
[0192] See also Figure 8 , Figure 8 This is an example of an automaton description text proposed according to an embodiment of the present invention. As can be seen from the figure, the format of the automaton description text includes an overall description, a static description, and a dynamic behavior description. The overall description includes the figure name, the format version mark, and the tool compatibility information. The static description is mainly the static context information of the software state machine, including sets, constants, and axioms. The dynamic behavior description is the core of the state machine, mainly variables, invariants, and state transition events. The state transition event definition includes the guard conditions of the state transition event and the effects of the guard conditions of the state transition event. Optionally, the state transition is expressed using a predicate expression. If the source node and the destination node are the same, there is no need to use a predicate expression.
[0193] Convert the UML state machine diagram into automaton description text. The automaton description text is a platform-independent intermediate semantics. After matching with the back-end adapter, it can generate different language versions and run on different professional model detection tools.
[0194] The state machine diagram conversion method provided by the present application obtains a UML state machine diagram, wherein the UML state machine diagram includes a plurality of nodes, a plurality of connecting edges between the nodes, and a plurality of general components, wherein the connecting edges represent state transition events, the nodes represent a state machine, the state of the state machine, and any one of the connection relationships between the connecting edges, and the general components represent a context declaration of the state machine; based on the attribute information of the UML state machine diagram, an overall description is obtained; the context declaration of the state machine represented by the general component in the UML state machine diagram is parsed to obtain a static description; the nodes, the connecting edges, and the general components in the UML state machine diagram are parsed to obtain a dynamic behavior description; based on the overall description, the static description, and the dynamic behavior description, an automaton description text corresponding to the UML state machine diagram is generated.
[0195] The state machine diagram conversion method provided by this application has the following beneficial effects:
[0196] (1) A method for constructing UML state machine diagrams was designed to perform UML modeling on state machine objects. At the same time, the UML state machine diagrams were converted into automaton description texts. The automaton description texts are platform-independent intermediate semantics that can be adapted to run on different professional model detection tools, thereby achieving platform decoupling.
[0197] (2) Designers only need to learn how to construct the UML state machine diagram. A design performed once on any general UML tool can be run and verified multiple times on different professional model checking tools without the need for multiple modeling. This can reduce the learning cost of software designers and improve the efficiency of modeling and verification.
[0198] In an optional embodiment, the present application proposes a state machine diagram conversion device, the device comprising a state machine diagram acquisition module and an automaton description text conversion module;
[0199] The state machine diagram acquisition module is used to acquire a UML state machine diagram, wherein the UML state machine diagram includes a plurality of nodes, a plurality of connection edges between the nodes, and a plurality of general components, wherein the connection edges represent state transition events, the nodes represent any one of a state machine, a state of the state machine, and a connection relationship between the connection edges, and the general components represent a context declaration of the state machine;
[0200] The automaton description text conversion module is used to obtain an overall description based on the attribute information of the UML state machine diagram; and is used to parse the context declaration of the state machine represented by the general component in the UML state machine diagram to obtain a static description; and is used to parse the nodes, the connection edges and the general components in the UML state machine diagram to obtain a dynamic behavior description; and is used to generate an automaton description text corresponding to the UML state machine diagram based on the overall description, the static description and the dynamic behavior description.
[0201] In an optional embodiment, the present application proposes an electronic device for a state machine diagram conversion method, the electronic device comprising a processor and a memory, the memory storing at least one instruction or at least one program, the at least one instruction or at least one program being loaded and executed by the processor to implement the state machine diagram conversion method as described in any of the above embodiments.
[0202] In an optional embodiment, the present application proposes a computer-readable storage medium, which stores at least one instruction or at least one program, and the at least one instruction or the at least one program is loaded and executed by a processor to implement a state machine diagram conversion method as described in any of the above embodiments.
[0203] The above description is only an optional embodiment of the present application and is not intended to limit the present application. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the present application should be included in the protection scope of the present application.
Claims
1. A state machine diagram conversion method, characterized in that: The method comprises: Obtaining a UML state machine diagram, wherein the UML state machine diagram includes a plurality of nodes, a plurality of connection edges between the nodes, and a plurality of general components, wherein the connection edges represent state transition events, the nodes represent any one of a state machine, a state of the state machine, and a connection relationship between the connection edges, and the general components represent a context declaration of the state machine; Based on the attribute information of the UML state machine diagram, an overall description is obtained; the context declaration of the state machine represented by the general component in the UML state machine diagram is parsed to obtain a static description; the nodes, the connection edges and the general component in the UML state machine diagram are parsed to obtain a dynamic behavior description; Based on the overall description, the static description and the dynamic behavior description, an automaton description text corresponding to the UML state machine diagram is generated.
2. The state machine diagram conversion method according to claim 1, characterized in that: The method for constructing the UML state machine diagram includes: Setting a plurality of the nodes, and configuring each of the nodes to represent any one of a state machine, a state of the state machine, and a connection relationship between the connection edges; Connecting a plurality of the nodes to obtain connection edges between the plurality of the nodes, and configuring each of the connection edges to represent a state transition event; Set up a number of the general components, configure each of the general components to represent any one of the context declaration of the state machine, the constant conditions of the state machine, the guard conditions of the state transition event, and the effects of the state transition event, to obtain the UML state machine diagram.
3. The state machine diagram conversion method according to claim 2, characterized in that: The plurality of nodes include state machine nodes, state nodes, and intermediate state nodes. The plurality of nodes are set and each of the nodes is configured to represent any one of a state machine, a state of the state machine, and a connection relationship between the connection edges, including: Setting a state machine node and configuring the state machine node so that it represents the state machine; Setting a state node, and configuring the state node so that it represents the state of the state machine; An intermediate state node is set, and the input end and the output end of the intermediate state node are configured so that the intermediate state node represents the connection relationship between the plurality of connection edges.
4. The state machine diagram conversion method according to claim 3, characterized in that: The plurality of intermediate nodes include connection nodes, split nodes, merge nodes, and selection nodes. The setting of the intermediate nodes configures the input and output ends of the intermediate nodes to represent the connection relationship between the plurality of connection edges, including: Setting a connection node, configuring an input end and an output end of the connection node so that the input end of the connection node is connected to a plurality of the connection edges, and so that the output end of the connection node is connected to a plurality of the connection edges; Setting a split node, configuring the input end and the output end of the split node so that the input end of the split node is connected to one of the connection edges, and so that the output end of the split node is connected to a plurality of the connection edges; Setting a merging node, and configuring an input end and an output end of the merging node so that the input end of the merging node is connected to a plurality of the connecting edges, and so that the output end of the merging node is connected to one of the connecting edges; A selection node is set, and an input end and an output end of the selection node are configured so that the input end of the selection node is connected to a plurality of the connection edges, and the output end of the selection node is connected to a plurality of the connection edges.
5. The state machine diagram conversion method according to claim 4, characterized in that: The plurality of general components include a record component, a constraint component, an information component, and an activity component. The plurality of general components are set, and each general component is configured to represent any one of the context declaration of the state machine, the constant condition of the state machine, the guard condition of the state transition event, and the effect of the state transition event, to obtain the UML state machine diagram, including: Setting a recording component, configuring the recording component to represent a context statement of the state machine; Setting a constraint component, configuring the constraint component to represent a constant condition of the state machine; Setting an information component, configuring the information component to represent the guard condition of the state transition event; An active component is set and configured to represent the effect of the state transition event.
6. The state machine diagram conversion method according to claim 1, characterized in that: The constructing of an overall description based on the attribute information of the UML state machine diagram includes: Acquire the attribute information; the attribute information includes at least one of the name of the UML state machine diagram, the format version mark, and the tool compatibility information; The attribute information is determined as the overall description.
7. The state machine diagram conversion method according to claim 5, characterized in that: After constructing the overall description based on the attribute information of the UML state machine diagram, the method further includes: Respectively connect and process the state transition events represented by the connection edges connected to the connection nodes, split nodes, merge nodes, and selection nodes to obtain a new UML state machine diagram; The new UML state machine diagram is used to obtain the automaton description text after parsing.
8. The state machine diagram conversion method according to claim 7, characterized in that: The context declaration of the state machine represented by the general component in the UML state machine diagram is parsed to obtain a static description, including: Parsing the context declaration represented by the record component in the new UML state machine diagram to obtain a context declaration parsing result of the state machine; Based on the context declaration parsing result, a static description is generated.
9. The state machine diagram conversion method according to claim 8, characterized in that: The step of parsing the nodes, the connection edges and the general components in the UML state machine diagram to obtain a dynamic behavior description includes: Parsing the state of the state machine represented by the state node of the new UML state machine diagram and the state transition event represented by the connection edge to obtain a first dynamic behavior parsing result; Parsing the constant conditions of the state machine represented by the constraint component of the new UML state machine diagram to obtain a second dynamic behavior parsing result; Parsing the guard condition of the state transition event represented by the information component of the new UML state machine diagram to obtain a third dynamic behavior parsing result; Analyze the effect of the state transition event represented by the active component of the new UML state machine diagram to obtain a fourth dynamic behavior analysis result; A dynamic behavior description is generated based on the first dynamic behavior analysis result, the second dynamic behavior analysis result, the third dynamic behavior analysis result, and the fourth dynamic behavior analysis result.
10. The state machine diagram conversion method according to claim 9, characterized in that: The method further comprises: Acquire mathematical symbol conversion information, wherein the symbol conversion information represents a correspondence between mathematical symbols and identifier keywords; Determine, according to the mathematical symbol conversion information, an identifier keyword corresponding to the mathematical symbol in the content represented by the universal component in the new UML state machine diagram; In the process of parsing the general component in the new UML state machine diagram, the mathematical symbols in the content represented by the general component are converted into corresponding identifier keywords to generate the automaton description text corresponding to the new UML state machine diagram.
11. A state machine diagram conversion device, characterized in that: The device comprises a state machine diagram acquisition module and an automaton description text conversion module; The state machine diagram acquisition module is used to acquire a UML state machine diagram, wherein the UML state machine diagram includes a plurality of nodes, a plurality of connection edges between the nodes, and a plurality of general components, wherein the connection edges represent state transition events, the nodes represent any one of a state machine, a state of the state machine, and a connection relationship between the connection edges, and the general components represent a context declaration of the state machine; The automaton description text conversion module is used to obtain a general description based on the attribute information of the UML state machine diagram; and for parsing a context declaration of a state machine represented by a general component in the UML state machine diagram to obtain a static description; and for parsing the nodes, the connection edges and the general components in the UML state machine diagram to obtain a dynamic behavior description; And used to generate the automaton description text corresponding to the UML state machine diagram based on the overall description, the static description and the dynamic behavior description.
12. An electronic device, characterized in that: The electronic device includes a processor and a memory, wherein at least one instruction or at least one program is stored in the memory, and the at least one instruction or at least one program is loaded and executed by the processor to implement the state machine diagram conversion method according to any one of claims 1-10.
13. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores at least one instruction or at least one program, and the at least one instruction or the at least one program is loaded and executed by a processor to implement the state machine diagram conversion method according to any one of claims 1 to 10.