Skip to content

Commit 75073e3

Browse files
Fix/remove unused node metrics (#26)
* Removed unsupported device commands * Update Readme * Bump Revision
1 parent 39e985d commit 75073e3

File tree

6 files changed

+50
-24
lines changed

6 files changed

+50
-24
lines changed

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ LABEL org.opencontainers.image.authors="[email protected]"
66
LABEL org.opencontainers.image.source="https://github.com/Spruik/PackML-MQTT-Simulator"
77
LABEL org.opencontainers.image.url="https://spruiktec.com/"
88
LABEL org.opencontainers.image.vendor="Spruik Technologies LLC"
9-
LABEL org.opencontainers.image.version="2.0.0"
9+
LABEL org.opencontainers.image.version="2.0.1"
1010

1111
WORKDIR /machine
1212

README.md

Lines changed: 45 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,22 +2,24 @@
22

33
> Manufacturing line simulator interfaced using PackML over MQTT.
44
5-
PackML MQTT Simulator is a virtual line that interfaces using PackML implemented over MQTT. For use with the development of Industry 4.0 software solutions. The simulator implements the following PackML State model below and communicates over MQTT topics as defined by environmental variables.
5+
PackML MQTT Simulator is a virtual line that interfaces using PackML implemented over MQTT. For use with the development of Industry 4.0 software solutions. The simulator implements the following PackML State model below and communicates over MQTT topics as defined by environmental variables. The simulator can run with either a basic MQTT topic structure or SparkPlugB.
66

77
![PackML State Model](./docs/PackML-StateModel.png)
88

99
The simulator supports the following topic and payload defintions:
1010

11-
- [Custom](#interfacing-via-custom-interface)
11+
- [Basic MQTT Topic Structure](#interfacing-via-basic-mqtt-topic-structure)
1212
- [SparkplugB v1.0](#interfacing-via-sparkplugb-v10)
1313

1414
## Getting Started
1515

16-
To start and run the PackML simulation, you'll need an MQTT server running and accessible to the image. Once available, the easiest approach is using docker to run the simulation using environmental variables to control the MQTT connection, Site, Area, and line. Once up and running, use an MQTT client to publish to .../Command/Reset and .../Command/Start to get the simulated machine into the execute state. The default topic and payload is Custom as defined below.
16+
To start and run the PackML simulation, you'll need an MQTT server running and accessible. Once available, the easiest approach is using docker to run the simulation using environmental variables to control the MQTT connection, Site, Area, and line.
1717

1818
### Docker
1919

20-
Start your container with environmental variables
20+
Start your container with environmental variables.
21+
22+
#### Basic MQTT Structure
2123

2224
```shell
2325
$ docker run -it -e SITE=Site -e AREA=Area -e LINE=Line -e MQTT_HOST=mqtt://broker.hivemq.com -m 30m spruiktec/packml-simulator
@@ -26,8 +28,23 @@ $ docker run -it -e SITE=Site -e AREA=Area -e LINE=Line -e MQTT_HOST=mqtt://brok
2628
2020-06-22T03:13:49.819Z | info: Site/Area/Line/Status/UnitModeCurrent : Production
2729
```
2830

31+
Once up and running, use an MQTT client to publish to .../Command/Reset and .../Command/Start to get the simulated machine into the execute state. The default topic and payload is Custom as defined below.
32+
33+
#### SparkPlugB
34+
35+
```shell
36+
$ docker run -it -e CLIENT_TYPE=sparkplugb -e SITE=Site -e AREA=Area -e LINE=Line -e MQTT_HOST=mqtt://broker.hivemq.com -m 30m spruiktec/packml-simulator
37+
2020-06-22T03:13:49.301Z | info: Initializing
38+
2020-06-22T03:13:49.817Z | info: Connected to mqtt://broker.hivemq.com:1883
39+
2020-06-22T03:13:49.819Z | info: Site/Area/Line/Status/UnitModeCurrent : Production
40+
```
41+
42+
Once up and running, use an Sparkplug B device commands to publish to `Command.Reset` and `Command.Start` metrics to get the simulated machine into the execute state.
43+
2944
### Node
3045

46+
#### Basic MQTT Structure
47+
3148
```shell
3249
$ npm i
3350
...
@@ -41,7 +58,23 @@ $ node --max-old-space-size=20 ./src/index.js
4158
2020-06-22T03:13:49.819Z | info: Site/Area/Line/Status/UnitModeCurrent : Production
4259
```
4360

44-
### Publish Commands
61+
#### SparkPlugB
62+
63+
```shell
64+
$ npm i
65+
...
66+
added 421 packages from 213 contributors and audited 421 packages in 12.337s
67+
found 0 vulnerabilities
68+
$ export LINE=Line
69+
$ export CLIENT_TYPE=sparkplugb
70+
71+
$ node --max-old-space-size=20 ./src/index.js
72+
2021-06-01T20:05:30.841Z | info: Initializing
73+
2021-06-01T20:05:31.141Z | info: Connected to mqtt://broker.hivemq.com:1883
74+
2021-06-01T20:05:31.142Z | info: Site/Area/Line/Status/UnitModeCurrentStr : Production
75+
```
76+
77+
### Publish Commands for Basic MQTT Structure
4578

4679
Please allow some time in between commands to enable the machine to get to the Idle state before issuing the Start command.
4780

@@ -72,9 +105,9 @@ The simulation consists of
72105

73106
The simulation uses probability dice rolls to determine actions.
74107

75-
## Interfacing via Custom Interface
108+
## interfacing via Basic MQTT Topic Structure
76109

77-
Interface with the virtual line via MQTT. The virtual line subscribes to `<SITE>/<AREA>/<LINE>/Command/*` (see below) and publishes information to `<SITE>/<AREA>/<LINE>/Status` and `<SITE>/<AREA>/<LINE>/Admin`. `<SITE>`, `<AREA>` and `<LINE>` are set using environmental variables.
110+
Interface with the virtual line via the basic MQTT structure. The virtual line subscribes to `<SITE>/<AREA>/<LINE>/Command/*` (see below) and publishes information to `<SITE>/<AREA>/<LINE>/Status` and `<SITE>/<AREA>/<LINE>/Admin`. `<SITE>`, `<AREA>` and `<LINE>` are set using environmental variables.
78111

79112
### Commands
80113

@@ -262,6 +295,11 @@ For any issue, there are fundamentally three ways an individual can contribute:
262295

263296
## Changelog
264297

298+
- 2.0.1
299+
- Removed unsupported device commands
300+
- Update Readme
301+
- Bump Revision
302+
265303
- 2.0.0
266304
- Add Sparkplug B Payload and Topic Support
267305
- Add CLIENT_TYPE environmental variable

chart/Chart.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@ name: packml-sim
33
description: PackML Machine Simulator
44
type: application
55
version: 0.0.2
6-
appVersion: 2.0.0
6+
appVersion: 2.0.1

package-lock.json

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "packaging-machine-language-mqtt-simulator",
3-
"version": "2.0.0",
3+
"version": "2.0.1",
44
"description": "Manufacturing line simulator interfaced using PackML over MQTT.",
55
"keywords": [
66
"packml",

src/clients/sparkplug.js

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -113,28 +113,16 @@ class Client extends events.EventEmitter {
113113
value: this._globalConfig.TICK,
114114
type: 'Int32'
115115
},
116-
{
117-
name: 'Node Control/Reboot',
118-
timestamp: timestamp,
119-
value: false,
120-
type: 'Boolean'
121-
},
122116
{
123117
name: 'Node Control/Rebirth',
124118
timestamp: timestamp,
125119
value: false,
126120
type: 'Boolean'
127121
},
128-
{
129-
name: 'Node Control/Next Server',
130-
timestamp: timestamp,
131-
value: false,
132-
type: 'Boolean'
133-
},
134122
{
135123
name: "Properties/OS Version",
136124
timestamp: timestamp,
137-
value: "1.1.0",
125+
value: "2.0.1",
138126
type: "String"
139127
},
140128
{

0 commit comments

Comments
 (0)