archetypal.template.schedule.DaySchedule
- class archetypal.template.schedule.DaySchedule(Name, Values, Category='Day', **kwargs)[source]
Superclass of UmiSchedule that handles daily schedules.
Initialize a DaySchedule object with parameters.
- Parameters
Values (list) – List of 24 values.
Name (str) – Name of the schedule.
Category (str) – category identification (default: “Day”).
**kwargs – Keywords passed to the
UmiSchedule
constructor.
- property all_values: numpy.ndarray
Return numpy array of schedule Values.
- classmethod from_epbunch(epbunch, strict=False, **kwargs)[source]
Create a DaySchedule from an EpBunch.
This method accepts “Schedule:Day:Hourly”, “Schedule:Day:List” and “Schedule:Day:Interval”.
- Parameters
epbunch (EpBunch) – The EpBunch object to construct a DaySchedule from.
**kwargs – Keywords passed to the
UmiSchedule
constructor. SeeUmiSchedule
for more details.
- classmethod from_values(Name, Values, Type='Fraction', **kwargs)[source]
Create a DaySchedule from an array of size (24,).
- Parameters
Name –
Values (array-like) – A list of values of length 24.
Type (str) – Schedule Type Limit name.
**kwargs – Keywords passed to the
UmiSchedule
constructor. SeeUmiSchedule
for more details.
- classmethod from_dict(data, **kwargs)[source]
Create a DaySchedule from a dictionary.
- Parameters
data (dict) – A python dictionary with the structure shown bellow.
**kwargs – keywords passed to parents constructors.
{ "$id": "67", "Category": "Day", "Type": "Fraction", "Values": [...], # 24 hourly values "Comments": "default", "DataSource": "default", "Name": "B_Res_D_Occ_WD" },
- mapping(validate=True)[source]
Get a dict based on the object properties, useful for dict repr.
- Parameters
validate (bool) – If True, try to validate object before returning the mapping.
- to_epbunch(idf)[source]
Convert self to an epbunch given an idf model.
- Parameters
idf (IDF) – An IDF model.
SCHEDULE:DAY:HOURLY, , !- Name , !- Schedule Type Limits Name 0, !- Hour 1 0, !- Hour 2 0, !- Hour 3 0, !- Hour 4 0, !- Hour 5 0, !- Hour 6 0, !- Hour 7 0, !- Hour 8 0, !- Hour 9 0, !- Hour 10 0, !- Hour 11 0, !- Hour 12 0, !- Hour 13 0, !- Hour 14 0, !- Hour 15 0, !- Hour 16 0, !- Hour 17 0, !- Hour 18 0, !- Hour 19 0, !- Hour 20 0, !- Hour 21 0, !- Hour 22 0, !- Hour 23 0; !- Hour 24
- Returns
The EpBunch object added to the idf model.
- Return type
EpBunch
- property Category
Get or set the Category attribute.
- property Comments
Get or set the object comments.
- property DataSource
Get or set the datasource of the object.
- property Name
Get or set the name of the schedule.
- property Type
Get or set the schedule type limits object. Can be None.
- property Values
Get or set the list of schedule values.
- property allow_duplicates
Get or set the use of duplicates [bool].
- combine(other, weights=None, quantity=None)
Combine two UmiSchedule objects together.
- Parameters
other (UmiSchedule) – The other Schedule object to combine with.
weights (list, dict or string) – Attribute of self and other containing the weight factor. If a list is passed, it must have len = 2; the first element is applied to self and the second element is applied to other. If a dict is passed, the self.Name and other.Name are the keys. If a str is passed, the
quantity (list or dict or bool) – Scalar value that will be multiplied by self before the averaging occurs. This ensures that the resulting schedule returns the correct integrated value. If a dict is passed, keys are schedules Names and values are quantities.
- Returns
the combined UmiSchedule object.
- Return type
- Raises
TypeError – if Quantity is not of type list, tuple, dict or a callable.
- classmethod constant_schedule(value=1, Name='AlwaysOn', Type='Fraction', **kwargs)
Create an UmiSchedule with a constant value at each timestep.
- Parameters
Type –
value (float) –
Name –
idf –
**kwargs –
- develop()
Develop the UmiSchedule into a Year-Week-Day schedule structure.
- extend(other, allow_duplicates)
Append other to self. Modify and return self.
- float_mean(other, attr, weights=None)
Calculates the average attribute value of two floats. Can provide weights.
- get_ref(ref)
Get item matching reference id.
- Parameters
ref –
- static get_schedule_type_limits_name(epbunch)
Return the Schedule Type Limits name associated to this schedule.
- property id
Get or set the id.
- property max
Get the maximum value of the schedule.
- property mean
Get the mean value of the schedule.
- property min
Get the minimum value of the schedule.
- plot(**kwargs)
Plot the schedule. Implements the .loc accessor on the series object.
Notes
Plotting can also be acheived through the series property: Schedule.series.plot().
Examples
>>> from archetypal import IDF >>> idf = IDF() >>> epbunch = idf.schedules_dict["NECB-A-Thermostat Setpoint-Heating"] >>> s = Schedule.from_epbunch(epbunch) >>> ) >>> s.plot(drawstyle="steps-post")
- Parameters
**kwargs (dict) – keyword arguments passed to
EnergySeries.plot()
.
- plot2d(**kwargs)
Plot the carpet plot of the schedule.Plot rectangular data as a color-encoded 2d-matrix.
- Parameters
periodlength (int) – The period length to show on the yaxis. By default, the period length will be calculated to represent one day of data on the yaxis and days on the xaxis.
vmin (float) – The data value that defines
0.0
in the normalization. Defaults to the min value of the dataset.vmax (float) – The data value that defines
1.0
in the normalization. Defaults to the the max value of the dataset.vcenter (float) – The data value that defines
0.5
in the normalization.axis_off (bool) – If True, no axis is plotted.
cmap (str or Colormap) – Colormap to select colors from. If string, load colormap with that name from matplotlib.
figsize (tuple) – Size of a figure object. A tuple (width, height) in inches.
show (bool) – whether to display the figure or not.
save (bool) – whether to save the figure to disk or not.
close (bool) – close the figure (only if show equals False) to prevent display.
dpi (int) – the resolution of the image file if saving (Dots per inch)
file_format (string) – the format of the file to save (e.g., ‘jpg’, ‘png’, ‘svg’).
colorbar (bool) – If True, plot the colorbar.
ax (Axes) – An axes of the current figure.
filename (string) – the name of the file to save.
extent (str or .Bbox) – Bounding box in inches: only the given portion of the figure is saved. If ‘tight’, try to figure out the tight bbox of the figure.
ylabel (str) – Set the label for the y-axis.
xlabel (str) – Set the label for the x-axis.
ax_title (bool or str) – Title to use for the ax. If True, the Series name is used.
**kwargs – Options to pass to matplotlib imshow method.
- Returns
tuple containing:
fig: is the Matplotlib Figure object ax: a single axis object.
- Return type
(tuple)
- property predecessors
Get or set the predecessors of self.
Of which objects is self made of. If from nothing else then self, return self.
- property quantity
Get or set the schedule quantity.
- classmethod random(Name='AlwaysOn', Type='Fraction', **kwargs)
Create an UmiSchedule with a randomized value (0-1) at each timestep.
- replace(new_values: pandas.core.series.Series)
Replace values with new values while keeping the full load hours constant.
Time steps that are not specified in new_values will be adjusted to keep the full load hours of the schedule constant. No check whether the new schedule stays between the bounds set by self.Type is done. Be aware.
- scale(diversity=0.1)
Scale the schedule values by a diversity factor around the average.
- property series
Return an
EnergySeries
.
- property startDate
Get the start date of the schedule. Satisfies startDayOfTheWeek.
- to_year_week_day()
Convert to three-tuple epbunch given an idf model.
Returns ‘Schedule:Year’, ‘Schedule:Week:Daily’ and ‘Schedule:Day:Hourly’ representations.
- Returns
3-element tuple containing
yearly (Schedule): The yearly schedule object
weekly (list of Schedule): The list of weekly schedule objects
daily (list of Schedule):The list of daily schedule objects
- validate()
Validate object and fill in missing values.