Skip to content

Transition to Asset Modeler V4 Model

Overview

In Asset Modeler V3, it is possible to upload models to the Insights Hub. However, retrieval of these models is not supported, and neither deletion nor updating of resources is permitted. The model is not updated after a change made through the Asset Manager.

However, by using Asset Modeler V4, the model can be retrieved and resources within the model can be retrieved, updated, and deleted using their reference IDs. After changes are made through Asset Manager, the model is automatically updated.

If the mappings are already created with Asset Modeler V3, it is possible to get V4 model with these already created mappings. Thereafter, you can add/delete mappings using V4 topic.

To update the V3 model, follow below steps:

Prerequisites

  • To generate certificates, ensure to have the OpenSSL toolkit or an equivalent setup to create certificates.

  • MQTTX is installed on your computer or an equivalent setup.

Preparation

Update the following fields with appropriate values before using the samples given in this section:

  • <requestId>
  • <tenantId>
  • <clientId>

1. Check Your Mappings from UI

You can check your mappings from Asset Manager UI.

image1

2. Get Your Latest Model

You need to get your model with Asset Modeler V4 get model topic.

Get Instantiated Model

Subscribe to following topic to get the already created asset model. In the response message, pre-sign bucket url is available. Download your model from this link within one day.

SUB tc/<tenantId>/<clientId>/i/amo_v4/m or SUB tc/<tenantId>/<clientId>/i/amo_v4/#

image2

Response Message Examples:

    {
    "id": "01HFVCJYNARR56BPHBEA8Y90QE",
    "correlationId": "01HFVCJYN9WDFXT9N6PDWTPPN5",
    "requestId": "myModelGetRequest",
    "data": {
        "content": "https://your-bucket-name.s3.amazonaws.com/path/to/your/object/file.json?AWSAccessKeyId=YOUR_ACCESS_KEY_ID&Expires=EXPIRATION_TIMESTAMP&Signature=SIGNATURE",       
        "status": "Success"
    }
    }

Send Message to get Instantiated Model

Request the entire asset model with all the resource definitions.

image3

PUB tc/<tenantId>/<clientId>/o/amo_v4/m

    {
    "id": "<requestId>"
    }

Copy your model from request url and store it for update. Ensure that the model structure obtained from the URL is different from the model to be sent.

Sample
    {
      "id": "01HG86TSRC4WQFQARCEJ7X2MCN",
      "namespace": "614ac81f8997466d876b9f1aca3a4822",
      "typeModel": {
          "aspectTypes": [
              {
                  "id": "<tenantId>.windTurbineAspectType",
                  "name": "windTurbineAspectType",
                  "description": "Wind turbine properties of an device",
                  "category": "dynamic",
                  "referenceId": "01HG8FMBRWNTT3YB9QZNVXDPC4",
                  "variables": [
                      {
                          "name": "temperature",
                          "dataType": "DOUBLE",
                          "qualityCode": true,
                          "unit": null,
                          "searchable": true,
                          "length": null,
                          "defaultValue": null,
                          "referenceId": "01HG8FMBRX9A7J83119JS278S9"
                      }
                  ]
              }
          ],
          "assetTypes": [
              {
                  "id": "<tenantId>.windTurbineAssetType",
                  "name": "windTurbineAssetType",
                  "description": "Asset Type with wind turbine properties",
                  "parentTypeId": "core.basicasset",
                  "instantiable": true,
                  "variables": [],
                  "referenceId": "01HG8FMBRWAJ51DE8TX4RE1A3H",
                  "aspects": [
                      {
                          "name": "windTurbineAspect",
                          "aspectTypeId": "<tenantId>.windTurbineAspectType",
                          "referenceId": "01HG8FMBRWCDK1EV4PMAABCQD2"
                      }
                  ]
              }
          ]
      },
      "instanceModel": {
          "assets": [
              {
                  "name": "windTurbineAsset",
                  "typeId": "<tenantId>.windTurbineAssetType",
                  "description": "Asset with wind turbine properties",
                  "variables": [],
                  "referenceId": "01HG8FMBNSED80EKC9NA0XK97W"
              }
          ]
      },
      "mappingModel": {
          "mappings": [
              {
                  "aspectName": "windTurbineAspect",
                  "variableName": "temperature",
                  "dataPointId": "dataPoint1",
                  "assetReferenceId": "01HG8FMBNSED80EKC9NA0XK97W",
                  "assetId": "9083f518eac24a58a71cc4daea353414",
                  "referenceId": "01HG8FMBSW7RKBF10FJNQBPB0V"
              }
          ]
      }
  }

Add New Mappings to your Model via V4

You can add new resources to your model to instantiate automatically via Asset Modeller V4. New resource to be added can be any of the following resource types:

  • aspect types
  • aspect type variables
  • asset types
  • asset type aspects
  • asset instances
  • data point mappings.

PUB tc/<tenantId>/<clientId>/o/amo_v4/mi

For this example, let us add a new variable to the already existing aspect type and create a new mapping for that variable. Since the Asset Type and Assets created earlier are used, there is no need to resend them.

Model Instantiation Message Example:

Example
{
  "id": "<requestId>",
  "data": {
    "typeModel": {
      "aspectTypes": [
        {
          "id": "<tenantId>.windTurbineAspectType",
          "name": "windTurbineAspectType",
          "description": "Wind turbine properties of an device",
          "category": "dynamic",
          "referenceId": "01HG8FMBRWNTT3YB9QZNVXDPC4",
          "variables": [
            {
              "name": "addedVariable",
              "dataType": "DOUBLE",
              "qualityCode": true,
              "searchable": true,
              "referenceId": "addedVariableRefId"
            }
          ]
        }
      ],
      "assetTypes": [
      ]
    },
    "instanceModel": {
      "assets": [
      ]
    },
    "mappingModel": {
      "mappings": [
        {
          "aspectName": "windTurbineAspect",
          "variableName": "addedVariable",
          "dataPointId": "addedDataPoint",
          "assetReferenceId": "windTurbineAssetRefId",
          "referenceId": "addedDataPointRefId"
        }
      ]
    }
  }
}

image4

Check Newly added Mappings from UI

Check your newly added resources from Asset Manager UI.

image4


Last update: August 8, 2024

Except where otherwise noted, content on this site is licensed under the Development License Agreement.