ScheduleModel
- class OBLib.ScheduleModel.ScheduleModel[source]
Bases:
OBLib.DeterministicModel.DeterministicModelThe ScheduleModel class.
This is a deterministic model which makes predictions based on a series of fixed ‘daily profiles’.
This is similar to the approach taken to specify schedules in many building simulation tools.
Code Example
>>> from OBLib import ScheduleModel >>> model=ScheduleModel() >>> model.inputs.set_timestamps(start=(2021,1,1), >>> freq='H', >>> periods=24*7) >>> model.inputs.all_days=[21] >>> result=model.run()
- property inputs
The model inputs. Access this object to change the model inputs.
Read-only property.
- Return type
- class OBLib.ScheduleModel.ScheduleInputs[source]
Bases:
OBLib.DeterministicModel.DeterministicInputsInputs to the
ScheduleModelclass.The inputs are formed of a series of ‘day profiles’.
A day profile is a list of numbers which represents the schedule for a day: For example:
[21] represents a constant value of 21 throughout the day.
[5,12,5] represents a value of 5 for the first 8 hours, followed by a value of 21 for the next 8 hours, with a final value of 8 for the remaining 8 hours.
[5]*8 + [12]*8 + [5]*8 represents the same profile as [5,12,5]
Day profile lists can be set to the following attributes. These attributes are applied in the order below when creating the final predicted values.
all_days: This day profile is applied to all days.weekdays: This day profile is applied to weekdays (Monday to Friday) only.weekends: This day profile is applied to weekends (Saturday and Sunday) only.
- property all_days
A day schedule to be applied to all days.
Default value is [np.nan].
Read/write property.
- set_timestamps(start=None, end=None, *args, **kwargs)
Convenience method to set the
timestampsproperty.- Parameters
The remaining input arguments here are passed to the
pandas.date_rangemethod. See the pandas documentation for details.Typcial inputs might be:
start=(2021,1,1,0,0) (i.e. 1st January 2021)
freq=’H’ (for hourly intervals)
periods=24 (to generate 1 day of hourly intervals)
- Return type
- property timestamps
The input timestamps. Model predictions will be made for each timestamp.
Read / write property.
- Return type
- property weekdays
A day schedule to be applied to weekdays (Monday to Friday).
Read/write property.
- class OBLib.ScheduleModel.ScheduleOutputs[source]
Bases:
OBLib.DeterministicModel.DeterministicOutputsOutputs of the
ScheduleModelclass.- property data
The model predictions.
Read-only property.
- Returns
A dictionary of the model results. Key-value pairs are: keys -> the name of the quantity or variable; values -> a list of the model predictions (this list aligns with the output timestamps).
- Return type
- property df
A Pandas dataframe of the timestamps and data.
Read-only property.
- Returns
A dataframe with: index -> timestamps; columns -> ‘data’ keys; values ->
datavalues.- Return type
- property timestamps
The outputs timestamps.
Read-only property.
- Return type