Attributes
Kanoa MES has two built-in methods for tracking custom data: Custom Attributes and Dynamic Attributes. Picking the right attribute type to use data boils down to whether or not you want to track when that property value changes and when.
Custom Attributes store static properties for an asset or an item. Every time you save or retrieve a custom attribute, you will edit or get the one value associated with that custom attribute. For example: the time zone of a site asset or the view-path of a manual entry screen for a line asset would be good candidates for an asset custom attribute.
Custom attributes are set in the asset configuration screen.
Dynamic Attributes track changing, or dynamic properties for an asset. Dynamic attribute data is stored as events with timestamps, and you can save and retrieve dynamic attribute data for a given point-in-time. For example: a line's working Crew Size could be a dynamic attribute, one which may change per shift or per run and you may want to report on the Crew Size at a specific time. Dynamic attributes are always linked to assets.
Dynamic Attributes
Defining and Linking Dynamic Attributes
Dynamic Attributes are defined and linked to assets in the Dynamic Attributes Configuration page (Configuration > Asset Management > Dynamic Attributes by default). Dynamic attributes are defined in the left-hand 'Attributes' list.
Use the button to open the Attribute editor. Here you can create or delete dynamic attributes and folders.
To link an asset with a dynamic attribute, select the dynamic attribute in the Attribute Settings pane and click the button. Use the button to add a data source, pick the asset and enable.
Attributes can be deleted by selecting an attribute and clicking the button. Click OK when the deletion confirmation popup opens.
If the value for the dynamic attribute can be pulled directly from an asset, configure the Data Source settings. To add a new data source, click the button on the left.
Use the Asset Selector and Tag Browser to select the tag. Scale Factor and Ignore zero values parameters are specific to tag collector values, scaling the PLC value and preventing the storage of zero values if not required. Use the Enabled checkbox to enable or disable a data source.
Viewing, Creating, and Editing Dynamic Attribute Events
Dynamic attribute events are used to establish the dynamic attribute value at a given time for a specific asset. Attribute events can be viewed and edited through the Attribute Events page (Ops > Operations > Attribute Events by default).
Use the provided filters to select an asset and a dynamic attribute associated with that asset, and a time-range for which you want to see Attribute Events. Qualified users can then change the values and timestamps of previously recorded attribute events, add new attribute events, or delete attribute events.
Note that this is often considered an 'Administrative' screen where qualified, trained users are manually updating or adding data. Dynamic Attributes are more accessible if incorporated into custom manual entry screens, as described in the sections below.
Dynamic Attributes in the Ignition Designer
Designing Manual Entry Screens using Kanoa Views
Dynamic attributes are commonly used to design custom manual entry screens. Kanoa has provided pre-made Views designed to be used as Ignition embedded views for users to quickly create their own manual entry screens using dynamic attributes. These screens can be found in the kanoa/mes/asset/attributes view folder.
There are two Views designed to support Dynamic Attribute data entry:
kanoa/mes/asset/attributes/dropdownSelector
Provides a drop-down menu which creates a dynamic attribute event for the provided attribute and asset. The timestamp for this event will be the time the value is changed.
View Parameters: { "value": { "assetId": 614, "attributeLabel": "Crew Size", "attributeName": "Crew Size", "dropdownList": [ { "label": 1, "value": 1 }, { "label": 2, "value": 2 }, { "label": 3, "value": 3 }, { "label": 4, "value": 4 } ], "userId": custom.security.userId } }
kanoa/mes/asset/attributes/textEntry
Provides a text field which creates a Dynamic attribute event for the provided attribute and asset. The timestamp for this event will be the time the value is changed.
View Parameters: { "assetId": 614, "attributeName": "Crew Size", "userId": custom.security.userId }
Accessing Dynamic Attribute data via the Kanoa API
Kanoa's dynamic attribute functions are found via the path system.kanoa.attribute.*.
Common use-cases include: Get the most recent dynamic attribute value for a given asset: attributeId = system.kanoa.utilities.getFieldValue('attributeId', system.kanoa.attribute.getAttributes({'attributeName': value['attributeName']}))
return system.kanoa.utilities.getFieldValue('value', system.kanoa.attribute.getPreviousAttributeEvent(value['assetId'], attributeId, system.date.now()))
Setting the value of a dynamic attribute for a given asset:
linkId = system.kanoa.attribute.getAttributeAssetLinks({'assetId': self.view.params.value.assetId, 'attributeName': self.view.params.value.attributeName})
if linkId is not None:
linkId = linkId[0]['attributeAssetLinkId']
system.kanoa.attribute.addAttributeEvent({'attributeAssetLinkId': linkId, 'value': 'Jane Doe', 'tStamp': system.date.now()}, userId)