data-structure
Introduction
Assets are individual instances of a blueprint that contain data (from a real asset or a virtual asset). Assets are always referencing to a base blueprint that provides the basic information about the asset. The asset also contains several other attributes that form a complete data structure. They are listed here:
id
(int, orNone
): ID of the asset (Altergo-specific)iot_data
(dict orNone
): A dictionary to handle the IoT Data for the asset. If the asset is virtual, the IoT Data is also virtual.serial_number
(str, orNone
): A unique identifier for the asset.model
(Model
, orNone
): Base blueprint from which the asset is instantiated.current_state
(CurrentState
, orNone
): Current State of the asset.tags
(list[Tag
], orNone
): List of tags associated with the asset.df
(DataFrame
): DataFrame associated for the asset. DataFrame can be placed in thedf
attribute in preparation for dispatching data to the platform. It is also the place where data is placed when the getAssetDataFrame method is called.dfList
(DataFrame
): Temporarily stores a list of dataframes when the getAssetDataFrame method is called.
The Model
attribute in the asset stores information about the model. The model itself is a datastructure that contains several attributes:
id
(int, optional): ID of the model (Altergo-specific)name
(int, optional): Name of the model.is_configurable
(bool, optional): Flag to indicate if the model is configurable.configuration_type
(str, optional): Type of configuration associated with the model.view_template
(ViewTemplate
, optional):ViewTemplate
associated with the model.category
(Category
, optional):Category
associated with the model.image
(Image
, optional):Image
associated with the model.configurations
(list ofConfiguration
, optional): List ofConfiguration
s associated with the model.parameters
(list ofParamter
, optional): List ofParameter
s associated with theModel
.- sensors (list of
Sensor
, optional): List ofSensor
s associated with the model. child_component_models
(list ofChildComponentModel
, optional): List ofChildComponentModel
s associated with the model.
Assets vs. Blueprints
Often, new users get confused with the difference between blueprints and assets. To make a clear distinction between the two, it is often useful to look at the concepts of Object Oriented Programming (OOP). In OOP, we have classes and objects. One class can have one or many object instantiations. In this analogy, blueprints are analogous to classes, and assets are analogous to objects. A key difference in the analogy is that assets reflect changes made to the blueprints. Thus, if a blueprint is modified, the changes are reflected across all assets instantiated from that blueprint.