Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Taking your Siemens PLC s7-1200 to industry 4.0

695 views

Published on

Project Engineer James Condon led a presentation on Siemens PLC Industry 4.0. The presentation covered how Industry 4.0 can offer better efficiency for existing industrial equipment.

Published in: Engineering
  • Be the first to comment

Taking your Siemens PLC s7-1200 to industry 4.0

  1. 1. Taking Your Siemens PLC to Industry 4.0 James Condon, DMC usa.siemens.com/summitUnrestricted © Siemens 2019
  2. 2. Unrestricted © Siemens Industry, Inc. 2019 Page 2 2019 Automation Summit • Title: Taking Your Siemens PLC to Industry 4.0 • Track: BPNA • Presenter: James Condon • Company: DMC • Session # (for your survey): 14.3
  3. 3. Unrestricted © Siemens Industry, Inc. 2019 Page 3 James Condon Project Engineer • BS Mechanical Engineering • University of Illinois, Urbana-Champaign • With DMC since 2011 • Chicago 2011-2015 • Denver 2015-Present Presenter Info
  4. 4. Unrestricted © Siemens Industry, Inc. 2019 Page 4 DMC Overview Established in 1996, offices in Chicago, Boston, & Denver and customers throughout the world Established in 1996, DMC serves customers worldwide from offices in Chicago, Boston, Dallas, Denver, Houston, New York, Seattle, and St. Louis employees & growing 170+
  5. 5. Unrestricted © Siemens Industry, Inc. 2019 Page 5 DMC has the highest number of S7 certified engineers in the US. Siemens Expertise 35+
  6. 6. Unrestricted © Siemens Industry, Inc. 2019 Page 6 DMC Customers
  7. 7. Unrestricted © Siemens Industry, Inc. 2019 Page 8 Agenda • What is Industry 4.0 and why should I be interested? • I4.0 case study with Agri- Inject‘s Reflex Connect product line • Overview of DMC‘s S7-1200 Industry 4.0 technology stack • Deep dive into DMC‘s MQTT S7-1200 driver
  8. 8. Unrestricted © Siemens Industry, Inc. 2019 Page 9 What is the internet of things? • The interconnection via the Internet of computing devices embedded in everyday objects, enabling them to send and receive data • Adding internet to things because we can and it makes our lives easier (maybe)
  9. 9. Unrestricted © Siemens Industry, Inc. 2019 Page 10 Industry 4.0, X.0, IIoT and other buzz words • Industrial equipment already has the capability of communicating to external devices • Typically a local HMI or other PLCs used in the process • Higher level SCADA are now often used to tie together multiple PLCs • Industry 4.0 is a broad term, but generally refers to allowing machines to communicate beyond their local area (on some kind of interconnected network, if that’s a thing that exists) • Often this is still a SCADA system used to control multiple sites • Either an off the shelf product (e.g. WinCC OA/7) or a custom solution (we’ll see one later)
  10. 10. Unrestricted © Siemens Industry, Inc. 2019 Page 11 Why should I be interested in Industry 4.0? • Data availability from controllers • Data analytics platforms, such as MindSphere, are becoming more accessible and we should be taking advantage of their capabilities • OEE dashboards, finding weak spots in manufacturing processes, better predictive maintenance • For geographically distributed systems, being able to react faster to alarms • Being able to re-supply sites only when needed rather than spending time doing periodic visits, which are not all needed
  11. 11. Unrestricted © Siemens Industry, Inc. 2019 Page 12 Why should I be interested in Industry 4.0? Better data coverage!
  12. 12. Unrestricted © Siemens Industry, Inc. 2019 Page 13 Why should I be interested in Industry 4.0? • Get better efficiency out of existing equipment • As data analytics dictates needs for parameter updates, those updates can be applied in real time • Speeds up the cycle of analyze data, identifying problems, creating an update, and implementing the changes • For geographically distributed systems making any update remotely can be a significant time saving over having to get to the controller location
  13. 13. Unrestricted © Siemens Industry, Inc. 2019 Page 14 Agri-Inject Case Study • Company Overview • Problems their customers face • Solution overview • End customer benefits • Or why this is a more useful product than an IoT diaper
  14. 14. Unrestricted © Siemens Industry, Inc. 2019 Page 15 Agri-Inject Company Overview • Located in Yuma, CO • Specializes in fluid injection pumps • Size range from 1.25 gph to 150 gph • Can be used for residential, agricultural, and industrial applications
  15. 15. Unrestricted © Siemens Industry, Inc. 2019 Page 16 Reflex Connect Justification • For agricultural fertilizer injectors, they can often be distributed over hundreds of square miles. • To make adjustments to fertilizer usage, it can take all day to visit each site to make adjustments • The only way to gather alarm information from a fertilizer injector is to visit the site
  16. 16. Unrestricted © Siemens Industry, Inc. 2019 Page 17 Reflex Connect Solution • Field Control Panel • S7-1200, Comfort Panel, and Cell Modem • Azure • MQTT Broker, API, SQL Database, ReactJS front end website • End user • Browser
  17. 17. Unrestricted © Siemens Industry, Inc. 2019 Page 18 Reflex Connect Solution
  18. 18. Unrestricted © Siemens Industry, Inc. 2019 Page 19 What is different about DMC’s solution? MQTT • Message Queuing Telemetry Transport • First created in 1999 • Widely adopted • AWS, Azure, Google Cloud, MindSphere • Libraries already exist for python, C++, .NET and more • Lightweight and fast
  19. 19. Unrestricted © Siemens Industry, Inc. 2019 Page 20 PLC to Database Connection • Traditional polling steps • Open TCP connection • Send query against API • Receive response, often there will be no changes • Close TCP connection • Wait • Repeat ServerPLC Any new data? Nope Any new data? Nope Any new data? Yes, here it is
  20. 20. Unrestricted © Siemens Industry, Inc. 2019 Page 21 Why you should use MQTT over traditional polling ServerPLC New message • MQTT communication steps • Open TCP and MQTT connection • Listen for updates • Benefits of MQTT • Uses less bandwidth • Faster
  21. 21. Unrestricted © Siemens Industry, Inc. 2019 Page 22 What else goes into MQTT? • Current version is 3.1.1, documentation is available at http://mqtt.org/documentation • A basic exchange is shown below • More message types available (e.g. ping/ping response) ServerClient Connect Connect acknowledge Publish Topic B Publish Topic A Subscribe to Topic A Subscribe Acknowledge
  22. 22. Unrestricted © Siemens Industry, Inc. 2019 Page 23 PLC Library • Made up of 1 function block, 1 data block, and 2 functions • fbMQTT • Two state machines • Sending data (also manages the TCP connection) • Receiving data • fcSerializeData • Takes a topic name and data, enqueues it into the message buffer • fcDeserializeData • Takes a topic name and an ANY, checks the receive buffer for messages that match its topic name • dbMqttData • Holds buffer for outgoing messages and slots for receiving messages
  23. 23. Unrestricted © Siemens Industry, Inc. 2019 Page 24 What can we do with Industry 4.0? Monitoring
  24. 24. Unrestricted © Siemens Industry, Inc. 2019 Page 25 What can we do with Industry 4.0? Data Logging
  25. 25. Unrestricted © Siemens Industry, Inc. 2019 Page 26 What can we do with Industry 4.0? Control
  26. 26. Unrestricted © Siemens Industry, Inc. 2019 Page 27 What can we do with Industry 4.0? Alarming
  27. 27. Unrestricted © Siemens Industry, Inc. 2019 Page 28 What can we do with MQTT, Siemens PLCs, and Industry 4.0? • Overall, it opens up possibilities for monitoring and control of remote systems from PLC • Eliminates need for 3rd party gateways or VPN/VLAN solutions for remote access of data • By linking up the MQTT broker with an API, it opens up possibilities to be able to monitor and control a PLC remotely (e.g. web sites or native mobile applications)
  28. 28. Unrestricted © Siemens Industry, Inc. 2019 Page 29 Your Benefits • This PLC MQTT library is open source and available at https://github.com/jcondonDMC/SiemensMQTT. Features include • Publishing data with QoS 0 and 1 • Subscribing to 10 topics and receiving data (this is arbitrary and could be changed depending on available memory) • Runs on S7-1200 and S7-1500 • Supports user authentication
  29. 29. Unrestricted © Siemens Industry, Inc. 2019 Page 30 Why you shouldn’t use MQTT on a Siemens PLC • Currently no bidirectional native MQTT communication instructions are available • Open TCP communication blocks are available. • DMC created an MQTT communication library capable of serializing/deserializing raw PLC data • On the Mindsphere road map! • PLCs are not good at parsing strings and the traditional payload of MQTT messages is JSON • The PLC library that DMC wrote pairs with a .NET MQTT broker in the cloud that can interpret and create raw byte arrays of PLC data
  30. 30. Unrestricted © Siemens Industry, Inc. 2019 Page 31 What’s Next • Add in encryption • Currently encryption is achieved through a VPN connection with the cell modem • Memory optimizations • Add in QoS 2 for publishing and receiving data • Create Mindsphere solution when bidirectional communication is available
  31. 31. Unrestricted © Siemens Industry, Inc. 2019 Page 32 Your Benefits • Drink Bot MQTT integration • Since the library is robust and extensible it was easy to apply to Drink Bot • Order drinks with Alexa • Reporting of consumed drinks and dashboards • Nearly identical technology stack as Agri-Inject • Azure hosted SQL database, API web-service, and front end web-service • With Agri-Inject, only the front end web-service used the API, but the API is just a set of HTTPS endpoints that can be easily used by other services such as Alexa
  32. 32. Unrestricted © Siemens Industry, Inc. 2019 Page 33 Your Benefits
  33. 33. Unrestricted © Siemens Industry, Inc. 2019 Page 34 Title of your presentation here Name: James Condon Company: DMC Email: james.condon@dmcinfo.com Phone: 303 223 1801 Session # (for your survey): 14.3
  34. 34. Unrestricted © Siemens Industry, Inc. 2019 Page 35 DMC’s S7-1200 Industry 4.0 Solution • Field Control Panel • S7-1200 and Cell Modem • Cloud - Azure/AWS • MQTT Broker, API, SQL Database, ReactJS front end website • End user • Browser
  35. 35. Unrestricted © Siemens Industry, Inc. 2019 Page 36 What else goes into MQTT? • Current version is 3.1.1, documentation is available at http://mqtt.org/documentation • A basic exchange is shown below • More message types available (e.g. ping/ping response) ServerClient Connect Connect acknowledge Publish Topic B Publish acknowledge Publish Topic A Publish acknowledge Subscribe to Topic A Subscribe Acknowledge
  36. 36. Unrestricted © Siemens Industry, Inc. 2019 Page 37 PLC Library • Made up of 1 function block, 1 data block, and 2 functions • fbMQTT • Two state machines • Sending data (also manages the TCP connection) • Receiving data • fcSerializeData • Takes a topic name and data, enqueues it into the message buffer • fcDeserializeData • Takes a topic name and an ANY, checks the receive buffer for messages that match its topic name • dbMqttData • Holds buffer for outgoing messages and slots for receiving messages
  37. 37. Unrestricted © Siemens Industry, Inc. 2019 Page 38 fbMqtt • Send data state machine • Opens TCP connection and MQTT connection • Checks message buffer • If messages are available sends message and waits for confirmation (if QoS 1) • Receive data state machine • Checks for incoming publish messages • Parses topic and payload • Inserts into appropriate slot in the receive message buffer
  38. 38. Unrestricted © Siemens Industry, Inc. 2019 Page 39 Serialize Data • Takes topic name and pointer to a datablock structure • Serializes the structure to a byte array and inserts the byte array and topic name into the next available slot in the send message array. Also sets a flag that this message is ready to be sent.
  39. 39. Unrestricted © Siemens Industry, Inc. 2019 Page 40 Deserialize Message • Takes topic name and pointer to a datablock structure • Reserves a slot in the incoming message array • When fbMqtt receives a message that matches this topic name, it will insert the message into the incoming message array and set a flag for a new message being received • fcDeserialzieMessage will take the byte array from the incoming message array and serialize it to its pointer
  40. 40. Unrestricted © Siemens Industry, Inc. 2019 Page 41 Working with raw PLC data • Most MQTT data is JSON data, which is easy to read and the receiver of the data does not need prior knowledge of what the data to contain • Example: { "name":"John", "age":30 } • Easy to understand • Two variables, name and age, with values John and 30 • Without reflection capabilities in a PLC, it’s not possible to dynamically generate JSON data. • DMC’s solution is let the broker know about the payload contents in advance • The server MQTT broker is based db files generated from TIA Portal so that it can properly parse
  41. 41. Unrestricted © Siemens Industry, Inc. 2019 Page 42 Receiving raw PLC data • When the MQTT broker starts, it checks a folder for .db files and creates a dictionary of classes based on the contents • Topic name is based on the file name • Class properties are generated based on the data block variables • When a message from the PLC is received, the MQTT broker checks the topic name and grabs the appropriate class from the dictionary created earlier. Data is then sent to the API and database. Raw data API SQL
  42. 42. Unrestricted © Siemens Industry, Inc. 2019 Page 43 Sending raw PLC data • Just as the MQTT broker creates classes for receiving raw data, it will create classes for sending raw data • When a message from the API is received, the MQTT broker checks the topic name and grabs the appropriate class from the dictionary created earlier. Data is then PLC SQL Front EndAPI
  43. 43. Unrestricted © Siemens Industry, Inc. 2019 Page 44 Title of your presentation here Name: James Condon Company: DMC Email: james.condon@dmcinfo.com Phone: 303 223 1801 Session # (for your survey): 14.3

×