Skip to content

Incubator Digital Twin validation with NuRV Monitor

Overview

This example demonstrates how to validate some digital twin components using FMU monitors (in this example, the monitors are generated with NuRV[1]).

Simulated scenario

This example validates some components of the Incubator digital twin, by performing a simulation in which the commponents are wrapped inside FMUs, and are then inspected at runtime by some a FMU monitor generated by NuRV.

The input data for the simulation is generated by a purpose-built FMU component named source, which supplies testing data to the anomaly detector, simulating an anomaly occurring at time t=60s. An additional component, watcher, is employed to verify whether the energy saver activates in response to an anomaly reported by the anomaly detector.

The output of the watcher is the passed to the monitor, which ensures that when an anomaly is detected, the energy saver activates within a maximum of three simulation cycles.

Example structure

A diagram depicting the logical software structure of the example can be seen below.

DT structure

Digital Twin configuration

The example uses the following assets:

Asset Type Names of Assets Visibility Reuse in other Examples
Models anomaly_detection.fmu Private No
energy_saver.fmu Private No
Source.fmu Private No
Watcher.fmu Private No
Specification safe-operation.smv Private No
Tool maestro-2.3.0-jar-with-dependencies.jar Common Yes

The safe-operation.smv file contains the default monitored specification as described in the Simulated scenario section.

Lifecycle phases

The lifecycle phases for this example include:

Lifecycle Phase Completed Tasks
Create Installs Java Development Kit for Maestro tool
Generates and compiles the monitor FMU
Execute Produces and stores output in data/incubator-NuRV-monitor-validation/output directory
Clean Clears run logs and outputs

If required, change the execute permissions of lifecycle scripts you need to execute. This can be done using the following command

chmod +x lifecycle/{script}

where {script} is the name of the script, e.g. create, execute etc.

Run the example

To run the example, change your present directory.

cd /workspace/examples/digital_twins/incubator-NuRV-monitor-validation

If required, change the execute permission of lifecycle scripts you need to execute, for example:

chmod +x lifecycle/create

Now, run the following scripts:

Create

  • Installs Open Java Development Kit 17 in the workspace.
  • Generates and compiles the monitor FMU from the NuRV specification
lifecycle/create

Execute

Run the the Digital Twin. Since this is a co-simulation based digital twin, the Maestro co-simulation tool executes co-simulation using the FMU models.

lifecycle/execute

Analyze phase

Process the output of co-simulation to produce a plot at: /workspace/examples/data/incubator-NuRV-monitor-validation/output/plots.

lifecycle/analyze

A sample plot is given here.

output plot

In the plot, four color-coded indicators provide a visual representation of distinct values. The blue line depicts the simulated temperature, while orange one represents the temperature estimate. A red dashed line indicates the target temperature set by the energy saver component. The green line shows the monitor's output verdict. As observed, when there is a disparity between the estimated and actual temperatures, the energy saver adjusts the target temperature downward, indicating that the component is working properly. Thus, the output of the monitor is fixed at unknown (0), signifying that the monitoring property is not violated.

Examine the results

The results can be found in the /workspace/examples/data/incubator-NuRV-monitor-validation/output directory where the logs are also included.

Figures of the output results can be found in the /workspace/examples/data/incubator-NuRV-monitor-validation/output directory.

Terminate phase

Terminate to clean up the debug files and co-simulation output files.

lifecycle/terminate

References

  1. More information about NuRV is available here.