Skip to content

Commit

Permalink
Upgrade runner dependencies (INTO-CPS-Association#601)
Browse files Browse the repository at this point in the history
  - Upgrades the runner to support nodejs v20.x
  - Upgrades all npm packages of the runner
  - Adds configuration yaml to runner
  - Adds new digital twin example to the documentation
  • Loading branch information
prasadtalasila authored Mar 16, 2024
1 parent 92dc38d commit 375d3a9
Show file tree
Hide file tree
Showing 28 changed files with 2,002 additions and 1,471 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/lib-ms.yml
Original file line number Diff line number Diff line change
Expand Up @@ -135,4 +135,4 @@ jobs:
registry: ghcr.io
image-name: into-cps-association/dtaas-libms
version: ${{ needs.get_version.outputs.version }}
dockerfile: libms.dockerfile
dockerfile: libms.dockerfile
4 changes: 2 additions & 2 deletions .github/workflows/runner.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:
- name: Setup node
uses: actions/setup-node@v3
with:
node-version: 18
node-version: 20
cache: "yarn"
cache-dependency-path: "**/yarn.lock"

Expand Down Expand Up @@ -73,7 +73,7 @@ jobs:
- name: Setup node
uses: actions/setup-node@v3
with:
node-version: 18
node-version: 20
cache: "yarn"
cache-dependency-path: "**/yarn.lock"
always-auth: true
Expand Down
275 changes: 273 additions & 2 deletions docs/user/examples/examples.drawio

Large diffs are not rendered by default.

163 changes: 103 additions & 60 deletions docs/user/examples/incubator/README.md
Original file line number Diff line number Diff line change
@@ -1,60 +1,103 @@
# Incubator Demo

Installation of required python packages for the Incubator demo

```bash
pip install pyhocon
pip install influxdb_client
pip install scipy
pip install pandas
pip install pika
pip install oomodelling
pip install control
pip install filterpy
pip install sympy
pip install docker
```

start rabbitmq server and create a rabbitmq account with,

```txt
name: incubator
password:incubator
with access to the virtual host "/"
```

```bash
docker run -d --name rabbitmq-server \
--restart always \
-p 15672:15672 -p 5672:5672 rabbitmq:3-management
docker exec rabbitmq-server rabbitmqctl add_user incubator incubator
docker exec rabbitmq-server rabbitmqctl set_permissions -p "/" incubator ".*" ".*" ".*"
```

Access InfluxDB running on another machine.
Remember that InfluxDB works only on a distinct sub-domain
name like `influx.foo.com`, but not on `foo.com/influx`.

```bash
ssh -i /vagrant/vagrant -fNT -L 40000:localhost:80 [email protected]
```

Update the rabbitmq-server and influxdb configuration in

```bash
/home/vagrant/dt/1/incubator/example_digital-twin_incubator/software/startup.conf
```

select (comment / uncomment) functions in

```bash
/home/vagrant/dt/1/incubator/example_digital-twin_incubator/software/startup/start_all_services.py
```

Start the program

```bash
export PYTHONPATH="${PYTHONPATH}:/home/vagrant/dt/1/incubator/example_digital-twin_incubator/software/incubator"
cd /home/vagrant/dt/1/incubator/example_digital-twin_incubator/software
python3 -m startup.start_all_services
```
# Incubator Digital Twin

## Overview

This is a case study of an Incubator with the purpose of understanding
the steps and processes involved in developing a digital twin system.
This incubator is an insulated container with the ability to keep a temperature
and heat, but not cool. A picture of the incubator is given below.

![Incubator Picture](figures/incubator_pt.png)

The overall purpose of the system is to reach a certain temperature within
a box and keep the temperature regardless of content.
An overview of the system can be seen below:

![Incubator Schematic](figures/system.svg)

The system consists of:

* 1x styrofoam box in order to have an insulated container
* 1x heat source to heat up the content within the Styrofoam box.
* 1x fan to distribute the heating within the box
* 2x temperature sensor to monitor the temperature within the box
* 1x temperature Sensor to monitor the temperature outside the box
* 1x controller to actuate the heat source and the fan and read sensory
information from the temperature sensors, and communicate with
the digital twin.

The original repository for the example can be found: [Original repository](https://github.com/INTO-CPS-Association/example_digital-twin_incubator/).
This trimmed version of the codebase does not have the following:

* docker support
* tests
* datasets

The original repository contains the complete documentation of
the example, including the full system architecture, instructions for
running with a physical twin, and instructions for running
a 3D visualization of the incubator.

## Digital Twin Structure

![System overview of the incubator](figures/dt-structure.svg)

This diagrams shows the main components and the interfaces they use to communicate.
All components communicate via the RabbitMQ message exchange,
and the data is stored in a time series database.
The RabbitMQ and InfluxDB are platform services hosted by the DTaaS.

The Incubator digital twin is a pre-packaged digital twin. It can be
used as is or integrated with other digital twins.

The mock physical twin is executed from
`incubator/mock_plant/real_time_model_solver.py` script.

## Digital Twin Configuration

This example uses a plethora of Python scripts to run the digital twin.
By default it is configured to run with a mock physical twin.
Furthermore, it depends on a RabbitMQ and an InfluxDB instances.

There are two configuration files. One is is DT has a single configuration files.
First is `incubator/log.log`; it controls the verbosity of terminal log level
during DT execution.
Second is `simulation.conf` which provides the control and
connection parameters to the DT.

## Examining the results

After starting all services successfully, the controller service will
start producing output that looks like the following:

````log
time execution_interval elapsed heater_on fan_on room box_air_temperature state
19/11 16:17:59 3.00 0.01 True False 10.70 19.68 Heating
19/11 16:18:02 3.00 0.03 True True 10.70 19.57 Heating
19/11 16:18:05 3.00 0.01 True True 10.70 19.57 Heating
19/11 16:18:08 3.00 0.01 True True 10.69 19.47 Heating
19/11 16:18:11 3.00 0.01 True True 10.69 19.41 Heating
````

An InfluxDB dashboard can be setup based on
`incubator/digital_twin/data_access/influxdbserver/dashboards/incubator_data.json`.
If the dashboard on the InfluxDB is setup properly,
the following visualization can be seen:

![Influx Dashboard](figures/visualization.png)

## References

**NOTE**: Forked from:
[Incubator repository](https://github.com/INTO-CPS-Association/example_digital-twin_incubator/)
with commit ID: 989ccf5909a684ad26a9c3ec16be2390667643aa

To understand what a digital twin is, we recommend you read/watch one
or more of the following resources:

1. Feng, Hao, Cláudio Gomes, Casper Thule, Kenneth Lausdahl,
Alexandros Iosifidis, and Peter Gorm Larsen. “Introduction to
Digital Twin Engineering.” In 2021 Annual Modeling and Simulation
Conference (ANNSIM), 1–12. Fairfax, VA, USA: IEEE, 2021.
[https://doi.org/10.23919/ANNSIM52504.2021.9552135](https://doi.org/10.23919/ANNSIM52504.2021.9552135).
1. [Video recording of presentation by Claudio Gomes](https://videos.ida.dk/media/Introduction+to+Digital+Twin+Engineering+with+Cl%C3%A1udio+%C3%82ngelo+Gon%C3%A7alves+Gomes%2C+Aarhus+Universitet/1_7r1j05g8/256930613)
Loading

0 comments on commit 375d3a9

Please sign in to comment.