Add an instance
10 min
an instance represents a specific asset (a machine, device, or line) created from a model when you add an instance, you select the model it inherits its structure from and then fill in the actual values the real world attribute data for that asset and the data topics that feed its dynamic attributes this topic shows you how to add an instance, configure its values and topics, and check the payload it publishes for the model an instance inherits from, see create and configure a model docid\ zpadx1lmme0f44v7r6v6q note also see digital twins docid\ xlj3gvozyg 52ue4pb5u7 for overview and background information before you begin before you add an instance, make sure you have a digital twins model to build the instance from the metadata values for the asset this instance represents, such as plant, area, and manufacturer the topics that feed the model's dynamic attributes devicehub tags, integration topics, or other message broker topics values for any parameters the model defines add an instance when you add an instance, you set a few key options that affect how data is published interval how often litmus edge assembles and publishes the full instance payload enter 0 to disable interval based publishing use the pollonce topic instead to trigger on demand flatten hierarchy converts nested json objects to single level, dot notation key value pairs (for example, dynamic attribute temperature value 30 ) enable this when sending payloads to tabular databases such as sql or influxdb publish attributes creates additional, targeted topics for individual static and dynamic attributes alongside the main instance topic enable this when downstream consumers need only part of the full payload see publish specific attributes docid\ jzoth4t0hcrtrauusdryk to add an instance navigate to digital twins > instances the instances pane appears click the add an instance tile the add an instance dialog appears search for or select the model to associate with this instance enter a name for the instance in interval , enter the publishing interval in seconds enter 0 to disable interval based publishing in topic , review the default topic for this instance the topic follows the format digitaltwins \<model name> \<instance name> to flatten nested json structures, select flatten hierarchy to publish individual attribute topics in addition to the main topic, select publish attributes click add configure the instance after creating the instance, select its tile in grid view to open the configuration page the instance inherits its attribute structure from the model here you fill in the real values and map live data topics click save after making changes, then click restart instance to apply them enter static attribute values the static attributes tab lists the metadata fields defined in the model, each holding the placeholder value the model set replace those placeholders with the actual values for this asset for example, replace the plant name, area, and manufacturer with the values for the specific machine this instance represents to enter values for an asset open the static attributes tab click the edit icon for an attribute enter the value for this asset repeat for each remaining attribute click save instance to set many values at once, click import attributes and open a csv file that contains them include the instancename column so that the import sets the values on this instance rather than on the model see create and configure a model docid\ zpadx1lmme0f44v7r6v6q for the required csv format map dynamic attributes the dynamic attributes tab lists the real time data fields defined in the model for each one, map the topic that feeds it for this asset a devicehub tag, an integration topic, or another message broker topic that publishes the relevant data if a dynamic attribute has a topic expression defined in the model, its topic is read only in the instance to change that topic, edit the topic expression in the model or set the instance's parameter values important data for a dynamic attribute appears in the instance payload only when that attribute has a topic mapped to it to map the topics for this asset open the dynamic attributes tab click edit for an attribute search for a devicehub tag, or enter the name of an integration topic or another message broker topic repeat for each remaining attribute click save instance to map many attributes at once, click import attributes and open a csv file that contains the topic mappings set parameter values a parameter lets one topic expression in the model resolve to a different topic in each instance to set the parameter values for this instance select the instance and click open parameters the instance parameters dialog appears set the value of each parameter for this instance navigate to the instance dynamic attributes page and confirm that each topic expression resolved to the topic you expect view the payload the data access tab shows the topic the instance publishes on and the assembled json payload it carries to view the payload open the data access tab the tab shows the instance topic and its interval the topic follows the format digitaltwins \<model name> \<instance name> click subscribe the payload appears as litmus edge assembles and publishes it to reuse the topic elsewhere, click the copy icon click unsubscribe to stop viewing the data publish specific attributes when publish attributes is enabled for an instance, litmus edge creates additional topics that publish subsets of the full payload static attributes publish all key value pairs to a single topic at the instance's configured interval digitaltwins \<model name> \<instance name> staticattributes dynamic attributes each publish to their own topic, event driven based on when new data arrives for that attribute digitaltwins \<model name> \<instance name> \<dynamic attribute name> example a model named cnc with an instance named cnc001 , an interval of 10 seconds, and dynamic attributes temperature , current , pressure , and power static attributes topic (publishes every 10 seconds) digitaltwins cnc cnc001 staticattributes temperature topic digitaltwins cnc cnc001 temperature current topic digitaltwins cnc cnc001 current pressure topic digitaltwins cnc cnc001 pressure power topic digitaltwins cnc cnc001 power to subscribe to these topics when adding or editing the instance, select publish attributes navigate to analytics > instances and add the datahub subscribe processor enter the topic for the attribute you want to subscribe to note you can use wildcards in these topics use an asterisk ( ) to match a single segment (model name or instance name), or a right angle bracket ( > ) to match everything after a given point examples digitaltwins cnc power subscribes to the power attribute for all cnc instances digitaltwins cnc cnc001 > subscribes to all attribute topics for cnc001 related topics digital twins docid\ xlj3gvozyg 52ue4pb5u7 create and configure a model docid\ zpadx1lmme0f44v7r6v6q configure transformations docid\ tbkp rlu3ocbdjcnjy4lq configure parameters docid\ tsncjwvos5h4bxmoujicg model and instance actions docid\ hk0idxlg7zcoetajwcobo