Book a Demo

Please note : This help page is not for the latest version of Enterprise Architect. The latest help can be found here.

Prev Next

Getting Started with OpenModelica

An easy way to get started with OpenModelica and Enterprise Architect's machinery to produce Parametric simulations is to view some existing examples. This is a useful learning device for any feature in Enterprise Architect, but is particularly pertinent when learning the power of OpenModelica as there are a number of new things to learn and this is best done with some learning aids. We will start by looking at a fully worked exemplar taken from the Example model, which is distributed with every installation of Enterprise Architect and is available from the Help Item on the Start ribbon.

The example we will explore is the Pendulum example, but firstly we need to open the example model, which we do by selecting the ribbon option:

     Start > Help > Help > Resources > Open Example Model

The OpenModelica features are conveniently grouped in a single location with other simulation capabilities, and can be launched using the Modelica/Simulink menu available from the 'System Behavior' panel of the 'Simulate' ribbon. The OpenModelica facility keeps company with other simulation tools such as Executable StateMachine, Decision Modeling Notation and BPSim.

With the model loaded we can use the OpenModelica features within Enterprise Architect to locate the Pendulum example in the model. It is common for a model of a complex system to be very large, and there could be any number of existing simulations set up, so Enterprise Architect provides a mechanism to search for these simulations.

Selecting this option will return a list of SysML simulation configuration artifacts, which are the elements where the OpenModelica details are specified. From this list we can select the Pendulum example, which will launch a window that can be used to configure and solve the problem codified in the example. To be able to run the simulation, a version of OpenModelica must be installed on the machine that is running Enterprise Architect. Details on how to install OpenModelica are contained in the next section.

There are two sections to the window:

  • The configuration (left hand) panel defines the Value Types, Blocks and Constraint Properties, all of which are defined in the repository and - as we will see later - can be viewed in the Browser window and diagrams
  • The simulation (right hand) panel is used to select and specify options that will effect the simulation, such as the data-set, the wait time and duration of the simulation, output file types and more.

The information in the window is automatically populated from the model that is visible in the Browser window, and the location of the elements - including Value Types, Blocks and Constraint Properties - can be found using the 'Find in Project Browser' option from the context menu.  There is also an analogous option to find the selected element in any diagrams in which it appears.

Installing OpenModelica

Enterprise Architect utilizes the power of the OpenModelica platform, so when you run a simulation from the Simulation window it is effectively calling out to OpenModelica (installed on the same machine) to do the heavy lifting and return the simulation results. This ensures that Enterprise Architect leverages the power of this open tool and all of the brilliant minds that have contributed to its excellence. There are both Windows and Linux version of OpenModelica and you will need to install the one appropriate for your environment. The steps are summarized here.

  1. Download the OpenModelica software (Windows or Linux).
  2. Install the Software.
  3. Check the Installation.
  4. Configure the Solver by specifying the path in Enterprise Architect.

Full details of the installation and configuration can be found in the OpenModelica Integration  Help topic.

Simulation with Data Sets

Simulation forms an import aspect of engineering analysis and provides a useful and cost effective way of analyzing a system's behavior. The system might already have been built or it might be planned for development; either way, simulation can be used to visualize component or system design considerations, performance optimization, safety engineering and much more. To provide this capability it is important to have the ability to run a simulation using different values for variables and constants. For example, in our pendulum example we might want to analyze how the system would perform on different planets, to examine, say:

  • The effect of terrestrial versus lunar (or other planet's) gravitational force
  • The effect of different string length
  • The effect of different masses
  • The effect of different starting point
  • Any combination of the above

Enterprise Architect provides a Data Set facility for simulations that can be applied at the Block level. Using the 'Simulation' tab (right hand panel) of the SysMLSim Configuration window we can select predefined data sets.

Any number of data sets can be defined and can be added to the appropriate Block in the 'Configuration' (left-hand) panel of the Simulation window. These are available as nodes under each Block and there is an option to view and edit the data values in a window by using the Browse [...] button on the datasets row.

When selected, the Configure Simulation Data window will be opened allowing values to be viewed and edited, imported or exported. This mechanism means that the simulation machinery can be reused in many different contexts, and engineering organizations that focus on particular types of problems can create libraries of simulations that could be reused in a multitude of contexts and types of engineering problem. The window illustrated here shows a data set that contains values pertaining to the two pendulum problems we have been looking at and we can see as an example the acceleration due to lunar gravity has been defined as an approximation of 1.6 m/s2 approximately 16.6% of the value on the surface of the earth. This simulation could be reused with a different data sets applicable to Mars or Jupiter or in a more terrestrial example with a different mass or length of string.