How-To Guides

Use Digital Twins to Contextualize Data

22min

Refer to the following how-to guide for leveraging Digital Twins for energy monitoring.

User Scenario

In this user scenario, the devicehub device will simulate the energy monitoring process across different plant sites. The data generated by the tags reflects real-time energy production, which allows for active analysis of energy efficiency, cost, and consumption patterns.

Digital Twins will model the asset as an energy-monitoring machine located at several plant sites. The instances for the model will be the specific energy-monitoring machines at each site.

The power generated in the last hour will be used to calculate values for cost, energy used, and energy rate. The timestamp value will be used to generate values for the attributes of season, start hour, and energy-rate description.

We need to add two tags for this. Tag 1, named "L3_Machine2", will generate random values simulating the variable power of an energy-monitoring machine. Tag 2 in Devicehub collects and stores data from energy monitoring devices. It helps in analyzing energy rates and seasons by simulating timestamp values.

Step 1: Add a Device

Follow the steps to Connect a Device and configure the following parameters:

  • Device Type: Simulator
  • Driver Name: Generator
  • Enable Alias Topics: Select the checkbox.

Step 2: Add Tags

After connecting the device, add the following tag. See Add Tags to learn more.

Tag 1: L3_Machine2

  • Name: Select S - Random value generator
  • Value Type: Select float64
  • Polling Interval: Enter 1
  • Tag Name: Enter L3_Machine2
  • Min value: Enter 1
  • Max value: Enter 25

Values for power generated will be sent through the topic devicehub.alias.P2_Electrical_Panel.L3_Machine2.

Tag 2

The data collected from Energy Monitoring devices is stored in Devicehub by enabling the Enable Data Store option on the simulator devices. The simulator device will act as a device measuring power values. The tag will simulate these timestamp values from one of the energy monitoring machines, and then the output will be written to the topic flowToDT.EMD_L3_Machine2.

To process this data, you will need to connect to a third-party database and create a Flow using Flows Manager. This flow will collect the values and determine the season and energy rate based on the date and timestamp.

JS


Sample Output Payload from Instance

This user scenario will be based on the following sample output payload from one instance.

JSON


Step 3: Create Digital Twins Model

You will first need to create the model that will store the instances of energy monitoring machines.

To create the model:

  1. Navigate to Digital Twins. The Models pane appears.
  2. From the Models pane, click the Create a model tile. The Create a Model dialog box appears.

    The Create a Model tile
    The Create a Model tile
    
  3. Click the Type drop-down list and select ASSET.
  4. Enter the name of the model in the Name field (for example, Energy_Monitoring_Model).
  5. (Optional) Enter a short description of the model in the Description field.
  6. Click Add. The new model appears in the Models pane.

After creating the model, you can configure it with the following parameters.

Model Static Attributes

The static attributes will need to be customized for each instance.

  • Asset
  • Line
  • Model
  • Manufacturer
  • Location
  • Plant

Transformations

The transformations are based on the sample payload above.

energyRateDescription

JSON


energyRate

JSON


energyUsed

JSON


shift

JSON


startHour

JSON


season

JSON


cost

JSON


The list of transformations would display as the following.

List of transformations
List of transformations


Tip: To access nested metadata keys, you should include a period after the initial dollar sign. For example:

  • $.metadata will extract the entire metadata object.
  • $.metadata.$cost will extract the cost key in the metadata object.

Model Dynamic Attributes

The dynamic attributes will use the appropriate schemaID (transformation) to generate values.

Name

Unit (optional)

DataType (optional)

SchemaID (optional)

cost

USD



cost

energyRateDescription





energyRateDescription

energyRate

USD/kWh



energyRate

energyUsed





energyUsed

shift





shift

startHour





startHour

season





season

power

kW





Hierarchy

The output for the model will be based on the hierarchy, which would categorize the dynamic and static attributes into telemetry or properties. It would look like the following.

Document image


Step 4: Create Instances

Once the model is configured, you will need to Add an Instance for each energy monitoring device at each site.

One of the instances is described below based on the topics for the data in the user scenario description.

Instance Static Attributes

You will customize the model static attributes to the specific instance.

Attribute Name

Attribute Value

Asset

Machine 2

Line

Line 1

Model

model_112233

Manufacturer

Siemens

Location

Canada

Plant

Toronto

Instance Dynamic Attributes

You will configure the appropriate topics in the user scenario description to the dynamic attributes configured in the model.

Name

Unit

DataType

Topic

SchemaID (optional)

power

kW



devicehub.alias.P2_Electrical_Panel.L3_Machine2



cost

USD



flowToDT.EMD_L3_Machine2

cost

energyRateDescription





flowToDT.EMD_L3_Machine2

energyRateDescription

energyRate

USD/kWh



flowToDT.EMD_L3_Machine2

energyRate

energyUsed





flowToDT.EMD_L3_Machine2

energyUsed

shift





flowToDT.EMD_L3_Machine2

shift

startHour





flowToDT.EMD_L3_Machine2

startHour

season





flowToDT.EMD_L3_Machine2

season