Azure Digital Twins

You can create an Azure Digital Twins connector to connect to the Azure Digital Twins Service. This enables real-time digital twin instances to retrieve saved values for their state properties and to persist updates to their state properties in corresponding digital twin instances stored in the Azure Digital Twins service.

To connect to the Azure Digital Twins service, you need to supply the following account parameters when creating the connector. The first parameter is the Azure Digital Twins Service URL, which is the host name listed in the Azure Digital Twins resource created in your Azure subscription. More information on creating an Azure Digital Twins resource group and resource can be found here.

The next three parameters are account credentials in your Azure Digital Twins App Registration in Azure Active Directory. The first two credentials are listed in the registration. The client secret is supplied to when you create the registration and must be saved at that time. More information on creating an app registration can be found here.

  • Azure Digital Twins Tenant ID: tenant id listed in the Azure Digital Twins App Registration in AD

  • Client ID: client id listed in the Azure Digital Twins App Registration in AD

  • Client Secret: client secret supplied when creating the Azure Digital Twins App Registration in AD

In addition, you can supply the following parameters for the connection:

  • Update Interval: the minimum period in seconds between successive updates to an Azure Digital Twins instance after updates to its corresponding real-time digital twins instance

  • Retrieve State on Create: indication whether to retrieve properties from Azure Digital Twins when creating a real-time digital twin instance; 1 = retrieve state; 0 = do not retrieve state

Note

The Update Interval parameter allows real-time digital twin deployments with high message rates and/or many data sources to throttle their updates to the Azure Digital Twins service and avoid hitting its resource limits (currently 1000 updates per second). More information on Azure Digital Twins resource limits can be found here.

Here is a screenshot of the dialog in the ScaleOut Digital Twins™ UI for creating an Azure Digital Twins connector:

adt_connector_image

You can deploy the connector immediately after it is created, or you can deploy it at a later time. The connector authenticates with the Azure Digital Twins service when it is deployed.

Enabling Persistence for a Digital Twin Model

Java Models

Java models can enable persistence to the Azure Digital Twins service by adding a value enablePersistence in the appsetttings file for the model. You should set the persistenceProvider value to “AzureDigitalTwinsService” if more than one persistence provider has been configured. Finally, specify the azureDigitalTwinModelName value for the Azure Digital Twins service. This value is the Azure Digital Twins Digital Twin Model Identifier (DTMI) as specified by the Digital Twin Data Language (DTDL).

.NET Core Models

.NET Core models can enable persistence to the Azure Digital Twins service by adding a value EnablePersistence in the appsetttings file for the model. You should set the PersistenceProvider value to “AzureDigitalTwinsService” if more than one persistence provider has been configured. Finally, specify the AzureDigitalTwinModelName value for the Azure Digital Twins service. This value is the Azure Digital Twins Digital Twin Model Identifier (DTMI) as specified by the Digital Twin Data Language (DTDL).

Here is an example of an appsettings.json file for a “WindTurbine” digital twin model:

 {
     "StartupDll": "WindTurbine.dll",
     "ModelName": "WindTurbine",
     "ModelType": "WindTurbine.dll, WindTurbine.WindTurbineDigitalTwin",
     "AzureDigitalTwinModelName": "dtmi:scaleoutsoftware:windturbine;3",
     "MessageType": "WindTurbineMessages.dll, WindTurbineMessages.DeviceTelemetry",
     "EnablePersistence": true,
     "PersistenceProvider": "AzureDigitalTwinsService"
 }

Rule-Based or Machine Learning Models

To enable persistence in rules-engine models, set the EnablePersistence property and the AzureDigitalTwinModelName property in your model definition file. This can be done directly in the ScaleOut Model Development Tool:

persistence_dev_tool