1. Overview¶
This section presents an overview of the Maestro 2 approach to co-simulation. Roughly, the approach is to generate a specification expressed in the Domain Specfic Language called Maestro Base Language (MaBL) and then execute it in order to conduct a co-simulation. This specification is a recipe of what is going to be executed in order to conduct a co-simulation. By seperating the specification and execution it is possible to verify the specification prior to executing it.
1.1. Creating a specification¶
A specification can be written completely by hand if so desired, but Maestro2 also features a Specification Generator that can assist in creating a co-simulation according to a given configuration. For more information on how to use the Specification Generator please see Specification Generator.
Maestro2 also contains a plugin system of expansion plugins that can assist in creating a specification. An expansion plugin offers one or more functions that can be invoked in the specification. If a specifiation makes use of expansion plugins, then Maestro2 replaces expand function calls with the behaviour of the function call, which is provided by a given expansion plugin. For more information on expansion plugins, please see Expansion.
1.2. Expansion of a Specification¶
Once a specification has been created it goes through an expansion phase, where expand
statements related to the aforementioned Expansion Plugins are replaced with their corresponding behaviour.
For example, if a specification passed to Maestro2 contains the statement expand convertBoolean2Real(booleanVariable, realVariable)
, then it will be replaced by the behaviour of the function convertBoolean2Real
:
if( booleanVariable )
{
realVariable = 1.0;
}
else
{
realVariable = 0.0;
}
Once a specification is free of expand
statements it is ready for execution.
1.3. Executing a specification¶
Maestro2 has an interpreter capable of executing a MaBL specification. It is possible to define runtime plugins that offer functionality to be used in a MaBL specification. The interpreter will then invoke these functions during execution of the specification. One such example is the CSV plugin, which writes values to a CSV file.
1.4. Outline of the Co-simulation Process with Maestro2¶
There are two main ways of creating a specification using Maestro2: Write it by hand or use the Specification Generator. However, several of the processes are the same.
The sections outlines the process of how Maestro2 generates a MaBL specification and executes it.
configuration.json: | |
---|---|
Configuration for the co-simulation | |
specification.mabl: | |
Specification written in Maestro Base Language (MaBL). | |
SpecificationGenerator: | |
Controls the process of creating a MaBL Specification from configuration files. For more information, see Specification Generator | |
Expand: | Expand refers to the process of expansion. Expansion is where a expand function(args) statements are replaced by the behaviour of the given function based on an expansion plugin. For more information, see Expansion. |
IMaestroExpansion: | |
A plugin that provides one or more functions that can be used in context of expansion. | |
ExpandedSpecification: | |
A MaBL Specification that is free from expand statements. |
|
Interpreter: | Can execute a MaBL Specification. |
RuntimePlugin: | A plugin that is executed by the interpreter during the interpretation of a MaBL Specification. |
results: | An expanded MaBL specification and other results of the co-simulation efforts, i.e. a CSV file with results of the co-simulation. |