archetypal.schedule.Schedule

class archetypal.schedule.Schedule(Name: str, start_day_of_the_week: FrozenSet[typing_extensions.Literal[0, 1, 2, 3, 4, 5, 6]] = 0, strict: bool = False, Type: Optional[Union[str, archetypal.schedule.ScheduleTypeLimits]] = None, Values: Optional[Union[List[Union[int, float]], numpy.ndarray]] = None, **kwargs)[source]

Class handling any EnergyPlus schedule object.

Initialize object.

Parameters
  • Name (str) – The schedule name in the idf model.

  • start_day_of_the_week (int) – 0-based day of week (Monday=0). Default is None which looks for the start day in the IDF model.

  • strict (bool) – if True, schedules that have the Field-Sets such as Holidays and CustomDay will raise an error if they are absent from the IDF file. If False, any missing qualifiers will be ignored.

  • Type (str, ScheduleTypeLimits) – This field contains a reference to the Schedule Type Limits object. If found in a list of Schedule Type Limits (see above), then the restrictions from the referenced object will be used to validate the current field values. If None, no validation will occur.

  • Values (ndarray) – A 24 or 8760 list of schedule values.

  • **kwargs

property Type

Get or set the schedule type limits object. Can be None.

property Values

Get or set the list of schedule values.

property Name

Get or set the name of the schedule.

classmethod from_values(Name: str, Values: List[Union[int, float]], Type: str = 'Fraction', **kwargs)[source]

Create a Schedule from a list of Values.

classmethod from_epbunch(epbunch, strict=False, Type=None, **kwargs)[source]

Create a Schedule from an epbunch.

Parameters
  • epbunch

  • strict

  • **kwargs

classmethod constant_schedule(value=1, Name='AlwaysOn', Type='Fraction', **kwargs)[source]

Initialize a schedule with a constant value for the whole year.

Defaults to a schedule with a value of 1, named ‘AlwaysOn’.

Parameters
  • value (float, optional) – The value for the constant schedule. Defaults to 1.

  • Name (str, optional) – The name of the schedule. Defaults to Always On.

  • **kwargs

property all_values: numpy.ndarray

Return numpy array of schedule Values.

property max

Get the maximum value of the schedule.

property min

Get the minimum value of the schedule.

property mean

Get the mean value of the schedule.

property series

Return an EnergySeries.

static get_schedule_type_limits_name(epbunch)[source]

Return the Schedule Type Limits name associated to this schedule.

property startDate

Get the start date of the schedule. Satisfies startDayOfTheWeek.

scale(diversity=0.1)[source]

Scale the schedule values by a diversity factor around the average.

replace(new_values: pandas.core.series.Series)[source]

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.

plot(**kwargs)[source]

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)[source]

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)

to_year_week_day()[source]

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

combine(other, weights=None, quantity=None)[source]

Combine two schedule objects together.

Parameters
  • other (Schedule) – the other Schedule object to combine with.

  • weights (list-like, optional) – A list-like object of len 2. If None, equal weights are used.

  • quantity – scalar value that will be multiplied by self before the averaging occurs. This ensures that the resulting schedule returns the correct integrated value.

Returns

the combined Schedule object.

Return type

(Schedule)