.OpenModelica.Scripting.loadModel

Information

Loads a Modelica library.

Syntax

loadModel(Modelica)
loadModel(Modelica,{"3.2"})

Description

loadModel() begins by parsing the getModelicaPath(), and looking for candidate packages to load in the given paths (separated by : or ; depending on OS).

The candidate is selected by choosing the one with the highest priority, chosen by looking through the priorityVersion argument to the function. If the version searched for is "default", the following special priority is used: no version name > highest main release > highest pre-release > lexical sort of others (see table below for examples). If none of the searched versions exist, false is returned and an error is added to the buffer.

A top-level package may either be defined in a file ("Modelica 3.2.mo") or directory ("Modelica 3.2/package.mo")

The encoding of any Modelica file in the package is assumed to be UTF-8. Legacy code may contain files in a different encoding. In order to handle this, add a file package.encoding at the top-level of the package, containing a single line with the name of the encoding in it. If your package contains files with mixed encodings and your system iconv supports UTF-8//IGNORE, you can ignore the bad characters in some of the files. You are recommended to convert your files to UTF-8 without byte-order mark.

PriorityExample
No version nameModelica
Main releaseModelica 3.3
Pre-releaseModelica 3.3 Beta 1
Non-orderedModelica Trunk

Bugs

If loadModel(Modelica.XXX) is called, loadModel(Modelica) is executed instead, loading the complete library.

Interface

function loadModel
  input TypeName className;
  input String[:] priorityVersion = {"default"};
  input Boolean notify = false "Give a notification of the libraries and versions that were loaded";
  input String languageStandard = "" "Override the set language standard. Parse with the given setting, but do not change it permanently.";
  input Boolean requireExactVersion = false "If the version is required to be exact, if there is a uses Modelica(version=\"3.2\"), Modelica 3.2.1 will not match it.";
  output Boolean success;
end loadModel;

Generated at 2024-11-04T19:25:26Z by OpenModelicaOpenModelica 1.24.0 using GenerateDoc.mos