---
title: Create and Import Models
slug: litmusedge-v2/product-features/digital-twins/create-and-import-models
description: Learn how to create and import digital twins models. 
docTags: 
createdAt: 2022-09-08T19:10:53.000Z
---

:::hint{type="info"}
**Note**: To access the Digital Twins feature, you need a Scale or Growth Litmus license.&#x20;
:::

You can create Digital Twins models by navigating to **Digital Twins** > **Models**.&#x20;

See [Use Digital Twins to Contextualize Data](docId\:JfTh4HofYGQaCaiMxlodu) to review how to leverage Digital Twins.&#x20;

# Step 1: Create Model

You have two options for creating the model. You can create a new model or import a model as a JSON file.&#x20;

## Create a  New Model

**To create a new model:**

1. Navigate to **Digital Twins**.&#x20;
   The *Models&#x20;*&#x70;ane appears.&#x20;
2. From the *Models&#x20;*&#x70;ane, click the **Create a model&#x20;**&#x74;ile.&#x20;
   The *Create a Model* dialog box appears.
   ::Image[]{src="https://api.archbee.com/api/optimize/SSUUxKZUk9bFTEPNn_6Zo/RgVgMbkVf98fnibVlKx5M_createmodel.png" size="80" width="1266" height="482" caption="The Create a Model tile" position="center" showCaption="true"}
3. Click the **Type** drop-down list and select a model type.
4. Enter the name of the model in the **Name** field.
5. (Optional) Enter a short description of the model in the **Description** field.
6. (Optional) If applicable, select the **UNS Enabled checkbox** and select a UNS connector from the drop-down menu.&#x20;
7. Click **Add**.****
   A new model tile appears in the *Models&#x20;*&#x70;ane.

## Import an Existing Model

You can import a model as a JSON file.

To import an existing model, click th&#x65;**&#x20;Import Model** icon, select the `<model name>.json` file, and click **Open**.&#x20;

::Image[]{src="https://api.archbee.com/api/optimize/SSUUxKZUk9bFTEPNn_6Zo/LAj9ItVAwnDjSPV0mYRoF_image.png" size="80" width="1920" height="482" caption="Import Model icon" position="center" showCaption="true"}

## Model Versions

When you create a model, the model version starts at v.0. When you save the model, the version number is updated.

:::hint{type="info"}
**Note:&#x20;**&#x59;ou can identify models sourced from Litmus Edge Manager with a flag.
:::

For Litmus Edge version 3.11.1 and later, the version number is also displayed in the model and instance configuration.&#x20;

::Image[]{src="https://api.archbee.com/api/optimize/SSUUxKZUk9bFTEPNn_6Zo/ykav22cg5JaoDGVX2LkeM_image.png" size="80" width="1276" height="804" position="center" showCaption="false"}

## Implement Model Updates to Instances

If there are changes to the model that need to be implemented in associated instances, click **Upgrade Instances**.&#x20;

::Image[]{src="https://api.archbee.com/api/optimize/SSUUxKZUk9bFTEPNn_6Zo/l6lqT8nXUCoV2H_1Bo6Av_image.png" size="80" width="1276" height="804" position="center" showCaption="false"}

Then, select the instances to upgrade and click **Upgrade**.&#x20;

::Image[]{src="https://api.archbee.com/api/optimize/SSUUxKZUk9bFTEPNn_6Zo/5Os84oYFEY-0PBcVVZtf1_image.png" size="40" width="557" height="388" position="center" caption="Model Changed dialog" showCaption="true"}

:::hint{type="info"}
**Note**: You have the option to update models with instances and select which instances to update as well.&#x20;
:::

# Step 2: Configure Model

After creating the model, you can configure it appropriately for instances.&#x20;

Click the **Model tile** (grid view) or **Model name** (table view) to view the model details.&#x20;

## Model Image

Click th&#x65;**&#x20;Upload image** icon to select an image for the model. The image will display for the model tile on the *Models* pane.&#x20;

::Image[]{src="https://api.archbee.com/api/optimize/SSUUxKZUk9bFTEPNn_6Zo/DEQ6AjyYcjo6HsHs6wEX2_image.png" size="80" width="1277" height="841" position="center" showCaption="false"}

## Static Attributes

Manage the metadata for the model from the *Static Attributes* tab.&#x20;

:::hint{type="info"}
**Note**: You can create up to 2000 static attributes.&#x20;
:::

### Manually Add Static Attributes

**To add static attributes:**

1. Click the **Model tile** (grid view) or **Model name** (table view) to open the model details.
2. From the *Static Attributes* tab, click th&#x65;**&#x20;Add item** icon.
   ::Image[]{src="https://api.archbee.com/api/optimize/SSUUxKZUk9bFTEPNn_6Zo/qRvZqvLUt7kiZWOwlMKIW_image.png" size="70" width="1276" height="741" position="center" showCaption="false"}
3. In the **Attribute Name** field, either select an item from the drop-down list or enter a custom attribute name.
   ::Image[]{src="https://api.archbee.com/api/optimize/SSUUxKZUk9bFTEPNn_6Zo/N0H8t8wv5EuOnwUwNnrmo_image.png" size="80" width="1277" height="807" position="center" showCaption="false"}
4. In the **Attribute Value** field, enter a value for the model.&#x20;
5. When done adding attributes, click **Save Model**.&#x20;

![](https://api.archbee.com/api/optimize/SSUUxKZUk9bFTEPNn_6Zo/bU5KpVnnqIzVVO8CdKnwO_image.png)

If you need to filter existing attributes, you can use the search field.&#x20;

### Import Static Attributes

To import static attributes, create a CSV file with the following headers.&#x20;

**Required Headers**

- ModelName
- Key
- Value

**Optional Headers**

- InstanceName

After creating the file, click the model tile, navigate to **Static Attributes**, and click the **Import Attributes** icon.&#x20;

![](https://api.archbee.com/api/optimize/SSUUxKZUk9bFTEPNn_6Zo/2laxtLye4n9xS15IE7Tar_image.png)

### Export Static Attributes

To export a CSV file of existing static attributes, click the **Export Attributes** icon.&#x20;

![](https://api.archbee.com/api/optimize/SSUUxKZUk9bFTEPNn_6Zo/OAwIv9XiP4W7MCie7GESH_image.png)

## Transformations

Use the *Transformation&#x20;*&#x74;ab to transform the data collected in instances by converting raw JSON data to a desired format by defining the JSON-based schema.&#x20;

You can define schema IDs, which can be used to manipulate the payload and define a structure for the payload as the model inherits data.&#x20;

See [Use Digital Twins to Contextualize Data](docId\:JfTh4HofYGQaCaiMxlodu) to review how to format transformations.

:::hint{type="info"}
**Note:&#x20;**&#x4C;itmus Edge versions 3.16.1 and above use **JSONPath&#x20;**&#x73;yntax. Incorrect syntax will return `NULL` values. You can see examples of nested keys in [Digital Twin guide](docId\:JfTh4HofYGQaCaiMxlodu).&#x20;
:::

:::hint{type="info"}
**Note**: If you update a transformation and remove all elements from the schema, the entire NATS message will be included in any dynamic attribute that has the transformation selected for the *Schema ID*.
:::

### Arrays

You can configure arrays in transformations.&#x20;

For example:

```json
{
  "key": [
    "$timestamp",
    "$value",
    "$metadata",
    {
      "key2": "$timestamp",
      "key3": "$value",
      "key4": "$metadata"
    }
  ],
  "key5 new": "$timestamp"
}
```

### Configure Transformations

**To add a transformation schema:**

1. Click the **Model tile** (grid view) or **Model name** (table view) to open the model details.&#x20;
2. Click the **Transformation&#x20;**&#x74;ab.&#x20;
3. Click the **Add a Schema** icon.
   The *Add&#x20;*&#x64;ialog box appears.
   ::Image[]{src="https://api.archbee.com/api/optimize/SSUUxKZUk9bFTEPNn_6Zo/EIrP3Y5HwVzc8oGTK3Z2N_image.png" size="80" width="1277" height="602" position="center" showCaption="false"}
4. Enter a name for the schema.&#x20;
5. Select from **JSON&#x20;**&#x66;rom *Schema Type* drop-down menu.
6. In the code window, copy and paste the JSON-based schema.&#x20;
7. (Optional) You can use the *System Variables&#x20;*&#x69;n the code drawer.
8. Click **Add**.
9. When done adding attributes, click **Save Model**.&#x20;

![](https://api.archbee.com/api/optimize/SSUUxKZUk9bFTEPNn_6Zo/HS0Azvt0qrTpE9p_Pbgg5_image.png)

To edit or delete a schema, click the **Action menu** for the schema and select an option.&#x20;

![](https://api.archbee.com/api/optimize/SSUUxKZUk9bFTEPNn_6Zo/AZjj0404qT6twuQpILYOO_image.png)

## Dynamic Attributes

Manage variable data in the model from the *Dynamic Attributes* tab. You have the option of adding a schema ID, which can be used to map dynamic attributes one-to-one for data transformation.&#x20;

:::hint{type="info"}
**Note**: You can create up to 2000 dynamic attributes. &#x20;
:::

### Manually Add Dynamic Attributes

**To add a dynamic attribute:**

1. Click the **Add item** icon.
   ::Image[]{src="https://api.archbee.com/api/optimize/SSUUxKZUk9bFTEPNn_6Zo/tdOhZhK6LJ6fegKGIp7S8_image.png" size="80" width="1277" height="454" position="center" showCaption="false"}
2. In the **Name&#x20;**&#x66;ield, enter a name for the attribute.&#x20;
3. (Optional) Enter a value for **Unit&#x20;**&#x61;nd select a **Data Type**.
4. The **Skip Key&#x20;**&#x6F;ption is only available when the *Data Type&#x20;*&#x69;s set to JSON.&#x20;
5. (Optional) If you've created data transformation schemas, select one from the **SchemaID&#x20;**&#x66;ield.&#x20;
6. When done adding attributes, click **Save Model**.&#x20;

![](https://api.archbee.com/api/optimize/SSUUxKZUk9bFTEPNn_6Zo/Rirgb5fwOwwHHEyAUljfY_image.png)

If you need to filter existing attributes, you can use the search field.&#x20;

![](https://api.archbee.com/api/optimize/SSUUxKZUk9bFTEPNn_6Zo/8X4gojz2yaC7fJBNaG5Jq_image.png)

### Import/Export Dynamic Attributes

To import dynamic attributes, create a CSV file with the following headers.&#x20;

**Required Headers**

- ModelName
- SchemaID

**&#x20;Optional Headers**

- InstanceName
- Topic
- Name
- Unit
- DataType

After creating the file, click the model tile, navigate to **Dynamic Attributes**, and click the **Import Attributes** icon.&#x20;

To export a CSV file of existing dynamic attributes, click the **Export Attributes** icon.&#x20;

![](https://api.archbee.com/api/optimize/SSUUxKZUk9bFTEPNn_6Zo/L5fIpkJ-UWov1tSWhBRah_image.png)

:::hint{type="success"}
**Note:&#x20;**&#x43;heck the Sample CSV here.

::File{src="https://api.archbee.com/api/presign/Q116WJTAr1sefeVNvMCF9-V_QXvCRithqA_YF2hjBmw-20250505-190948.csv" label="dynamic-attributes-sample.csv"}
:::

## Schema

Use the *Schema&#x20;*&#x74;ab to create a custom data structure for the model.&#x20;

:::hint{type="info"}
**Note**: Clicking the **Save Model** button will increment the version number, even if no changes are made.
:::

![](https://api.archbee.com/api/optimize/SSUUxKZUk9bFTEPNn_6Zo/lwuguKlSBXurwXu_ibW28_image.png)

To create a category for the schema, click the **Action menu** icon for *root&#x20;*&#x61;nd select **Add Node**.&#x20;

![](https://api.archbee.com/api/optimize/SSUUxKZUk9bFTEPNn_6Zo/TVIBE3N7d7WJ-AT2fIszf_image.png)

To add attributes to the schema, do one of the following:&#x20;

- Drag and drop attributes from the left-hand list to the canvas under the appropriate category.&#x20;
- Click the **Action menu** for a category and select **Add item to Node**. Then, select the attribute to add.

When done configuring the schema, click **Save Model**.&#x20;

![](https://api.archbee.com/api/optimize/SSUUxKZUk9bFTEPNn_6Zo/DPfal6J4rZZmzZv41Xfuk_image.png)

### Import Schemas

![](https://api.archbee.com/api/optimize/SSUUxKZUk9bFTEPNn_6Zo/EVS-LeVQ22cuaCXqurzwO_image.png)

To import a CSV file of a schema, create a CSV file with the following headers:

- ID
- ModelID
- Position: Enter the position of the attribute in the schema.&#x20;
- ParentID: If the attribute is under a node/category, enter the ParentID of the node. To get the ParentID, create a new node, export the schema, and then refer to the **ParentID&#x20;**&#x63;olumn.&#x20;
- Name: The name of the attribute.&#x20;
- IsFolder: If it is an attribute, the value is **FALSE**. If it is a node, the value is **TRUE**.&#x20;
- AttributeID
- AttributeType

### Export Schemas

To export a CSV file of an existing schema, click the **Export Schema&#x20;**&#x69;con.&#x20;

### Sync Attributes

To sync  the existing schema, click the **Sync Attributes&#x20;**&#x69;con.&#x20;

All attributes will be appended to the current hierarchy. If they exist, the *static\_attributes&#x20;*&#x61;nd *dynamic\_attributes&#x20;*&#x6E;odes will be recreated.&#x20;

If you wish to proceed, then click **Yes**.

![](https://api.archbee.com/api/optimize/SSUUxKZUk9bFTEPNn_6Zo/5L_p8--grreqVNxolbwMa_image.png)

### Clear Schema

To clear the schema builder tree, click the **Clear Schema&#x20;**&#x69;con. The model must be saved for the changes to take effect.

![](https://api.archbee.com/api/optimize/SSUUxKZUk9bFTEPNn_6Zo/-RBn8nyJY0HQeFhDSYSdf_image.png)



