sailor.assetcentral.equipment
Retrieve Equipment information from AssetCentral.
Classes are provided for individual Equipment as well as groups of Equipment (EquipmentSet).
- class sailor.assetcentral.equipment.Equipment(ac_json)[source]
Bases:
AssetcentralEntity
AssetCentral Equipment Object.
- Parameters
ac_json (dict) –
- find_equipment_indicators(*, extended_filters=(), **kwargs)[source]
Find all Indicators assigned to this Equipment.
This method supports the common filter language explained at Filter Language.
- Parameters
extended_filters – See Filter Language.
**kwargs – See Filter Language.
- Return type
Example
Find all indicators with name ‘MyIndicator’ for equipment object ‘my_equipment’:
my_equipment.find_equipment_indicators(name='MyIndicator')
- find_failure_modes(*, extended_filters=(), **kwargs)[source]
Fetch the failure modes configured for the given equipment.
This method supports the common filter language explained at Filter Language.
- Parameters
extended_filters – See Filter Language.
**kwargs – See Filter Language.
- Return type
Examples
Find all failure modes with name ‘MyFailureMode’ for equipment object ‘my_equipment’:
my_equipment.find_failure_modes(name='MyFailureMode')
- find_notifications(*, extended_filters=(), **kwargs)[source]
Fetch notifications objects associated with this equipment.
This is a wrapper for
sailor.assetcentral.notification.find_notifications()
that limits the fetch query to this equipment.This method supports the common filter language explained at Filter Language.
- Parameters
extended_filters – See Filter Language.
**kwargs – See Filter Language.
- Return type
Example
Find all notifications for equipment object ‘my_equipment’:
my_equipment.find_notifications()
- find_workorders(*, extended_filters=(), **kwargs)[source]
Fetch workorder objects associated with this equipment.
This is a wrapper for
sailor.assetcentral.workorder.find_workorders()
that limits the fetch query to this equipment.This method supports the common filter language explained at Filter Language.
- Parameters
extended_filters – See Filter Language.
**kwargs – See Filter Language.
- Return type
Examples
Find all workorders for equipment object ‘my_equipment’:
my_equipment.find_workorders()
- classmethod get_available_properties()
Return the available properties for this class.
- get_indicator_data(start, end, indicator_set=None, *, timeout=None)[source]
Fetch timeseries data from SAP Internet of Things for Indicators attached to this equipment.
This is a wrapper for
sailor.sap_iot.fetch.get_indicator_data()
that limits the fetch query to this equipment. Note that filtering for the equipment can only be done locally, so calling this function repeatedly for different equipment with the same indicators can be very inefficient.- Parameters
start (Union[str, pd.Timestamp, datetime.timestamp, datetime.date]) – Date of beginning of requested timeseries data. Any time component will be ignored.
end (Union[str, pd.Timestamp, datetime.timestamp, datetime.date]) – Date of end of requested timeseries data. Any time component will be ignored
indicator_set (IndicatorSet) – IndicatorSet for which timeseries data is returned.
timeout (Union[str, pd.Timedelta, datetime.timedelta]) – Maximum amount of time the request may take. Can be specified as an ISO 8601 string (like PT2M for 2-minute duration) or as a pandas.Timedelta or datetime.timedelta object. If None, there is no time limit.
- Return type
Example
- Get indicator data for an equipment ‘my_equipment’ for a period from 01.06.2020 to 05.12.2020 ::
my_equipment = find_equipment(name=’my_equipment’)[0] my_equipment.get_indicator_data(‘2020-06-01’, ‘2020-12-05’)
Note
If indicator_set is not specified, all indicators associated to this equipment are used.
- property id
Return the ID of the object.
- class sailor.assetcentral.equipment.EquipmentSet(elements)[source]
Bases:
AssetcentralEntitySet
Class representing a group of Equipment.
- as_df(columns=None)
Return all information on the objects stored in the MasterDataEntitySet as a pandas dataframe.
columns
can be specified to select the columns (and their order) for the DataFrame.- Parameters
columns (Optional[Iterable[str]]) –
- filter(**kwargs)
Select a subset of the collection based on named filter criteria for the attributes of the elements.
All keyword arguments are concatenated as filters with OR operator, i.e., only one of the supplied filters must match for an entity to be selected.
Returns a new AssetcentralEntitySet object.
- Return type
MasterDataEntitySet
- find_common_indicators(*, extended_filters=(), **kwargs)[source]
Find all Indicators common to all Equipment in this EquipmentSet.
This method supports the common filter language explained at Filter Language.
- Parameters
extended_filters – See Filter Language.
**kwargs – See Filter Language.
- Return type
Example
Find all common indicators for an EquipmentSet ‘my_equipment_set’:
my_equipment_set.find_common_indicators().as_df()
Note
If all the Equipment in the set are derived from the same Model the overlap in Indicators is likely very high. If you get fewer indicators than expected from this method verify the uniformity of the Equipment included in this set.
- find_notifications(*, extended_filters=(), **kwargs)[source]
Find all Notifications for any of the equipment in this EquipmentSet.
- Parameters
extended_filters – See Filter Language.
**kwargs – See Filter Language.
- Return type
Examples
Get all notifications for the ‘equipment_set’ as a data frame:
equipment_set = find_equipment() equipment_set.find_notifications().as_df()
Get all Breakdown notifications (M2) for the ‘equipment_set’ as a data frame:
equipment_set.find_notifications(type = 'M2').as_df()
- find_workorders(*, extended_filters=(), **kwargs)[source]
Find all Workorders for any of the equipment in this EquipmentSet.
- Parameters
extended_filters – See Filter Language.
**kwargs – See Filter Language.
- Return type
Example
Find all workorders for an equipment set ‘my_equipment_set’:
my_equipment_set.find_workorders()
This method supports the common filter language explained at Filter Language.
- get_indicator_aggregates(start, end, indicator_set=None, aggregation_functions=('AVG',), aggregation_interval='PT2M')[source]
Fetch timeseries data from SAP Internet of Things for Indicators attached to all equipments in this set.
This is a wrapper for
sailor.sap_iot.fetch_aggregates.get_indicator_aggregates()
that limits the fetch query to this equipment set. Unlikesailor.assetcentral.equipment.Equipment.get_indicator_data()
this function retrieves pre-aggregated data from the hot store.- Parameters
start (Union[str, pd.Timestamp, datetime.timestamp, datetime.date]) – Date of beginning of requested timeseries data.
end (Union[str, pd.Timestamp, datetime.timestamp, datetime.date]) – Date of end of requested timeseries data.
indicator_set (IndicatorSet) – IndicatorSet for which timeseries data is returned. Defaults to indicators common to all equipment in this equipment set.
aggregation_functions (Determines which aggregates to retrieve. Possible aggregates are) – ‘MIN’, ‘MAX’, ‘AVG’, ‘STDDEV’, ‘SUM’, ‘FIRST’, ‘LAST’, ‘COUNT’, ‘PERCENT_GOOD’, ‘TMIN’, ‘TMAX’, ‘TFIRST’, ‘TLAST’
aggregation_interval (Determines the aggregation interval. Can be specified as an ISO 8601 string) – (like PT2M for 2-minute aggregates) or as a pandas.Timedelta or datetime.timedelta object.
- Return type
Example
Get indicator data for all Equipment belonging to the Model ‘MyModel’ for a period from 01.06.2020 to 05.12.2020
my_equipment_set = find_equipment(model_name='MyModel') my_equipment_set.get_indicator_aggregates('2020-06-01', '2020-12-05', aggregation_functions=['MIN'])
- get_indicator_data(start, end, indicator_set=None, *, timeout=None)[source]
Fetch timeseries data from SAP Internet of Things for Indicators attached to all equipments in this set.
This is a wrapper for
sailor.sap_iot.fetch.get_indicator_data()
that limits the fetch query to this equipment set.- Parameters
start (Union[str, pd.Timestamp, datetime.timestamp, datetime.date]) – Date of beginning of requested timeseries data. Any time component will be ignored.
end (Union[str, pd.Timestamp, datetime.timestamp, datetime.date]) – Date of end of requested timeseries data. Any time component will be ignored.
indicator_set (IndicatorSet) – IndicatorSet for which timeseries data is returned.
timeout (Union[str, pd.Timedelta, datetime.timedelta]) – Maximum amount of time the request may take. Can be specified as an ISO 8601 string (like PT2M for 2-minute duration) or as a pandas.Timedelta or datetime.timedelta object. If None, there is no time limit.
- Return type
Example
Get indicator data for all Equipment belonging to the Model ‘MyModel’ for a period from 01.06.2020 to 05.12.2020
my_equipment_set = find_equipment(model_name='MyModel') my_equipment_set.get_indicator_data('2020-06-01', '2020-12-05')
Note
If indicator_set is not specified, indicators common to all equipments in this set are used.
- plot_distribution(by=None, fill=None, dropna=False)
Plot the distribution of elements of a MasterDataEntitySet based on their properties.
This effectively creates a histogram with the number of elements per group on the y-axis, and the group (given by the by parameter) on the x-axis. Additionally, the fill colour of the bar can be used to distinguish a second dimension.
- sailor.assetcentral.equipment.find_equipment(*, extended_filters=(), **kwargs)[source]
Fetch Equipments from AssetCentral with the applied filters, return an EquipmentSet.
This method supports the common filter language explained at Filter Language.
- Parameters
extended_filters – See Filter Language.
**kwargs – See Filter Language.
- Return type
Examples
Find all Equipment with the name ‘MyEquipment’:
find_equipment(name='MyEquipment')
Find all Equipment which either have the name ‘MyEquipment’ or the name ‘MyOtherEquipment’:
find_equipment(name=['MyEquipment', 'MyOtherEquipment'])
Find all Equipment with the name ‘MyEquipment’ which are also located in ‘London’:
find_equipment(name='MyEquipment', location_name='London')
Find all Equipment installed between January 1, 2018 and January 1, 2019 in ‘London’:
find_equipment(extended_filters=['installationDate >= "2018-01-01"', 'installationDate < "2019-01-01"'], location_name='London')