A conversion method and system based on semantic mapping of SysML and Modelica models
By constructing a field-level semantic mapping mechanism between SysML and Modelica models, the problems of semantic inconsistency between models and difficulties in data synchronization are solved. This enables unified modeling and synchronous updates of models at the structural, attribute, and behavioral levels, thereby improving the system's modeling efficiency and simulation integration capabilities.
Patent Information
- Application Number
- CN202511286921.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-09-10
- Publication Date
- 2025-11-18
- Estimated Expiration
- 2045-09-10
AI Technical Summary
The semantic inconsistency between SysML and Modelica models, the difficulty in data synchronization, the difficulty in synchronizing model changes, the inability to effectively transmit simulation results, and the lack of unified mapping relationship management and version control lead to incomplete model conversion, low simulation integration efficiency, and inconsistent model evolution.
This paper constructs a field-level semantic mapping mechanism driven by a unified identifier ID and a qualified name, describes in detail the automatic generation process from SysML model to Modelica model, realizes bidirectional semantic mapping between model elements, supports simulation result feedback and model consistency verification, and achieves unified modeling and synchronous updates of the model at the structural, attribute and behavioral levels through the bidirectional semantic mapping and joint simulation linkage mechanism between SysML and Modelica models.
It improves the efficiency of system modeling and the ability of cross-tool model collaboration, and achieves accurate model conversion, bidirectional semantic preservation, traceable simulation results, and high structural reusability, significantly enhancing the integration and verifiability of system modeling.
Smart Images

Figure CN120780317B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of system modeling and simulation integration, and particularly relates to a conversion method and system based on semantic mapping of SysML and Modelica models. BACKGROUND
[0002] In the design and verification process of modern complex systems, modeling and simulation have become the core link in system engineering. SysML (System Modeling Language) is a standard modeling language based on UML, which is widely used in system requirement analysis, structure modeling, behavior modeling and verification design stages, and has good hierarchical modeling capability and requirement tracking mechanism. Modelica language is a multi-domain physical modeling language oriented to equations, which is particularly suitable for modeling and numerical simulation of dynamic systems, and supports unified modeling and joint simulation of multi-physical domain models. Both have their own advantages in system modeling and analysis, SysML is biased towards abstract system design and requirement modeling, and Modelica focuses on quantitative analysis and dynamic simulation of models. However, due to the significant differences in modeling syntax, model structure and semantic system between the two, the realization of the cooperation and integration between SysML and Modelica models in actual engineering projects still faces many challenges.
[0003] Existing research attempts to convert SysML models into Modelica models through intermediate languages, manual scripts or customized interface tools, or to import part of the structure information of Modelica models into SysML. However, these methods mostly have the following problems: first, there is a lack of system-level semantic mapping mechanism, which cannot realize the data consistency and semantic equivalent conversion between models at the field level; second, model changes are difficult to synchronize, and SysML model updates often need to manually modify Modelica model, increasing maintenance cost; third, joint simulation feedback and system modeling information are separated, which cannot effectively support simulation result feedback and model consistency verification; fourth, there is a lack of unified mapping relationship management and version control mechanism, which easily leads to model structure redundancy or semantic conflict.
[0004] Based on the above problems, the present application proposes a conversion method and system based on semantic mapping of SysML and Modelica models, which constructs a unified bidirectional conversion mechanism around the key processes of SysML model construction, Modelica model export, semantic mapping establishment, model change synchronization and simulation result feedback, solves the problems of incomplete model conversion, low simulation integration efficiency and inconsistent model evolution in the prior art, and improves the integration, reusability and verifiability of system modeling. SUMMARY
[0005] An object of the present application is to provide a conversion method and system based on semantic mapping of SysML and Modelica models, aiming at the problem of semantic inconsistency between existing system modeling and multi-physical field simulation models and difficulty in data synchronization, a field-level semantic mapping mechanism driven by unified identification ID and limited name is constructed, the automatic generation process of SysML model to Modelica model, the structured import process of Modelica model to SysML model and the structure alignment and behavior verification method of joint simulation feedback data are described in detail. The present application has the advantages of accurate model conversion, bidirectional semantic preservation, traceable simulation results and high structure reuse degree, and can significantly improve the system modeling efficiency and cross-tool model collaboration ability.
[0006] According to the conversion method based on semantic mapping of SysML and Modelica models according to the embodiment of the present application, the following steps are included:
[0007] S1, importing a Modelica standard model library converted into a SysML language structure expression form into a SysML modeling tool;
[0008] S2, constructing a system model instance in the SysML modeling tool based on the imported Modelica standard model library, defining behavior elements and forming a SysML model instance;
[0009] S3, exporting a standard mo format Modelica model executable by a Modelica simulator according to the internal block diagram structure of the constructed system model instance;
[0010] S4, establishing a mapping relationship table between SysML model elements and Modelica model elements;
[0011] S5, when a SysML model changes, updating the corresponding Modelica model content according to the mapping relationship table;
[0012] S6, importing from the Modelica model to the SysML model, generating a corresponding SysML model instance according to the structure relationship vector, attribute definition vector and equation expression vector;
[0013] S7, on the basis of the generated Modelica model file, calling a simulation execution function, performing simulation result mapping and behavior modeling generation, forming a state transition diagram structure and completing the structure update of the internal block diagram in the system model.
[0014] Optionally, the S1 specifically includes:
[0015] S11, pre-convert the Modelica standard model library into a set of modeling components with SysML language structure expression, and build a SysML modeling library consistent with the Modelica model semantics;
[0016] S12, import the Modelica standard model library converted into SysML language structure expression into the SysML modeling tool;
[0017] S13, during the import process, the structure information, parameter field, Boolean operation semantics and spatial relationship configuration in the original Modelica standard model are retained;
[0018] S14, register the imported Modelica standard model components to the component library of the SysML modeling tool, and support reference, combination and attribute configuration during system model construction. The system model is a modeling instance model built in the SysML modeling tool based on the SysML language, used to represent system structure, behavior and parameter configuration.
[0019] Optionally, the S1 specifically comprises:
[0020] S21, in the SysML modeling tool, call the registered Modelica standard model components, build the basic structure level of the system model based on the requirement analysis, function decomposition and index definition task;
[0021] S22, call the modeling units in the Modelica standard model component library, embed them into the internal block diagram of the system model, complete the definition and connection configuration of each model block, and establish the structure relationship and data interaction path in the system model;
[0022] The structure relationship is the most basic component unit in system modeling, used to represent how the modules (or components) in the system are combined, nested and connected;
[0023] The data interaction path is the data flow channel formed by the port connection between the model blocks in the system model, which clearly describes the path structure of how data is transmitted, exchanged and controlled between different modules;
[0024] S23, for each model block, configure attribute parameters, initial value settings, constraint relationships and spatial logic according to the Modelica standard model semantics;
[0025] S24, during the system model construction process, support the modeling operation of behavior elements, including events, messages and interfaces; keep consistent with the semantics of the referenced Modelica standard model components.
[0026] Optionally, the S3 specifically comprises:
[0027] S31, call the internal block diagram structure in the system model which has been constructed, read the connection relationship between each structural element in the internal block diagram, port definition, data flow direction and interface information, extract the interaction logic and physical connection configuration between the instantiation units of the Modelica standard model components;
[0028] S32, generate component declaration statements and connection statements for Modelica language expression according to the structural node and port mapping rules contained in the internal block diagram structure, and build the Modelica structure expression consistent with the system model structure;
[0029] S33, the attribute parameters, initial value setting and spatial position information of each model block formed by the instantiation of Modelica standard model components in the system model are organized as parameter definition fields according to Modelica semantic rules, and inserted into the corresponding component instance in the Modelica code structure;
[0030] S34, in the export process, the generated component declaration, connection statement, parameter configuration and simulation annotation are embedded into the Modelica standard model file structure according to the Modelica standard model syntax format, output as an executable mo model file which meets the Modelica semantic requirements and can be used for functional simulation unit generation, and the semantic mapping relationship with the elements in the system model is preserved;
[0031] S35, record the conversion log information in the export process, and the generated mo model file can be downloaded by the user to save locally.
[0032] Optionally, the S4 specifically comprises:
[0033] S41, assign a unique identification ID to each SysML model element, and establish a qualified name for describing the path level and name space of the SysML model element in the system structure, and build an index set of elements which can be uniquely identified;
[0034] The unique identification ID is a unique identity tag for identifying each element in the SysML model, which constitutes an index set of elements and is composed of model type + qualified path name + unique number;
[0035] S42, record the component type, parameter field, interface port, behavior definition and structure position information of the SysML model in the internal block diagram during the construction of the SysML model, and generate the structured SysML model semantic metadata;
[0036] S43, when performing the Modelica file export and import operation, respectively extracting class structure definition, component parameter, connection statement and equation set description in the Modelica model file, establishing field level correspondence between the Modelica model and the SysML model semantic metadata;
[0037] The field level correspondence refers to that in the Modelica model structure analysis process, for the semantic units of class structure, parameter definition, connection statement and equation expression in the model file, according to the field structure of the SysML model semantic metadata, a one-to-one field mapping path and type matching relationship is established, forming a field level mapping table structure supporting bidirectional conversion and synchronization of model semantics.
[0038] S44, according to the unique identifier ID and the limited name as the mapping primary key, a mapping relationship table between the SysML model elements and the Modelica model elements is established, and the mapping relationship of the corresponding structure information, parameter information, behavior semantic field and simulation result field is recorded.
[0039] Optionally, the S5 specifically comprises:
[0040] S51, detecting a structure change event of a system model instance in a SysML modeling tool, recording a model element unique identifier ID and a limited name corresponding to the structure change event, extracting a change type caused by an addition, modification or deletion operation, and constructing a model change data set;
[0041] The structure change event refers to a modeling behavior that affects the model structure level or component connection relationship when an addition, modification or deletion operation is performed on the system model structure in the SysML modeling tool;
[0042] The change type includes structure information change, parameter field change and behavior semantic change;
[0043] S52, according to the field level correspondence of the SysML model elements and the Modelica model elements recorded in the mapping relationship table, locating a corresponding Modelica model target element in the model change data set;
[0044] S53, according to the change type, mapping and updating the structure information, parameter information and behavior semantic content in the model change data set to the corresponding position in the Modelica model structure, completing incremental content replacement;
[0045] The incremental content replacement is based on the unique identifier of the model element and the mapping relationship table, and combines the abstract syntax tree analysis and local update template rule of the Modelica model structure, to realize local accurate positioning and replacement update of the structure information, parameter configuration and behavior expression, avoid overall reconstruction operation, and improve model synchronization efficiency and simulation update response speed.
[0046] S54, after the change is completed, re-executing the Modelica model semantic checking and exporting operation, generating a synchronously updated executable Modelica model file, keeping the SysML model and the Modelica model consistent in structure, semantics and parameter level content. The semantic checking adopts a verification algorithm based on abstract syntax tree (AST) analysis and semantic rule matching, ensuring that the generated Modelica model meets the standard semantic specifications in terms of type consistency, structural integrity and equation balance.
[0047] Optionally, the S6 specifically includes:
[0048] S61, receiving an input mo file in Modelica language format, performing a preprocessing operation on the mo file content, including syntax structure scanning and comment removal, and generating a structured source file;
[0049] S62, extracting a component hierarchical structure in the structured source file, identifying component definition statements, inheritance relationships and connection statements, and generating a structure relationship vector oriented to a SysML internal block diagram structure; the component hierarchical structure includes a top-level system class, sub-component definitions, nested component structures, inheritance relationships and connection statements;
[0050] S63, extracting Modelica model parameter configuration content in the structured source file, identifying parameter declarations and default value definitions for each component, and mapping parameter names, data types and initial values into an attribute definition vector in a SysML modeling tool; the initial value is a default assignment of each parameter or variable in the Modelica model at the start of simulation;
[0051] The attribute definition vector is used to describe the name, type and initial value information of each attribute field in the SysML block.
[0052] S64, analyzing a set of behavioral equations contained in the structured source file, extracting physical quantity symbols, constraint relationships and equation types on the left and right sides of the equations, and constructing an equation representation vector conforming to the requirements of SysML behavior modeling;
[0053] S65, automatically generating a model instance structure in a SysML modeling tool according to the structure relationship vector, the attribute definition vector and the equation representation vector, respectively mapping into a block definition diagram, an internal block diagram and a behavior constraint relationship, completing the semantic equivalent import operation of the Modelica model into the SysML model, and supporting field mapping and updating of simulation response results in the SysML model.
[0054] Optionally, the S7 specifically includes:
[0055] S71, based on the derived executable Modelica model file, calling the simulation execution function on the M-Design platform, loading the functional simulation unit generated by the Modelica model encapsulation, initializing the co-simulation process.
[0056] S72, according to the simulation parameter configuration and state initial condition in the system model, the SysML modeling tool generates a logical simulation input data package, and sends it to the co-simulation scheduling and feedback module through the semantic mapping relationship table, and starts the simulation run.
[0057] S73, receiving the state response data and numerical calculation results output in the simulation execution process, including state variable changes, constraint condition feedback and output port signals, constructing a simulation result data set.
[0058] S74, according to the semantic mapping relationship table established between SysML and Modelica model, synchronously mapping the simulation result data set to the corresponding field in the SysML modeling tool, updating the attribute value and behavior constraint relationship.
[0059] S75, combined with the system time sequence behavior in the simulation output process, the model consistency verification and design index comparison analysis are executed, which assists the architecture correction, performance evaluation and modeling closed-loop optimization of the system model. The system time sequence behavior includes state transition trajectory, port signal response sequence, behavior constraint activation time point, interaction event trigger sequence and discrete time sampling value under simulation step;
[0060] S76, write the simulation result data set generated in the co-simulation process into the system model instance in the SysML modeling tool, and according to the established semantic mapping relationship table, each simulation output data field is respectively corresponding to the attribute field of the system model and the SysML behavior modeling element;
[0061] S77, extract the system state variable, control signal and event trigger information from the simulation result data set generated in the co-simulation process, according to the state chart and activity chart modeling specification supported by the SysML modeling tool, construct the SysML behavior modeling element set containing state node, transition edge, trigger event and action node, and embed it into the state chart and activity chart view in the system model, form the state transition graph structure;
[0062] According to the unique identifier ID and limited name of the model element, identify the newly added or adjusted port connection relationship from the simulation result data set, and map each port connection relationship to the corresponding connector element in the internal block diagram structure in the system model, update the structure relationship.
[0063] S78, the block definition diagram, internal block diagram, state diagram, activity diagram, attribute field configuration content, state response data and system timing behavior information of the integrated simulation output in the integrated system model are defined, and a joint model unified representation structure consistent with the structure level, parameter configuration and behavior modeling semantics is constructed;
[0064] The unique identification ID, limited name and field type of each model element are uniformly organized and recorded in the standardized element index table format, so that the field level consistency tracking and semantic mapping reuse in the bidirectional conversion process of the SysML model and the Modelica model are ensured.
[0065] According to the embodiment of the application, a conversion system based on semantic mapping of SysML and Modelica models comprises the following modules:
[0066] The model semantic mapping and management module is used for allocating a unified identification ID and a limited name to each modeling element in the SysML system model, and constructing a mapping relationship table of the SysML model element and the Modelica model element.
[0067] The SysML-to-Modelica conversion module is used for constructing a standard Modelica syntax structure through the model mapping relationship table according to the structure definition and the parameter configuration content in the SysML system model, and outputting a Modelica model file in the mo file format.
[0068] The Modelica-to-SysML conversion module is used for parsing an input mo file in the Modelica language format, constructing a structure relationship vector, an attribute definition vector and an equation representation vector, and automatically mapping the vectors into a system model instance in the SysML modeling tool.
[0069] The model structure change synchronization module is used for updating the Modelica model file when the structure and the parameters of the SysML system model change.
[0070] The joint simulation scheduling and feedback module is used for loading a functional simulation unit encapsulated by the Modelica model, starting a joint simulation process, sending SysML logical simulation input data, calling an FMU to execute simulation and receiving state response and simulation results.
[0071] The application has the following beneficial effects:
[0072] The application provides a conversion method and system based on semantic mapping of SysML and Modelica models, fully solves the long-standing inconsistency between system-level modeling language and physical modeling language in structural expression, semantic description and parameter configuration, and significantly improves model compatibility and simulation collaboration capability in a heterogeneous modeling environment.
[0073] The application realizes complete expression of structure, parameters and behavior information of Modelica components in SysML by constructing a semantic mapping path of a standard Modelica model library to a SysML modeling tool.
[0074] The application establishes a field-level mapping structure between SysML model elements and Modelica model fields by defining a unified semantic mapping relationship table and a unique identification mechanism, and provides a stable index basis for subsequent bidirectional conversion and incremental synchronization.
[0075] The application also introduces a co-simulation and model behavior feedback mechanism, which can feed back state variables, control signals and output data in the simulation process to the SysML model after calling the simulation function on the M-Design platform, and dynamically updates attribute fields and behavior modeling views.
[0076] In summary, the application significantly improves the model interoperability between SysML and Modelica, and has good applicability and promotion value in system engineering modeling, complex system design and cross-domain simulation scenarios. BRIEF DESCRIPTION OF DRAWINGS
[0077] The accompanying drawings are included to provide a further understanding of the application, and constitute a part of the specification, illustrate the application together with the embodiments thereof, and explain the application without limiting the application. In the drawings:
[0078] Figure 1 The application provides a conversion method based on semantic mapping of SysML and Modelica models;
[0079] Figure 2A model semantic mapping and model change import flowchart of a conversion method based on SysML and Modelica model semantic mapping is provided in the present application;
[0080] Figure 3 A Modelica and SysML model mutual conversion flowchart of a conversion method based on SysML and Modelica model semantic mapping is provided in the present application;
[0081] Figure 4 A conversion system structure schematic diagram based on SysML and Modelica model semantic mapping is provided in the present application. DETAILED DESCRIPTION
[0082] The present application will be further described in detail in combination with the drawings. These drawings are all simplified schematic diagrams, and only schematically show the basic structure of the present application, and thus only show the components related to the present application.
[0083] REFERENCE Figures 1-3 A conversion method based on SysML and Modelica model semantic mapping, comprising the following steps:
[0084] S1, importing a Modelica standard model library converted into a SysML language structure expression form into a SysML modeling tool;
[0085] S2, constructing a system model instance based on the imported Modelica standard model library in the SysML modeling tool, completing the definition of behavior elements, and forming a SysML model instance;
[0086] S3, exporting a standard mo format Modelica model which can be executed by a Modelica simulator according to the internal block diagram structure of the constructed system model instance;
[0087] S4, establishing a mapping relationship table between SysML model elements and Modelica model elements;
[0088] S5, when a SysML model changes, updating the corresponding Modelica model content according to the mapping relationship table;
[0089] S6, importing from a Modelica model to a SysML model, and generating a corresponding SysML model instance according to a structure relationship vector, a property definition vector and an equation expression vector;
[0090] S7, calling a simulation execution function based on the generated Modelica model file, executing simulation result mapping and behavior modeling generation, forming a state transition diagram structure, and completing the structure update of the internal block diagram of the system model.
[0091] The method realizes unified modeling and synchronous updating of models in the structure, attribute and behavior levels through the bidirectional semantic mapping between SysML and Modelica models and the joint simulation linkage mechanism, and improves the efficiency and consistency of collaborative modeling and verification analysis of multi-source models.
[0092] In the embodiment, the S1 specifically includes:
[0093] S11, the Modelica standard model library is converted into a modeling component set with SysML language structure expression in advance, and a SysML modeling library consistent with the Modelica model semantics is constructed;
[0094] S12, the Modelica standard model library converted into SysML language structure expression is imported into the SysML modeling tool;
[0095] S13, in the importing process, the structure information, parameter field, Boolean operation semantics and spatial relationship configuration in the original Modelica standard model are reserved;
[0096] S14, the imported Modelica standard model component is registered to the component library of the SysML modeling tool, and reference, combination and attribute configuration are supported in the system model construction process. The system model is a modeling instance model for representing system structure, behavior and parameter configuration, which is constructed in the SysML modeling tool based on the SysML language.
[0097] The application converts the Modelica standard model library into a modeling component set with SysML language structure expression in advance, and reserves the structure information, parameter field and spatial configuration semantics in the importing process, so that the Modelica component can be uniformly registered, referenced and configured in the SysML modeling tool, ensures the semantic consistency in the system model construction process and the cross-language reuse ability of modeling resources, thereby improving the integrated utilization rate of model resources and the modeling efficiency.
[0098] In the embodiment, the S1 specifically includes:
[0099] S21, the registered Modelica standard model component is called in the SysML modeling tool, and the basic structure level of the system model is built based on the requirement analysis, function decomposition and index definition task;
[0100] S22, the modeling unit in the Modelica standard model component library is called and embedded into the internal block diagram of the system model, the definition and connection configuration of each model block are completed, and the structure relationship and data interaction path in the system model are established;
[0101] The structural relationship is the most basic component unit in system modeling, used to represent how the modules (or components) in the system are combined, nested and connected;
[0102] The data interaction path is a data flow channel formed by the port connection between the model blocks in the system model, which clearly describes the path structure of how data is transmitted, exchanged and controlled between different modules;
[0103] S23, for each model block, configure attribute parameters, initial value setting, constraint relationship and spatial logic according to the Modelica standard model semantics;
[0104] S24, in the system model construction process, support the modeling operation of behavior elements, including events, messages and interfaces; keep consistent with the referenced Modelica standard model component semantics.
[0105] The application calls the registered Modelica standard model components in the SysML modeling tool, combines the requirement analysis and function decomposition task, efficiently constructs the structural level and data interaction path of the system model, clearly defines the combination relationship and data transmission channel of each module in the system; at the same time, supports the execution of attribute parameter configuration, initial value setting and spatial logic constraint on each model block, and introduces events, messages and interfaces and other behavior elements in the behavior modeling process, so that the system model can be fully aligned with the Modelica model semantics in the structure, parameter and behavior level, and realize the structural consistency and behavior consistency in the cross-language modeling process.
[0106] In the embodiment, the basic structural level of the system model includes:
[0107] In the initial stage of executing system modeling, the functional requirements, performance indicators and interface constraint conditions of the target system are clearly defined. Through the requirement document imported or defined by the system engineer, the functional boundary, main constituent modules and interaction scene of the target system are analyzed, and the task constraint of structure building is formed.
[0108] According to the result of requirement analysis, the system modeling tool starts the function decomposition process. Each sub-function module is mapped to a model block to be built, which is defined as a block structure unit in the SysML modeling tool to express the structural responsibility and behavior boundary of the module.
[0109] After the functional module division is clear, the system engineer defines the hierarchical relationship and interface connection logic between the modules in combination with the performance indicators and constraint conditions. This process is realized by building a block definition diagram in the SysML modeling tool, forming a basic structural level atlas of the system model.
[0110] After the structure level definition is completed, the called Modelica standard model component is embedded into the internal block diagram for specifically expressing the data flow path, physical connection relationship and control signal channel between modules. In the embedding process, the input and output ports, attribute fields and interaction interfaces are configured for each model block, and the connector path is established according to the design logic.
[0111] Through the module disintegration based on the requirement analysis, the hierarchical construction based on the function structure and the connection configuration based on the interface index, the basic structure level of the system model is completed.
[0112] The embodiment introduces the structure building process based on the requirement analysis driving, systematically completes the identification of the function boundary of the target system, the module responsibility and the interface constraint, and then performs the function decomposition and the hierarchical structure construction in the SysML modeling tool, so that the system model has a clear modular organization form and the superior and inferior level relationship in the structure level. Meanwhile, the embedding use of the Modelica standard model component is combined to realize the accurate modeling of the data path, the physical connection and the control signal, effectively support the integrated expression of the system structure model and the behavior modeling element, and improve the integrity of the modeling process and the cross-language model consistency.
[0113] In the embodiment, the S3 specifically includes:
[0114] S31, the internal block diagram structure in the system model which has been constructed is called, the connection relationship between the structure elements in the internal block diagram, the port definition, the data flow direction and the interface information are read, and the interaction logic and the physical connection configuration between the instantiation units of the Modelica standard model component are extracted;
[0115] S32, according to the structure node and the port mapping rule contained in the internal block diagram structure, the component declaration statement and the connection statement for the Modelica language expression are generated, and the Modelica structure expression consistent with the system model structure is constructed;
[0116] S33, the attribute parameters, the initial value setting and the space position information of each model block formed by the instantiation of the Modelica standard model component in the system model are organized as the parameter definition field according to the Modelica semantic rule, and are inserted into the corresponding component instance in the Modelica code structure;
[0117] S34, in the export process, the generated component declaration, the connection statement, the parameter configuration and the simulation annotation are embedded into the Modelica standard model file structure according to the Modelica standard model syntax format, and are output as the executable mo model file which meets the Modelica semantic requirements and can be used for the functional simulation unit generation, and the semantic mapping relationship with the elements in the system model is reserved;
[0118] S35, record the conversion log information in the derivation process, and the generated mo model file can be downloaded by a user to a local for storage.
[0119] The application realizes complete conversion of modeling elements such as structure nodes, port connections and parameter configurations to Modelica semantics based on information extraction and semantic mapping rules of the internal block diagram structure of the system model, automatically generates component declaration statements, connection statements and parameter fields conforming to the Modelica language specification, and constructs an executable mo model file consistent with the structure of the SysML system model. The semantic mapping relationship between the models is preserved in the derivation process, and a traceable conversion log is generated, which significantly improves the standardization of the model derivation process and the automation degree of the simulation model generation, and provides a data basis and semantic consistency guarantee for subsequent functional simulation and joint modeling.
[0120] In the embodiment, the port mapping rule refers to a set of semantic alignment and structure matching rules followed when performing port-level modeling element conversion between the SysML model and the Modelica model. The rule system clearly defines how the name, type, direction and data attribute elements of each port in the SysML model correspond to the declaration statement and connection expression form of the component port in the Modelica language through the pre-defined mapping standard, and ensures the consistency of the interface structure and the integrity of the behavior semantics in the bidirectional model conversion process.
[0121] The port mapping rule includes:
[0122] Port name mapping rule: mapping the port name (such as port_A) defined in the SysML model to the identification name of the component interface variable in Modelica, keeping the name semantics consistent;
[0123] Port type mapping rule: determining the corresponding Modelica connector type (such as connectorElectricPin) according to the type (such as FlowPort: ElectricConnector) bound to the SysML port, and realizing type consistency docking;
[0124] Port direction mapping rule: converting the direction semantics (such as in, out or inout) of the SysML port to the supported direction modifier (such as input, output, flow, etc.) in Modelica;
[0125] Data type mapping rule: mapping the parameter type (such as Real, Integer, Boolean) carried by the port in SysML to the equivalent data type in Modelica;
[0126] Connection statement generation rule: according to the connection relationship between the ports in the internal block diagram, a standard Modelica connect (component1. port1, component2. port2) connection statement is generated;
[0127] Namespace and scope mapping rule: the nested structure or hierarchical relationship existing in the SysML model is processed through the qualified name mechanism, and the correct parsing of the connection path in the Modelica model is ensured.
[0128] Through the application of the above port mapping rule, the system can automatically complete the conversion of the interface information extracted from the SysML modeling environment to the Modelica semantic expression, and generate a component connection code that is correct in syntax, clear in structure and executable.
[0129] In the embodiment, the S4 specifically comprises:
[0130] S41, a unique identification ID is allocated to each SysML model element, and a qualified name is established to describe the path level and name space of the SysML model element in the system structure, and a uniquely identifiable element index set is constructed;
[0131] The unique identification ID is a unique identity tag for identifying each element in the SysML model, and constitutes an element index set, which is composed of a model type, a qualified path name and a unique number;
[0132] S42, during the construction of the SysML model, the component type, parameter field, interface port, behavior definition and structure position information of the SysML model in the internal block diagram are recorded, and structured SysML model semantic metadata is generated;
[0133] S43, when performing Modelica file export and import operations, the class structure definition, component parameters, connection statements and equation set descriptions in the Modelica model file are extracted, and a field-level correspondence relationship between the SysML model semantic metadata is established;
[0134] The field-level correspondence relationship refers to, in the Modelica model structure analysis process, for the class structure, parameter definition, connection statement and equation expression semantic units in the model file, according to the field structure of the SysML model semantic metadata, a one-to-one field mapping path and type matching relationship is established, and a field-level mapping table structure supporting bidirectional conversion and synchronization of model semantics is formed.
[0135] S44, according to the unique identification ID and the qualified name as the mapping primary key, a mapping relationship table between the SysML model elements and the Modelica model elements is established, and the mapping relationship of the corresponding structure information, parameter information, behavior semantic field and simulation result field is recorded.
[0136] The application constructs a traceable element index set by assigning a unique identification ID and a limited name to each SysML model element, records structure types, parameter fields, port information and behavior semantics, and generates structured SysML model semantic metadata; in the Modelica model file import and export process, semantic units such as class structure, parameters and connection statements are extracted, a one-to-one field-level mapping table between the field structure and the SysML model is established, and the semantic content of the models is accurately corresponding and synchronously updated. By constructing a semantic mapping relationship table with a unique identification ID as the primary key, the consistency of the bidirectional conversion between the SysML model and the Modelica model in the structure, parameters and behavior levels is effectively guaranteed, and a stable semantic alignment mechanism and mapping support are provided for joint simulation and closed-loop modeling.
[0137] In the embodiment, the S5 specifically includes:
[0138] S51, detecting a structure change event of a system model instance in a SysML modeling tool, recording a unique identification ID and a limited name of a model element corresponding to the structure change event, extracting a change type caused by an addition, modification or deletion operation, and constructing a model change data set;
[0139] The structure change event refers to a modeling behavior that affects the model structure level or the component connection relationship when an addition, modification or deletion operation is performed on the system model structure in the SysML modeling tool;
[0140] The change type includes structure information change, parameter field change and behavior semantics change;
[0141] S52, according to the field-level corresponding relationship between the SysML model element and the Modelica model element recorded in the mapping relationship table, locating a corresponding Modelica model target element in the model change data set;
[0142] S53, according to the change type, mapping and updating the structure information, parameter information and behavior semantic content in the model change data set to the corresponding position in the Modelica model structure, and completing incremental content replacement;
[0143] The incremental content replacement is based on the unique identification of the model element and the mapping relationship table, combines the abstract syntax tree analysis and local update template rule of the Modelica model structure, realizes the local accurate positioning and replacement update of the structure information, parameter configuration and behavior expression, avoids the whole reconstruction operation, and improves the model synchronization efficiency and the simulation update response speed;
[0144] S54, after the change is completed, re-executing the Modelica model semantic checking and exporting operation, generating the executable Modelica model file updated synchronously, keeping the consistency of the SysML model and the Modelica model in structure, semantics and parameter level. The semantic checking adopts a verification algorithm based on abstract syntax tree (AST) analysis and semantic rule matching, ensuring that the generated Modelica model meets the standard semantic specifications in terms of type consistency, structural integrity and equation balance.
[0145] The application detects the structural change event of the system model instance in the SysML modeling tool in real time, constructs a model change data set containing the change type and element identification, accurately locates and updates the corresponding structure, parameter and behavior semantic content in the Modelica model according to the field-level correspondence in the mapping relationship table, adopts an incremental content replacement mechanism to avoid overall reconstruction, improves the model synchronization efficiency and simulation update response speed; after the update is completed, the semantic checking of the Modelica model is performed through the abstract syntax tree analysis and semantic rule matching algorithm, ensuring the structural consistency, type matching and equation balance, so as to realize the efficient collaborative update and semantic consistency guarantee between the SysML model and the Modelica model.
[0146] In the embodiment, the S6 specifically includes:
[0147] S61, receiving the input mo file in Modelica language format, performing a preprocessing operation on the mo file content, including syntax structure scanning and comment removal, and generating a structured source file;
[0148] S62, extracting the component hierarchical structure in the structured source file, identifying the component definition statement, the inheritance relationship and the connection statement, and generating a structure relationship vector facing the SysML internal block diagram structure; the component hierarchical structure includes a top-level system class, a sub-component definition, a nested component structure, an inheritance relationship and a connection statement;
[0149] S63, extracting the Modelica model parameter configuration content in the structured source file, identifying the parameter declaration and the default value definition of each component, and mapping the parameter name, data type and initial value into an attribute definition vector in the SysML modeling tool; the initial value is the default assignment of each parameter or variable in the Modelica model at the starting time of simulation;
[0150] The attribute definition vector is used to describe the name, type and initial value information of each attribute field in the SysML block.
[0151] S64, analyze the behavior equation set contained in the structured source file, extract the physical quantity symbol, constraint relationship and equation type of the left and right sides of the equation, and construct an equation representation vector meeting the equation modeling requirements of SysML;
[0152] S65, according to the structure relationship vector, the attribute definition vector and the equation representation vector, automatically generate a model instance structure in the SysML modeling tool, which is respectively mapped to a block definition graph, an internal block graph and a behavior constraint relationship, complete the semantic equivalent import operation of the Modelica model to the SysML model, and support field mapping and updating of simulation response results in the SysML model.
[0153] The application extracts the component hierarchical structure, parameter configuration and behavior equation content by performing syntax preprocessing and structured analysis on the input Modelica language format mo file, respectively generates a structure relationship vector, an attribute definition vector and an equation representation vector, and then automatically generates a corresponding block definition graph, an internal block graph and a behavior constraint modeling structure in the SysML modeling tool according to the above vector information, realizes semantic equivalent import of the Modelica model to the SysML model, effectively retains the structure logic and simulation semantics in the original model, improves the model migration efficiency and modeling consistency, and supports synchronous mapping and updating of simulation response data in the SysML model.
[0154] In the embodiment, the structure relationship vector is used to express the hierarchical relationship, inheritance relationship and connection structure between components, and the specific acquisition method includes: performing syntax analysis on the structure definition statements starting with keywords such as model, class, package and the like in the structured source file, extracting the name, parent class name and nesting relationship of each component, and constructing a component hierarchical index; analyzing the extends statement, identifying the inheritance relationship, and recording the relationship between the parent class and the child class as an inheritance vector item; extracting all connection statements in the form of connect(port1, port2), identifying the connection endpoints and the components where they are located, and establishing a port connection vector between components; combining the component definition relationship, inheritance relationship and connection relationship to form a structure relationship vector as a basic input for representing the internal block graph structure configuration;
[0155] In the embodiment, the attribute definition vector is used to express the attribute field information of the component, and the specific acquisition method includes: identifying the declaration statements such as parameter, Real, Integer and Boolean contained in the component definition statement; for each attribute declaration item, analyzing the attribute name, data type and default initial value, and extracting the component identifier to which it belongs; organizing the attribute name, data type and initial value in the form of a structured triple; and constructing an attribute definition vector for describing the name, type and initial value of the attribute field in the SysML block definition graph.
[0156] In the embodiment, the equation representation vector is used to express the behavior logic of the component or system, and the specific acquisition manner includes: extracting the equation, initial equation, algorithm and other structural blocks in the source file; parsing each equation or assignment statement to extract the left value symbol, right value expression and operator type; determining whether the der() operator is included, which is used to identify the differential equation; if there is no der() and only an equal sign, it is regarded as an algebraic equation; if a function call or a constraint form is included, it is classified as a behavior constraint equation; encoding the above information into a symbol vector to form a three-element structure of the left side, right side and equation type of the equation; and aggregating the equation representation vector to serve as a constraint expression source of the behavior modeling view.
[0157] In the embodiment, the S7 specifically includes:
[0158] S71, based on the derived executable Modelica model file, a simulation execution function is called on the M-Design platform, a functional simulation unit generated by the Modelica model encapsulation is loaded, and a co-simulation process is initialized.
[0159] S72, according to the simulation parameter configuration and state initial condition in the system model, a logic simulation input data packet is generated by the SysML modeling tool, and is sent to the co-simulation scheduling and feedback module through a semantic mapping relationship table, and simulation running is started.
[0160] S73, state response data and numerical calculation results output in the simulation execution process are received, including state variable changes, constraint condition feedback and output port signals, and a simulation result data set is constructed.
[0161] S74, according to the semantic mapping relationship table established between the SysML and the Modelica model, the simulation result data set is synchronously mapped to the corresponding field in the SysML modeling tool, and the attribute value and the behavior constraint relationship are updated.
[0162] S75, combined with the system time sequence behavior in the simulation output process, model consistency verification and design index comparison analysis are performed to assist in architecture modification, performance evaluation and modeling closed-loop optimization of the system model. The system time sequence behavior includes state transition trajectory, port signal response sequence, behavior constraint activation time point, interactive event trigger sequence and discrete time sampling value under the simulation step length;
[0163] S76, the simulation result data set generated in the co-simulation process is written into the system model instance in the SysML modeling tool, and each simulation output data field is respectively corresponded to the attribute field and the behavior modeling element of the system model according to the established semantic mapping relationship table;
[0164] S77, extract system state variables, control signals and event trigger information from the simulation result data set generated from the joint simulation process, construct a behavior modeling element set containing state nodes, transition edges, trigger events and action nodes according to the state chart and activity chart modeling specifications supported by the SysML modeling tool, and embed them into the state chart and activity chart views in the system model to form a state transition chart structure;
[0165] According to the unique identifier ID and the limited name of the model element, identify the newly added or adjusted port connection relationship from the simulation result data set, map each port connection relationship to the corresponding connector element in the internal block diagram structure in the system model, and update the structure relationship.
[0166] S78, integrate the block definition diagram, internal block diagram, state chart, activity chart, attribute field configuration content, state response data and system timing behavior information output by the joint simulation in the system model, and construct a joint model unified representation structure with consistent structure level, parameter configuration and behavior modeling semantics;
[0167] Adopting a standardized element index table format, the unique identifier ID, limited name and field type of each model element are uniformly organized and recorded to ensure field-level consistency tracking and semantic mapping reuse in the bidirectional conversion process of SysML model and Modelica model; the joint model unified representation structure is exported as a parsable data representation set and stored in a structured manner in JSON format.
[0168] The present application realizes the function simulation of Modelica model by calling the simulation execution function in M-Design platform, combines the simulation input data generated by SysML modeling tool, and realizes the real-time collection of state response data, system timing behavior and port connection relationship in simulation result; further based on the semantic mapping relationship between SysML and Modelica, the simulation output result is mapped to SysML model, the attribute field, behavior modeling element and structure connection information are automatically updated, and the joint model unified representation structure with consistent structure, parameter and behavior semantics is generated; the structure not only supports the visual modeling and simulation closed-loop optimization of model behavior, but also guarantees the field-level consistency tracking and semantic reuse in the bidirectional conversion process through the standardized element index mechanism, which significantly improves the automation level and engineering application value of system modeling and simulation linkage.
[0169] In the embodiment, the generation process of the SysML behavior modeling element is as follows:
[0170] Step one: extract the key state variables that can represent the system running state from the simulation result data set,
[0171] Discrete sampling of each state variable on the time axis, extracting its stable interval and mutation point, and taking it as a potential state node and state transition event candidate.
[0172] Step two: Based on the state variable mutation point timestamp, locate the specific timing of state transition occurrence; combine port signal changes, Boolean condition activation, and control event triggers to identify the event source that triggers the transition (such as input signal changes, internal calculation results reaching a threshold, etc.); form a triple structure:
[0173] Step three: According to the above triple structure, generate corresponding SysML state diagram elements for each group of state relationships: state nodes, transition edges, trigger events, and condition guards;
[0174] Step four: If there are process behavior trajectories in the simulation data (such as component execution in sequence, action chain invocation), extract their operation steps and execution order; map them to SysML activity diagram elements, including: action nodes,
[0175] Control flow edges, input / output object nodes;
[0176] Step five: Write the above state diagram and activity diagram elements into the behavior modeling view of the system model in the format supported by the modeling tool (such as XML or XMI); make the system model have consistent behavior expression capability with the simulation behavior, support visual model behavior analysis and verification.
[0177] In this embodiment, the structure of the SysML model includes system component hierarchy, interface port relationship, connector path, attribute variable, and static modeling content based on block definition diagram (BD) and internal block diagram (IBD), providing a semantically consistent target structure for field-level write-back of simulation result data;
[0178] Reference Figure 4 A conversion system based on SysML and Modelica model semantic mapping, comprising the following modules:
[0179] Model semantic mapping and management module, for assigning a uniform identification ID and a limited name to each modeling element in the SysML system model, and constructing a SysML model element and Modelica model element mapping relationship table;
[0180] SysML to Modelica conversion module, for constructing a standard Modelica syntax structure through the model mapping relationship table according to the structure definition and parameter configuration content in the SysML system model, and outputting a Modelica model file in mo file format;
[0181] A Modelica-to-SysML conversion module is configured to parse an input mo file in a Modelica language format, build a structural relationship vector, a property definition vector and an equation representation vector, and automatically map the vectors to a system model instance in a SysML modeling tool;
[0182] A model structure change synchronization module is configured to update a Modelica model file when a SysML system model structure and parameters change;
[0183] A co-simulation scheduling and feedback module is configured to load a functional simulation unit encapsulated by a Modelica model, start a co-simulation process, send SysML logic simulation input data, call an FMU to perform simulation and receive a state response and simulation results;
[0184] The present application realizes semantic consistent modeling and efficient conversion between a SysML system model and a Modelica model by constructing a modular system including a model semantic mapping and management module, a bidirectional model conversion module, a structure change synchronization module and a co-simulation scheduling and feedback module, supports not only structured export of SysML to Modelica and simulation execution, but also equivalent import of structure, parameter and behavior semantics of a Modelica model to a SysML model, effectively guarantees bidirectional consistency of the model in the structure, parameter and behavior aspects, and improves the collaborative development efficiency and system co-simulation capability between heterogeneous modeling languages.
[0185] Embodiment 1
[0186] To verify the feasibility of the present application in implementation, the present application is applied to digital modeling and multi-domain simulation tasks of a complex mechatronic system, specifically including the whole process of system structure modeling, model semantic conversion, model linkage update and co-simulation feedback. The system integrates an electric drive module, a mechanical transmission module and a control logic module, has a multi-physical domain coupling characteristic, and generally has problems of inconsistent models, inconsistent semantics and difficult synchronization in modification in traditional modeling methods, which seriously restricts system development efficiency and simulation accuracy.
[0187] In the present embodiment, a project team first builds a functional structure diagram and an internal block diagram of the target system based on a SysML modeling tool, covering 13 subsystem modules and more than 120 interface connection relationships. At the beginning of system modeling, a complete system hierarchical structure and module responsibility division are formed through requirement document input and function decomposition operation. Subsequently, the model semantic mapping and management module in the present application is called to automatically assign a unique identification ID and a limited path name to each modeling element, establish a traceable field-level index structure, and integrate a pre-converted Modelica standard model component in a SysML component library.
[0188] After the model is built, the SysML to Modelica conversion module is enabled, and the system automatically analyzes the structure definition and parameter configuration content, generates a standard Modelica syntax structure according to the semantic mapping relationship table, and exports it as an executable.mo file. When this Modelica model file is imported into the Dymola simulation environment, it passes the semantic check, type check and structure integrity analysis all at once, with a generation time of only 3.6 seconds, which is about 82% shorter than the traditional manual modeling process. The system engineer then modifies the parameter configuration of the electric drive sub-module, including the maximum voltage, current limit and speed setting range, and the model structure change synchronization module detects the change and completes the partial synchronous update of the Modelica model in 2.1 seconds without any semantic conflict or model failure problems. Statistical analysis is performed in combination with model construction time, simulation efficiency, semantic consistency, change response capability and modeling accuracy, and the results are shown in Table 1 below:
[0189] Table 1 Performance evaluation table of SysML and Modelica model semantic mapping conversion system
[0190]
[0191] The joint simulation scheduling and feedback module is called to load the generated Modelica model into the M-Design platform and perform joint simulation. The simulation input data package generated by the SysML modeling tool is accurately transmitted to the FMU interface through the semantic mapping table to complete the initialization input injection. The simulation execution lasts for 8 seconds, and the output data includes 92 state variable response sequences, 34 port signal trajectories and 12 constraint feedback paths, with a system simulation accuracy error of less than ±1.7%.
[0192] After the simulation is completed, the system automatically maps the simulation result fields back to the SysML model instance to build a complete behavior modeling view, including state charts and activity charts. The state transition trajectory and signal response sequence are mapped to a total of 15 state nodes, 24 transition edges and 19 action nodes, which truly reflect the logical changes in the system operation process. After expert manual verification, the consistency score of the corresponding system modeling and simulation design is 96.3 (out of 100), which is significantly better than the 86.5 of the manual modeling method.
[0193] The present application realizes efficient interconnection and consistency linkage between SysML system modeling and Modelica multi-physical domain simulation by constructing a structured semantic mapping mechanism and a bidirectional model conversion process, significantly improves the model construction efficiency, simulation accuracy and modeling closed-loop capability, and is suitable for digital modeling and verification scenarios of mechatronics, embedded control and complex industrial systems.
[0194] The above merely describes preferred specific embodiments of the present application, but the protection scope of the present application is not limited thereto, and any person skilled in the art, according to the technical solution and inventive concept of the present application, makes equivalent replacement or change within the technical range disclosed by the present application, which should be covered within the protection scope of the present application.
Claims
1. A conversion method based on semantic mapping between SysML and Modelica models, characterized in that, Includes the following steps: S1. Import the Modelica standard model library, which has been converted into SysML language structural expression form, into the SysML modeling tool; S2. In the SysML modeling tool, build a system model instance based on the imported Modelica standard model library, complete the definition of behavioral elements, and form a SysML model instance. S3. Based on the internal block diagram structure in the existing system model instance, export the standard mo format Modelica model that can be executed by the Modelica simulator; S4. Establish a mapping table between SysML model elements and Modelica model elements; S5. When a SysML model changes, update the corresponding Modelica model content based on the mapping table. S6. Import the Modelica model into the SysML model, and generate the corresponding SysML model instance based on the structural relationship vector, attribute definition vector, and equation representation vector. S7. Based on the generated Modelica model file, call the simulation execution function to perform simulation result mapping and behavior modeling generation, form a state transition diagram structure, and complete the structural update of the internal block diagram in the system model.
2. The conversion method based on semantic mapping between SysML and Modelica models according to claim 1, characterized in that, S1 specifically includes: S11. Pre-convert the Modelica standard model library into a set of modeling components with SysML language structural expressions, and construct a SysML modeling library with semantics consistent with Modelica models. S12. Import the Modelica standard model library, which has been converted into a SysML language structure expression, into the SysML modeling tool; S13. During the import process, retain the structural information, parameter fields, Boolean operation semantics and spatial relationship configuration of the original Modelica standard model; S14. Register the imported Modelica standard model components to the component library of the SysML modeling tool, and support referencing, combining and configuring attributes during the system model construction process.
3. The conversion method based on semantic mapping between SysML and Modelica models according to claim 1, characterized in that, S2 specifically includes: S21. In the SysML modeling tool, call the registered Modelica standard model components and build the basic structural hierarchy of the system model based on the tasks of requirements analysis, functional decomposition and indicator definition. S22. Call the modeling units in the Modelica standard model component library, embed them into the block diagram inside the system model, complete the definition and connection configuration of each model block, and establish the structural and connection relationships in the system model. The connection relationships include the connection relationships between structural elements in the internal block diagram and the connection relationships of newly added and adjusted ports; The structural relationship refers to the connection method and hierarchical structure between components in the system model, which consist of model blocks, ports, and connectors. S23. For each model block, configure attribute parameters, initial value settings, constraint relationships and spatial logic according to the Modelica standard model semantics. S24. During the system model construction process, support modeling operations for behavioral elements, including events, messages, and interfaces; maintain semantic consistency with the referenced Modelica standard model components.
4. The conversion method based on semantic mapping between SysML and Modelica models according to claim 1, characterized in that, S3 specifically includes: S31. Call the internal block diagram structure in the completed system model, read the connection relationship between each structural element in the internal block diagram, and extract the interaction logic and physical connection configuration between the instantiated units of the Modelica standard model component. S32. Based on the structural nodes and port mapping rules contained in the internal block diagram structure, generate component declaration statements and connect statements for Modelica language expression, and construct a Modelica structural expression consistent with the system model structure. S33. Organize the attribute parameters, initial value settings, and spatial location information of each model block formed by instantiating Modelica standard model components in the system model into parameter definition fields according to Modelica semantic rules, and insert them into the corresponding component instance in the Modelica code structure. S34. During the export process, the generated component declarations, connection statements, parameter configurations, and simulation comments are embedded into the Modelica standard model file structure according to the Modelica standard model syntax format. The output is an executable MO model file that meets the Modelica semantic requirements and can be used for generating functional simulation units, while retaining the semantic mapping relationship with the elements in the system model. S35. Record the conversion log information during the export process. The generated MO model file can be downloaded by the user for local storage.
5. The conversion method based on semantic mapping between SysML and Modelica models according to claim 1, characterized in that, S4 specifically includes: S41. Assign a unique identifier ID to each SysML model element and establish a qualified name to describe the path hierarchy and namespace of the SysML model element in the system structure, and construct a set of uniquely identifiable element indexes. S42. During the SysML model construction process, record the component type, parameter fields, interface ports, behavior definitions, and the structural position information of the SysML model in the internal block diagram to generate structured SysML model semantic metadata. S43. When performing Modelica file export and import operations, extract the class structure definition, component parameters, connection statements and equation system descriptions from the Modelica model file respectively, and establish a field-level correspondence between them and the semantic metadata of the SysML model. S44. Based on the unique identifier ID and the qualified name as the mapping primary key, establish a mapping relationship table between SysML model elements and Modelica model elements, and record the mapping relationship between the corresponding structural information, parameter information, behavioral semantic fields and simulation result fields.
6. The conversion method based on semantic mapping between SysML and Modelica models according to claim 1, characterized in that, S5 specifically includes: S51. In the SysML modeling tool, detect structural change events of system model instances, record the unique identifier ID and qualified name of the model element corresponding to the structural change event, extract the change types caused by add, modify and delete operations, and construct a model change dataset. The types of changes include structural information changes, parameter field changes, and behavioral semantic changes; S52. Based on the field correspondence between SysML model elements and Modelica model elements recorded in the mapping relationship table, locate the corresponding Modelica model target element in the model change dataset. S53. Based on the change type, map and update the structural information, parameter information and behavioral semantic content in the model change dataset to the corresponding positions in the Modelica model structure to complete the incremental content replacement. S54. After the changes are completed, re-execute the Modelica model semantic verification and export operation to generate a synchronized updated executable Modelica model file, maintaining the consistency of the SysML model and the Modelica model in terms of structure, semantics and parameters.
7. The conversion method based on semantic mapping between SysML and Modelica models according to claim 1, characterized in that, S6 specifically includes: S61. Receive the input Modelica language format mo file, perform preprocessing operations on the mo file content, including syntax structure scanning and comment removal, and generate a structured source file; S62. Extract the component hierarchy from the structured source file, identify component definition statements, inheritance relationships and connection statements, and generate a structural relationship vector for SysML internal block diagram (IBD) structure. S63. Extract the Modelica model parameter configuration content from the structured source file, identify the parameter declaration and default value definition of each component, and map the parameter name, data type, and initial value to the attribute definition vector in the SysML modeling tool. The attribute definition vector is used to describe the name, type, and initial value information of each attribute field in the SysML block; S64. Analyze the set of behavioral equations contained in the structured source file, extract the physical quantity symbols, constraint relationships and equation types on the left and right sides of the equations, and construct an equation representation vector that meets the requirements of SysML behavioral modeling. S65. Based on the structural relationship vector, attribute definition vector, and equation representation vector, the model instance structure is automatically generated in the SysML modeling tool and mapped to block definition graph, internal block graph, and behavioral constraint relationship, respectively. This completes the semantic equivalence import operation from the Modelica model to the SysML model and supports the field mapping and updating of simulation response results in the SysML model.
8. The conversion method based on semantic mapping between SysML and Modelica models according to claim 1, characterized in that, Specifically, S7 includes: S71. Based on the exported executable Modelica model file, call the simulation execution function on the M-Design platform, load the functional simulation unit generated by the Modelica model encapsulation, and initialize the co-simulation process. S72. The SysML modeling tool generates a logic simulation input data packet based on the simulation parameter configuration and initial state conditions in the system model, and sends it to the joint simulation scheduling and feedback module through the semantic mapping table to start the simulation. S73. Receive the state response data and numerical calculation results output during the simulation execution process, including changes in state variables, constraint feedback and output port signals, and construct the simulation result dataset; S74. Based on the semantic mapping relationship table established between SysML and Modelica models, synchronously map the simulation result dataset to the corresponding fields in the SysML modeling tool, and update the attribute values and behavioral constraint relationships. S75. Combining the system timing behavior in the simulation output process, perform model consistency verification and design index comparison analysis to assist in the system model architecture correction, performance evaluation and modeling closed-loop optimization; the system timing behavior includes state transition trajectory, port signal response sequence, behavioral constraint activation time point, interactive event trigger sequence and discrete time sampled values under the simulation step size; S76. Write the simulation result dataset generated during the co-simulation process into the system model instance in the SysML modeling tool. Based on the established semantic mapping relationship table, map each simulation output data field to the attribute field of the system model and the SysML behavioral modeling element respectively. S77. Extract system state variables, control signals and event triggering information from the simulation result dataset generated during the co-simulation process. Based on the state diagram and activity diagram modeling specifications supported by the SysML modeling tool, construct a SysML behavior modeling element set containing state nodes, transition edges, triggering events and action nodes, and embed it into the state diagram and activity diagram view in the system model to form a state transition diagram structure. Based on the unique identifiers (IDs) and defined names of system model elements constructed in the SysML modeling tool, newly added and adjusted port connection relationships are identified from the simulation result dataset. Each port connection relationship is mapped to the corresponding connector element in the internal block diagram structure of the system model, and the structural relationships are updated.
9. A conversion system based on semantic mapping between SysML and Modelica models, performing the conversion method based on semantic mapping between SysML and Modelica models as described in any one of claims 1 to 8, characterized in that, Includes the following modules: The Model Semantic Mapping and Management module is used to assign a unified identifier (ID) and a qualified name to each modeling element in the SysML system model, and to build a mapping table between SysML model elements and Modelica model elements. The SysML to Modelica conversion module is used to output Modelica model files in .mo file format based on the structural definitions and parameter configurations in the SysML system model. The Modelica to SysML conversion module is used to parse the input Modelica language format mo file, construct structural relation vectors, attribute definition vectors and equation representation vectors, and automatically map them to system model instances in the SysML modeling tool. The model structure change synchronization module is used to update the Modelica model file when the model structure and parameters of the SysML system change; The co-simulation scheduling and feedback module is used to load the functional simulation unit encapsulated by the Modelica model, start the co-simulation process, send SysML logic simulation input data, call the functional simulation unit to execute the simulation, and receive the status response and simulation results.
Citation Information
Patent Citations
Hybrid system modeling method based on SysML-Modelica and method for converting hybrid system modeling into hybrid interface automaton
CN114417606A
Model conversion method based on SysML and Modelica semantic analysis
CN116663083A