The parametric evaluator only evaluates expressions that are written in the syntax it supports. By default, the parametric evaluator uses the built-in math to solve expressions. The built-in math uses a syntax that is similar to the Octave syntax (see Built-in Math for more information about built-in math). You can also write an expression using a scripting language that is supported by MagicDraw.
You can specify a scripting language to evaluate an expression through the Specification dialog of the opaque expression, which is the specification of the constraint.
To specify the language to evaluate an expression in the Specification dialog
Right-click an opaque expression in the Containment tree and select Specification. The Specification dialog of the opaque expression will open (see the following figure).
- Click the row next to the Language option to open the text box and enter the name of the language you want.
- Click Close to close the dialog.
You can also select the language for constraints on a SysML constraint block through the context menu on the constraint block or a constraint property typed by the constraint block (see the following figure).
To select the language for the constraint of a SysML constraint block
- Right-click a SysML constraint block or a constraint property typed by the constraint block on the diagram.
Click Language and select any supported language to evaluate constraint blocks from the list.
The language of the Default Parametric Evaluator in Magic Model Analyst is Built-in Math. Therefore, it will use Built-in Math to evaluate an opaque expression whose language you do not specify. You can see the language options of the Default Parametric Evaluator in the Environment Options dialog.
To change the language of the Default Parametric Evaluator in Magic Model Analyst
- Click Options > Environment on the main menu to open the Environment Options dialog.
- Select Simulation on the left-hand side of the dialog.
Click the row next to the Default Parametric Evaluator option to select a parametric evaluator (see the following figure).
You can also specify the duration you want to wait for the parametric evaluator to evaluate an expression. The timeout value is specified in second. If, for example, the timeout value is 15, the parametric evaluator has 15 seconds to evaluate a given expression. If it cannot give you the result within 15 seconds, it will stop evaluating the expression.
Related pages
- Value binding
- Evaluating expressions
- Evaluation with causality
- Dynamic constraint
- Manual value updates using the Parametric Evaluator
- Communicating with evaluators through simulation console
- Exchanging values between Magic Model Analyst and Parametric Evaluator
- Built-in Math
- Integration with external Evaluators
- Trade study with Magic Model Analyst
- Sample project