Skip to main content

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

Custom Attributes store static properties for an asset (and can also be set for material items). They can be set in the asset configuration screen or through scripting. An example use case for a custom attribute would be to store the asset name used by ERP to link the assets between different systems.

productionDay

Custom attributes are stored in the mes.assetAttr database table. They are linked to an assetId and store the value as a string. In this way, you can use a custom attribute to store whatever data type you want including dictionaries, you would just need to encode/decode it. In the case of storing a dictionary, use system.util.jsonEncode() / system.util.jsonDecode() system functions.


Reserved Custom Attributes

We use custom attributes throughout the Kanoa MES application to change behavior based on asset selection. Reserved custom attributes have an underscore at the beginning of them. You are welcome to use the reserved custom attributes to affect the behavior of the application in specific ways.

_ProductionDay

This reserved custom attribute allows you to customize what the date selector view returns for start and end times when an assetPath is provided to the date selector. This attribute can be set at any level of the asset tree and assets below it will adhere to it. Different times can be set for different assets. If no value is found for _ProductionDay, the date selector will default to midnight for the date range selected.

dateSelector

This reserved custom attribute value is stored as an encoded dictionary with key/value pairs of 'startTime' and 'EndTime'.

{'startTime': 0700, 'endTime': 1700}


_assetOpsInfoPanelViewPath

The left hand panel of the Operation Screen can be set to a custom view. By default, the 'kanoa/mes/asset/operation/assetInfoPanel' view is used for this panel. We also provide 'kanoa/mes/asset/operation/assetInfoPanelWorkCell' that was built for a line that has work cells underneath it.

productionDay

This reserved custom attribute value is stored as a string and expects the viewPath.


_assetOpsViewPath

The right hand panel of the Operation Screen can also be set to a custom view. By default, the 'kanoa/mes/asset/operation/defaultNav' view is used for this panel. We also provide 'kanoa/mes/asset/operation/assetOperationPanel' that provides for dashboards to be used to further customize what a user sees when selecting a specific asset.

This reserved custom attribute value is stored as a string and expects the viewPath.


_productionReportViewPath

When a value is found for this reserved custom attribute, a link to a custom production report view will be visible to the user when viewing a certain asset.

This reserved custom attribute value is stored as a string and expects the viewPath.


_runSetupViewPath

When an operator stats a production run from the Run Control screen, you can force a custom popup that requires the operator to perform certain actions prior to starting the run. Example might be checking off actions such as ensuring the print labeler has been set up.

productionDay

This reserved custom attribute value is stored as a string and expects the viewPath.


Dynamic Attributes

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 number of workers badging in and out of a line could be a dynamic attribute called 'Crew Size', allowing you to report on the crew size for a given time period. Dynamic attributes are always linked to assets.

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.

assets

Use the assets button to open the Attribute editor. Here you can create or delete dynamic attributes and folders.

assets

To link an asset with a dynamic attribute, select the dynamic attribute in the Attribute Settings pane and click the assets button. Use the assets button to add a data source, pick the asset and enable.

Attributes can be deleted by selecting an attribute and clicking the assets 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 assets 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.

assets


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).

assets

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.

assets

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)