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.
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).
simulated-shop-floor.yml
description:> This Service simulates a shop floor equipped with a single machine talking the modbus protocolmetadata:name:Simulated Shop Flooricon:https://www.cybus.io/wp-content/uploads/2017/10/for-whom1.svgprovider:cybushomepage:https://www.cybus.ioparameters:modbusPort:type:integerdefault:10502resources:modbusMachine:type:Cybus::Containerproperties:image:registry.cybus.io/cybus-services/baz-machine-simulator:0.0.1ports: - !sub'${modbusPort}:10502/tcp'
description:> This service provides a connectivity to all endpoints provided by the simulated shop floormetadata:name:Connectivity Layericon:https://www.cybus.io/wp-content/uploads/2017/10/connection.svgprovider:cybushomepage:https://www.cybus.ioparameters:agentName:type:stringdefault:protocol-mappermodbusPort:type:integerdefault:10502dockerBridgeNetworkIp:type:stringdefault:172.17.0.1description:The IP address of the docker bridge network gateway, see "docker network inspect bridge"definitions:defaultModbusAddress:fc:3length:2interval:1000dataType:uint16BEresources:modbusConnection:type:Cybus::Connectionproperties:agentName:!refagentNameprotocol:ModbustargetState:connectedconnection:host:!refdockerBridgeNetworkIpport:!refmodbusPortcurrentState:type:Cybus::Endpointproperties:agentName:!refagentNameprotocol:Modbusconnection:!refmodbusConnectionsubscribe:!mergedefaultModbusAddress:address:0currentTool:type:Cybus::Endpointproperties:agentName:!refagentNameprotocol:Modbusconnection:!refmodbusConnectionsubscribe:!mergedefaultModbusAddress:address:2coolantLevel:type:Cybus::Endpointproperties:agentName:!refagentNameprotocol:Modbusconnection:!refmodbusConnectionsubscribe:!mergedefaultModbusAddress:address:4spindleSpeed:type:Cybus::Endpointproperties:agentName:!refagentNameprotocol:Modbusconnection:!refmodbusConnectionsubscribe:!mergedefaultModbusAddress:address:6
The example file below uses an additional Docker image provided by Cybus, see comment at the topmost file for details.
description:> This Service visualizes data of a the simulated-shop floor connectivity layer.metadata:name:Data Visualizationversion:1.0.0icon:https://www.cybus.io/wp-content/uploads/2017/10/for-whom3.svgprovider:cybushomepage:https://www.cybus.ioparameters:connectivityService:type:stringdefault:connectivitylayerdefinitions:CYBUS_MQTT_ROOT:cybus/baz-simulatorresources:dashboard:type:Cybus::Containerproperties:image:registry.cybus.io/cybus-services/baz-dashboard:0.2.3volumes: - !sub'${dashboardData}:/root/.node-red'environment:MQTT_HOST:!refCybus::MqttHostMQTT_USER:!refCybus::MqttUserMQTT_PASS:!refCybus::MqttPasswordMQTT_PORT:!refCybus::MqttPortHTTP_ROOT:/dashboardData:type:Cybus::VolumedashboardRoute:type:Cybus::IngressRouteproperties:container:!refdashboardtype:httpslug:dashboardtarget:path:/port:1880dashboardLink:type:Cybus::Linkproperties:ingressRoute:!refdashboardRoutehref:ui/name:Dashboardmapping:type:Cybus::Mappingproperties:mappings: - subscribe:endpoint:!ref'${connectivityService}::currentState'publish:topic:!sub'${CYBUS_MQTT_ROOT}/current-state' - subscribe:endpoint:!ref'${connectivityService}::currentTool'publish:topic:!sub'${CYBUS_MQTT_ROOT}/current-tool' - subscribe:endpoint:!ref'${connectivityService}::coolantLevel'publish:topic:!sub'${CYBUS_MQTT_ROOT}/coolant-level' - subscribe:endpoint:!ref'${connectivityService}::spindleSpeed'publish:topic:!sub'${CYBUS_MQTT_ROOT}/spindle-speed'# debug - subscribe:endpoint:!ref'${connectivityService}::spindleSpeed'rules: - transform:expression:| { "value": $ }publish:topic:debug/spindleSpeed