Skip to content

Commit

Permalink
Merge pull request #12 from industrial-edge/fix
Browse files Browse the repository at this point in the history
Updates and fixes
  • Loading branch information
EvaKaul authored Feb 28, 2023
2 parents f23ecb2 + 6412839 commit b95aa17
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 213 deletions.
51 changes: 25 additions & 26 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ This application example contains the source files to build a Databus Ping Pong
- [Overview](#overview)
- [General task](#general-task)
- [Requirements](#requirements)
- [Prerequisites](#prerequisites)
- [Used components](#used-components)
- [Further requirements](#further-requirements)
- [Installation](#installation)
- [Usage](#usage)
- [Documentation](#documentation)
Expand All @@ -22,7 +22,7 @@ This application example contains the source files to build a Databus Ping Pong
This application example shows how to connect to the IE Databus via MQTT and how to publish and subscribe data using an implementation in C#.
The IE Flow Creator is used to exchange data between different topics within the IE Databus.

![Use Case](docs/graphics/Overview.png)
![Use Case](/docs/graphics/Overview.png)

This implementation example uses the ``mono:6.8.0`` image, that is an implementation of Microsoft's .NET Framework. Thereby the C# source code can be build an executed.
Here a multi-stage process for building the docker image is used to keep the image size as small as possible. The two ``FROM`` Statements in the [Dockerfile](src/Dockerfile) separate the build process into two stages.
Expand All @@ -37,41 +37,40 @@ This example also shows two ways of configuring the application:

The application includes a MQTT client to subscribe to one topic of the IE Databus and waits to receive data. When data arrives, it publishes a corresponding answer to a second topic of the IE Databus. If it receives the string "Ping", it will answer with "Pong" and the other way around.

![Use Case](docs/graphics/PingPongFlow.png)
![Use Case](/docs/graphics/PingPongFlow.png)

The names of the IE Databus topics as well as the credentials used by the application can be configured via different options, otherwise environmental variables included in the docker-compose file are used.

## Requirements

### Used components
### Prerequisites

- Industrial Edge Management V1.3.0-58 / V1.4.3
- IE Databus Configurator V1.4.22
- IE Databus V1.4.16
- IE Flow Creator V1.2.2
- IE App Configuration Service V1.0.7
- Industrial Edge Device (IED) V1.3.0-57
- Industrial Edge App Publisher V1.4.3
- Docker Engine V20.10.10
- Docker Compose V1.28.5
- Access to an Industrial Edge Management (IEM) with onboarded Industrial Edge Device (IED)
- IEM: Installed apps: Databus Configurator, IE App Configuration Service
- IED: Installed apps: Databus, IE Flow Creator

### Further requirements
### Used components

- IED is onboarded to a IEM
- IE Databus Configurator is deployed to the IEM
- IE Configuration Service is deployed to the IEM
- IE Databus is deployed to the IED
- IE Flow Creator is deployed to the IED
- Industrial Edge Management (IEM) V1.5.2-4 / V1.11.8
- IE App Configuration Service V1.2.2
- IE Databus Configurator V2.0.0-5
- Industrial Edge Device (IED) V1.9.0-27
- IE Databus V2.0.0-4
- IE Flow Creator V 1.12.0-1
- Industrial Edge App Publisher V1.5.6
- Docker Engine V20.10.10
- Docker Compose V1.29.2
- Web browser (Chrome)

## Installation

Please refer to the [Installation](docs/Installation.md) section on how to build and deploy the application to an IED.
Please refer to the [Installation](/docs/Installation.md) section on how to build and deploy the application to an IED:

- [Build application](docs/Installation.md#build-application)
- [Configuring the Industrial Edge Databus](docs/Installation.md#configuring-the-industrial-edge-databus)
- [Create configuration for the application](docs/Installation.md#create-configuration-for-the-application)
- [Upload the application to the Industrial Edge Management](docs/Installation.md#upload-the-application-to-the-industrial-edge-management)
- [Configuring and deploying the application to a Industrial Edge Device](docs/Installation.md#configuring-and-deploying-the-application-to-a-industrial-edge-device)
- [Build application](/docs/Installation.md#build-application)
- [Configuring the Industrial Edge Databus](/docs/Installation.md#configuring-the-industrial-edge-databus)
- [Create configuration for the application](/docs/Installation.md#create-configuration-for-the-application)
- [Upload the application to the Industrial Edge Management](/docs/Installation.md#upload-the-application-to-the-industrial-edge-management)
- [Configuring and deploying the application to a Industrial Edge Device](/docs/Installation.md#configuring-and-deploying-the-application-to-a-industrial-edge-device)

## Usage

Expand All @@ -86,7 +85,7 @@ On the IED restart the PingPong application, to ensure the right configuration i

Deploy the flow and test by injecting a string payload into the mqtt in node. If the string is "Ping", the application will answer with "Pong". If the string is "Pong" the application will answer with "Ping".

The finished flow is available [here](src/Flow_Pingpong_Test.json) and can be imported into the IE Flow Creator.
The finished flow is available [here](/src/Flow_Pingpong_Test.json) and can be imported into the IE Flow Creator.

![Flow Creator](docs/graphics/FlowCreator.png)

Expand Down
2 changes: 1 addition & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ services:
#### pingpong service ####
pingpong_csharp:
build: ./src
image: pingpong_csharp:1.3.0
image: pingpong_csharp:1.4.0
restart: unless-stopped
mem_limit: 100mb
networks:
Expand Down
185 changes: 1 addition & 184 deletions src/Flow_Pingpong_Test.json
Original file line number Diff line number Diff line change
@@ -1,184 +1 @@
[
{
"id": "cd02c1b1.e5539",
"type": "tab",
"label": "PingPong Test",
"disabled": false,
"info": ""
},
{
"id": "28f15183.6df22e",
"type": "inject",
"z": "cd02c1b1.e5539",
"name": "",
"props": [
{
"p": "payload"
},
{
"p": "topic",
"vt": "str"
}
],
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": 0.1,
"topic": "",
"payload": "Ping",
"payloadType": "str",
"x": 450,
"y": 180,
"wires": [
[
"a7b5026b.7018c"
]
]
},
{
"id": "5357c931.64e9d8",
"type": "inject",
"z": "cd02c1b1.e5539",
"name": "",
"props": [
{
"p": "payload"
},
{
"p": "topic",
"vt": "str"
}
],
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": 0.1,
"topic": "",
"payload": "Pong",
"payloadType": "str",
"x": 450,
"y": 240,
"wires": [
[
"a7b5026b.7018c"
]
]
},
{
"id": "d34cbaff.a45528",
"type": "inject",
"z": "cd02c1b1.e5539",
"name": "",
"props": [
{
"p": "payload"
},
{
"p": "topic",
"vt": "str"
}
],
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": 0.1,
"topic": "",
"payload": "Something else",
"payloadType": "str",
"x": 420,
"y": 300,
"wires": [
[
"a7b5026b.7018c"
]
]
},
{
"id": "a7b5026b.7018c",
"type": "mqtt out",
"z": "cd02c1b1.e5539",
"name": "",
"topic": "topic1",
"qos": "",
"retain": "",
"broker": "f9797e4b.7d9c9",
"x": 610,
"y": 240,
"wires": []
},
{
"id": "be36003a.4e936",
"type": "mqtt in",
"z": "cd02c1b1.e5539",
"name": "",
"topic": "topic2",
"qos": "2",
"datatype": "auto",
"broker": "f9797e4b.7d9c9",
"x": 390,
"y": 440,
"wires": [
[
"9618c676.7e2158"
]
]
},
{
"id": "9618c676.7e2158",
"type": "debug",
"z": "cd02c1b1.e5539",
"name": "",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "false",
"statusVal": "",
"statusType": "auto",
"x": 590,
"y": 440,
"wires": []
},
{
"id": "23479def.67eba2",
"type": "comment",
"z": "cd02c1b1.e5539",
"name": "publish different data to topic on databus",
"info": "",
"x": 480,
"y": 120,
"wires": []
},
{
"id": "227e2d39.73b9e2",
"type": "comment",
"z": "cd02c1b1.e5539",
"name": "subscribe to topic on databus to receive answer",
"info": "",
"x": 500,
"y": 400,
"wires": []
},
{
"id": "f9797e4b.7d9c9",
"type": "mqtt-broker",
"z": "",
"name": "",
"broker": "ie_databus",
"port": "1883",
"clientid": "",
"usetls": false,
"compatmode": false,
"keepalive": "60",
"cleansession": true,
"birthTopic": "",
"birthQos": "0",
"birthPayload": "",
"closeTopic": "",
"closeQos": "0",
"closePayload": "",
"willTopic": "",
"willQos": "0",
"willPayload": ""
}
]
[{"id":"cd02c1b1.e5539","type":"tab","label":"PingPong Test","disabled":false,"info":""},{"id":"28f15183.6df22e","type":"inject","z":"cd02c1b1.e5539","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"Ping","payloadType":"str","x":450,"y":180,"wires":[["a7b5026b.7018c"]]},{"id":"5357c931.64e9d8","type":"inject","z":"cd02c1b1.e5539","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"Pong","payloadType":"str","x":450,"y":240,"wires":[["a7b5026b.7018c"]]},{"id":"d34cbaff.a45528","type":"inject","z":"cd02c1b1.e5539","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"Something else","payloadType":"str","x":420,"y":300,"wires":[["a7b5026b.7018c"]]},{"id":"a7b5026b.7018c","type":"mqtt out","z":"cd02c1b1.e5539","name":"","topic":"topic1","qos":"","retain":"","respTopic":"","contentType":"","userProps":"","correl":"","expiry":"","broker":"6bd4974.1100768","x":610,"y":240,"wires":[]},{"id":"be36003a.4e936","type":"mqtt in","z":"cd02c1b1.e5539","name":"","topic":"topic2","qos":"2","datatype":"auto","broker":"6bd4974.1100768","nl":false,"rap":false,"inputs":0,"x":390,"y":440,"wires":[["9618c676.7e2158"]]},{"id":"9618c676.7e2158","type":"debug","z":"cd02c1b1.e5539","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":590,"y":440,"wires":[]},{"id":"23479def.67eba2","type":"comment","z":"cd02c1b1.e5539","name":"publish different data to topic on databus","info":"","x":480,"y":120,"wires":[]},{"id":"227e2d39.73b9e2","type":"comment","z":"cd02c1b1.e5539","name":"subscribe to topic on databus to receive answer","info":"","x":500,"y":400,"wires":[]},{"id":"6bd4974.1100768","type":"mqtt-broker","name":"","broker":"ie-databus","port":"1883","clientid":"","autoConnect":true,"usetls":false,"compatmode":false,"protocolVersion":"4","keepalive":"60","cleansession":true,"birthTopic":"","birthQos":"0","birthPayload":"","birthMsg":{},"closeTopic":"","closeQos":"0","closePayload":"","closeMsg":{},"willTopic":"","willQos":"0","willPayload":"","willMsg":{},"userProps":"","sessionExpiry":""}]
4 changes: 2 additions & 2 deletions src/PingPong.cs
Original file line number Diff line number Diff line change
Expand Up @@ -175,10 +175,10 @@ static void Connect()
clientId = Guid.NewGuid().ToString();

// connect to the broker
client.Connect(clientId);
//client.Connect(clientId);

// connect with authentication
//client.Connect(clientId, mqtt_user, mqtt_pw);
client.Connect(clientId, mqtt_user, mqtt_pw);

if (client.IsConnected == true)
System.Console.WriteLine("Client successfully connected to broker!");
Expand Down

0 comments on commit b95aa17

Please sign in to comment.