Domain Library Preprocessing in MWorks - a platform for Modeling and Simulation of Multi-domain Physical Systems Based on Modelica

Modeling and simulating with Modelica-based platforms for multi-domain physical systems need support of diversified domain libraries. Modelica Standard Library (MSL) is a free, reusable library released by Modelica Association, which comprises definitions of basic classes belonging to many domains such as mechanical, electrical, hydraulic, control, multi-body, thermodynamics, etc. User can also define or extend his special library. These libraries usually are stored at disk with mo text format (or binary encrypted format). They only record text information of the defined classes, and do not save their structured information. They will be loaded when system starts up, and they can be reused as extends classes or component instances when modeling. When the current main class is being checked or translated, the referenced classes (including extends and component classes) from domain library will be parsed first. Loading mo format files involves searching of a great many files from the library directory. At the same time, lexical and syntax analysis is performed. So the loading process is time-consuming. Likewise, parsing the referenced classes from domain library when parsing the current main class is also a timeconsuming process. So this paper studies a so-called domain library preprocessing technology which can greatly improves loading speed of domain library and parsing speed of the main class. The idea of this approach is that: parsing all the classes within domain library once, building their structured information of document object models, and then saving them to a binary file. When the system starts up, the binary file is automatically serialized to construct structured information of the classes which were defined originally in domain library. This approach is implemented in MWorks – another independent platform for modeling and simulation of multi-domain physical systems based on Modelica language.