Create and configure a model
12 min
a model defines the structure of a digital twin its static attribute placeholders, dynamic attribute fields, data transformations, topic expression parameters, and schema every instance you create from the model inherits that structure and supplies the values for a specific physical asset this topic shows you how to create a model and configure its attributes and schema also see configure transformations docid\ tbkp rlu3ocbdjcnjy4lq and configure parameters docid\ tsncjwvos5h4bxmoujicg topics before you begin before you create a model, ensure you have a scale or growth litmus license access to digital twins in litmus edge (le) an exported model json file if you plan to import a model instead of creating one a csv file of attributes if you plan to import static or dynamic attributes create a model you can create a model from scratch or import one from a json file exported from another le instance to create a new model navigate to digital twins > models click the create a model tile the create a model dialog appears click the type list and select a model type enter a name for the model optionally, enter a short description in the description field to use the litmus unified namespace ( uns) or unify cloud connector, select the uns enabled checkbox and select a uns connector from the drop down list the connector ensures that mqtt topic names conform to your unified namespace structure click add the new model tile appears in the models pane to import a model from the models pane, click the import model icon select the \<model name> json file click open optionally, click the upload image icon to add a picture that visually identifies the model model versions each model starts at version zero (v 0) the version increments each time you save the model the current version appears on the model tile and on the model configuration page instances track which model version they were created from, which matters when you use upgrade instances to push model changes to existing instances add static attributes static attributes hold fixed metadata such as manufacturer , plant , area , or device description you set placeholder values in the model and instances replace them with values for the assets they represent to add static attributes click the model tile to open the model configuration page from the static attributes tab, click add item in attribute name , select an existing attribute from the drop down list or enter a new name in attribute value , enter a placeholder value import static attributes you can import static attributes from a csv file this is useful when you have many attributes or want to populate several instances at once before importing, create a csv file with the following headers header description required modelname model the attributes belong to yes key attribute name yes value attribute value yes instancename sets attribute values on the named instance instead of on the model no to import static attributes navigate to static attributes and select import attributes click import/export attributes at the right and select sample csv navigate to the csv file and open it to export static attributes to a csv file for offline editing select the static attributes tab click export attributes asset hierarchy attributes when an instance is linked to an asset in asset hierarchy in litmus edge manager (lem), these additional read only static attributes display hierarchypath instance's location in the asset hierarchy (for example, acme europe greenfield plant 2 boiler boiler 01 ) hierarchymetadata a json object of key/value pairs describing levels in the hierarchy (for example, enterprise , region , site , plant , area ) lem sets and updates these values when the instance is added to, moved within, or deleted from the hierarchy add dynamic attributes dynamic attributes hold real time data for an asset, such as temperature readings, current values, and pressure each dynamic attribute is mapped to a data topic in an instance and the live data from that topic appears in the instance payload dynamic attributes support json, boolean, array, string, and number data types if you don't specify a data type, json applies each dynamic attribute can also reference a transformation schema to shape the data before it enters the payload to add a dynamic attribute click the add item icon enter a name for the attribute optionally, enter a value in unit and select a data type if the data type is json, optionally select skip key to exclude the attribute key from the payload while keeping its value for example, the value persists as value='20' without the key name optionally, define a topic expression using static strings and parameter placeholders in curly brackets for example devicehub alias {device} tagname the {device} part is resolved per instance based on the instance's parameter value for device optionally, select a transformation schema from the schemaid field click save model import and export dynamic attributes to import dynamic attributes to download the sample csv file, click import/export attributes at the right and select sample csv populate it with your attributes click the model tile and select the dynamic attributes tab click import attributes to export dynamic attributes to a csv file select the dynamic attributes tab click export attributes define the schema a schema groups static and dynamic attributes into a named hierarchy for downstream systems that expect a specific json structure to create a schema select the schema tab click the action menu icon for root and select add node add attributes to the schema using either method drag attributes from the left hand list onto the canvas under the appropriate category click the action menu for a category, select add item to node , then select the attribute click save model the schema tab also provides the following options export schema exports the current schema to a json file sync attributes appends all current attributes to the schema hierarchy the static attributes and dynamic attributes nodes are recreated if they already exist confirm the sync when prompted clear schema removes all nodes from the schema builder changes apply when you save the model apply model updates to instances existing instances do not inherit model changes automatically use upgrade instances to push the changes to selected instances to apply model updates click upgrade instances select the instances to upgrade click upgrade verify the model to confirm the model is configured correctly from the models pane, confirm the model tile appears with the name and version you expect open the model and confirm the attributes you added are listed on the static attributes and dynamic attributes tabs create an instance from the model and open its data access tab confirm the assembled json payload contains the attributes and structure you defined related topics digital twins docid\ xlj3gvozyg 52ue4pb5u7 configure transformations docid\ tbkp rlu3ocbdjcnjy4lq configure parameters docid\ tsncjwvos5h4bxmoujicg add an instance docid\ jzoth4t0hcrtrauusdryk model and instance actions docid\ hk0idxlg7zcoetajwcobo