Skip to content

Commit 8a5db53

Browse files
Levi Jamtmrindar
Levi Jamt
andauthored
OSP validator page and renaming MSMI to OSP-IS (#75)
* New osp-validator page and renaming MSMI to OSP-IS #62 * typo #62 * specification, not standard #62 * Added links and did some minor modifications * Added link to xsd documentation Co-authored-by: Martin Rindarøy <[email protected]>
1 parent 49a7789 commit 8a5db53

11 files changed

+168
-58
lines changed

assets/img/validatorFig1.png

-32.8 KB
Binary file not shown.

assets/img/validatorFig2.png

-27.2 KB
Binary file not shown.

assets/img/validatorFig3.png

-19.4 KB
Binary file not shown.

cosim-cli.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ nav_order: 2
1414
</div>
1515

1616
# Command line interface
17-
`cosim` is a command line interface (CLI) to libcosim for the cases where a graphical user interface is not available or needed. It facilitates for running co-simulations of systems configured with SSP or MSMI.
17+
`cosim` is a command line interface (CLI) to libcosim for the cases where a graphical user interface is not available or needed. It facilitates for running co-simulations of systems configured with SSP or [OSP system structure configuration](./libcosim/configuration).
1818
It has three primary use cases:
1919

2020
- Running simulations from other programs or scripts

cosim-demo-app/user-guide.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,7 @@ The code below is an example of a "OspSystemStructure.xml" file:
213213

214214
If your configuration directory contains both (“OspSystemStructure.xml” and a “SystemStructure.ssd”), the .xml file will be prioritized. If you would like to load your simulation with the connections as defined on the “SystemStructure.ssd” file, include it in the path.
215215

216-
Note: The new MSMI connection types are not supported when using the SSP standard.
216+
Note: The new OSP-IS connection types are not supported when using the SSP standard.
217217

218218
[back to top](./user-guide#user-guide)
219219

downloads.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,6 @@ You can use this page to download:
1515
- [cosim demo app](https://github.com/open-simulation-platform/cosim-demo-app/releases)
1616
- [cosim4j (java wrapper)](https://github.com/open-simulation-platform/cosim4j/releases)
1717
- [demo simulation models](https://github.com/open-simulation-platform/demo-cases/releases)
18-
- [OSP validator](https://github.com/open-simulation-platform/msmi-validator/releases)
18+
- [osp-validator](https://github.com/open-simulation-platform/osp-validator/releases)
1919
- [kopl - windows](https://mooropt2.marintek.sintef.no/nexus/content/repositories/thirdparty/no/sintef/ocean/kopl/kopl/1.0.0/kopl-1.0.0-win32.x86_64.zip)
2020
- [kopl - linux (experimental)](https://mooropt2.marintek.sintef.no/nexus/content/repositories/thirdparty/no/sintef/ocean/kopl/kopl/1.0.0/kopl-1.0.0-linux.gtk.x86_64.zip)

index.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ The software produced in the OSP JIP consists of the following elements:
3030
- [cosim](./cosim) - command line interface
3131
- [cosim demo app](./cosim-demo-app/cosim-demo-app) - demo application with a graphical user interface
3232
- [cosim4j](./cosim4j) - libcosim java wrapper
33-
- [osp-validator](./model-interface-validator) validation tools for configuration and model interfaces
33+
- [osp-validator](./osp-validator) validation tools for configuration and model interfaces
3434
- [kopl](./kopl) - co-simulation configuration tool
3535

3636

kopl.md

+5-5
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ nav_order: 7
77
---
88

99
# Configuration tool
10-
`Kopl` is a configurator to help set up and run a simulation. It can also be used to validate the model using the [MSMI validator](./model-interface-validator).
10+
`Kopl` is a configurator to help set up and run a simulation. It can also be used to validate the model using the [OSP validator](./osp-validator).
1111
`Kopl` is not an open source software but can be freely used without any restrictions.
1212

1313
{% include figure.html
@@ -43,8 +43,8 @@ Here you have two options,either to create an empty configuration or point to an
4343
* Once two or more FMUs are added to the diagram it is possible to add connections between the blocks.
4444
Just start dragging from an output or input slot and drop when hovering over the correct terminal.
4545

46-
## Variable groups (MSMI)
47-
* If you want to follow the MSMI standard, you can start creating variable groups in the definitions tab within the variable groups tab.
46+
## Variable groups (OSP-IS)
47+
* If you want to follow the OSP-IS, you can start creating variable groups in the definitions tab within the variable groups tab.
4848
* Click the green button or right click an empty space in the local navigator/tree widget
4949
* Created variable groups may then be choosen as input or output to the FMU
5050

@@ -54,9 +54,9 @@ Just start dragging from an output or input slot and drop when hovering over the
5454
caption="Definition of nested variable groups"
5555
%}
5656

57-
## MSMI validation
57+
## OSP-IS validation
5858

59-
Right click the configuration and choose validate in the context menu to let the [MSMI validator](./model-interface-validator) validate the current setup
59+
Right click the configuration and choose validate in the context menu to let the [OSP validator](./osp-validator) validate the current setup
6060

6161
## Export
6262

libcosim/configuration.md

+3-5
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@ nav_order: 1
88
---
99
# Simulation configuration
1010

11-
The configuration format is based on the [MSMI specification]() and is used to configure the simulation system structure, including
11+
The OSP system structure configuration format is based on the OSP Inteface Specification [OSP-IS]() and is used to configure the simulation system structure, including
1212
connections between FMUs and setting of initial values for input and parameter variables. The configuration format is XML according to schema
13-
[OspSystemStructure.xsd](https://github.com/open-simulation-platform/cse-core/blob/master/test/data/msmi/schema/OspModelDescription.xsd).
13+
[OspSystemStructure.xsd](https://open-simulation-platform.com/xsd/OspSystemStructure-0.1.xsd).
1414
Description of the OspSystemStructure elements and their attributes are shown below. Code implementation examples follow.
1515

1616
## \<OspSystemStructure>
@@ -28,8 +28,6 @@ Description of the OspSystemStructure elements and their attributes are shown be
2828
```xml
2929
<?xml version="1.0" encoding="utf-8" ?>
3030
<OspSystemStructure
31-
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
32-
xsi:schemaLocation="http://opensimulationplatform.com/MSMI/OSPSystemStructure"
3331
xmlns="http://opensimulationplatform.com/MSMI/OSPSystemStructure"
3432
version="0.1">
3533
<StartTime>0.0</StartTime>
@@ -96,7 +94,7 @@ This is especially important when different models are provided by different ven
9694
```
9795

9896
## \<Connection>
99-
As defined in the MSMI specification, `connections` are configured through variables and variableGroups. It is highly recommended to follow the specification for its interfaces when exporting a model for connections.
97+
As defined in OSP-IS, `connections` are configured through variables and variableGroups. It is highly recommended to follow the specification for its interfaces when exporting a model for connections.
10098

10199
| sub-element | attribute |Description |
102100
| :--------------- | :----------------------------------| :----------------------------------------------------------------------------------------------------- |

model-interface-validator.md

-44
This file was deleted.

osp-validator.md

+156
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,156 @@
1+
---
2+
layout: default
3+
title: "OSP validator"
4+
permalink: /osp-validator
5+
has_toc: false
6+
nav_order: 6
7+
---
8+
<div style="text-align: right">
9+
<b>
10+
<a href="https://github.com/open-simulation-platform/osp-validator">osp-validator</a>
11+
on GitHub
12+
</b>
13+
</div>
14+
15+
# OSP validator
16+
The [osp-validator](https://github.com/open-simulation-platform/osp-validator) repository implements a java library and
17+
command line interface tool which validates an FMU with accompanying `OspModelDescription.xml` file, according to the
18+
[OSP-IS](/url/to/osp-is/document) specification. It also validates a simulation configuration as specified by a libcosim
19+
`OspSystemStructure.xml` file defined [here](./libcosim/configuration.md). The documentation for the xml schemas of both
20+
`OspModelDescription.xsd` and `OspSystemStructure.xsd` can be found [here](https://opensimulationplatform.com/xsd/)
21+
22+
## Java library
23+
The jar file `osp-validator-api-<version>.jar` is found in every release of `osp-validator`, downloadable from
24+
[here](https://github.com/open-simulation-platform/osp-validator/releases), and contains the java API.
25+
26+
The java library can be used by simulation configuration tools which needs to validate that the models and configuration
27+
is according to OSP-IS. The [kopl](./kopl.md) configuration tool uses this library for validation.
28+
29+
Examples showing how it can be used in a java application can be found
30+
[here](https://github.com/open-simulation-platform/osp-validator/tree/1.0.0/osp-validator-api/src/main/java/com/opensimulationplatform/api/examples)
31+
32+
## Command line interface
33+
A command line tool to interface the validator called `osp-cli.jar` is produced when building the `osp-validator`
34+
project, and it is downloadable from [here](https://github.com/open-simulation-platform/osp-validator/releases). The
35+
command line interface tool can be used to verify that a given `OspModelDescription.xml` and FMU is according to the
36+
OSP-IS. It can also validate simulation configurations defined by a `OspSystemStructure.xml` file. If there are no
37+
validation errors, the output is empty. In case there are validation errors, it will print error messages for all the
38+
violated rules.
39+
40+
Calling the `osp-cli.jar` without any input arguments prints out usage help:
41+
```
42+
$ java -jar osp-cli.jar
43+
Usage: osp-cli.jar [options] [command] [command options]
44+
Options:
45+
--help, -h
46+
Print help
47+
--version, -v
48+
Print version
49+
Commands:
50+
osp-system-structure Validate OspSystemStructure.xml
51+
Usage: osp-system-structure [options]
52+
Options:
53+
-file
54+
Path to OspSystemStructure.xml
55+
56+
osp-model-description Validate OspModelDescription.xml
57+
Usage: osp-model-description [options]
58+
Options:
59+
-file
60+
Path to OspModelDescription.xml
61+
-fmu
62+
Path to fmu
63+
```
64+
65+
### Usage example
66+
The .xml files shown below, which represents a valid configuration, can be validated with `osp-cli.jar` as follows:
67+
68+
```
69+
$ java -jar osp-cli.jar osp-system-structure -file OspSystemStructure.xml
70+
```
71+
72+
This produces no output, meaning all models, and the configuration itself is valid according to
73+
OSP-IS. If we change the line `<VariableGroup simulator="crane_controller" name="linear_mechanical_port"/>` in
74+
`OspSystemStructure.xml` to `<VariableGroup simulator="crane_controller" name="force"/>` and run the validation again,
75+
we see that the validator prints out an error message associated with the violated rules, and accompanying line
76+
number for where the error is:
77+
78+
```
79+
$ java -jar osp-cli.jar osp-system-structure -file OspSystemStructure.xml
80+
Validation error in OspSystemStructure.xml on line 11:
81+
VariableGroupConnection [crane_controller.force, knuckle_boom_crane.linear_mechanical_port] is invalid
82+
because they have different types [Force, LinearMechanicalPort]
83+
```
84+
85+
### Example XML files
86+
`CraneController_OspModelDescription.xml`
87+
```xml
88+
<?xml version="1.0" encoding="utf-8" ?>
89+
<OspModelDescription xmlns="http://opensimulationplatform.com/osp-is/OSPModelDescription" version="1.0">
90+
<VariableGroups>
91+
<Generic name="actuator_limits">
92+
<Variable ref="Act_Limits[1]"/>
93+
<Variable ref="Act_Limits[2]"/>
94+
<Variable ref="Act_Limits[3]"/>
95+
</Generic>
96+
<LinearMechanicalPort name="linear_mechanical_port">
97+
<Force name="force">
98+
<Variable ref="p_Crane.e[1]"/>
99+
<Variable ref="p_Crane.e[2]"/>
100+
<Variable ref="p_Crane.e[3]"/>
101+
</Force>
102+
<LinearVelocity name="linear_velocity">
103+
<Variable ref="p_Crane.f[1]"/>
104+
<Variable ref="p_Crane.f[2]"/>
105+
<Variable ref="p_Crane.f[3]"/>
106+
</LinearVelocity>
107+
</LinearMechanicalPort>
108+
</VariableGroups>
109+
</OspModelDescription>
110+
```
111+
112+
`KnuckleBoomCrane_OspModelDescription.xml`
113+
```xml
114+
<?xml version="1.0" encoding="utf-8" ?>
115+
<OspModelDescription xmlns="http://opensimulationplatform.com/osp-is/OSPModelDescription" version="1.0">
116+
<VariableGroups>
117+
<Generic name="actuator_limits">
118+
<Variable ref="Act_Limits[1]"/>
119+
<Variable ref="Act_Limits[2]"/>
120+
<Variable ref="Act_Limits[3]"/>
121+
</Generic>
122+
<LinearMechanicalPort name="linear_mechanical_port">
123+
<Force name="force">
124+
<Variable ref="p_Crane.e[1]"/>
125+
<Variable ref="p_Crane.e[2]"/>
126+
<Variable ref="p_Crane.e[3]"/>
127+
</Force>
128+
<LinearVelocity name="linear_velocity">
129+
<Variable ref="p_Crane.f[1]"/>
130+
<Variable ref="p_Crane.f[2]"/>
131+
<Variable ref="p_Crane.f[3]"/>
132+
</LinearVelocity>
133+
</LinearMechanicalPort>
134+
</VariableGroups>
135+
</OspModelDescription>
136+
```
137+
138+
`OspSystemStructure.xml`
139+
```xml
140+
<OspSystemStructure version="0.1" xmlns="http://opensimulationplatform.com/MSMI/OSPSystemStructure">
141+
<Simulators>
142+
<Simulator name="crane_controller" source="CraneController.fmu" stepSize="1.051732E7"/>
143+
<Simulator name="knuckle_boom_crane" source="KnuckleBoomCrane.fmu" stepSize="1.051732E7"/>
144+
</Simulators>
145+
<Connections>
146+
<VariableConnection>
147+
<Variable simulator="crane_controller" name="Act_Limits[1]"/>
148+
<Variable simulator="knuckle_boom_crane" name="Act_Limits[1]"/>
149+
</VariableConnection>
150+
<VariableGroupConnection>
151+
<VariableGroup simulator="crane_controller" name="linear_mechanical_port"/>
152+
<VariableGroup simulator="knuckle_boom_crane" name="linear_mechanical_port"/>
153+
</VariableGroupConnection>
154+
</Connections>
155+
</OspSystemStructure>
156+
```

0 commit comments

Comments
 (0)