Supply Chain Management Blogs by SAP
Expand your SAP SCM knowledge and stay informed about supply chain management technology and solutions with blog posts by SAP. Follow and stay connected.
cancel
Showing results for 
Search instead for 
Did you mean: 
Jay2
Product and Topic Expert
Product and Topic Expert


Introduction -

Consumer awareness and competitive market have led industries to put themselves on their toes to meet customer requirements and upgrade the manufacturing infrastructure. The latest technologies and world-class manufacturing infrastructure demand complex IT infrastructure, which demands an agile and robust platform to operate and maintain these machines.

This blog will help you understand how machine sensor data from the shop floor can be transported to the IoT cloud with the help of a 4 layer IoT stack. Currently, there are different IoT communication protocols available but will focus on a couple of them in this blog, which will give a clear understanding of how you can set up the infrastructure.


Proposed IoT stack for this exercise


Pre-requisites -

  1. SAP Plant Connectivity (PCo) runs on the following operating systems

    1. Windows 8.1 (x64)

    2. Windows 10 Version 1709 (Build 10.0.16299) and higher (x64)

    3. Windows Server 2008 R2 SP1 (x64)

    4. Windows Server 2012 (x64)

    5. Windows Server 2012 R2 (x64)

    6. Windows Server 2016 (x64)

    7. Windows Server 2019 (x64)



  2. Access to SAP IoT on SAP Business technology platform- If you are new to SAP IoT, please follow the tutorials to yourself familiarize with the solution.


Scenario -

To start the exercise, let's consider we have a shop floor in a manufacturing plant which has many operational motors. These motors are equipped with sensors to capture Vibration, RPM, and temperature. Sensor values have to be analyzed, and meaningful information has to be derived which can be used by different stakeholders to take appropriate actions.

Setup - Let's start setting up the infrastructure as per the steps mentioned below. Initially, you will feel it's a lengthy process but trust me the end result is something which you will be proud of. Let's follow the below diagram to understand what components we are going to set up on SAP PCo.



Definitions -

  • Source system - A source system refers to a specific data source from which data is to be queried.

  • Agents - The connection between the data source and PCo is established using agents.

  • Destination - A destination system is a system or the server to which notification messages are to be sent.

  • Notification - You use notifications to define under which circumstances, with which data, and to which destination you want PCo to send information when a specific event occurs.





    1. Configure and install OPC-UA simulation Server - The OPC Unified Architecture (UA), released in 2008, is a platform-independent service-oriented architecture that integrates all the functionality of the individual OPC Classic specifications into one extensible framework. This is widely used architecture in most industries.

      1. Download OPC UA simulation software from the following link - Installation link

      2. Create dummy sensors and simulate values

        1. vibration

        2. temperature

        3. rpm














      3. Setup data simulation rate -Set interval in 1500 (ms)

      4. Do not start the simulation as we first need to set up SAP PCo.



    2. Configure and install SAP PCo - Install SAP PCo referring to the Installation guide. After successful installation, you should be able to find the Management Console application, which you need to launch.

      1. Copy OPC-UA server endpoint which we created in the previous setup and modify the URL as below


      2. Create Source system OPC-UA and connect to OPC-UA Server created in the last step.

















    3. SAP IoT Setup - Login to your SAP BTP account and open the SAP IoT application listed under your subscriptions. With our new SAP IoT (One Product) IoT service cockpit being discontinued hence we have to use device connectivity APIs to set up a device and respective sensors.











      1. Create capability and sensor type with the payloads mentioned below.










        1. {
          "alternateId": "MOTOR_CAPABILITY",
          "name": "MOTOR_CAPABILITY",
          "properties": [{
          "dataType": "float",
          "formatter": {
          "dataType": "float",
          "scale": 0,
          "shift": 0,
          "swap": true
          },
          "name": "temperature"
          }, {
          "dataType": "float",
          "formatter": {
          "dataType": "float",
          "scale": 0,
          "shift": 0,
          "swap": true
          },
          "name": "rpm"
          }, {
          "dataType": "float",
          "formatter": {
          "dataType": "float",
          "scale": 0,
          "shift": 0,
          "swap": true
          },
          "name": "vibration"
          }]
          }


          {

          "capabilities": [
          {
          "id": "{{CAPABABILITY ID}}",
          "type": "measure"
          }
          ],
          "name": "MOTOR_SENSOR_TYPE"
          }





      2. Create MQTT device and sensor with sensor type as created in the previous step.









        1. {
          "alternateId": "MOTOR_DEVICE",
          "gatewayId": "2",
          "name": "MOTOR_DEVICE",
          "sensors": [{
          "alternateId": "MOTOR_SENSOR",
          "name": "MOTOR_SENSOR",
          "sensorTypeId": "{{SENSOR_TYPE_ID}}"
          }]
          }





      3. Thing Modelling - Now it's time to create the digital twin of our device, which we call as a thing. Follow the steps below to define Thing properties, Thing's type, and finally derive the thing which will be attached to the respective sensor we created i.e. MOTOR_SENSOR.





















      4. Download Device certificate - Use the following API from the list to download the certificate in p12 format.(/v1/devices/{deviceId}/authentications/clientCertificate/p12)

        1. Open the downloaded file in a text editor and copy the p12 value in a new file, which will name it with extension p12. (motor_device_certificate.p12)

        2. Copy the secret which will need when we install the certificate.



      5. The last step is to create a service instance of SAP IoT. We need to copy the device connectivity details mentioned in the service key of the same.














    4. Install the device certificate on a Windows machine where SAP PCo is installed.














    5. Create a source MQTT system with SAP IoT tenant details.

      1. Fill the device alternate ID as client ID

      2. Give the path of the installed device certificate















    6. Create a destination system that will point to the created device on SAP IoT.

      1. Add destination system

      2. Define the message configuration

        1. We have to define the message (payload) in the following format -
          {
          "capabilityAlternateId": "MOTOR_CAPABILITY",
          "sensorAlternateId": "MOTOR_SENSOR",
          "measures": [{
          "temperature": 45,
          "rpm": 100,
          "vibration": 10,

          }]
          }​




      3. Change the topic name so that the messages are sent to the respective device -measures/MOTOR_DEVICE

      4. Test the connection with the MQTT endpoint

      5. After successful ingestion, we will check the data it SAP IoT thing measures.






























    1. Create an Agent Instance - We have to create an Agent instance with the OPC-UA source system. 

    2. Add subscription to sensor values-














    3. Create Notification - To read the sensor values from OPC-UA server we have to create a notification and subscribe to the respective sensors (Which we call tags). Whenever there is data published, this notification is able to read the values and pass them to the respective destination.

      1. Create notification of type static.

      2. Select output and map subscriptions

      3. Create destination with SAP_MQTT_DESTINATION

      4. Map the destinations input variables

      5. Activate the notification

      6. Start Agent Instance

      7. Start data simulation from OPC-UA simulation server





















    4. Test the ingested value in SAP IoT application thing measures - At this step, our simulator is already sending data to SAP PCo and the agent instance is able to call the MQTT destination to ingest data into SAP IoT. Measured values update every 30seconds, so you should see the update on Things after 30 seconds.




 

Conclusion - 

With successful data ingestion, we were able to bring the machine data into SAP IoT Cloud with help of SAP Plant Connectivity. We have seen how to use the MQTT protocol for device connectivity from SAP PCo and similarly, we can try other protocols supported by the system. In my next blog will enrich the sensor data and see how we can bring business context into it. Please do drop your comments and suggestions.

 

References -

SAP IoT - https://www.sap.com/india/products/iot-data-services.html

SAP PCo - https://help.sap.com/viewer/p/SAP_PLANT_CONNECTIVITY

OPC-UA - https://opcfoundation.org/about/opc-technologies/opc-ua/

Server Certificate issue - https://help.sap.com/doc/saphelp_me150/15.0.3VERSIONFORSAPME/en-US/ac/41dffc7e94476cada950d78494fb33...

 

 

 

 

 
1 Comment