WOLFRAM SYSTEMMODELER TUTORIAL

Model CenterKernel Commands

Introduction | Class Browser | Class Window | Graphical Views | Modelica Text View | Component Browser | Variable Views | Reliability View | Messages View | Kernel Command View | Documentation Center | Functional Mock-up Interface | Keyboard Shortcuts | Kernel Commands

These kernel commands that can be used in the Kernel Command view of Model Center.

Model handling

  • clear(): clears all class definitions currently loaded.
  • instantiateModel(classname): performs code instantiation of a class and returns a string containing the flat class definition.
  • saveTotalModel(filename,classname): saves a total class definition of the named class to the Modelica file given as a string. The file will contain all class definitions used by the named class, making it a self-contained file. This is a more lightweight alternative to File Save Total Model. This version only saves a minimal set of Modelica classes needed for the given class, while the alternative in the File menu creates an archive file with complete libraries, external file dependencies, and a convenient workflow for loading and working with the model.

Variables and evaluation

The Kernel Command view can also be used as a Modelica expression evaluator. This is an example of a session, showing evaluation of expressions, functions, and assignment of variables. Inputs are shown in bold:

1 + 2
3
Modelica.Math.sin(0.1)
0.09983341664682815
a := 2
2
b := Modelica.Constants.pi / 2
1.570796326794897
a + Modelica.Math.sin(b)
3.0
ndims({{1, 2}, {3, 4}})
2
size({{1, 2}, {3, 4}})
{2,2}

These commands can be used to handle variables defined in the kernel session:

  • clearVariables(): clears all variables defined in the kernel command session.
  • listVariables(): returns a list of the names of the variables currently defined in the kernel session.

Introduction | Class Browser | Class Window | Graphical Views | Modelica Text View | Component Browser | Variable Views | Reliability View | Messages View | Kernel Command View | Documentation Center | Functional Mock-up Interface | Keyboard Shortcuts | Kernel Commands