con3187 creating industrial middleware with java me and single-board computers
TRANSCRIPT
Creating Industrial Middleware with Java ME and Single-Board ComputersSeptember 2016
2Copyright © 2016 Accenture All rights reserved.
About Us
Senior Technology Architect
Accenture
Global Java Community Lead
Twitter: @_deors
GitHub: deors
Technology Architect
Accenture
Global Java Community Champion
Twitter: @restalion
GitHub: restalion
Copyright © 2016 Accenture All rights reserved. 3
Related Sessions in Java One 2016
Monday, Sep 19 Tuesday, Sep 20 Wednesday, Sep 21
Introduction to Java ME 8 [CON3189]
Java ME and Single-Board Computers for Creating Industrial Middleware [CON3187]
All Your Faces Belong to Us: Building an Open Face Recognition Platform [CON6217]
12:30 p.m. - 1:30 p.m 2:30 p.m. - 3:30 p.m 3:00 p.m. - 4:00 p.m
Hilton - Golden Gate 6/7/8
Hilton - Golden Gate 6/7/8
Hilton - Golden Gate 6/7/8
Kevin HookeJulio Palma
Jorge HidalgoJulio Palma
Jorge HidalgoMariano Rodriguez
Copyright © 2016 Accenture All rights reserved. 4
The Environment• We can find a lot of different machines, sensors, alerts, … into an industrial environment.
• Every single machine has usually a mechanism that allow us to know its state (visual or sound signals, communication ports, …)
• Operator has to decide the action to be executed (call maintenance team, restart the machine, do a little maintenance, …).
• Most of times reason why machine is not productive enough is simply lost, plants has not the information, it is lost or dispersed into some operator’s minds.
Problem description
Copyright © 2016 Accenture All rights reserved. 5
This is a global challenge
Problem description
Copyright © 2016 Accenture All rights reserved. 6
The plants• Each plant has different characteristics:
– Equipment
– Processes
– Legal requirements
• Easy to find old factories working together with new ones.
• Information from plants is not structured.
– And we need to show all this information structured to be useful.
Problem description
Copyright © 2016 Accenture All rights reserved. 7
Problem descriptionDecision centers are also global
Copyright © 2016 Accenture All rights reserved. 8
Problem descriptionDecision centers are also global
Copyright © 2016 Accenture All rights reserved. 9
Problem descriptionDecision centers are also global
Copyright © 2016 Accenture All rights reserved. 10
Management systems• Enterprises have management systems as complex as production line.
– Standard ERPs (such as SAP)
– Custom applications
• Our goal is retrieve all this information and create a model that let us make better decisions.
– Which plants are more productive?
– Which ones work better together?
– Anticipate needs for raw materials
• We need a way to retrieve information:
– Without errors
– Automatically (no human intervention)
– Real-time
Problem description
Copyright © 2016 Accenture All rights reserved. 11
High-level diagram
Solution description
Copyright © 2016 Accenture All rights reserved. 12
High-level diagram
Solution description
Machines. We can’t touch!
Copyright © 2016 Accenture All rights reserved. 13
High-level diagram
Solution description
Machines. We can’t touch!
Board of directors.We can’t touch!
Copyright © 2016 Accenture All rights reserved. 14
High-level diagram
Solution description
Machines. We can’t touch!
Board of directors.We can’t touch!Covered by ERP
Copyright © 2016 Accenture All rights reserved. 15
High-level diagram
Solution description
Machines. We can’t touch!
Board of directors.We can’t touch!Covered by ERP
This is our domain
Copyright © 2016 Accenture All rights reserved. 16
Our approach
• The idea is create customizable translation middleware:
– Reads output signals from machines.
– Send translated information to ERP.
Solution description
Machine 1
Machine 2
Machine 3
Translation Middleware
Translation Middleware
Translation Middleware
ERP
Copyright © 2016 Accenture All rights reserved. 17
Topology
Solution description
Robot Simulator
Translation Middleware
Robot Simulator
Translation Middleware
Receiver Microservice
ERP Simulation
Receiver Microservice
Receiver Microservice
MongoDBMongoDBMongoDB
Copyright © 2016 Accenture All rights reserved. 18
Schema• Java ME application.
• Running in a Raspberry Pi.
• Simulate different types of machines without the actual machine.
• Created for testing purposes.
• Communication with Translation Middleware via GPIO.
Robot Simulator
Robot Simulator Midlet
Robot Controller
Translation Middleware
Copyright © 2016 Accenture All rights reserved. 19
Timeline• For this sample demo we’ll only manage five signals:
– Input signals:
• Start/Stop button
• Error button
– Output signals:
• Machine downtime
• Machine running
• Machine error
Robot Simulator
Machine running
Machine error
Machine down
Robot Simulator
Tim
elin
e
Wor
king
Hou
rs
Copyright © 2016 Accenture All rights reserved. 20
UML Diagram
• Only four classes are needed to simulate our simplified robot.
• Two helper classes are created to simplify LEDs and buttons management.
Robot Simulator
Copyright © 2016 Accenture All rights reserved. 21
Schematic• Two input signals:
– One connected to GPIO 17 for ON/OFF events
– One connected to GPIO 22 for ERROR events
• Three output signals:
– ON signal on GPIO 24
– OFF signal on GPIO 23
– ERROR signal on GPIO 25
Robot Simulator
Copyright © 2016 Accenture All rights reserved. 22
Schema• Java ME application.
• Running in a Raspberry Pi.
• Translates the signals from Machine-specific to Receiver input messages
• Communication with Robot Simulator via GPIO.
• Communication with Receiver Microservice via REST interface.
Translation Middleware
MachineMiddleware Midlet
MachineMiddleware Controller
Robot Simulator
Receiver Microservice
Copyright © 2016 Accenture All rights reserved. 23
Timeline• For each signal from machine we create a new event.
• We add metadata information to the event:
– Machine ID
– Event timestamp.
• Status is not maintained in middleware. We receive signals, enrich and translate them to message that ERP can receive and understand.
Translation Middleware
Machine running
Machine error
Machine down
Robot Simulator
Translation Middleware
ON event
ERROR event
OFF event
Tim
elin
e
Wor
king
Hou
rs
Copyright © 2016 Accenture All rights reserved. 24
UML Diagram
• Only four classes are needed to simulate our simplified robot.
• Two helper classes are created to simplify LEDs and buttons management.
Translation Middleware
Copyright © 2016 Accenture All rights reserved. 25
Configuration
• You can customize your input pins, device name and REST service URL.
Translation Middleware
Copyright © 2016 Accenture All rights reserved. 26
Schematic• Three input signals:
– ON Signal in port 22
– OFF Signal in port 18
– ERROR Signal in port 24
Translation Middleware
Copyright © 2016 Accenture All rights reserved. 27
Schema• It’s role is translate from Events to data that ERP can understand.
• Spring Boot application running into a Docker cotainer.
• In our sample project it stores data into a MongoDB database
• Exposes a REST interface to retrieve events and send intervals information to ERP application.
Receiver Microservice
Spring Boot REST Services
Spring Data MongoDB
MongoDB
Copyright © 2016 Accenture All rights reserved. 28
Timeline• Events sent by middleware are stored into database.
• Microservice returns information translated into intervals.
• Can receive events from different sources (Machines, Apps, …) through its REST interface.
Receiver Microservice
Machine running
Machine error
Machine down
Robot Simulator
Translation Middleware
ON event
ERROR event
OFF event
ReceiverMicroservice
Tim
elin
e
ON interval
ERROR interval
Wor
king
Hou
rs
Copyright © 2016 Accenture All rights reserved. 29
UML Diagram
• Only four classes are needed to simulate our simplified robot.
• Two helper classes are created to simplify LEDs and buttons management.
Receiver Microservice
Copyright © 2016 Accenture All rights reserved. 30
Events• Events stores information of each signal from machines.
• They are a direct representation of information itself.
Receiver Microservice
Copyright © 2016 Accenture All rights reserved. 31
Intervals• Intervals are the same information but in the format expected by ERP.
• Intervals are information processed to be visualized.
Receiver Microservice
Copyright © 2016 Accenture All rights reserved. 32
Testing
• We can run a little test using JaSON Chrome extension.
– Launch a new event.
Receiver Microservice
Copyright © 2016 Accenture All rights reserved. 33
Testing
• We can run a little test using JaSon Chrome extension.
– Launch a new event.
Receiver Microservice
Copyright © 2016 Accenture All rights reserved. 34
Schema• There are a lot of difirent ERPs
– Custom
– SAP, …
• We need some program that let us create friendly reports.
• For our sample we’ve created a very simple application that shows an activity timeline.
ERP Simulator
Receiver
Vaadin App
RESTEasy
Copyright © 2016 Accenture All rights reserved. 35
Timeline• Receiver Microservice returns information as intervals.
• ERP Simulator shows an activity table.
• Filter options are available.
• Application autorefresh information.
ERP Simulator
Machine running
Machine error
Machine down
Robot Simulator
Translation Middleware
ON event
ERROR event
OFF event
ReceiverMicroservice
Tim
elin
e
ON interval
ERROR interval
ERP Simulator
Wor
king
Hou
rs
Copyright © 2016 Accenture All rights reserved. 36
UML Diagram
• We can easily view the activity of machines:
– Filtered by source (machine) and date
– In different dates.
ERP Simulator
Copyright © 2016 Accenture All rights reserved. 37
View
• We can easily view the activity of machines:
– Filtered by source (machine) and date
– In different dates.
ERP Simulator
Copyright © 2016 Accenture All rights reserved. 38
Demo
Copyright © 2016 Accenture All rights reserved. 39
• Modern single board computers are powerful enough to run different roles into a full solution.
• Combination of availability, affordability, power compsumtion… make them a best choice for real solutions.
• Java ME provides us a powerful set of tools that allow us to:
– Capture data from phisical devices.
– Send data to other systems.
• Fine-grained architectures let us create powerful and flexible solutions.
• Combination of Java ME and Microservices take our solutions to the next level:
– One single language: Java!
– Comunications via GPIO and REST Services
– Containerized microservices
Conclusions
Copyright © 2016 Accenture All rights reserved. 40
Questions
Copyright © 2016 Accenture All rights reserved.
• https://github.com/restalion/middleware-solution
References
41