Calling Functions

You can call existing functions from libraries. This lets you enter values and execute the function.

Note: You can also call functions using scripting. For example, a single function can be executed manually using for example the context command Insert Function Call in the command input line of the Modelica Scripting window. See Create and Execute a Script.


Before you begin: Functions must be available, either in the Package Browser or in the Preferred Classes Browser.

For example, in the Package Browser, open Modelica.Math.Matrices.eigenValues from the Modelica Standard Library.

  1. Right-click the eigenValues function and select Call Function.

    Note: A function is usually displayed in the Package Browser or Preferred Classes Browser with a circled 'f', but this icon can be customized.

    The Modelica.Math.Matrices.eigenValues dialog box appears to let you enter the values to be used in the function.
  2. Enter your values. In our example:
    1. For A values: Click Edit to open a matrix editor for entering an array.

      For more information about the matrix editor, see Working with the Matrix Editor.

    2. Adapt the size of the array using Rows and Columns in this editor.
    3. Enter values in the array cells.
    4. Click OK to close the matrix editor and return to the Modelica.Math.Matrices.eigenValues dialog box.
      The values are presented in the A box.
  3. Select the arrow at the end of a box to access the following commands:
    • Edit: to edit the box.
    • Edit Text: to edit the box in a separate dialog box.
    • Copy Default: to overload the value with the default value specified in the Modelica text of the function.
  4. Select OK or Execute to execute the function. You could also select:
    • Info to display a Help window and display information about the function.
    • Copy Call to copy the function with the values. This can be used in scripting.
    • Close to exit the dialog box without executing the function.
    The function is executed and the Modelica Scripting window displays the result. For more information, see The Modelica Scripting Window.
  5. Click Close to exit the Modelica Scripting window.
  6. Click Close to exit the Modelica.Math.Matrices.eigenValues dialog box, if still open.