The Internet of Things on AWS – Official Blog

Collecting, organizing, monitoring, and analyzing industrial data at scale using AWS IoT SiteWise (Part 1)

Post by Saras Kaul, Senior Product Manager of IoT SiteWise, Asim Kumar Sasmal, Senior Data Architect, and Mark Gilbert, Senior Consultant in the IoT Global Specialty Practice of AWS Professional Services.

 

Industrial customers have been looking for a secure, cost-effective, and reliable field-to-cloud solution that does the following:

  • Ingests all their data from hundreds of industrial sites that have tens of thousands of PLCs and sensors
  • Visualizes key measurements and metrics for the devices, processes, and equipment in near-real time
  • Enables condition monitoring and send notifications and alerts in near-real time to take actions when needed
  • Enables Business Intelligence (BI) on historical data for reporting

In this multi-part post, we will walk you through examples of how AWS IoT is helping customers solve these core challenges.

In Part 1 (this post), you learn how to:

  • Create virtual representations of your industrial assets using AWS IoT SiteWise
  • Collect and ingest data locked away in your industrial sites to AWS IoT SiteWise

For this post, we will use a KEPServerEX simulator driver from Kepware as the OPC-UA server for AWS IoT SiteWise to subscribe to the data. However, you can use any OPC-UA server of your choice.

In Part 2, you learn how to:

  • Monitor key operating parameters and performance metrics for your assets using SiteWise Monitor, a new capability of AWS IoT SiteWise, and take necessary actions when needed in near-real time

In Part 3, you learn how to:

  • Stream modeled equipment data in real-time from AWS IoT SiteWise to be consumed by custom applications via AWS IoT Core rules engine
  • Enable condition monitoring and send notifications or alerts using AWS IoT Events in near-real time
  • Enable Business Intelligence (BI) reporting on historical data using Amazon QuickSight

AWS IoT SiteWise is currently in preview. While in preview, there are no charges for using AWS IoT SiteWise and the service is subject to change.

About AWS IoT SiteWise

AWS IoT SiteWise is a fully managed AWS IoT service that you can use to collect, organize, and analyze data from industrial equipment at scale. AWS IoT SiteWise enables you to collect data on the plant floor from sensors, equipment, or a local on-premises gateway and upload to AWS cloud using a gateway software (AWS IoT SiteWise Connector). AWS IoT SiteWise Connector runs on common industrial gateway devices running AWS IoT Greengrass, and reads data directly from servers and historians over the OPC-UA protocol. You can then structure and organize data using a rich asset-modeling framework to create virtual representations of equipment and processes. The data ingested and modeled in AWS IoT SiteWise is stored in a scalable and time-optimized internal data store. Once data is stored in AWS IoT SiteWise, you can stream live data in near real-time and query historical data to build downstream IoT applications. With the recently announced SiteWise Monitor capability of AWS IoT SiteWise, you can explore your library of assets, and create and share operational dashboards with plant operators for real-time monitoring and visualization of equipment health and output. To learn more about what’s new with AWS IoT SiteWise, visit to What’s new.

Solution Architecture

The following diagram illustrates the high-level end-to-end solution described in this multi-part post along with the AWS services used in the solution.

Walkthrough

There are five sections in this step-by-step walk-through:

  • Prerequisites
  • Setting up KEPServerEX with sample data
  • Setting up AWS IoT Greengrass and deploying AWS IoT SiteWise gateway software
  • Modeling your assets in AWS IoT SiteWise
  • Setting up AWS IoT SiteWise gateway for data ingestion

Prerequisites

  • This example uses the US West (Oregon) Region. However, you can choose another AWS Region of your choice where AWS IoT SiteWise (in preview), AWS IoT Analytics, and AWS IoT Events services are available. Visit the AWS Region table for a full list of AWS Regions where AWS services are available.
  • You have an AWS account in the same AWS Region.
  • You have the AdministratorAccess policy granted to your AWS account (for production, we recommend restricting access as needed).
  • You have AWS CLI installed and configured to use with your AWS account.

This example uses simulated Wind Turbine data using KEPServerEX from Kepware (a third-party software) as the OPC-UA server and its simulator driver. If you have any questions regarding KEPServerEX, please contact Kepware for support.

Setting up KEPServerEX with sample data

  • Launch an Amazon EC2 Windows instance (t2.medium, Windows Server 2019 for this post) by following the instructions in Getting Started with Amazon EC2 Windows Instances.
  • Download and install the free demo for KEPServerEX from Kepware on the EC2 instance.
  • Make sure that the EC2 instance’s security group inbound rule allows traffic for the port number that you plan to use with the OPC-UA endpoint. This post uses the default port number 49320.
  • For the message security policy, choose Basic128Rsa15 – Sign and encrypt.
  • Right click on Project and navigate to Properties, Property Editor. Choose Allow anonymous login option as Yes for OPC UA (if default is No) from the Property Editor as shown below and click on Apply:

After KEPServerEX is set up, log in to the Windows machine to set up the three wind turbines (Wind Turbine 1, Wind Turbine 2, Wind Turbine 3) using the KEPServerEX simulator driver.

As shown in the following screenshot, each wind turbine has two PLC units:

  • Unit 1 has three tags: Power, Rotor Speed, and Wind Speed
  • Unit 2 has two tags: Equipment Temperature and Outside Temperature

After the tags are created, monitor the simulated values by launching the OPC Quick Client (shown in the screenshot above) to validate the data simulation. The following screenshot shows the OPC Quick Client display when Wind Turbine 1.Unit 1 PLC is selected.

The following screenshot shows the OPC Quick Client display when Wind Turbine 1.Unit 2 PLC is selected.

Setting up AWS IoT Greengrass and deploying AWS IoT SiteWise gateway software

Now that KEPServerEX is set up to simulate the required sample data for this walkthrough, set up AWS IoT Greengrass on your device gateway.

For this post, you use an Amazon EC2 Linux instance instead of a real industrial gateway device. AWS IoT SiteWise supports x86_64 and ARMv7l CPU architecture-based device gateways.

Use the following steps to set up AWS IoT Greengrass on the EC2 Linux instance.

  1. Create an IAM role named SiteWiseDemo with required permissions using the steps in Create an IAM Policy and Role. Make a note of the IAM role ARN, which you will use later.
  2. Launch an EC2 Linux instance (t2.medium), using the steps in Getting Started with AWS IoT Greengrass – Module 1 – Setting Up an Amazon EC2 Instance.
  3. After the EC2 instance is launched and is in running status, connect to the EC2 instance by using SSH
    1. Make sure that your EC2 Linux instance has the pre-requisites as noted, specifically the following:
      1. x86 64-bit architecture
      2. OpenJDK 8 (not an earlier or later version). Execute sudo yum install java-1.8.0 to install the required version (if needed).
    2. To allow AWS IoT Greengrass to use Java, you need to create a java8 symbolic link to the Java executable (if not already setup by the Java 8 installation earlier). Execute sudo ln -s /usr/bin/java /usr/bin/java8 to create the symbolic link (if needed). Execute java8 -version to validate the symbolic link pointing to 1.8.x version.
    3. Create a /var/sitewise data directory and give the ggc_user permissions for that directory using the commands below. AWS IoT SiteWise uses this directory to store system data.
      sudo mkdir /var/sitewise
      sudo chown ggc_user /var/sitewise
      sudo chmod 700 /var/sitewise

      The /var/sitewise is the default directory which you can customize (for example, replace /var/sitewise with /var/custom/path/). Doing so requires extra steps after the AWS IoT SiteWise gateway is created. For more information, see step 5 in Configure the AWS IoT SiteWise Connector.

  4. After EC2 instance configuration is complete, follow the instructions in Module 2: Installing the AWS IoT Greengrass Core Software to install AWS IoT Greengrass software (version 1.9.4 or later) on the EC2 instance and also create an AWS IoT Greengrass group named sitewise_gg. Only execute the instructions up to Module 2 from the AWS IoT Greengrass Getting Started guide.
  5. To attach the IAM role SiteWiseDemo to the AWS IoT Greengrass group sitewise_gg you just created, follow the steps in Attach an IAM Role to an AWS IoT Greengrass Group.
  6. AWS IoT SiteWise gateway is a software which is available as an AWS IoT Greengrass Connector. A Unix shell script below deploys the AWS IoT SiteWise Connector (replace the GG_GROUP_ID, GG_GROUP_NAME, REGION, and PROFILE parameters from your environment). If you have the AWS CLI available and configured for your environment, execute the shell script from your laptop or from the EC2 instance.
    #!/bin/bash
    
    export GG_GROUP_ID="xxxx"
    export GG_GROUP_NAME="xxxx"
    export REGION="xxxx"
    export PROFILE="xxxx"
    
    COMMAND="aws --region $REGION greengrass --profile $PROFILE"
    GG_LIST_GROUPS_RESULT=`$COMMAND list-groups | jq ".Groups[] | select(.Name == \"$GG_GROUP_NAME\")"`
    GG_GROUP_VERSION=`echo $GG_LIST_GROUPS_RESULT | jq -r '.LatestVersion'`
    
    function add_connector {
         GET_GROUP_VERSION_RESULT=`$COMMAND get-group-version --group-id $GG_GROUP_ID --group-version-id $GG_GROUP_VERSION`
     
         CREATE_CONNECTOR_DEFINITION_RESULT=`$COMMAND create-connector-definition --name $GG_GROUP_NAME --initial-version "{ \
             \"Connectors\": [ \
                 { \
                     \"Id\": \"MySiteWiseConnector\", \
                     \"ConnectorArn\": \"arn:aws:greengrass:$REGION::/connectors/IoTSiteWise/versions/1\", \
                     \"Parameters\": { \
                     } \
                 } \
             ] \
         }"`
     
         CONNECTOR_DEFINITION_ARN=`echo $CREATE_CONNECTOR_DEFINITION_RESULT | jq -r ".LatestVersionArn"`
     
         CORE_DEFINITION_ARN=`echo $GET_GROUP_VERSION_RESULT | jq -r ".Definition.CoreDefinitionVersionArn"`
         CREATE_GROUP_VERSION_RESULT=`$COMMAND create-group-version --group-id $GG_GROUP_ID --core-definition-version-arn $CORE_DEFINITION_ARN --connector-definition-version-arn $CONNECTOR_DEFINITION_ARN`
     
         GG_GROUP_VERSION_ID=`echo $CREATE_GROUP_VERSION_RESULT | jq -r '.Version'`
         $COMMAND create-deployment --deployment-type "NewDeployment" --group-id $GG_GROUP_ID --group-version-id $GG_GROUP_VERSION_ID
     
     }
     add_connector

    Sample run output:

  7. Edit the Security Group for the Windows EC2 instance for KEPServerEX to allow traffic from the Security Group for the Greengrass EC2 instance for port number 49320, which you plan to use with the OPC-UA end-point.

Modeling your assets in AWS IoT SiteWise

You now have your KEPServerEX simulating OPC-UA data and have configured AWS IoT Greengrass with the AWS IoT SiteWise gateway software running on your edge gateway.

Next, you will model your assets using asset modeling in AWS IoT SiteWise before you ingest your data. Asset models drive standardization for your industrial data. An asset model contains a name, description, asset properties, and asset hierarchy definitions.

Earlier, you set up three wind turbines in KEPServerEX. Assume that one of the three wind turbines is in the East location and the remaining two are in the West location in the state of Illinois. You want to create the below asset hierarchy for the Wind Farm. Assume that Unit 1 PLC and Unit 2 PLCs are same model type across all the three Wind Turbines. You need to create four models for the asset hierarchy below – one for Unit 1 PLC, one for Unit 2 PLC, one for Wind Turbine, and finally, one for Wind Farm.

Follow the steps below to create the models:

  1. Execute the following AWS CLI command to create the model for Unit 1 PLC:
    aws iotsitewise create-asset-model --cli-input-json file://Unit_1_PLC_model_template.json --profile default

    The file Unit_1_PLC_model_template.json contains the following code:

    {
        "assetModelHierarchies": [], 
        "assetModelDescription": "Unit 1 PLC Model Template", 
        "assetModelName": "Unit 1 PLC Model", 
        "assetModelProperties": [
            {
                "dataType": "DOUBLE", 
                "type": {
                    "measurement": {}
                }, 
                "unit": "m/s", 
                "name": "Wind Speed"
            }, 
            {
                "dataType": "DOUBLE", 
                "type": {
                    "measurement": {}
                }, 
                "unit": "rev/s", 
                "name": "Rotor Speed"
            }, 
            {
                "dataType": "STRING", 
                "type": {
                    "attribute": {
                        "defaultValue": "Serial BT12345"
                    }
                }, 
                "name": "Model"
            }, 
            {
                "dataType": "DOUBLE", 
                "type": {
                    "measurement": {}
                }, 
                "unit": "kW", 
                "name": "Generated Power"
            }, 
            {
                "dataType": "DOUBLE", 
                "type": {
                    "metric": {
                        "variables": [
                            {
                                "name": "var_generatedpower",
                                "value": {
                                    "propertyId": "Generated Power"
                                } 
                            }
                        ], 
                        "expression": "max(var_generatedpower)", 
                        "window": {
                            "tumbling": {
                                "interval": "5m"
                            }
                        }
                    }
                }, 
                "name": "Max Generated Power"
            }, 
            {
                "dataType": "DOUBLE", 
                "type": {
                    "metric": {
                        "variables": [
                            {
                                "name": "var_windspeed", 
                                "value": {
                                    "propertyId": "Wind Speed"
                                }
                            }
                        ], 
                        "expression": "avg(var_windspeed)", 
                        "window": {
                            "tumbling": {
                                "interval": "5m"
                            }
                        }
                    }
                }, 
                "name": "Average Wind Speed"
            }, 
            {
                "dataType": "STRING", 
                "type": {
                    "attribute": {
                        "defaultValue": "Unit 1 PLC"
                    }
                }, 
                "name": "Name"
            }
        ]
    }

    Sample run output:

    {
        "assetModelArn": "arn:aws:iotsitewise:us-west-2:<AWS-Account-ID>:asset-model/b82337f0-c24d-45ed-8ac4-bbfb370bb27e", 
        "assetModelId": "b82337f0-c24d-45ed-8ac4-bbfb370bb27e", 
        "assetModelStatus": {
            "state": "CREATING"
        }
    }

    Make a note of the assetModelId to use shortly.

  2. Execute the following AWS CLI command to create the model for Unit 2 PLC:
    aws iotsitewise create-asset-model --cli-input-json file://Unit_2_PLC_model_template.json --profile default

    The file Unit_2_PLC_model_template.json contains the following code:

    {
        "assetModelHierarchies": [], 
        "assetModelDescription": "Unit 2 PLC Model Template", 
        "assetModelName": "Unit 2 PLC Model", 
        "assetModelProperties": [
            {
                "dataType": "DOUBLE", 
                "type": {
                    "metric": {
                        "variables": [
                            {
                                "name": "var_outsidetemperature", 
                                "value": {
                                    "propertyId": "Outside Temperature"
                                }
                            }
                        ], 
                        "expression": "avg(var_outsidetemperature)", 
                        "window": {
                            "tumbling": {
                                "interval": "15m"
                            }
                        }
                    }
                }, 
                "name": "Avg Outside Temperature"
            }, 
            {
                "dataType": "DOUBLE", 
                "type": {
                    "measurement": {}
                }, 
                "unit": "Fahrenheit", 
                "name": "Outside Temperature"
            }, 
            {
                "dataType": "STRING", 
                "type": {
                    "attribute": {
                        "defaultValue": "Serial BT54321"
                    }
                }, 
                "name": "Model"
            }, 
            {
                "dataType": "DOUBLE", 
                "type": {
                    "measurement": {}
                }, 
                "unit": "Fahrenheit", 
                "name": "Equipment Temperature"
            }, 
            {
                "dataType": "DOUBLE", 
                "type": {
                    "metric": {
                        "variables": [
                            {
                                "name": "var_equipmenttemperature", 
                                "value": {
                                    "propertyId": "Equipment Temperature"
                                }
                            }
                        ], 
                        "expression": "avg(var_equipmenttemperature)", 
                        "window": {
                            "tumbling": {
                                "interval": "15m"
                            }
                        }
                    }
                }, 
                "name": "Avg Equipment Temperature"
            }, 
            {
                "dataType": "STRING", 
                "type": {
                    "attribute": {
                        "defaultValue": "Unit 2 PLC"
                    }
                }, 
                "name": "Name"
            }
        ]
    }

    Sample run output:

    {
        "assetModelArn": "arn:aws:iotsitewise:us-west-2:<AWS-Account-ID>:asset-model/4ae586a6-f41e-4f7c-bb03-968349a0e1f5", 
        "assetModelId": "4ae586a6-f41e-4f7c-bb03-968349a0e1f5", 
        "assetModelStatus": {
            "state": "CREATING"
        }
    }

    Make a note of the assetModelId to use shortly.

  3. Execute the following AWS CLI command to create the model for Wind Turbine:
    aws iotsitewise create-asset-model --cli-input-json file://wind_turbine_model_template.json --profile default

    The file wind_turbine_model_template.json contains the following code (remember to replace the two childAssetModelId with the model ids you noted above for Unit 1 PLC and Unit 2 PLC models):

    {
        "assetModelDescription": "Wind Turbine Model Template", 
        "assetModelName": "Wind Turbine Model",
        "assetModelHierarchies": [
            {
                "childAssetModelId": "<Replace with assetModelId noted above for Unit 1 PLC>", 
                "name": "Unit 1 PLC Model"
            }, 
            {
                "childAssetModelId": "<Replace with assetModelId noted above for Unit 2 PLC>", 
                "name": "Unit 2 PLC Model"
            }
        ], 
        "assetModelProperties": [
            {
                "dataType": "STRING", 
                "type": {
                    "attribute": {
                        "defaultValue": "Wind Turbine"
                    }
                }, 
                "name": "Name"
            }, 
            {
                "dataType": "STRING", 
                "type": {
                    "attribute": {
                        "defaultValue": "East"
                    }
                }, 
                "name": "Location"
            }
        ]
    }

    Sample run output:

    {
        "assetModelArn": "arn:aws:iotsitewise:us-west-2:<AWS-Account-ID>:asset-model/97b68f68-2fba-46ff-a199-6fc90bbb11e4", 
        "assetModelId": "97b68f68-2fba-46ff-a199-6fc90bbb11e4", 
        "assetModelStatus": {
            "state": "CREATING"
        }
    }

    Make a note of the assetModelId to use shortly.

  4. Execute the following AWS CLI command to create the model for Wind Farm:
    aws iotsitewise create-asset-model --cli-input-json file://wind_farm_model_template.json --profile default

    The file wind_farm_model_template.json contains the following code (remember to replace the childAssetModelId with the model id you noted above for the Wind Turbine Model above):

    {
        "assetModelDescription": "Wind Farm Model Template", 
        "assetModelName": "Wind Farm Model",
        "assetModelHierarchies": [
            {
                "childAssetModelId": "<Replace with assetModelId noted above for Wind Turbine>", 
                "name": "Wind Turbine Model"
            }
        ], 
        "assetModelProperties": [
            {
                "dataType": "STRING", 
                "type": {
                    "attribute": {
                        "defaultValue": "Wind Farm"
                    }
                }, 
                "name": "Name"
            }, 
            {
                "dataType": "STRING", 
                "type": {
                    "attribute": {
                        "defaultValue": "Illinois"
                    }
                }, 
                "name": "Location"
            }
        ]
    }

    Sample run output:

    {
        "assetModelArn": "arn:aws:iotsitewise:us-west-2:<AWS-Account-ID>:asset-model/fd30d3bf-e58a-4ec6-90a7-f882d35b7823", 
        "assetModelId": "fd30d3bf-e58a-4ec6-90a7-f882d35b7823", 
        "assetModelStatus": {
            "state": "CREATING"
        }
    }
  5. Execute the following AWS CLI command to get the list of all the model IDs you created above for creating the assets next.
    aws iotsitewise list-asset-models --profile default

    Sample run output:

    {
        "assetModelSummaries": [
            {
                "status": {
                    "state": "ACTIVE"
                }, 
                "description": "Unit 2 PLC Model Template", 
                "lastUpdateDate": 1574824993.0, 
                "creationDate": 1574824993.0, 
                "id": "4ae586a6-f41e-4f7c-bb03-968349a0e1f5", 
                "arn": "arn:aws:iotsitewise:us-west-2:<AWS-Account-ID>:asset-model/4ae586a6-f41e-4f7c-bb03-968349a0e1f5", 
                "name": "Unit 2 PLC Model"
            }, 
            {
                "status": {
                    "state": "ACTIVE"
                }, 
                "description": "Wind Turbine Model Template", 
                "lastUpdateDate": 1574825291.0, 
                "creationDate": 1574825289.0, 
                "id": "97b68f68-2fba-46ff-a199-6fc90bbb11e4", 
                "arn": "arn:aws:iotsitewise:us-west-2:<AWS-Account-ID>:asset-model/97b68f68-2fba-46ff-a199-6fc90bbb11e4", 
                "name": "Wind Turbine Model"
            }, 
            {
                "status": {
                    "state": "ACTIVE"
                }, 
                "description": "Unit 1 PLC Model Template", 
                "lastUpdateDate": 1574824802.0, 
                "creationDate": 1574824801.0, 
                "id": "b82337f0-c24d-45ed-8ac4-bbfb370bb27e", 
                "arn": "arn:aws:iotsitewise:us-west-2:<AWS-Account-ID>:asset-model/b82337f0-c24d-45ed-8ac4-bbfb370bb27e", 
                "name": "Unit 1 PLC Model"
            }, 
            {
                "status": {
                    "state": "ACTIVE"
                }, 
                "description": "Wind Farm Model Template", 
                "lastUpdateDate": 1574826696.0, 
                "creationDate": 1574826675.0, 
                "id": "fd30d3bf-e58a-4ec6-90a7-f882d35b7823", 
                "arn": "arn:aws:iotsitewise:us-west-2:<AWS-Account-ID>:asset-model/fd30d3bf-e58a-4ec6-90a7-f882d35b7823", 
                "name": "Wind Farm Model"
            }
        ]
    }

    Make a note of the 4 asset model ids you will be using for asset creation in the next step.

  6. Execute the following AWS CLI commands to create the assets below (remember to replace the asset-model-id with the corresponding model ids you noted in the previous step):
    1. Wind Turbine 1 – PLC Unit 1 (For Wind Turbine 1 PLC Unit 1)
    2. Wind Turbine 1 – PLC Unit 2 (For Wind Turbine 1 PLC Unit 2)
    3. Wind Turbine 2 – PLC Unit 1 (For Wind Turbine 2 PLC Unit 1)
    4. Wind Turbine 2 – PLC Unit 2 (For Wind Turbine 2 PLC Unit 2)
    5. Wind Turbine 3 – PLC Unit 1 (For Wind Turbine 3 PLC Unit 1)
    6. Wind Turbine 3 – PLC Unit 2 (For Wind Turbine 3 PLC Unit 2)
      aws iotsitewise create-asset --asset-name "Wind Turbine 1 - PLC Unit 1" --asset-model-id "b82337f0-c24d-45ed-8ac4-bbfb370bb27e" --profile default
      aws iotsitewise create-asset --asset-name "Wind Turbine 1 - PLC Unit 2" --asset-model-id "4ae586a6-f41e-4f7c-bb03-968349a0e1f5" --profile default
      aws iotsitewise create-asset --asset-name "Wind Turbine 2 - PLC Unit 1" --asset-model-id "b82337f0-c24d-45ed-8ac4-bbfb370bb27e" --profile default
      aws iotsitewise create-asset --asset-name "Wind Turbine 2 - PLC Unit 2" --asset-model-id "4ae586a6-f41e-4f7c-bb03-968349a0e1f5" --profile default
      aws iotsitewise create-asset --asset-name "Wind Turbine 3 - PLC Unit 1" --asset-model-id "b82337f0-c24d-45ed-8ac4-bbfb370bb27e" --profile default
      aws iotsitewise create-asset --asset-name "Wind Turbine 3 - PLC Unit 2" --asset-model-id "4ae586a6-f41e-4f7c-bb03-968349a0e1f5" --profile default
  7. Navigate to AWS IoT SiteWise, AssetsWind Turbine 1 – PLC Unit 1 asset and click on Edit to update the following:
    1. Under Measurements:
      1. Update property alias for Generated Power with the OPC-UA tag name – /Wind Turbine 1/Unit 1 PLC/Power and Notification Status with ENABLED (default is DISABLED)
      2. Update property alias for Rotor Speed with the OPC-UA tag name – /Wind Turbine 1/Unit 1 PLC/Rotor Speed and Notification Status with ENABLED (default is DISABLED)
      3. Update property alias for Wind Speed with the OPC-UA tag name – /Wind Turbine 1/Unit 1 PLC/Wind Speed and Notification Status with ENABLED (default is DISABLED
    2. Under Metric, update Notification Status with ENABLED (default is DISABLED) for both Max Generated Power and Average Wind Speed
    3. Click on Save asset to save the changes. In this step, you mapped the Measurements to their appropriate OPC-UA tags. Also, by enabling Notification Status, modeled data from AWS IoT SiteWise will now be published to the topic names as shown in the screenshot above. You can subscribe to those topics from AWS IoT Core rules engine to build your own IoT applications downstream (outside AWS IoT SiteWise).
  8. Repeat step 7-1, 7-2, and 7-3 above for the remaining five assets below to update with their corresponding OPC-UA tags for the Measurements from KEPServerEX and enable the Notification Status for both Measurements and Metrics:
    1. Wind Turbine 1 – PLC Unit 2
    2. Wind Turbine 2 – PLC Unit 1
    3. Wind Turbine 2 – PLC Unit 2
    4. Wind Turbine 3 – PLC Unit 1
    5. Wind Turbine 3 – PLC Unit 2
  9. Execute the following AWS CLI commands to create the assets below (remember to replace the asset-model-id from your own environment):
    1. Wind Turbine 1
    2. Wind Turbine 2
    3. Wind Turbine 3
    4. Wind Farm
      aws iotsitewise create-asset --asset-name "Wind Turbine 1" --asset-model-id "97b68f68-2fba-46ff-a199-6fc90bbb11e4" --profile default
      aws iotsitewise create-asset --asset-name "Wind Turbine 2" --asset-model-id "97b68f68-2fba-46ff-a199-6fc90bbb11e4" --profile default
      aws iotsitewise create-asset --asset-name "Wind Turbine 3" --asset-model-id "97b68f68-2fba-46ff-a199-6fc90bbb11e4" --profile default
      aws iotsitewise create-asset --asset-name "Wind Farm" --asset-model-id "fd30d3bf-e58a-4ec6-90a7-f882d35b7823" --profile default
  10. Navigate to AWS IoT SiteWise, Assets, Wind Turbine 1 asset and click on Edit. Under Assets associated to this asset, add the following two hierarchy nodes as shown in below screenshot and also update Location to East and Name to Wind Turbine 1, and click on Save asset
  11. Repeat step 10 above for the remaining assets below to associate the necessary asset hierarchy nodes:
    1. Wind Turbine 2 (Associate to Wind Turbine 2 – PLC Unit 1 and Wind Turbine 2 – PLC Unit 2)
    2. Wind Turbine 3 (Associate to Wind Turbine 3 – PLC Unit 1 and Wind Turbine 3 – PLC Unit 2)
    3. Wind Farm (Associate to Wind Turbine 1, Wind Turbine 2, and Wind Turbine 3)
  12. Navigate to AWS IoT SiteWise, Assets to verify that the asset hierarchy looks the one you wanted to build. 

Ingesting data using AWS IoT SiteWise gateway

Now that you have the asset model created, set up your AWS IoT SiteWise gateway in the cloud to start the data ingestion into AWS IoT SiteWise.

  1. Navigate to AWS IoT SiteWise, Ingest, Gateways and click on Add gateway to create a new SiteWise Gateway named Wind Turbine SiteWise Gateway with Greengrass group ID as sitewise_gg. Click on Add gateway once done. 
  2. Once the SiteWise Gateway is created successfully, you will see below: 
  3. You are now ready to add a source (KEPServerEX for this post) for the AWS IoT SiteWise Gateway you just created. Click on Manage, View DetailsNew source to add your source OPC-UA server details. Click on Save to save the details. Note that you can add multiple sources to the same gateway.Note that the message security policy is set to Basic128Rsa15 – Sign and encrypt (this is the same message security policy you chose earlier for KEPServerEX). The message security policy determines the algorithm used for the encryption and signing of OPC-UA messages exchanged with the gateway device.
    Also, authentication is set to none and anonymous to match with the Allow anonymous login option you have chosen earlier from KEPServerEX under Property Editor, General, OPC UA.
  4. After creating the gateway and associating with the source (OPC-UA server), log in to the KEPServerEX Windows machine. To trust the certificate from OPC UA Configuration Manager (which allows the data to flow from KEPServerEX to AWS), choose Trust as shown in the screenshot below. 
  5. To verify that the OPC-UA data is streaming from KEPServerEX to AWS IoT SiteWise, execute the below AWS CLI command a couple of times for any of the asset properties to see that the value is changing from time to time. For this post, you choose asset as Wind Turbine 1 – PLC Unit 1 and Generated Power as the property. Remember to replace with the corresponding asset-id and property-id from list-assets and describe-assetoutput in your environment.
    aws iotsitewise get-asset-property-value --asset-id "84841a92-232d-4a43-ab0a-fe7536a537ed" --property-id "a2085ae5-c553-446e-825a-ba9e84dabaf1" --profile default

    Sample output for Run 1:

    {
        "propertyValue": {
            "timestamp": {
                "timeInSeconds": 1574876940, 
                "offsetInNanos": 524000000
            }, 
            "quality": "GOOD", 
            "value": {
                "doubleValue": 3.702181100845337
            }
        }
    }

    Sample output for Run 2:

    {
        "propertyValue": {
            "timestamp": {
                "timeInSeconds": 1574876972, 
                "offsetInNanos": 25000000
            }, 
            "quality": "GOOD", 
            "value": {
                "doubleValue": 4.034252643585205
            }
        }
    }

Summary

In Part 1 of this multi-part post, you learned how to model your industrial assets and ingest data from industrial sites in a secure, cost-effective, and reliable manner using AWS IoT SiteWise. You used KEPServerEX from Kepware as the OPC-UA server for AWS IoT SiteWise to subscribe to the data.

In Part 2, you learn how to:

  • Monitor key operating parameters and performance metrics for your assets using SiteWise Monitor, a new capability of AWS IoT SiteWise, and take necessary actions when needed in near-real time

In Part 3, you learn how to:

  • Stream modeled equipment data in real-time from AWS IoT SiteWise to be consumed by custom applications via AWS IoT Core rules engine
  • Enable condition monitoring and send notifications or alerts using AWS IoT Events in near-real time
  • Enable Business Intelligence (BI) reporting on historical data using Amazon QuickSight

We hope you found this post informative and the walk-through helpful. As always, AWS welcomes feedback. Please submit your comments or questions below.