Example

This example demonstrates how to use this Action Agent to send simple pump data readings to Azure Digital Twins. This would allow current data to be stored for later retrieval for contextualization.

Refer to configuration to understand all configuration options of this Agent.

Step 1: Add the Agent

  1. Drag the Azure Digital Twin Action Agent onto the canvas.

  2. Rename the Agent and link the output endpoint to the printer

  3. Save the Data Stream.

  4. Double-click to configure the Agent.

Step 2: Configure Authentication

Enter the Authentication of your Azure Digital Twin

In this case, tick to use variables and select the authentication settings: Subscription Id, Tenant Id, Client Id, and Client Secret.

Step 3: Create a Digital Twin (optional)

Refer Azure resource creation on how to enable this link, or skip to step 5.

We're going to create a Digital Twins instance. Go to setting the Digital Twins Host Name if you want to skip this step.

  1. Click 'Create new resource' to open the Create New Resource blade.

  2. Set the Resource Location, Resource Group, and Digital Twins Instance Name. In this case, set Resource Location to australiaeast, Resource Group to XMDocs, and Digital Twins Instance Name to XMDTExample. Click Setup Infrastructure.

  3. Apply the changes on the Create New Resource blade.

Step 4: Configure Digital Twin

  1. Set the Host Name to the Azure Digital Twin Host Name variable.

  2. Click Upload new model.

  3. Click Select File and select the DTDL Model file. Apply the changes.

  1. Set the Model Name to Pump and the Twin Id to PumpId.

  2. Apply the changes and save the Data Stream.

Step 5: Input Mapping

  1. Click on the Azure Digital Twin's input arrow.

  2. Click Configure.

  3. Map one of the parent Agent's output attributes to each model attribute, which is fetched from the Azure model.

Step 6: Results

Apply the changes, save the Data Stream, and publish it.

Let's look at the Live Data View. Observe that the PumpId and Temperature data are submitted to the Azure Digital Twin instance and printed by the agent.

Files

See the Import, Export, and Clone - XMPro article for steps to import a Data Stream.

Last updated