### Start Minikube with Recommended Configuration Source: https://github.com/ertis-research/opentwins/blob/main/docs/docs/quickstart.mdx Starts a local Kubernetes cluster using Minikube with specified CPU, disk size, and memory to ensure smooth deployment of OpenTwins. ```bash minikube start --cpus 4 --disk-size 40gb --memory 8192 ``` -------------------------------- ### Install Python Dependencies for MQTT Source: https://github.com/ertis-research/opentwins/blob/main/docs/docs/quickstart.mdx Installs the necessary Python libraries, `paho-mqtt` and `typing_extensions`, required for MQTT communication and data generation for the digital twin simulation script. ```shell pip install paho-mqtt pip install typing_extensions ``` -------------------------------- ### Example Ditto Protocol JSON Message for Wheel Data Source: https://github.com/ertis-research/opentwins/blob/main/docs/docs/quickstart.mdx This JSON snippet illustrates the structure of a message sent to Eclipse Ditto for updating wheel sensor data. It shows the topic, headers, path, and the `value` payload containing velocity and direction properties, all conforming to the Ditto Protocol's merge command format. ```json { "topic": "example/mycar:wheel_2/things/twin/commands/merge", "headers": { "content-type": "application/merge-patch+json" }, "path": "/features", "value": { "velocity": { "properties": { "value": 44.07908610511725, "time": 1715943644787 } }, "direction": { "properties": { "value": 37.92163063527694, "time": 1715943644787 } } } } ``` -------------------------------- ### Example Mosquitto Configuration File Source: https://github.com/ertis-research/opentwins/blob/main/docs/docs/guides/examples/raspberry-example/sending-data.mdx A complete example of the `mosquitto.conf` file, demonstrating the default settings combined with the added lines for listener configuration, password file, and anonymous access, ensuring the broker is ready for external connections. ```text # Place your local configuration in /etc/mosquitto/conf.d/ # # A full description of the configuration file is at # /usr/share/doc/mosquitto/examples/mosquitto.conf.gz pid_file /run/mosquitto/mosquitto.pid persistence true persistence_location /var/lib/mosquitto/ log_dest file /var/log/mosquitto/mosquitto.log log_type all log_timestamp true include_dir /etc/mosquitto/conf.d listener 1883 0.0.0.0 password_file /etc/mosquitto/passwd allow_anonymous true ``` -------------------------------- ### Install Apache Kafka Helm Chart Source: https://github.com/ertis-research/opentwins/blob/main/docs/docs/installation/manual/essential.md Installs the Bitnami Kafka Helm chart from OCI registry, specifying version 22.0.0 and using a custom values file. ```bash helm install kafka oci://registry-1.docker.io/bitnamicharts/kafka --version 22.0.0 -f values.yaml ``` -------------------------------- ### Install Mosquitto Helm Chart Source: https://github.com/ertis-research/opentwins/blob/main/docs/docs/installation/manual/essential.md This command sequence adds the Eritis Helm chart repository, updates it, and then installs the Mosquitto MQTT broker into the 'opentwins' namespace using a custom values file. ```bash helm repo add ertis https://ertis-research.github.io/Helm-charts/ helm repo update helm install mosquitto ertis/mosquitto -n opentwins --wait --dependency-update -f values.yaml ``` -------------------------------- ### Install OpenTwins Lightweight with Helm Source: https://github.com/ertis-research/opentwins/blob/main/docs/docs/installation/using-helm.mdx This command installs the OpenTwins Lightweight version using Helm. It adds the 'ot' release from the 'ertis/OpenTwins-Lightweight' chart into the 'opentwins' namespace. ```bash helm install ot ertis/OpenTwins-Lightweight -n opentwins ``` -------------------------------- ### Install Docusaurus Project Dependencies with Yarn Source: https://github.com/ertis-research/opentwins/blob/main/docs/README.md This command installs all required project dependencies for the Docusaurus website using the Yarn package manager. It prepares the environment for local development and building. ```Shell $ yarn ``` -------------------------------- ### Install Paho-MQTT Library for Python Source: https://github.com/ertis-research/opentwins/blob/main/docs/docs/guides/examples/raspberry-example/sending-data.mdx Installs the Eclipse Paho MQTT client library for Python using pip3, which is a necessary prerequisite for MQTT communication in Python applications. ```bash sudo pip3 install paho-mqtt ``` -------------------------------- ### Query Wheel Velocity Comparison Data for Digital Twin (Flux) Source: https://github.com/ertis-research/opentwins/blob/main/docs/docs/quickstart.mdx This Flux query extracts all velocity data for all wheel digital twins (e.g., 'example:mycar:wheel_') from the 'opentwins' bucket. It filters for velocity values, renames 'thingId' for readability, and retains all historical entries for comparing wheel velocities. ```Flux import "strings" from(bucket: "opentwins") |> range(start: v.timeRangeStart, stop: v.timeRangeStop) |> filter(fn: (r) => r["_measurement"] == "mqtt_consumer") |> filter(fn: (r) => strings.hasPrefix(v: r["thingId"], prefix: "example:mycar:wheel_")) |> filter(fn: (r) => r["_field"] == "value_velocity_properties_value") |> map(fn: (r) => ({ r with thingId: strings.replace(v: r["thingId"], t: "example:mycar:", u: "", i: 2) })) |> keep (columns: ["thingId", "_value", "_time"]) ``` -------------------------------- ### Set Kubectl Context to Minikube Source: https://github.com/ertis-research/opentwins/blob/main/docs/docs/quickstart.mdx Configures kubectl to use the 'minikube' context, ensuring commands are directed to the local Minikube cluster. ```bash kubectl config use-context minikube ``` -------------------------------- ### Start Docusaurus Local Development Server with Yarn Source: https://github.com/ertis-research/opentwins/blob/main/docs/README.md Executes the `yarn start` command to launch a local development server for the Docusaurus website. It automatically opens a browser window, and most code changes are reflected live without requiring a server restart, facilitating rapid development. ```Shell $ yarn start ``` -------------------------------- ### Install MongoDB using Helm Chart Source: https://github.com/ertis-research/opentwins/blob/main/docs/docs/installation/manual/essential.md This command installs MongoDB v6.0 into the 'opentwins' namespace using its official Helm chart. It specifies the chart version and applies custom values from a 'values.yaml' file. ```bash helm install mongodb -n opentwins oci://registry-1.docker.io/bitnamicharts/mongodb --version 13.8.3 -f values.yaml ``` -------------------------------- ### Install Mosquitto MQTT Broker on Raspberry Pi Source: https://github.com/ertis-research/opentwins/blob/main/docs/docs/guides/examples/raspberry-example/sending-data.mdx A series of bash commands to add the Mosquitto repository, update the package list, and install the Mosquitto MQTT broker and client utilities on a Raspberry Pi running Raspbian Buster. ```bash sudo wget http://repo.mosquitto.org/debian/mosquitto-repo.gpg.key sudo apt-key add mosquitto-repo.gpg.key cd /etc/apt/sources.list.d/ sudo wget http://repo.mosquitto.org/debian/mosquitto-buster.list sudo -i apt-get update apt-get install mosquitto apt-get install mosquitto-clients ``` -------------------------------- ### Deploy OpenTwins using Helm Source: https://github.com/ertis-research/opentwins/blob/main/docs/docs/quickstart.mdx Deploys or upgrades the OpenTwins platform using the Helm chart from the ERTIS repository. The --wait flag ensures the deployment completes before the command exits, and --dependency-update updates chart dependencies. ```bash helm upgrade --install opentwins ertis/OpenTwins --wait --dependency-update ``` -------------------------------- ### Deploy Telegraf Helm Chart Source: https://github.com/ertis-research/opentwins/blob/main/docs/docs/installation/manual/essential.md This Bash command sequence adds the InfluxData Helm repository, updates it, and installs the Telegraf chart into the opentwins namespace. It uses a values.yaml file for custom configuration and specifies a particular chart version. Ensure the values.yaml is tailored to your chosen intermediary (Mosquitto or Kafka) and InfluxDB setup. ```Bash helm repo add influxdata https://helm.influxdata.com/ helm repo update helm install -n opentwins telegraf influxdata/telegraf -f values.yaml --version=1.8.27 --set tplVersion=2 ``` -------------------------------- ### Query Current Wheel Direction Data for Digital Twin (Flux) Source: https://github.com/ertis-research/opentwins/blob/main/docs/docs/quickstart.mdx This Flux query retrieves the most recent direction data for all wheel digital twins (e.g., 'example:mycar:wheel_') from the 'opentwins' bucket. It filters for direction values, renames 'thingId' for readability, and returns the latest entry for each wheel. ```Flux import "strings" from(bucket: "opentwins") |> range(start: v.timeRangeStart, stop: v.timeRangeStop) |> filter(fn: (r) => r["_measurement"] == "mqtt_consumer") |> filter(fn: (r) => strings.hasPrefix(v: r["thingId"], prefix: "example:mycar:wheel_")) |> filter(fn: (r) => r["_field"] == "value_direction_properties_value") |> map(fn: (r) => ({ r with thingId: strings.replace(v: r["thingId"], t: "example:mycar:", u: "", i: 2) })) |> keep (columns: ["thingId", "_value", "_time"]) |> sort(columns: ["_time"], desc: false) |> last() ``` -------------------------------- ### Query Current GPS Data for Digital Twin (Flux) Source: https://github.com/ertis-research/opentwins/blob/main/docs/docs/quickstart.mdx This Flux query extracts the most recent longitude and latitude information for the 'example:mycar' digital twin from the 'opentwins' bucket. It renames fields for proper display, keeps relevant columns, sorts by time, and returns only the latest entry. ```Flux import "strings" from(bucket: "opentwins") |> range(start: v.timeRangeStart, stop: v.timeRangeStop) |> filter(fn: (r) => r["_measurement"] == "mqtt_consumer") |> filter(fn: (r) => r["thingId"] == "example:mycar") |> filter(fn: (r) => r["_field"] == "value_gps_properties_latitude" or r["_field"] == "value_gps_properties_longitude") |> map(fn: (r) => ({ r with _field: strings.replace(v: r["_field"], t: "value_gps_properties_", u: "", i: 2) })) |> keep (columns: ["_value", "_field", "_time"]) |> sort(columns: ["_time"], desc: false) |> last() ``` -------------------------------- ### Install Grafana Helm Chart Source: https://github.com/ertis-research/opentwins/blob/main/docs/docs/installation/manual/essential.md Adds the official Grafana Helm chart repository, updates it, and installs Grafana into the 'opentwins' namespace using a custom values file, specifying version 8.5.0. ```bash helm repo add grafana https://grafana.github.io/helm-charts helm repo update helm install grafana grafana/grafana -n opentwins --version 8.5.0 -f values.yaml ``` -------------------------------- ### Simulate Car Digital Twin Telemetry with Python and MQTT Source: https://github.com/ertis-research/opentwins/blob/main/docs/docs/quickstart.mdx This Python script generates random telemetry data for a car and its wheels, then publishes it to an MQTT broker in Eclipse Ditto Protocol format. It demonstrates how to connect to MQTT, generate simulated sensor data (velocity, direction, GPS), and structure it for digital twin updates. Users must configure the MQTT broker address and port before running. ```python import paho.mqtt.client as mqtt import random import time import json # Digital twin info namespace = "example" car_name = "mycar" wheels_name = "mycar:wheel_" # MQTT info broker = "localhost" # MQTT broker address port = 1883 # MQTT port topic = "telemetry/" # Topic where data will be published # MQTT connection def on_connect(client, userdata, flags, rc): if rc == 0: print("Successful connection") else: print(f"Connection failed with code {rc}") client = mqtt.Client(mqtt.CallbackAPIVersion.VERSION2) client.on_connect = on_connect client.username_pw_set(username, password) client.connect(broker, port, 60) # Data generator def generate_wheel_data(): velocity = random.uniform(0, 100) # Generate random velocity (between 0 and 100 km/h) direction = random.uniform(-45, 45) # Generate random direction (between -45 and 45 degrees) return velocity, direction def generate_gps_data(): latitude = random.uniform(-90.0, 90.0) longitude = random.uniform(-180.0, 180.0) return latitude, longitude ``` -------------------------------- ### Add ERTIS Helm Repository Source: https://github.com/ertis-research/opentwins/blob/main/docs/docs/quickstart.mdx Adds the ERTIS Helm chart repository, which contains the OpenTwins helm chart, to your Helm configuration. ```bash helm repo add ertis https://ertis-research.github.io/Helm-charts/ ``` -------------------------------- ### Install Eclipse Hono Helm Chart Source: https://github.com/ertis-research/opentwins/blob/main/docs/docs/installation/manual/essential.md Adds the Eclipse IoT Helm chart repository, updates it, and installs Eclipse Hono into the 'opentwins' namespace using a custom values file, specifying version 2.5.5. ```bash helm repo add eclipse-iot https://eclipse.org/packages/charts helm repo update helm install hono eclipse-iot/hono -n opentwins -f values.yaml --version=2.5.5 ``` -------------------------------- ### Query GPS Evolution Data for Digital Twin (Flux) Source: https://github.com/ertis-research/opentwins/blob/main/docs/docs/quickstart.mdx This Flux query extracts all longitude and latitude data for the 'example:mycar' digital twin from the 'opentwins' bucket. It filters for GPS properties, renames fields, and retains all historical entries for displaying GPS evolution over time. ```Flux import "strings" from(bucket: "opentwins") |> range(start: v.timeRangeStart, stop: v.timeRangeStop) |> filter(fn: (r) => r["_measurement"] == "mqtt_consumer") |> filter(fn: (r) => r["thingId"] == "example:mycar") |> filter(fn: (r) => r["_field"] == "value_gps_properties_latitude" or r["_field"] == "value_gps_properties_longitude") |> map(fn: (r) => ({ r with _field: strings.replace(v: r["_field"], t: "value_gps_properties_", u: "", i: 2) })) |> keep (columns: ["_value", "_field", "_time"]) ``` -------------------------------- ### Install DHT22 Sensor Library on Raspberry Pi Source: https://github.com/ertis-research/opentwins/blob/main/docs/docs/guides/examples/raspberry-example/sending-data.mdx Installs the Adafruit_DHT Python library required to interface with the DHT22 temperature and humidity sensor on the Raspberry Pi. ```bash sudo pip3 install Adafruit_DHT ``` -------------------------------- ### Install InfluxDB using Helm Chart Source: https://github.com/ertis-research/opentwins/blob/main/docs/docs/installation/manual/essential.md These commands add the InfluxData Helm repository, update it, and then install InfluxDB v2 into the 'opentwins' namespace using its Helm chart, applying custom values from a 'values.yaml' file. ```bash helm repo add influxdata https://helm.influxdata.com/ helm repo update helm install -n opentwins influxdb influxdata/influxdb2 --version 2.1.1 -f values.yaml ``` -------------------------------- ### Grafana Helm Chart values.yaml Configuration with Plugin Installation Source: https://github.com/ertis-research/opentwins/blob/main/docs/docs/installation/manual/essential.md Configuration for the Grafana Helm chart, enabling persistence, setting NodePort, configuring Grafana INI for plugins, and using an init container to download and install OpenTwins-specific Grafana plugins. ```yaml persistence: enabled: true service: type: NodePort nodePort: 30718 grafana.ini: plugins: plugin_admin_enabled: true allow_loading_unsigned_plugins: ertis-opentwins,ertis-unity-panel extraInitContainers: - name: install-opentwins-plugins image: busybox command: - /bin/sh - -c - | #!/bin/sh set -euo pipefail mkdir -p /grafana-storage/plugins cd /grafana-storage/plugins wget --no-check-certificate -O ertis-opentwins.zip https://github.com/ertis-research/opentwins-in-grafana/releases/download/latest/ertis-opentwins.zip unzip -o ertis-opentwins.zip rm ertis-opentwins.zip wget --no-check-certificate -O ertis-unity-panel.zip https://github.com/ertis-research/grafana-panel-unity/releases/download/latest/ertis-unity-panel.zip unzip -o ertis-unity-panel.zip rm ertis-unity-panel.zip volumeMounts: - name: storage mountPath: /grafana-storage ``` -------------------------------- ### Python Script for Continuous Data Publishing to Ditto Source: https://github.com/ertis-research/opentwins/blob/main/docs/docs/quickstart.mdx This Python script demonstrates how to continuously generate and publish car and wheel sensor data to respective digital twins in Eclipse Ditto via MQTT. It utilizes helper functions (`get_ditto_protocol_msg`, `get_ditto_protocol_value_car`, `get_ditto_protocol_value_wheel`) and external functions (`generate_gps_data`, `generate_wheel_data`) to format data. It publishes messages to an MQTT client (`client`) using a base `topic`, `namespace`, `car_name`, and `wheels_name`, and includes a `try-except` block for graceful shutdown upon `KeyboardInterrupt`. ```python try: while True: t = round(time.time() * 1000) # Unix ms # Car twin latitude, longitude = generate_gps_data() msg = get_ditto_protocol_msg(car_name, get_ditto_protocol_value_car(t, latitude, longitude)) client.publish(topic + namespace + "/" + car_name, json.dumps(msg)) print(car_name + " data published") # Wheels twins for i in range(1, 5): name = wheels_name+str(i) velocity, direction = generate_wheel_data() msg = get_ditto_protocol_msg(name, get_ditto_protocol_value_wheel(t, velocity, direction)) client.publish(topic + namespace + "/" + name, json.dumps(msg)) print(name + " data published") time.sleep(5) except KeyboardInterrupt: client.disconnect() ``` -------------------------------- ### Install or upgrade OpenTwins using Helm Source: https://github.com/ertis-research/opentwins/blob/main/docs/docs/installation/using-helm.mdx Deploys or updates the OpenTwins platform using the specified Helm chart from the ERTIS repository. The --wait flag ensures the command waits for all resources to be ready, --dependency-update updates chart dependencies, and --debug provides verbose output for troubleshooting. ```bash helm upgrade --install opentwins ertis/OpenTwins --wait --dependency-update --debug ``` -------------------------------- ### Configure Grafana Plugins for Local Installation Source: https://github.com/ertis-research/opentwins/blob/main/docs/docs/installation/manual/unity.md This INI snippet shows the `[plugins]` section within the Grafana configuration file. For local installations, this section needs to be uncommented or added to enable plugin management and specify plugin directories or unsigned plugin allowances. ```INI [plugins] ``` -------------------------------- ### Eclipse Ditto Protocol and Connection Requirements Source: https://github.com/ertis-research/opentwins/blob/main/docs/docs/quickstart.mdx This section outlines the core concepts for integrating data with Eclipse Ditto. It details the 'Ditto Protocol' as the required JSON format for data updates and describes the various connection methods (MQTT, AMQP, Kafka) along with their necessary configuration parameters like address, port, and credentials. It also mentions the capability of JavaScript mappings for message transformation and how to discover Mosquitto connection details. ```APIDOC Eclipse Ditto Protocol: - Format: JSON - Purpose: Indicates which parts of the digital twin to update and how. Eclipse Ditto Connections: - Purpose: Collect data for digital twins. - Supported Protocols: MQTT, AMQP, Kafka - Required Information: - Address (string) - Port (integer) - Credentials (username, password, etc.) - Features: - JavaScript Mapping: Transform messages to Ditto Protocol format. - Example: - mosquitto-source-connection (Helm installation default) - Pulls messages via MQTT from Mosquitto. - Topic: telemetry/# (e.g., telemetry/mycar) - Default: No JavaScript mapping (requires Ditto Protocol directly). Mosquitto Address Discovery: - Cluster: - Address: Cluster address - Port: NodePort of Mosquitto service (e.g., 30511) - Command: kubectl get services (look for NodePort) - Minikube: - Expose service to localhost. - Command: minikube service --url (returns URL with address and port) ``` -------------------------------- ### Python Script to Connect and Send Data to MQTT Broker Source: https://github.com/ertis-research/opentwins/blob/main/docs/docs/guides/examples/string-example.mdx This Python script initializes an MQTT client using `paho.mqtt.client` to connect to a specified broker. It sets up the connection details (address, port, topic) and starts the client's network loop, preparing to send data to the digital twin via MQTT. ```python import paho.mqtt.client as mqtt import json import time import datetime import random # Define the MQTT broker address and topic broker_address = "localhost" broker_port = 1883 topic = "ditto/productionline/robotic_arm_1" # Create an MQTT client client = mqtt.Client() # Connect to the MQTT broker client.connect(broker_address, broker_port) # Start the MQTT client loop client.loop_start() ``` -------------------------------- ### Install Eclipse Ditto using Helm Chart Source: https://github.com/ertis-research/opentwins/blob/main/docs/docs/installation/manual/essential.md This command installs Eclipse Ditto v3.3 into the 'opentwins' namespace using its official Helm chart. It includes dependency updates and waits for the deployment to complete, applying custom values from a 'values.yaml' file. ```bash helm install --dependency-update -n opentwins ditto oci://registry-1.docker.io/eclipse/ditto --version 3.3.7 --wait -f values.yaml ``` -------------------------------- ### Example Input Data Format for JavaScript Mapping Source: https://github.com/ertis-research/opentwins/blob/main/docs/docs/guides/examples/string-example.mdx This JSON snippet represents an example of raw data format received from a machine, which is not directly compatible with Eclipse Ditto. It contains state, time, and consumption data for a robotic arm, intended to be transformed by a JavaScript mapping. ```json { "robotic_arm_1": { "state": "State", "time": "Today's timestamp", "consumption": "Arm consumption" } } ``` -------------------------------- ### OpenTwins Digital Twin Design Concepts Source: https://github.com/ertis-research/opentwins/blob/main/docs/docs/quickstart.mdx Describes the conceptual design for creating digital twins within OpenTwins, focusing on composite digital twins and the use of types. It outlines how to define types like 'car' and 'wheel' and establish composition relationships, enabling automatic instantiation of sub-twins and independent data access. ```APIDOC DigitalTwinSystem: Concepts: - CompositeDigitalTwin: Description: A digital twin composed of multiple interconnected sub-twins. - DigitalTwinType: Description: A blueprint defining the structure and characteristics of a digital twin. Properties: - name: string (e.g., "car", "wheel") - attributes: object (key-value pairs defining characteristics) - relations: array (defines composition or other links to other types) Usage: - Recommended for reusability and consistency. - Can be instantiated directly or used in composition. Operations: - CreateDigitalTwin: Parameters: - type: string (Optional, name of a predefined DigitalTwinType) - data: object (Initial properties and attributes for the twin) Behavior: - If 'type' is provided, the twin is created based on the type's schema. - If 'type' is part of a composition, sub-twins are automatically generated. - If 'type' is not provided, twin is created "from scratch". - AccessTwinData: Parameters: - twinId: string (Unique identifier for the digital twin) - attributePath: string (Path to specific data within the twin, e.g., "wheels[0].speed") Returns: any (The requested data) Example: Car Digital Twin Model - CarType: attributes: - gpsLocation: {latitude: number, longitude: number} relations: - hasWheels: {type: "WheelType", count: 4} - WheelType: attributes: - speed: number - direction: string ``` -------------------------------- ### Mosquitto Helm Chart values.yaml Configuration Source: https://github.com/ertis-research/opentwins/blob/main/docs/docs/installation/manual/essential.md Configuration for the Mosquitto Helm chart, setting the service type to NodePort with a specific port and disabling authentication for simpler setup. ```yaml service: type: NodePort nodePort: 30511 configuration: authentication: enabled: false ``` -------------------------------- ### Python Functions for Ditto Protocol Message Construction Source: https://github.com/ertis-research/opentwins/blob/main/docs/docs/quickstart.mdx These Python functions define the structure for data payloads conforming to the Eclipse Ditto Protocol. `get_ditto_protocol_value_car` takes `time`, `latitude`, and `longitude` to format GPS data. `get_ditto_protocol_value_wheel` takes `time`, `velocity`, and `direction` to format wheel sensor data. `get_ditto_protocol_msg` takes a `name` (for the twin ID) and the `value` payload, wrapping them into a complete Ditto merge command message, including topic and headers. These functions are designed to be used with an external `namespace` variable. ```python def get_ditto_protocol_value_car(time, latitude, longitude): return { "gps" : { "properties": { "latitude": latitude, "longitude": longitude, "time": time } } } def get_ditto_protocol_value_wheel(time, velocity, direction): return { "velocity" : { "properties": { "value": velocity, "time": time } }, "direction": { "properties" : { "value": direction, "time" : time } } } def get_ditto_protocol_msg(name, value): return { "topic": "{}/{}/things/twin/commands/merge".format(namespace, name), "headers": { "content-type": "application/merge-patch+json" }, "path": "/features", "value": value } ``` -------------------------------- ### API Endpoint: Get All Running Simulations Source: https://github.com/ertis-research/opentwins/blob/main/docs/docs/guides/fmi/API.md This API endpoint retrieves a list of all currently running simulations within a specified context. It uses a GET request to the context path. The response is a JSON array containing detailed information for each active simulation. ```APIDOC Method: GET URL: /{context} Description: Get all running simulations in a specific context. Response: Status Code: 200 OK Body: A list of information of every single running simulations. ``` ```json [ { "schema-id": "schema1", "simulation-id": "pruebabouncingball", "namespace": "opentwins", "type": "one-time", "status": "Active", "pods": [ { "simulation-id": "pruebabouncingball", "phase": "Running", "status": false, "creation_timestamp": "2024/09/26, 03:06:06+0000" } ] } ] ``` -------------------------------- ### Configure Eclipse Ditto Helm Chart Values Source: https://github.com/ertis-research/opentwins/blob/main/docs/docs/installation/manual/essential.md This 'values.yaml' file customizes the Eclipse Ditto Helm chart installation. It sets up basic authentication users, configures the Nginx service as NodePort, disables Swagger UI and Ditto UI, and points Ditto's database configurations to the MongoDB service. ```yaml global: hashedBasicAuthUsers: false basicAuthUsers: ditto: user: ditto password: ditto devops: user: devops password: foobar nginx: service: type: NodePort nodePort: 30525 swaggerui: enabled: false dittoui: enabled: false mongodb: enabled: false dbconfig: policies: uri: 'mongodb://:27017/ditto' things: uri: 'mongodb://:27017/ditto' connectivity: uri: 'mongodb://:27017/ditto' thingsSearch: uri: 'mongodb://:27017/ditto' gateway: config: authentication: enablePreAuthentication: true devops: devopsPassword: foobar statusPassword: foobar ``` -------------------------------- ### Configure MongoDB Helm Chart Values Source: https://github.com/ertis-research/opentwins/blob/main/docs/docs/installation/manual/essential.md This 'values.yaml' file customizes the MongoDB Helm chart installation. It configures the service as NodePort, enables persistence, and disables authentication for development purposes. ```yaml service: type: NodePort nodePorts: mongodb: 30717 persistence: enabled: true volumePermissions: enabled: true auth: enabled: false ``` -------------------------------- ### Example JSON Response for Schema Retrieval Source: https://github.com/ertis-research/opentwins/blob/main/docs/docs/guides/fmi/API.md This JSON object illustrates the structure of a schema definition returned by the API. It includes details such as schema ID, associated FMUs with their inputs and outputs, schema connections, description, and related twins. ```json [ { "id": "schema2", "fmus": [ { "id": "Controller", "inputs": [ { "id": "u_s" }, { "id": "u_m" } ], "outputs": [ { "id": "y" } ] }, { "id": "Drivetrain", "inputs": [ { "id": "tau" } ], "outputs": [ { "id": "w" } ] } ], "name": "Schema 2", "schema": [ { "to": { "id": "Controller", "var": "u_s" }, "from": { "var": "w_ref" } }, { "to": { "id": "Controller", "var": "u_m" }, "from": { "id": "Drivetrain", "var": "w" } }, { "to": { "id": "Drivetrain", "var": "tau" }, "from": { "id": "Controller", "var": "y" } }, {n "to": { "var": "w" }, "from": { "id": "Drivetrain", "var": "w" } } ], "description": "Testing schema", "relatedTwins": [ "Twin1" ] } ] ``` -------------------------------- ### Verify Digital Twin: HTTP GET Request URL Source: https://github.com/ertis-research/opentwins/blob/main/docs/docs/guides/examples/raspberry-example/raspberry-example.mdx This snippet shows the HTTP GET request pattern used to retrieve and verify the schema of an existing digital twin from the Ditto API. It uses the same URL structure as the PUT request, requiring the Ditto IP, port, and the twin's name. ```bash GET http://{DITTO_IP}:{PORT}/api/2/things/{nameOfThing} ``` -------------------------------- ### Grafana Unity Panel Plugin Helm Installation via extraInitContainers Source: https://github.com/ertis-research/opentwins/blob/main/docs/docs/installation/manual/unity.md This YAML configuration for `values.yaml` defines an `extraInitContainer` that downloads and unzips the latest Grafana Unity panel plugin release into the Grafana plugins directory during a Helm deployment. It ensures the plugin files are available for Grafana to load. ```YAML extraInitContainers: - name: install-opentwins-plugins image: busybox command: - /bin/sh - -c - | #!/bin/sh set -euo pipefail mkdir -p /grafana-storage/plugins cd /grafana-storage/plugins wget --no-check-certificate -O ertis-unity-panel.zip https://github.com/ertis-research/grafana-panel-unity/releases/download/latest/ertis-unity-panel.zip unzip -o ertis-unity-panel.zip rm ertis-unity-panel.zip volumeMounts: - name: storage mountPath: /grafana-storage ``` -------------------------------- ### Configure InfluxDB Helm Chart Values Source: https://github.com/ertis-research/opentwins/blob/main/docs/docs/installation/manual/essential.md This 'values.yaml' file customizes the InfluxDB Helm chart installation. It enables persistence, configures the service as NodePort, and sets the image pull policy to always. ```yaml persistence: enabled: true service: type: NodePort nodePort: 30716 image: pullPolicy: Always ``` -------------------------------- ### Helm: Install OpenTwins Plugin with extraInitContainers Source: https://github.com/ertis-research/opentwins/blob/main/docs/docs/installation/manual/composition.md This YAML snippet for `values.yaml` defines an `extraInitContainer` named `install-opentwins-plugins`. This container uses `busybox` to download the latest OpenTwins plugin release from GitHub and unzip it into the Grafana plugins directory (`/grafana-storage/plugins`) during Helm deployment. It ensures the plugin files are correctly placed for Grafana to discover. ```yaml extraInitContainers: - name: install-opentwins-plugins image: busybox command: - /bin/sh - -c - |\n #!/bin/sh\n set -euo pipefail\n mkdir -p /grafana-storage/plugins\n cd /grafana-storage/plugins\n wget --no-check-certificate -O ertis-opentwins.zip https://github.com/ertis-research/opentwins-in-grafana/releases/download/latest/ertis-opentwins.zip\n unzip -o ertis-opentwins.zip\n rm ertis-opentwins.zip volumeMounts: - name: storage mountPath: /grafana-storage ``` -------------------------------- ### Retrieve Ditto Connection Details API Endpoint Source: https://github.com/ertis-research/opentwins/blob/main/docs/docs/guides/examples/raspberry-example/raspberry-example.mdx API endpoint for fetching the details of an existing Ditto connection by its unique ID using a GET request. This allows verification of the connection's status and configuration. ```bash GET http://{DITTO_IP}:{PORT}/api/2/connections/{connectionID} ``` -------------------------------- ### FMI Simulation Instance Running Schema Source: https://github.com/ertis-research/opentwins/blob/main/docs/docs/guides/fmi/concepts.mdx Specifies the schema used to create and run a simulation instance based on a previously defined simulation blueprint. This schema includes the reference to the blueprint ID, target connection details (e.g., MQTT broker information), and simulation configuration parameters such as start time, end time, step size, and schedule type. ```json { "id":"Simulation1", "name":"Simulation1", "schemaId": "schema1", "targetConnection":{ "BROKER_TYPE" : "mqtt", "BROKER_IP" : "", "BROKER_PORT" : "", "BROKER_TOPIC" : "", "BROKER_USERNAME" : "", "BROKER_PASSWORD" : "" }, "configuration":{ "SIMULATION_START_TIME":1, "SIMULATION_END_TIME":7, "SIMULATION_STEP_SIZE":1, "SIMULATION_DELAY_WARNING": 1, "SIMULATION_LAST_VALUE": true, "SIMULATION_TYPESCHEDULE": "one-time" }, "inputs":[], "outputs": [] } ``` -------------------------------- ### Helm: Upgrade Grafana Deployment Source: https://github.com/ertis-research/opentwins/blob/main/docs/docs/installation/manual/composition.md This Bash command is used to upgrade an existing Grafana Helm release. It applies the changes made in the `values.yaml` file, including the plugin installation and unsigned plugin configuration, to the Grafana deployment in the `opentwins` namespace. ```bash helm upgrade grafana grafana/grafana -n opentwins --version 8.5.0 -f values.yaml ``` -------------------------------- ### Local: Allow Unsigned OpenTwins Plugin in Grafana Configuration Source: https://github.com/ertis-research/opentwins/blob/main/docs/docs/installation/manual/composition.md This INI configuration snippet is for the local Grafana configuration file (`grafana.ini`). It sets the `allow_loading_unsigned_plugins` property under the `[plugins]` section to `ertis-opentwins`, enabling Grafana to load the locally installed OpenTwins plugin even though it is unsigned. ```ini [plugins] # Enter a comma-separated list of plugin identifiers to identify plugins to load even if they are unsigned. Plugins with modified signatures are never loaded. allow_loading_unsigned_plugins = ertis-opentwins ``` -------------------------------- ### API Endpoint: Get All Simulation Schemas Source: https://github.com/ertis-research/opentwins/blob/main/docs/docs/guides/fmi/API.md Documents the GET API endpoint to retrieve a list of all simulation schemas within a specified context. It includes the HTTP method, URL path, and an example JSON response body showing schema IDs and names for successful retrieval. ```APIDOC GET /{context} Description: Get all simulation schemas in a specific context. Method: GET URL: /{context} Response Status: 200 OK Response Body: A list of name and id of every single simulation schemas. Example Response: [ { "id": "schema1", "name": "Schema 1" } ] ``` -------------------------------- ### Example FMI Model Description XML Response Source: https://github.com/ertis-research/opentwins/blob/main/docs/docs/guides/fmi/API.md This XML snippet represents a 'fmiModelDescription' for a 'bouncingBall' FMI model, detailing its version, GUID, model variables (like height, velocity, gravity), and model structure. It's a typical response for retrieving an FMU's metadata, providing a detailed overview of the model's capabilities and parameters. ```XML ``` -------------------------------- ### API Endpoint: GET /fmi/fmus/{context}/{fmuName} - Get FMU XML Source: https://github.com/ertis-research/opentwins/blob/main/docs/docs/guides/fmi/API.md Retrieves the raw XML definition file for a specific FMU, identified by its name within a given context. ```APIDOC Method: GET URL: /fmi/fmus/{context}/{fmuName} ``` -------------------------------- ### API Endpoint: Get Specific Simulation Schema Source: https://github.com/ertis-research/opentwins/blob/main/docs/docs/guides/fmi/API.md Documents the GET API endpoint to retrieve a specific simulation schema by its ID within a given context. It specifies the HTTP method and URL path required for this operation. ```APIDOC GET /{context}/{schema_id} Description: Get a schema in a specific context. Method: GET URL: /{context}/{schema_id} ``` -------------------------------- ### Execute Python MQTT Publisher Script Source: https://github.com/ertis-research/opentwins/blob/main/docs/docs/guides/examples/raspberry-example/sending-data.mdx Navigates to the specified directory (Desktop) and executes the Python MQTT publisher script using the python3 interpreter. ```bash cd Desktop/ python3 dht22publisher.py ``` -------------------------------- ### Apply OpenTwins FMI Kubernetes Resources Source: https://github.com/ertis-research/opentwins/blob/main/docs/docs/installation/manual/simulations.md Commands to apply the Kubernetes Deployment and Service configurations for the OpenTwins FMI API. These `kubectl` commands deploy the defined resources into the specified `opentwins` namespace. ```bash kubectl apply -f deployment.yaml -n opentwins kubectl apply -f service.yaml -n opentwins ``` -------------------------------- ### Build Docusaurus Static Content with Yarn Source: https://github.com/ertis-research/opentwins/blob/main/docs/README.md Runs `yarn build` to generate all static content for the Docusaurus website. The output is placed into the `build` directory, making it ready for deployment on any standard static content hosting service. ```Shell $ yarn build ``` -------------------------------- ### Create Ditto Connection API Endpoint Source: https://github.com/ertis-research/opentwins/blob/main/docs/docs/guides/examples/raspberry-example/raspberry-example.mdx API endpoint for initiating new data ingestion connections (Kafka or MQTT) in Ditto using a POST request. This endpoint requires a JSON payload defining the connection parameters. ```bash POST http://{DITTO_IP}:{PORT}/api/2/connections ``` -------------------------------- ### Edit Mosquitto Configuration File Source: https://github.com/ertis-research/opentwins/blob/main/docs/docs/guides/examples/raspberry-example/sending-data.mdx Opens the main Mosquitto configuration file (`mosquitto.conf`) using the nano text editor with superuser privileges, allowing modifications to the broker's settings. ```bash sudo nano /etc/mosquitto/mosquitto.conf ``` -------------------------------- ### API Endpoint: Get Specific Simulation Information Source: https://github.com/ertis-research/opentwins/blob/main/docs/docs/guides/fmi/API.md This API endpoint retrieves detailed information for a particular simulation identified by its ID within a given context. It uses a GET request to the simulation-specific path. The response is a JSON object containing comprehensive details about the simulation, including its API version and metadata. ```APIDOC Method: GET URL: /{context}/{simulation_id} Description: Get all information about a specific simulation in a specific context. Response: Status Code: 200 OK ``` ```json { "api_version": "batch/v1", "kind": "Job", "metadata": { "annotations": null, "creation_timestamp": "2024-09-26 03:06:06+00:00", "deletion_grace_period_seconds": null, "deletion_timestamp": null } } ``` -------------------------------- ### Create Eclipse Hono Tenant Source: https://github.com/ertis-research/opentwins/blob/main/docs/docs/installation/manual/essential.md This command creates a new tenant in Eclipse Hono using a POST request. The tenant name is specified by the HONO_TENANT variable. This is a prerequisite for connecting Hono with Eclipse Ditto. ```bash HONO_TENANT=ditto curl -i -X POST http://$HONO_IP:$HONO_PORT/v1/tenants/$HONO_TENANT ``` -------------------------------- ### Run Python DHT22 Sensor Script Source: https://github.com/ertis-research/opentwins/blob/main/docs/docs/guides/examples/raspberry-example/sending-data.mdx Commands to navigate to the directory containing the Python script and execute it using python3, allowing the sensor data collection to begin. ```bash cd Desktop/ python3 dht_code.py ``` -------------------------------- ### API Response: Generic Success Message Source: https://github.com/ertis-research/opentwins/blob/main/docs/docs/guides/fmi/API.md A generic success response body indicating a successful operation, typically for deletion or status updates. This example shows a confirmation for schema deletion. ```APIDOC Status code: 200 OK Response Body: "Schema deleted succesfully" ``` -------------------------------- ### Subscribe to Remote MQTT Topic with Authentication Source: https://github.com/ertis-research/opentwins/blob/main/docs/docs/guides/examples/raspberry-example/sending-data.mdx Demonstrates how to subscribe to an MQTT topic on a remote Mosquitto broker, including specifying the host IP address and providing username and password for authentication. ```bash mosquitto_sub -h 192.168.0.27 -u "usuario" -P "usuario" -t "/Raspberry/Sensores/DHT22" ``` -------------------------------- ### Apache Kafka Helm Chart values.yaml Configuration Source: https://github.com/ertis-research/opentwins/blob/main/docs/docs/installation/manual/essential.md Configuration for the Apache Kafka Helm chart, enabling automatic topic creation. ```yaml autoCreateTopicsEnable: true ```