caseDict

Description

A caseDict is a file in dictIO dict file format used with ospCaseBuilder

A caseDict acts as input for ospCaseBuilder to

  • generate an osp-compatible simulation case, consisting of one or multiple fmu’s

  • trigger subsequent actions, such as writing a statisticsDict and a default watchDict

A caseDict file contains

  • generic information about the simulation case and the physical location of the fmu’s to be sourced

  • information about the components and the names to be used within the simulation

  • for each component, a dictionary of settings (e.g. start values and connector names)

  • a connection routing between connectors defined in component sub-dictionary

Elements

element / key

type

Description

#include

string

include directive. The specified dict file (e.g. a paramDict) will be read and merged into the caseDict

_environment

dict

environment variables needed by ospCaseBuilder at runtime

 libSource

string

relative or absolute path to the directory where the FMUs are located, i.e. the base folder of an FMU library. It acts as entry point for the FMU search.

systemStructure

dict

complete system structure

 components

dict

defines all component models used in the simulation

  <COMPONENT>

dict

unique name identifying a component in the simulation

   connectors

dict

itemization of connectors as defined in the FMU’s modelDescription.xml

    <CONNECTOR>

dict

speaking name of a connector, i.e. what it does and where it is mounted

     variable

string

name of a referenced variable as defined in the FMU file (mutually exclusive with variableGroup)

     variableGroup

string

name of a referenced VariableGroup as defined in <fmu_name>_OSPModelDescription.xml (mutually exclusive with variable)

     type

string

type of the connector. Choices: {input, output}

   initialize

dict

optional initialization, updating the FMU’s default settings

    <VARIABLE>

dict

the variable / parameter to be set. Needs to match the name as defined in the FMU file.

     causality

string

causality of the variable. Choices: {input, output, parameter}

     variability

string

variability of the variable. Choices: {fixed, calculated, tunable}

     start

float

initial value the variable shall be set to.

   fmu

string

relative path to the location of the source FMU (relative to libSource)

   stepSize

string

optional step size for this component. Only necessary in case the step size shall deviate from the default step size defined in the FMU’s ModelDescription.xml

 connections

dict

itemization of connections

  <CONNECTION>

dict

speaking name of the connection

   source

dict

source endpoint of <CONNECTION>

    component

string

name of source <COMPONENT>

    connector

string

name of <CONNECTOR> at source <COMPONENT> (mutually exclusive with variable)

    variable

string

name of <VARIABLE> at source <COMPONENT> (mutually exclusive with connector)

   target

dict

target endpoint of <CONNECTION>

    component

string

name of target <COMPONENT>

    connector

string

name of <CONNECTOR> at target <COMPONENT> (mutually exclusive with variable)

    variable

string

name of <VARIABLE> at target <COMPONENT> (mutually exclusive with connector)

run

dict

settings for simulation run

 simulation

dict

additional information about the simulaton. Used for window decoration.

  name

string

name of the simulation

  startTime

float

start time

  stopTime

float

start time

  baseStepSize

float

master algorithm step size

  algorithm

string

Co-simulation master algorithm (currently ‘fixedStep’ is supported by OSP)

Example

Below example shows a typical caseDict file.

/*---------------------------------*- C++ -*----------------------------------*\
filetype dictionary; coding utf-8; version 0.1; local --; purpose --;
\*----------------------------------------------------------------------------*/
#include paramDict

_environment
{
    libSource                           path/to/a/model/library/on/your/machine;
}
systemStructure
{
    connections
    {
        minuend_to_difference
        {
            source
            {
                component               minuend;
                connector               minuend_output;
            }
            target
            {
                component               difference;
                connector               difference_input_minuend;
            }
        }
        subtrahend_to_difference
        {
            source
            {
                component               subtrahend;
                connector               subtrahend_output;
            }
            target
            {
                component               difference;
                connector               difference_input_subtrahend;
            }
        }
        dividend_to_quotient
        {
            source
            {
                component               dividend;
                connector               dividend_output;
            }
            target
            {
                component               quotient;
                connector               quotient_input_dividend;
            }
        }
        difference_to_divisor
        {
            source
            {
                component               difference;
                connector               difference_output;
            }
            target
            {
                component               quotient;
                connector               quotient_input_divisor;
            }
        }
    }
    components
    {
        difference
        {
            connectors
            {
                difference_input_minuend
                {
                    variable            difference.IN1;
                    type                input;
                }
                difference_input_subtrahend
                {
                    variable            difference.IN2;
                    type                input;
                }
                difference_output
                {
                    variable            difference.OUT;
                    type                output;
                }
            }
            fmu                         subfolder/in/your/library/difference.fmu;
        }
        quotient
        {
            connectors
            {
                quotient_input_dividend
                {
                    variable            quotient.IN1;
                    type                input;
                }
                quotient_input_divisor
                {
                    variable            quotient.IN2;
                    type                input;
                }
                quotient_output
                {
                    variable            quotient.OUT;
                    type                output;
                }

            }
            fmu                         subfolder/in/your/library/quotient.fmu;
        }
        minuend
            {
            connectors
            {
                minuend_output
                {
                    variable            constVal.OUT;
                    type                output;
                }
            }
            initialize
            {
                constVal.IN
                {
                    causality           parameter;
                    variability         fixed;
                    start               $minuend;
                }
            }
            fmu                         subfolder/in/your/library/constantVal.fmu;
        }
        subtrahend
        {
            connectors
            {
                subtrahend_output
                {
                    variable            constVal.OUT;
                    type                output;
                }
            }
            initialize
            {
                constVal.IN
                {
                    causality           parameter;
                    variability         fixed;
                    start               $subtrahend;
                }
            }
            fmu                         subfolder/in/your/library/constantVal.fmu;
        }
        dividend
        {
            connectors
            {
                dividend_output
                {
                    variable            constVal.OUT;
                    type                output;
                }
            }
            initialize
            {
                constVal.IN
                {
                    causality           parameter;
                    variability         fixed;
                    start               $dividend;
                }
            }
            fmu                         subfolder/in/your/library/constantVal.fmu;
        }
    }
}
run
{
    simulation
    {
        name                            demoCase;
        startTime                       0;
        stopTime                        10;
        baseStepSize                    0.01;
        algorithm                       fixedStep;
    }
}

If you aim for just a first inspection of a simulation case, all you need to do is drop all referenced FMUs into the case’s build directory and call ospCaseBuilder with the –inspect option:

ospCaseBuilder caseDict --inspect --verbose

Inspection works already with a fairly rudimentary caseDict, such as:

/*---------------------------------*- C++ -*----------------------------------*\
filetype dictionary; coding utf-8; version 0.1; local --; purpose --;
\*----------------------------------------------------------------------------*/
_environment
{
    libSource                 path/to/a/model/library/on/your/machine;
}
systemStructure
{
    components
    {
        difference
        {
            fmu             subfolder/in/your/library/difference.fmu;
        }
        quotient
        {
            fmu             subfolder/in/your/library/quotient.fmu;
        }
        minuend
        {
            fmu             subfolder/in/your/library/constantVal.fmu;
        }
        subtrahend
        {
            fmu             subfolder/in/your/library/constantVal.fmu;
        }
        dividend
        {
            fmu             subfolder/in/your/library/constantVal.fmu;
        }
    }
}
run
{
    simulation
    {
        name                  demoCase;
    }
}