Skip to content

Getting Started: Running a co simulation through maestro CLI

Cláudio edited this page Sep 24, 2020 · 2 revisions

Step 0 - Environment

Make sure to have java installed (at least version 1.7)

Step 1 - Downloads

Download the latest coe-jar from the releases: https://github.com/INTO-CPS-Association/maestro/releases/

We will be running a co-simulation of the MassSpringDamper case study, described in https://github.com/INTO-CPS-Association/example-mass_spring_damper.

Download the two Mass Spring Damper FMUs exported from Open modelica: https://github.com/INTO-CPS-Association/example-mass_spring_damper/tree/master/FMUs/OpenModelica

Place both jar and FMUs in the same folder.

Step 2 - Describe FMU connections

Create the following scenario.json file in the same folder as the jar file:

{
	"fmus":{
		"{msd1}":"file:/H:/Data/Notes/maestro_cli_tutorial/MassSpringDamper1.fmu",
		"{msd2}":"file:/H:/Data/Notes/maestro_cli_tutorial/MassSpringDamper2.fmu"
	},
	"connections": {
		"{msd1}.msd1i.x1": [
      "{msd2}.msd2i.x1"
    ],
		"{msd1}.msd1i.v1": [
      "{msd2}.msd2i.v1"
    ],
		"{msd2}.msd2i.fk": [
      "{msd1}.msd1i.fk"
    ]
	},
	"logVariables":{
		"{msd2}.msd2i":["x2", "v2"]
	},
  "parameters": {
		"{msd2}.msd2i.c2": 1.0,
		"{msd2}.msd2i.cc": 1.0,
		"{msd2}.msd2i.d2": 1.0,
		"{msd2}.msd2i.dc": 1.0,
		"{msd2}.msd2i.m2": 1.0
	},
	"algorithm":{
		"type":"fixed-step",
		"size":0.001
	},
	"loggingOn": false,
	"overrideLogLevel": "INFO"
}

Step 3 - Run Co-simulation

With a terminal open on the same folder, run:

java -jar .\coe-1.0.10-jar-with-dependencies.jar --configuration .\scenario.json  --oneshot --starttime 0.0 --endtime 10.0

More information about the command line interface can be found in: https://into-cps-maestro.readthedocs.io/en/docs/user/index.html