Method and device for modeling and data synchronization under web system
By employing the collaborative work of modules such as file libraries, syntax parsers, listeners, and monitors within a Web-based system, the data synchronization inconsistency problem in Modelica simulation software was resolved, enabling real-time updates of model data and immediate feedback to user operations, thereby improving software performance and modeling efficiency.
Patent Information
- Application Number
- CN202510915748.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-07-03
- Publication Date
- 2026-07-14
- Estimated Expiration
- 2045-07-03
Smart Images

Figure CN120723998B_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the field of nuclear power technology, specifically relating to a method and apparatus for Modelica modeling and data synchronization under a Web architecture. Background Technology
[0002] Computer simulation technology, also known as simulation technology or modeling, can be described as the technology of using computer systems and related software to simulate the behavior of real-world systems. It is widely used in various fields, including aviation, aerospace, automotive, shipbuilding, military, energy, and construction. Different simulation software is used for simulation modeling and verification in various fields, such as Matlab, SolidWorks, and Fluent. Different programming languages, such as C, Fortran, and Python, are used to develop simulation model calculation programs during the modeling phase. To address the coupling of multi-domain simulation calculations, the reuse of simulation model libraries, and the challenges of simulating complex systems, the European Simulation Consortium proposed Modelica, a multi-domain complex physical modeling language, in 1997. Modelica supports object-oriented modeling, non-causal declarative modeling, multi-domain unified modeling, and continuous-discrete hybrid modeling, solving the multi-domain coupling problem in the simulation of complex engineering systems. Currently, most mainstream Modelica simulation software both domestically and internationally is developed based on local desktop applications. The development of web-based Modelica simulation software can be mainly divided into several key steps: configuration modeling, model translation, simulation solving, and result rendering. Such simulation software features unique multi-layered language characteristics, including icon, graphics, text, and document layers. However, most Modelica simulation software, both domestically and internationally, is still developed based on local desktop applications, with the mainstream approach being to use non-real-time synchronization or post-synchronization techniques to solve data synchronization problems. These techniques occasionally lead to model data corruption, thus affecting the quality of modeling and the overall performance of the simulation software. Improving real-time data synchronization capabilities is crucial for enhancing modeling efficiency and software performance in web-based Modelica simulation software. Summary of the Invention
[0003] To overcome the problems existing in related technologies, a method and apparatus for Modelica modeling and data synchronization under a Web system are provided.
[0004] According to one aspect of the embodiments of this disclosure, a method for configuration modeling and model data synchronization of a simulation model is provided, the method comprising:
[0005] Step 1: Create a file library to store simulation models. The file library contains text files of multiple original simulation models.
[0006] Step 2: When the WEB backend detects that a simulation model has been opened on the WEB frontend, it reads the text file corresponding to the simulation model from the file library, organizes and generates model file string data associated with the simulation model, and sends it to the WEB frontend through an interface.
[0007] Step 3: After receiving the model file string data associated with the simulation model, the WEB front-end calls the syntax parser embedded in the WEB front-end to perform the simulation model parsing task, builds and maintains the expanded data structure memory of the simulation model file, and forms a model data pool.
[0008] Step 4: The WEB configuration module preset by the WEB front end reads the model data pool generated by the simulation model, and constructs and generates the WEB configuration modeling data of the simulation model.
[0009] Step 5: The WEB front-end sets a listener to continuously monitor whether the model data pool of the simulation model has changed. If the model data pool has changed, the listener is triggered, and the WEB configuration module reads the changed model data pool and updates the WEB configuration modeling data of the simulation model. If the model data pool has not changed, the listener continues to monitor.
[0010] Step 6: The WEB front-end sets a monitor to continuously monitor whether the WEB configuration modeling data has changed. If the WEB configuration modeling data changes, the monitor is triggered, and the WEB front-end updates the expanded data structure memory in the model data pool according to the changed WEB configuration modeling data.
[0011] Step 7: The WEB configuration module reads the generated WEB configuration modeling data, renders the visualization view model, and generates the UI model corresponding to the simulation model; the user operates on the UI view model through the graphical editor of the WEB configuration module.
[0012] In one possible implementation, the method further includes:
[0013] Step 8: The monitor continuously monitors whether the UI model has been modified. When the monitor detects that the UI model has been modified, it notifies the WEB configuration module to modify the WEB configuration modeling data according to the modified content of the UI model, and performs synchronous update on the memory of the expanded data structure in the model data pool.
[0014] Step 9: When the listener detects that the text layer module of the simulation model has been opened, it notifies the web front-end to call the syntax parser to execute the text generation function, generate a readable model string from the model data pool, and return the readable model string to the text layer module. The text layer module renders and displays the readable model string and highlights the syntax keywords.
[0015] Step 10: When the listener detects that the readable model string of the text layer has been legally modified by the text editor, it notifies the web front-end to update the model data pool according to the modified scale model string; legal modifications to the readable model string include, for example, adding components, modifying parameters, adding or deleting connecting lines;
[0016] Step 11: When the listener detects that the text editor has legally modified the readable model string of the text layer and then performs a level switch or save model action, it notifies the WEB configuration module to update the UI model so that the UI model data maintains data consistency with the changed text layer.
[0017] In one possible implementation, the established file library uses a combination of database and local files to store the original simulation model.
[0018] In one possible implementation, the web backend and web frontend use JSON format for data exchange; or
[0019] XML is used as the intermediate data exchange format between the web backend and the web frontend.
[0020] In one possible implementation, the model data pool contains all parsed Modelica class instantiation data. If a new Modelica open task exists, the parsed Modelica class instantiation data is added to the model data pool. If the simulation model is closed, the corresponding operation of the simulation model is cleaned up from the model data pool.
[0021] In one possible implementation, the method further includes, when the web backend detects that multiple simulation models are opened on the web frontend, repeating steps 2 and 3 for each opened simulation model, and sequentially horizontally filling the model data pool of each opened simulation model.
[0022] According to another aspect of the embodiments of this disclosure, a device for configuration modeling and model data synchronization of a simulation model is provided, the device comprising:
[0023] The module is used to create a file library for storing simulation models. The file library contains text files of multiple original simulation models.
[0024] The string generation module is used to read the text file corresponding to the simulation model in the file library when a simulation model is detected to be opened on the web front end, organize and generate model file string data associated with the simulation model, and send it to the web front end through an interface.
[0025] The data pool generation module is used to call the syntax parser embedded in the WEB front end after receiving the model file string data associated with the simulation model, to perform the simulation model parsing task, build and maintain the expanded data structure memory of the simulation model file, and form a model data pool.
[0026] The configuration generation module is used to read the model data pool generated by the simulation model, construct and generate the WEB configuration modeling data of the simulation model;
[0027] The monitoring module is used to continuously monitor whether the model data pool of the simulation model has changed. If the model data pool has changed, the listener is triggered, and the WEB configuration module reads the changed model data pool and updates the WEB configuration modeling data of the simulation model. If the model data pool has not changed, the listener continues to monitor.
[0028] The monitoring module is used to continuously monitor whether the WEB configuration modeling data has changed. If the WEB configuration modeling data changes, the monitor is triggered, and the WEB front end updates the expanded data structure memory in the model data pool according to the changed WEB configuration modeling data.
[0029] The visualization rendering module is used to read the generated WEB configuration modeling data, render the visualization view model, and generate the UI model corresponding to the simulation model; users can operate the UI view model through the graphical editor of the WEB configuration module.
[0030] According to another aspect of the embodiments of this disclosure, a device for configuration modeling and model data synchronization of a simulation model is provided, the device comprising:
[0031] processor;
[0032] Memory used to store processor-executable instructions;
[0033] The processor is configured to execute the above-described method.
[0034] According to another aspect of the present disclosure, a non-volatile computer-readable storage medium is provided, on which computer program instructions are stored, which, when executed by a processor, implement the above-described method.
[0035] The beneficial effects of this disclosure are as follows: In the simulation model configuration modeling and model data synchronization method provided by this disclosure, when the user modifies components or connections in WEB configuration modeling, these changes can be reflected in the text layer in real time; conversely, changes in the text layer will also immediately update the content of the icon layer, graphics layer, and document layer. This solves the problem of correctness in WEB configuration modeling, improves software stability, avoids errors caused by asynchronous requests under the WEB system that result in inconsistencies between the graphical modeling configuration and the actual Modelica text model data, and moves the Modelica syntax parser forward in the software architecture, avoiding frequent network requests to the program backend due to configuration operations in the graphical editor, thus greatly improving software performance. This disclosure lays the data support foundation for Modelica language simulation software under the Web system and provides technical groundwork for the subsequent development of CEA simulation software for cloud-native applications. Attached Figure Description
[0036] Figure 1 This is a schematic flowchart illustrating a method for configuring and synchronizing simulation model data, as shown in an embodiment of this disclosure.
[0037] Figure 2 This is a block diagram of a simulation model configuration modeling and model data synchronization device shown in an embodiment of this disclosure. Detailed Implementation
[0038] The present disclosure will now be described in further detail with reference to the accompanying drawings and specific embodiments.
[0039] Unless otherwise defined, the technical and scientific terms used in this disclosure have the same meaning as commonly understood by one of ordinary skill in the art to which this disclosure pertains; the terminology used in this disclosure is for the purpose of describing particular embodiments only and is not intended to be limiting of this disclosure; the term "comprising" and any variations thereof in this disclosure are intended to cover non-exclusive inclusion. Clearly, the embodiments described in this disclosure are only a part of the embodiments of this disclosure, and not all of them. All other embodiments obtained by those of ordinary skill in the art based on the embodiments of this disclosure without inventive effort are within the scope of protection of this disclosure.
[0040] In this disclosure, the reference to "embodiment" means that a particular feature, structure, or characteristic described in connection with an embodiment may be included in at least one embodiment of this disclosure. The appearance of this phrase in various places throughout the specification does not necessarily refer to the same embodiment, nor is it a separate or alternative embodiment mutually exclusive with other embodiments. It will be explicitly and implicitly understood by those skilled in the art that the embodiments described herein can be combined with other embodiments.
[0041] Figure 1This is a flowchart illustrating a method for configuring and synchronizing simulation model data, as shown in an embodiment of this disclosure. This method can be executed by a terminal device, which can be a server, desktop computer, etc. This disclosure does not limit the type of terminal device. Figure 1 As shown, the method includes:
[0042] Step 1: Create a file library to store simulation models. The file library contains text files of multiple original simulation models.
[0043] For example, in step 1, the file library established uses a combination of database and local files to store the original simulation model. The database can be a MongoDB non-relational database or a relational database such as MySQL or SQL Server.
[0044] Step 2: When the web backend detects that a simulation model has been opened on the web frontend, it reads the text file corresponding to the simulation model from the file library, organizes and generates model file string data associated with the simulation model, and sends it to the web frontend through an interface.
[0045] In one possible implementation, the web backend and web frontend use JSON format for data exchange, ensuring efficient and compatible data transmission; the web backend and web frontend can also use XML format as an intermediate data exchange format to adapt to different data exchange scenarios.
[0046] Step 3: After receiving the model file string data associated with the simulation model, the web front-end calls the syntax parser embedded in the web front-end to perform the simulation model parsing task, builds and maintains the expanded data structure memory of the simulation model file, and forms a model data pool.
[0047] In step 3, the parser involves decomposing the text model and generating structured data. This is achieved through processes such as lexical analysis, syntax analysis, and grammar analysis, and generating instantiated Modelica model class data. For example, the Modelica parser can be implemented using the Antlr parser and the Rust language; alternatively, it can be implemented using other programming languages such as C, C++, Java, Python, and NodeJS.
[0048] The model data pool contains all parsed Modelica class instantiation data. If a new Modelica open task exists, the parsed Modelica class instantiation data is added to the model data pool. If the simulation model is closed, the corresponding operation of the simulation model is cleared from the model data pool.
[0049] In one possible implementation, the method further includes, when the web backend detects that multiple simulation models are opened on the web frontend, repeating steps 2 and 3 for each opened simulation model, and sequentially horizontally filling the model data pool of each opened simulation model.
[0050] Step 4: The WEB configuration module preset by the WEB front end reads the model data pool generated by the simulation model, and constructs and generates the WEB configuration modeling data of the simulation model.
[0051] In step 4, the WEB configuration module exposes and reads the data from the model data pool through the WASM module encapsulated by the syntax parser, and constructs and generates WEB configuration modeling data based on the read data. The WEB configuration modeling data is stored using the Object memory object method in Javascript.
[0052] Step 5: The WEB front-end sets up a listener to continuously monitor whether the model data pool of the simulation model has changed. If the model data pool has changed, the listener is triggered, and the WEB configuration module reads the changed model data pool and updates the WEB configuration modeling data of the simulation model. If the model data pool has not changed, the listener continues to monitor.
[0053] Step 6: The WEB front-end sets up a watcher to continuously monitor whether the WEB configuration modeling data has changed. If the WEB configuration modeling data changes, the watcher is triggered, and the WEB front-end updates the expanded data structure memory in the model data pool according to the changed WEB configuration modeling data.
[0054] Step 7: The WEB configuration module reads the generated WEB configuration modeling data, renders the visual view model, and generates the UI model corresponding to the simulation model. Users can manipulate the UI view model through the WEB configuration module's graphical editor, including but not limited to operations such as layout, copying, cutting, pasting, deleting, rotating, flipping, aligning, layering, and stretching, or other display methods to manipulate model components and basic primitives, including but not limited to right-clicking to open and modify properties, displaying and modifying properties in the sidebar or bottom bar, and displaying and modifying properties using shortcut keys.
[0055] In step 7, the WEB configuration module reads the generated WEB configuration modeling data and performs visualization graphics rendering, that is, displays the UI view model in the icon layer and graphics layer of the user interface of the simulation model.
[0056] Step 8: The monitor continuously monitors whether the UI model has been modified. When the monitor detects that the UI model has been modified, it notifies the WEB configuration module to modify the WEB configuration modeling data according to the modified content of the UI model, and performs a synchronous update on the memory of the expanded data structure in the model data pool.
[0057] In step 8, the user can modify the generated UI model in the user interface of the simulation model through the preset graphical editor in the icon layer interface or the graphical layer interface.
[0058] Step 9: When the listener detects that the text layer module of the simulation model has been opened, it notifies the web front-end to call the syntax parser to execute the text generation function, generate a readable model string from the model data pool, and return the readable model string to the text layer module. The text layer module renders and displays the readable model string and can also highlight syntax keywords.
[0059] Step 10: When the listener detects that the text editor has legally modified the readable model string of the text layer, it notifies the web frontend to update the model data pool according to the modified scale model string. Legal modifications to the readable model string can include, for example, adding components, modifying parameters, or adding / deleting connectors.
[0060] Step 11: When the listener detects that the text editor has legally modified the readable model string of the text layer and then performs a level switch or save model action, it notifies the WEB configuration module to update the UI model so that the UI model data maintains data consistency with the changed text layer.
[0061] In one possible implementation, the syntax parser function can run either locally or on the backend, or it can be embedded within the web frontend.
[0062] In one possible implementation, the graphics editor includes basic graphic primitives including at least lines, rectangles, polygons, circles, text, and images; the operations of the graphics editor include at least layout, copy, cut, paste, delete, rotate, flip, align, hierarchy, and stretch.
[0063] In one possible implementation, the simulation model is divided into four layers: icon layer, graphics layer, document layer, and text layer. Specific data from the text layer is read and defined as a new layer, such as a formula layer or numerical layer. Essentially, this involves formatting the text layer data and rendering it using a visualization method.
[0064] In one possible implementation, the action events of the graphical editor include left mouse click, left mouse double click, mouse hover, right mouse click, keyboard shortcut Ctrl+Z, keyboard shortcut Ctrl+C, keyboard shortcut Ctrl+V, keyboard delete key, and keyboard Esc key.
[0065] In one possible implementation, the graphical editor uses basic primitives to generate the appearance of model library components, and writes model algorithms in the text layer. The algorithms and appearances are combined to construct the Modelica model library.
[0066] In one application example, model data synchronization for a simulation model includes:
[0067] User actions on the UI model of the simulation model cause changes in the web configuration modeling data of the simulation model.
[0068] When the monitor detects a change in the WEB configuration modeling data, it calls the relevant data update function of the WASM module to notify the syntax parser to update the memory of the expanded data structure in the model data pool corresponding to the changed WEB configuration modeling data.
[0069] After the monitor detects a user switching to the text layer display event, it notifies the parser to read the expanded data structure memory of the model data pool, serialize it to generate a readable text model string, and send it to the text editor.
[0070] The text editor displays the received readable text model string; and provides functions for viewing, editing, and deleting text models, as well as highlighting Modelica language system keywords and distinguishing categories by color. The text editor also provides functions such as syntax input completion and line number display.
[0071] After the monitor detects a user switching icon layer, graphics layer, or model save / all model save event, it notifies the syntax parser to parse the latest modified readable text model string in the text editor and update the expanded data structure memory in the model data pool.
[0072] The aforementioned response mechanism of the simulation model ensures real-time updates of model data and immediate feedback from user operations. Through these steps, this disclosure provides a complete configuration modeling and model data synchronization solution for Modelica language simulation software based on a Web architecture, enabling users to perform efficient simulation modeling and data management on a unified platform, and strictly guaranteeing the correctness and real-time performance of configuration modeling data.
[0073] In one possible implementation, a device for configuration modeling and model data synchronization of a simulation model is provided, the device comprising:
[0074] The module is used to create a file library for storing simulation models. The file library contains text files of multiple original simulation models.
[0075] The string generation module is used to read the text file corresponding to the simulation model in the file library when a simulation model is detected to be opened on the web front end, organize and generate model file string data associated with the simulation model, and send it to the web front end through an interface.
[0076] The data pool generation module is used to call the syntax parser embedded in the WEB front end after receiving the model file string data associated with the simulation model, to perform the simulation model parsing task, build and maintain the expanded data structure memory of the simulation model file, and form a model data pool.
[0077] The configuration generation module is used to read the model data pool generated by the simulation model, construct and generate the WEB configuration modeling data of the simulation model;
[0078] The monitoring module is used to continuously monitor whether the model data pool of the simulation model has changed. If the model data pool has changed, the listener is triggered, and the WEB configuration module reads the changed model data pool and updates the WEB configuration modeling data of the simulation model. If the model data pool has not changed, the listener continues to monitor.
[0079] The monitoring module is used to continuously monitor whether the WEB configuration modeling data has changed. If the WEB configuration modeling data changes, the monitor is triggered, and the WEB front end updates the expanded data structure memory in the model data pool according to the changed WEB configuration modeling data.
[0080] The visualization rendering module is used to read the generated WEB configuration modeling data, render the visualization view model, and generate the UI model corresponding to the simulation model; users can operate the UI view model through the graphical editor of the WEB configuration module.
[0081] The description of the above-mentioned apparatus has been elaborated in detail in the description of the above-mentioned method, and will not be repeated here.
[0082] Figure 2 This is a block diagram illustrating a configuration modeling and model data synchronization device for a simulation model, as shown in an embodiment of this disclosure. For example, device 1900 can be provided as a server. (Refer to...) Figure 2The apparatus 1900 includes a processing component 1922, which further includes one or more processors, and memory resources represented by memory 1932 for storing instructions, such as application programs, that can be executed by the processing component 1922. The application programs stored in memory 1932 may include one or more modules, each corresponding to a set of instructions. Furthermore, the processing component 1922 is configured to execute instructions to perform the methods described above.
[0083] Device 1900 may also include a power supply component 1926 configured to perform power management of device 1900, a wired or wireless network interface 1950 configured to connect device 1900 to a network, and an input / output (I / O) interface 1958. Device 1900 can operate on an operating system stored in memory 1932, such as Windows Server™, MacOS X™, Unix™, Linux™, FreeBSD™, or similar.
[0084] In an exemplary embodiment, a non-volatile computer-readable storage medium is also provided, such as a memory 1932 including computer program instructions that can be executed by a processing component 1922 of the device 1900 to perform the above-described method.
[0085] This disclosure can be a system, method, and / or computer program product. A computer program product may include a computer-readable storage medium having computer-readable program instructions loaded thereon for causing a processor to implement various aspects of this disclosure.
[0086] Computer-readable storage media can be tangible devices capable of holding and storing instructions for use by an instruction execution device. Computer-readable storage media can be, for example—but not limited to—electrical storage devices, magnetic storage devices, optical storage devices, electromagnetic storage devices, semiconductor storage devices, or any suitable combination thereof. More specific examples (a non-exhaustive list) of computer-readable storage media include: portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), static random access memory (SRAM), portable compact disc read-only memory (CD-ROM), digital multifunction disc (DVD), memory sticks, floppy disks, mechanical encoding devices, such as punch cards or recessed protrusions storing instructions thereon, and any suitable combination thereof. The computer-readable storage media used herein are not to be construed as transient signals themselves, such as radio waves or other freely propagating electromagnetic waves, electromagnetic waves propagating through waveguides or other transmission media (e.g., light pulses through fiber optic cables), or electrical signals transmitted through wires.
[0087] The computer-readable program instructions described herein can be downloaded from computer-readable storage media to various computing / processing devices, or downloaded via a network, such as the Internet, local area network, wide area network, and / or wireless network, to an external computer or external storage device. The network may include copper transmission cables, fiber optic transmission, wireless transmission, routers, firewalls, switches, gateway computers, and / or edge servers. A network adapter card or network interface in each computing / processing device receives the computer-readable program instructions from the network and forwards them to the computer-readable storage media in the respective computing / processing device.
[0088] The computer program instructions used to perform the operations of this disclosure may be assembly instructions, instruction set architecture (ISA) instructions, machine instructions, machine-dependent instructions, microcode, firmware instructions, status setting data, or source code or object code written in any combination of one or more programming languages, including object-oriented programming languages such as Smalltalk, C++, etc., and conventional procedural programming languages such as the "C" language or similar programming languages. The computer-readable program instructions may execute entirely on the user's computer, partially on the user's computer, as a stand-alone software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In cases involving remote computers, the remote computer may be connected to the user's computer via any type of network—including a local area network (LAN) or a wide area network (WAN)—or may be connected to an external computer (e.g., via the Internet using an Internet service provider). In one possible implementation, electronic circuitry, such as a programmable logic circuit, a field-programmable gate array (FPGA), or a programmable logic array (PLA), is personalized by utilizing state information from computer-readable program instructions. This electronic circuitry can execute computer-readable program instructions to implement various aspects of this disclosure.
[0089] Various aspects of this disclosure are described herein with reference to flowchart illustrations and / or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of this disclosure. It should be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer-readable program instructions.
[0090] These computer-readable program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, or other programmable data processing apparatus to produce a machine such that, when executed by the processor of the computer or other programmable data processing apparatus, they create means for implementing the functions / actions specified in one or more blocks of the flowchart and / or block diagram. These computer-readable program instructions can also be stored in a computer-readable storage medium that causes a computer, programmable data processing apparatus, and / or other device to operate in a particular manner; thus, the computer-readable medium storing the instructions comprises an article of manufacture that includes instructions for implementing aspects of the functions / actions specified in one or more blocks of the flowchart and / or block diagram.
[0091] Computer-readable program instructions may also be loaded onto a computer, other programmable data processing apparatus, or other device to cause a series of operational steps to be performed on the computer, other programmable data processing apparatus, or other device to produce a computer-implemented process, thereby causing the instructions executed on the computer, other programmable data processing apparatus, or other device to perform the functions / actions specified in one or more boxes of a flowchart and / or block diagram.
[0092] The flowcharts and block diagrams in the accompanying drawings illustrate the architecture, functionality, and operation of possible implementations of systems, methods, and computer program products according to various embodiments of the present disclosure. In this regard, each block in a flowchart or block diagram may represent a module, segment, or portion of an instruction containing one or more executable instructions for implementing a specified logical function. In some alternative implementations, the functions marked in the blocks may occur in a different order than those shown in the drawings. For example, two consecutive blocks may actually be executed substantially in parallel, and they may sometimes be executed in reverse order, depending on the functions involved. It should also be noted that each block in the block diagrams and / or flowcharts, and combinations of blocks in the block diagrams and / or flowcharts, may be implemented using a dedicated hardware-based system that performs the specified function or action, or using a combination of dedicated hardware and computer instructions.
[0093] The various embodiments of this disclosure have been described above. These descriptions are exemplary and not exhaustive, nor are they limited to the disclosed embodiments. Many modifications and variations will be apparent to those skilled in the art without departing from the scope and spirit of the described embodiments. The terminology used herein is chosen to best explain the principles, practical application, or improvement of the technology in the market, or to enable others skilled in the art to understand the embodiments disclosed herein.
Claims
1. A method for Modelica modeling and data synchronization in a Web architecture, characterized in that, The method includes: Step 1: Create a file library to store simulation models. The file library contains text files of multiple original simulation models. Step 2: When the web backend detects that a simulation model has been opened on the web frontend, it reads the text file corresponding to the simulation model from the file library, organizes and generates model file string data associated with the simulation model, and sends it to the web frontend through an interface. Step 3: After receiving the model file string data associated with the simulation model, the WEB front-end calls the syntax parser embedded in the WEB front-end to perform the simulation model parsing task, builds and maintains the expanded data structure memory of the simulation model file, and forms a model data pool. Step 4: The WEB configuration module preset by the WEB front end reads the model data pool generated by the simulation model, and constructs and generates the WEB configuration modeling data of the simulation model. Step 5: The WEB front-end sets a listener to continuously monitor whether the model data pool of the simulation model has changed. If the model data pool has changed, the listener is triggered, and the WEB configuration module reads the changed model data pool and updates the WEB configuration modeling data of the simulation model. If the model data pool has not changed, the listener continues to monitor. Step 6: The WEB front-end sets a monitor to continuously monitor whether the WEB configuration modeling data has changed. If the WEB configuration modeling data changes, the monitor is triggered, and the WEB front-end updates the expanded data structure memory in the model data pool according to the changed WEB configuration modeling data. Step 7: The WEB configuration module reads the generated WEB configuration modeling data, renders the visualization view model, and generates the UI model corresponding to the simulation model; the user operates the UI view model through the graphical editor of the WEB configuration module. The method further includes: Step 8: The monitor continuously monitors whether the UI model has been modified. When the monitor detects that the UI model has been modified, it notifies the WEB configuration module to modify the WEB configuration modeling data according to the modified content of the UI model, and performs synchronous update on the memory of the expanded data structure in the model data pool. Step 9: When the listener detects that the text layer module of the simulation model has been opened, it notifies the web front-end to call the syntax parser to execute the text generation function, generate a readable model string from the model data pool, and return the readable model string to the text layer module. The text layer module renders and displays the readable model string and highlights the syntax keywords. Step 10: When the listener detects that the readable model string of the text layer has been legally modified by the text editor, it notifies the web front-end to update the model data pool according to the modified scale model string; legal modifications to the readable model string include adding components, modifying parameters, and adding or deleting connectors; Step 11: When the listener detects that the text editor has legally modified the readable model string of the text layer and then performs a level switch or save model action, it notifies the WEB configuration module to update the UI model so that the UI model data maintains data consistency with the changed text layer.
2. The method according to claim 1, characterized in that, The established file library uses a combination of database and local files to store the original simulation model.
3. The method according to claim 1, characterized in that, The web backend and web frontend exchange data using JSON format; or XML is used as the intermediate data exchange format between the web backend and the web frontend.
4. The method according to claim 1, characterized in that, The model data pool contains all parsed Modelica class instantiation data. If a new Modelica open task exists, the parsed Modelica class instantiation data is added to the model data pool. If the simulation model is closed, the corresponding operation of the simulation model is cleared from the model data pool.
5. The method according to claim 1, characterized in that, The method further includes that when the WEB backend detects that multiple simulation models are opened on the WEB frontend, for each opened simulation model, steps 2 and 3 are repeated to sequentially fill and expand the model data pool of each opened simulation model horizontally.
6. A Modelica modeling and data synchronization device under a Web architecture, characterized in that, The device includes: The module is used to create a file library for storing simulation models. The file library contains text files of multiple original simulation models. The string generation module is used to read the text file corresponding to the simulation model in the file library when a simulation model is detected to be opened on the web front end, organize and generate model file string data associated with the simulation model, and send it to the web front end through an interface. The data pool generation module is used to call the syntax parser embedded in the WEB front end after receiving the model file string data associated with the simulation model, to perform the simulation model parsing task, build and maintain the expanded data structure memory of the simulation model file, and form a model data pool. The configuration generation module is used to read the model data pool generated by the simulation model, construct and generate the WEB configuration modeling data of the simulation model; The monitoring module is used to continuously monitor whether the model data pool of the simulation model has changed. If the model data pool has changed, the listener is triggered, and the WEB configuration module reads the changed model data pool and updates the WEB configuration modeling data of the simulation model. If the model data pool has not changed, the listener continues to monitor. The monitoring module is used to continuously monitor whether the WEB configuration modeling data has changed. If the WEB configuration modeling data changes, the monitor is triggered, and the WEB front end updates the expanded data structure memory in the model data pool according to the changed WEB configuration modeling data. The visualization rendering module is used to read the generated WEB configuration modeling data, render the visualization view model, and generate the UI model corresponding to the simulation model; users can operate the UI view model through the graphical editor of the WEB configuration module. The device further includes: The first monitoring and notification module is used to continuously monitor whether the UI model has been modified. When the monitor detects that the UI model has been modified, it notifies the WEB configuration module to modify the WEB configuration modeling data according to the modified content of the UI model, and performs synchronous update on the expanded data structure memory in the model data pool. The second listening and notification module is used to notify the WEB front end to call the syntax parser and execute the text generation function when the text layer module of the simulation model is opened. The parser generates a readable model string from the model data pool and returns the readable model string to the text layer module. The text layer module renders and displays the readable model string and highlights the syntax keywords. The third monitoring and notification module is used to notify the web frontend to update the model data pool according to the modified scale model string when it detects that the readable model string of the text layer has been legally modified by the text editor. Legal modifications to the readable model string include adding components, modifying parameters, and adding or deleting connectors. The fourth monitoring and notification module is used to notify the WEB configuration module to update the UI model when it detects that the text editor has legally modified the readable model string of the text layer and then performs a level switch or save model action, so that the UI model data maintains data consistency with the changed text layer.
7. A Modelica modeling and data synchronization device under a Web architecture, characterized in that, The device includes: processor; Memory used to store processor-executable instructions; The processor is configured to perform the method according to any one of claims 1 to 5.
8. A non-volatile computer-readable storage medium storing computer program instructions thereon, characterized in that, When the computer program instructions are executed by the processor, they implement the method described in any one of claims 1 to 5.
Citation Information
Patent Citations
Graphical modeling method using Modelica web
CN115130042A
Visualization of data dependency in graphical models
US20130116986A1