Interacting with the System Modeler Kernel
Kernel Command View
The Kernel Command view is available in both Model Center and Simulation Center. It provides a way to interact with the System Modeler kernel by executing commands and evaluating Modelica expressions. When opening the Kernel Command view by choosing View ▶ Kernel Command, it will appear in the bottom area of the main window.
Executing commands in the Kernel Command view.
Kernel Commands
To interact with the kernel, the commands described in this section can be used.
General
- instantiateModel(classname): performs code instantiation of a Modelica class and returns a string containing the flat Modelica class definition.
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 and 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:
- listVariables(): returns a list of the names of the variables currently defined in the kernel session.
Clearing the View
The Kernel Command view can be cleared by right-clicking anywhere within the view and choosing Clear All.