GDTA - Generic Digital Twin Architecture Prototype for Industrial Energy Systems
This Prototype
implementation is a proof-of-concept of a service in the Generic Digital Twin Architecture (GDTA) proposed in reference [1].
The proof-of-concept shows the application of Semantic Web technologies for instantiating the proposed GDTA for a use case of a Packed-Bed Thermal Energy Storage (PBTES). The focus of the implementation is the Virtual Entity consisting of a Simulation Service in combination with context information, as it is a fundamental service inside a Digital Twin (DT).
Reference
[1] Steindl, G.; Stagl, M.; Kasper, L.; Kastner, W.; Hofmann, R. Generic Digital Twin Architecture for Industrial Energy Systems. Applied Sciences, 2020, 10, 8903. https://doi.org/10.3390/app10248903
Prerequisites
Setup Miniconda:
get https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh
bash Miniconda3-latest-Linux-x86_64.sh
conda create -n 5ddt
conda activate 5ddt
conda env list
conda install python=3.6
pip install -r ./src/main/SimulationServiceMatlab/requirements.txt
Enable Matlab Python Engine:
cd /usr/local/MATLAB/R2020a/extern/engines/python
python setup.py build --build-base ~/build install --prefix ~/Prototype/src/main/SimulationServiceMatlab
Shared Knoweldge
- Holds all instance data and a schema for all service categories defined from the service review
- Stored in
Jena Fuseki 2
using Docker, data persistence is achieved by storing the fuseki data in a Docker volume container named "fuseki-data" (Source
:https://hub.docker.com/r/stain/jena-fuseki)docker pull stain/jena-fuseki
-
docker run --name fuseki-data -e TDB=2 -v /fuseki busybox
(first time) -
docker run -d --name fuseki -p 3030:3030 -e TDB=2 --volumes-from fuseki-data stain/jena-fuseki
(to rerun) docker stop fuseki
FUSEKI Server in DOCKER:
docker pull stain/jena-fuseki
docker run -d --name fuseki -p 3030:3030 -e FUSEKI_DATASET1=dummy -e FUSEKI_DATASET_2=ds -v ~/fuseki:/fuseki -v ~/Prototype/src/main/PublicationService:/staging stain/jena-fuseki
- CREATE Dataset
ds
manually inhttp://localhost:3030/manage.html?tab=datasets
(username and password can be found underhome/username/fuseki/shiro.ini
)
One problem still needs to be solved, namely one needs to set the password in the *_service_fuseki_connection.py file accordingly to that of the fuseki servcer.
Service Categories:
Service categories consist of different service definitions which will be merged during runtime and
stored in the Shared Knowledge
. All service categories inherit from BaseService.owl
- Simulation Service
Services
Simulation Service
Code:
Code documentation in:
Setup:
- Go to the simulationServiceMatlab directory and execute:
-
nohup python simulationServiceMatlab.py &
- Role of nohup: nohup makes your script ignore SIGHUP, and redirects stdout/stderr to a file nohup.out, so that the command can continue running in the background after you log out. If you close the shell/terminal or log off, your command is no longer a child of that shell. It belongs to init process. If you search in pstree you'll see it is now owned by process 1 (init). To see the process again, use in terminal,
-
API:
- /service:
GET
(Retrieve Information):- Regularly calculates
Qualits of Service Parameters
and stores them inSHARED KNOWELDGE
- Regularly calculates
- /model:
GET
(Retrieve Information): - /train:
PUT
(Update Information):- Create a GLM from the input data based on its implementation by
statsmodels.api
- When train is invoced updates its model information in the
SHARED KNOWELDGE
- Create a GLM from the input data based on its implementation by
- /predict:
GET
(Retrieve Information): Return: new Model instance - /upload/data:
POST
(Create Information) - /upload/model:
POST
(Create Information)
Here a short example Workflow:
-
For SimulationServiceMatlab:
curl -u admin:admin -v -X GET http://localhost:5003/service
-
- curl -u admin:admin -v -X POST -H "Content-Type: multipart/form-data" -F "file=@C:\SimulationService\data_fbr_new_small.xlsx" http://localhost:5003/upload/data/filename=data_fbr_new_small.xlsx
-
- curl -u admin:admin -v -X POST -H "Content-Type multipart/form-data" -F "file=@<Path_to_File>" http://localhost:5003/upload/model/
- e.g.:curl -u admin:admin -v -X POST -H "Content-Type multipart/form-data" -F "file=@C:\Daten_IET2\trainNN.m" http://localhost:5003/upload/model/
- curl -u admin:admin -v -X POST -H "Content-Type multipart/form-data" -F "file=@<Path_to_File>" http://localhost:5003/upload/model/
- e.g.: curl -u admin:admin -v -X POST -H "Content-Type multipart/form-data" -F "file=@C:\Daten_IET2\predictNN.m" http://localhost:5003/upload/model/
- curl -u admin:admin -v -X POST -H "Content-Type multipart/form-data" -F "file=@<Path_to_File>" http://localhost:5003/upload/model/
-
- curl -u admin:admin http://localhost:5003/train -d "data_path=" -d "model=" -X PUT -v
- e.g.: curl -u admin:admin http://localhost:5003/train -d "data_path=data_fbr_new_small.xlsx" -d "model=trainNN.m" -X PUT -v
- curl -u admin:admin http://localhost:5003/train -d "data_path=" -d "model=" -X PUT -v
-
- curl -u admin:admin http://localhost:5003/predict -d "data_path=<Path_to_data_file_returned_from_upload>" -d "model=<Path_to_prediction_matlab_file_returned_from_upload>" -X GET -v
- e.g.: curl -u admin:admin http://localhost:5003/predict -d "data_path=data_fbr_new_small.xlsx" -d "model=predictNN.m" -X GET -v
- curl -u admin:admin http://localhost:5003/predict -d "data_path=<Path_to_data_file_returned_from_upload>" -d "model=<Path_to_prediction_matlab_file_returned_from_upload>" -X GET -v
-
- curl -u admin:admin http://localhost:5003/model -X GET -v
-
- curl -u admin:admin http://localhost:5003/service -X GET -v