HOW TO link OpenMI components via interface calls

Skip to end of metadata
Go to start of metadata

OpenMI components can be linked via a configuration utility such as e.g. the OpenMI editor.
However, once can also develop a linked system by calling the OpenMI interfaces. This page describes how to set up a hard-coded linked system, where the establishment of links and the deployment and execution of a combination of components is completely encapsulated in the source code.

When developing a hard-coded system, you usually know the underlying OpenMI components and their capabilities in terms of input and output. Hard-coding the system then comes down to the following steps:

  1. Instantiate the LinkableComponents and initialize them with the proper input data sets.
  2. Create the Quantity and ElementSet objects by querying ExchangeItems.
  3. Create the Link objects and populate them with the Quantity and ElementSet objects.
  4. Add the Link objects to the components and validate them.
  5. Prepare the event listener to catch events.
  6. Run the simulation (including preparation and finish).
  7. Dispose of the components.
    You must also continuously catch exceptions on all steps.

Example to setup a hard-coded system

The sample below provides a (pseudo) C#-code example that includes all phases in the utilization of OpenMI components. Note that this example does not include data operations and associated validations, while the calendar conversion between the DateTime data type of C# and the OpenMI Time object is omitted.

Figure Sample Hard-coded system using OpenMI linkable components

Labels:
status-ready-for-technical-or-contents-review status-ready-for-technical-or-contents-review Delete
Enter labels to add to this page:
Please wait 
Looking for a label? Just start typing.