“Bearbeitungszentrum BAZ” - Multiple Files

This example show a BAZ setup split in three files. One file will express the resources needed for modbus machine simulation. Another one expresses the connectivity layer. The third file expresses the resources needed for visualizing machining data on a dashboard.

Download: simulated-shop-floor.yml

Note

The example below uses an additional Docker image provided by Cybus that requires a suitable license. You can check the current capabilities and permissions of your Connectware license in the Cybus Portal (https://portal.cybus.io). If your license is not eligible to use the example Docker image, please contact Cybus Sales (sales@cybus.io).

 1description: >
 2  This Service simulates a shop floor equipped with a single machine talking
 3  the modbus protocol
 4
 5metadata:
 6
 7  name: Simulated Shop Floor
 8  icon: https://www.cybus.io/wp-content/uploads/2017/10/for-whom1.svg
 9  provider: cybus
10  homepage: https://www.cybus.io
11
12parameters:
13
14  modbusPort:
15    type: integer
16    default: 10502
17
18resources:
19
20  modbusMachine:
21    type: Cybus::Container
22    properties:
23      image: registry.cybus.io/cybus-services/baz-machine-simulator:0.0.1
24      ports:
25        - !sub '${modbusPort}:10502/tcp'

Download: connectivity.yml

 1description: >
 2  This service provides a connectivity to all endpoints provided by the
 3  simulated shop floor
 4
 5metadata:
 6
 7  name: Connectivity Layer
 8  icon: https://www.cybus.io/wp-content/uploads/2017/10/connection.svg
 9  provider: cybus
10  homepage: https://www.cybus.io
11
12parameters:
13
14  agentName:
15    type: string
16    default: protocol-mapper
17
18  modbusPort:
19    type: integer
20    default: 10502
21  dockerBridgeNetworkIp:
22    type: string
23    default: 172.17.0.1
24    description: The IP address of the docker bridge network gateway, see "docker network inspect bridge"
25
26definitions:
27
28  defaultModbusAddress:
29    fc: 3
30    length: 2
31    interval: 1000
32    dataType: uint16BE
33
34resources:
35
36  modbusConnection:
37    type: Cybus::Connection
38    properties:
39      agentName: !ref agentName
40      protocol: Modbus
41      targetState: connected
42      connection:
43        host: !ref dockerBridgeNetworkIp
44        port: !ref modbusPort
45
46  currentState:
47    type: Cybus::Endpoint
48    properties:
49      agentName: !ref agentName
50      protocol: Modbus
51      connection: !ref modbusConnection
52      subscribe:
53        !merge
54          defaultModbusAddress:
55          address: 0
56
57  currentTool:
58    type: Cybus::Endpoint
59    properties:
60      agentName: !ref agentName
61      protocol: Modbus
62      connection: !ref modbusConnection
63      subscribe:
64        !merge
65          defaultModbusAddress:
66          address: 2
67
68  coolantLevel:
69    type: Cybus::Endpoint
70    properties:
71      agentName: !ref agentName
72      protocol: Modbus
73      connection: !ref modbusConnection
74      subscribe:
75        !merge
76          defaultModbusAddress:
77          address: 4
78
79  spindleSpeed:
80    type: Cybus::Endpoint
81    properties:
82      agentName: !ref agentName
83      protocol: Modbus
84      connection: !ref modbusConnection
85      subscribe:
86        !merge
87          defaultModbusAddress:
88          address: 6

Download: dashboard.yml

Note

The example file below uses an additional Docker image provided by Cybus, see comment at the topmost file for details.

 1description: >
 2
 3  This Service visualizes data of a the simulated-shop floor connectivity
 4  layer.
 5
 6metadata:
 7
 8  name: Data Visualization
 9  version: 1.0.0
10  icon: https://www.cybus.io/wp-content/uploads/2017/10/for-whom3.svg
11  provider: cybus
12  homepage: https://www.cybus.io
13
14parameters:
15
16  connectivityService:
17    type: string
18    default: connectivitylayer
19
20definitions:
21
22  CYBUS_MQTT_ROOT: cybus/baz-simulator
23
24resources:
25
26  dashboard:
27    type: Cybus::Container
28    properties:
29      image: registry.cybus.io/cybus-services/baz-dashboard:0.2.3
30      volumes:
31        - !sub '${dashboardData}:/root/.node-red'
32      environment:
33        MQTT_HOST: !ref Cybus::MqttHost
34        MQTT_USER: !ref Cybus::MqttUser
35        MQTT_PASS: !ref Cybus::MqttPassword
36        MQTT_PORT: !ref Cybus::MqttPort
37        HTTP_ROOT: /
38
39  dashboardData:
40    type: Cybus::Volume
41
42  dashboardRoute:
43    type: Cybus::IngressRoute
44    properties:
45      container: !ref dashboard
46      type: http
47      slug: dashboard
48      target:
49        path: /
50        port: 1880
51
52  dashboardLink:
53    type: Cybus::Link
54    properties:
55      ingressRoute: !ref dashboardRoute
56      href: ui/
57      name: Dashboard
58
59  mapping:
60    type: Cybus::Mapping
61    properties:
62      mappings:
63        - subscribe:
64            endpoint: !ref '${connectivityService}::currentState'
65          publish:
66            topic: !sub '${CYBUS_MQTT_ROOT}/current-state'
67
68        - subscribe:
69            endpoint: !ref '${connectivityService}::currentTool'
70          publish:
71            topic: !sub '${CYBUS_MQTT_ROOT}/current-tool'
72
73        - subscribe:
74            endpoint: !ref '${connectivityService}::coolantLevel'
75          publish:
76            topic: !sub '${CYBUS_MQTT_ROOT}/coolant-level'
77
78        - subscribe:
79            endpoint: !ref '${connectivityService}::spindleSpeed'
80          publish:
81            topic: !sub '${CYBUS_MQTT_ROOT}/spindle-speed'
82
83        # debug
84
85        - subscribe:
86            endpoint: !ref '${connectivityService}::spindleSpeed'
87          rules:
88            - transform:
89                expression: |
90                  {
91                    "value": $
92                  }
93          publish:
94            topic: debug/spindleSpeed