Product Features
Digital Twins
Create and Import Models
24 min
a model is a template that contains static and dynamic attributes, data transformations, and schemas you create digital twin models and then create instances from the models when you create a model, you create a new model manually or from an import file deploy the model from litmus edge manager to your litmus edge instance configure the model by defining static and dynamic attributes, data transformations, and schemas you create digital twins models by navigating to digital twins > models see docid\ vdrp68hiwea7iylgo3ew7 for information on how to leverage digital twins note digital twins requires a scale or growth litmus license step 1 create the model you have two options for creating the model you can create a new model or import a model as a json file create a new model to create a new model navigate to digital twins the models pane appears from the models pane, click the create a model tile the create a model dialog appears click the type drop down list and select a model type enter the name of the model in the name field optionally, enter a short description of the model in the description field optionally, select the uns enabled checkbox and select a uns connector from the drop down menu click add a new model tile appears in the models pane import an existing model you can import a model as a json file to import an existing model, click the import model icon, select the \<model name> json file, and click open model versions when you create a model, the model version starts at v 0 the version number increments when you save the model the version number displays in the model tile model and instance configuration page step 2 configure the model after creating the model and defining a name, you can configure it with static and dynamic attributes and schema to represent your assets or data structures model image click the upload image icon to select an image for the model the image displays in the model tile on the models pane static attributes when you create static attributes, you define default attribute values as placeholders later, you change the default values in model instances for example, you might define manufacturer , device description , model and plant attributes and change the static attribute values later in instances manage the metadata for the model from the static attributes tab add static attributes if you need to filter existing attributes, you can use the search field to add static attributes from the static attributes tab, click the add item icon in the attribute name field, either select an attribute from the drop down list or enter a new attribute name in the attribute value field, enter a value for the attribute import static attributes before importing, create a csv file with the following headers, then add rows with attribute names and values required headers modelname key value optional headers instancename after creating the file navigate to static attributes , and select import attributes in the dialog your browser opens, navigate to and open the csv file export static attributes you can export all attributes to a csv file, modify them offline, and import them again to export a csv file with existing static attributes navigate to static attributes , and select export attributes attributes export to a csv file dynamic attributes next, define dynamic attributes that represent real time data for your asset dynamic attributes can be json, boolean, array, string, or number data types each dynamic attribute can have an associated transformation add dynamic attributes to add a dynamic attribute click the add item icon in the name field, enter a name for the attribute optionally, enter a value for unit and select a data type json applies if you do not specify a data type the skip key option is only available when the data type is json select skip key to exclude a specific attribute from the payload note that the value persists in the payload, for example, as value='20' optionally, define a topic expression consisting of static string values and parameters by surrounding the expression in curly brackets ( {} ) for example, devicehub alias {device} tagname optionally, i f you've created data transformation schemas, select one from the schemaid field if you need to filter existing attributes, you can use the search field import and export dynamic attributes to import dynamic attributes, download the sample csv file and populate it with your dynamic attributes after creating the file, click the model tile, navigate to dynamic attributes , and click the import attributes icon to export a csv file of existing dynamic attributes, click the export attributes icon transformations use transformations to convert the raw json data published on topics in the message broker to a desired format transformations apply to specific dynamic attributes and the resulting transformation is included in the full digital twins and publish attributes payloads transformations clean your data and make it easier for northbound systems to consume for example, create a transformation that eliminates duplicate timestamps and register ids in your payload transformations parse and transform the payload and specify a payload structure as the model inherits data see docid\ vdrp68hiwea7iylgo3ew7 for information on formatting transformations with transformations, you can create a json transformation that filters specific key value pairs for example, this transformation only includes the following attributes in the payload } “value“ “$value“, “timestamp“ “$timestamp“ } create a jsonata transformation to perform dynamic filtering https //docs jsonata org/overview\ html is a query language that allows logical conditions and computed outputs for example, use jsonata to create an alert when a temperature tag exceeds a high or low threshold value { "asset" devicename, "area" metadata area, "line" metadata line, "quality" success, "metric" "metric", "timestamp" $frommillis(1510067557121, '\[m01]/\[d01]/\[y0001] \[h#1] \[m01]\[p]'), "value" value } use a playground to test out your transformations before adding them to a model add the following system variables "$edge dt system time" , "$edge dt model version" , and "$edge dt model name" configure transformations to add a transformation schema click the transformation tab click the add a schema icon the add dialog appears enter a name for the schema select from json or jsonata from schema type drop down menu in the code window, copy and paste the json based or jsonata schema (optional) you can use the system variables in the code drawer experiment in a playground click add to edit or delete a schema, click the action menu for the schema and select an option apply the transformation to specific dynamic attributes configure parameters parameters are variables that you can insert into topic expressions parameters help you save time when defining instances that have many attributes for example, define a device parameter and add it as a topic expression for a dynamic variable with the following syntax devicehub alias {device} tagname then modify the value for the device parameter for each instance on the instance parameters configuration page note parameter names and values are case sensitive and cannot contain whitespaces allowed characters a z in lowercase and uppercase 0 9 hyphen ( ) and underscore ( ) characters to create a parameter navigate to the parameters tab and click add item enter a parameter name and a placeholder value click save row the new parameter saves add the parameter to a topic expression in this example, devicehub alias {device} temperature is added to the temperature attribute select an instance of the model and click open parameters in the instance parameters dialog, edit the value for the device navigate to the instance dynamic attributes page to see the topic defined for the dynamic attribute, based on your topic expression and parameter values note if a dynamic attribute has a topic expression defined, the topic for instances cannot be edited to change the dynamic attribute topic, you must edit the model or parameter values schema use the schema tab to create a custom data structure for the model to create a category for the schema click the action menu icon for root and select add node to add attributes to the schema, do one of the following drag and drop attributes from the left hand list to the canvas under the appropriate category click the action menu for a category and select add item to node then, select the attribute to add when you have configured the schema, click save model export schemas to export an existing schema to a csv file, click the export schema icon sync attributes to sync the existing schema click the sync attributes icon all attributes are appended to the current hierarchy if they exist, the static attributes and dynamic attributes nodes are recreated to confirm that you want to proceed, click yes clear schema to clear the schema builder tree, click clear schema c hanges apply when you save the model apply model updates to instances when you update your model, you can apply the changes to model instances to apply model updates click upgrade instances select the instances to upgrade and click upgrade