Table of Contents

Parametric Modeling and Simulations with Modelica

Keywords

Constraints have certain reserved keywords. They are

Common Built-in Variables can be modified in the 'Edit Constraint Block'. Click the 'Edit Built-in Variable' button. If you have more than one then separate them with a ','. Recommend to add:

Organizing Parametric Modeling

When you want to run the simulation Modelica is relatively harsh when it comes to parsing your model. Make sure to remove spaces and any special characters from your element names. Legal special characters include the underscore (_). Illegal special characters include the hyphen (-)

Modelica will assign classes to your Constraint Blocks. If the usage of the block is not assigned a name Sparx EA assigns it 'unnamed element'. Because Modelica doesn't like spaces within names it throws an error therefore you need to assign a name to each Constraint Block instance. Double click the part association relationship to open the Properties editor. In Source tab assign a name without spaces or special characters.

If you are linking blocks that reside in a different namespace then you will need to add a Package Import relationship between the Modeling package to the package that contains the elements you want to use

This should be a Warning and not an Error. E.g. if you have a summation equation that is 'a=b+c+d' but you only want to add 2 variables, b and c then d doesn't have a connection.

Customized Functions

The below is largely based on Creating a Parametric Model: Simulation Functions by Sparx Enterprise Architect which can be found here.

Need at least one input and one output.

min_output := 

if min_input_1 <= min_input_2 then 
	min_input_1
else 
	min_input_2;

Note that you have more code writing options if you click on the 'Code Editor…' button and ostensibly you can change the language. However I found that the chosen language is ignored and Modelica must be using its own interpreter to interpret your code.

Can I use this function in other constraint blocks?

Troubleshooting