archetypal.template.UmiSchedule

class archetypal.template.UmiSchedule(Name, quantity=None, **kwargs)[source]

Class that handles Schedules.

Initialize object with parameters.

Parameters
  • Name

  • quantity

  • **kwargs

property quantity

Get or set the schedule quantity.

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

Create an UmiSchedule with a constant value at each timestep.

Parameters
  • Type

  • value (float) –

  • Name

  • idf

  • **kwargs

classmethod random(Name='AlwaysOn', Type='Fraction', **kwargs)[source]

Create an UmiSchedule with a randomized value (0-1) at each timestep.

Parameters
  • Name (str) – The name of the Schedule.

  • Type (str or ScheduleTypeLimits) –

  • **kwargs – keywords passed to the constructor.

classmethod from_values(Name, Values, Type='Fraction', **kwargs)[source]

Create an UmiSchedule from a list of values.

Parameters
  • Name (str) – The name of the Schedule.

  • Values (list) –

  • Type

  • **kwargs

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

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

(UmiSchedule)

Raises

TypeError – if Quantity is not of type list, tuple, dict or a callable.

develop()[source]

Develop the UmiSchedule into a Year-Week-Day schedule structure.

get_unique()[source]

Return the first of all the created objects that is equivalent to self.

to_dict()[source]

Return UmiSchedule dictionary representation.

Hint

UmiSchedule does not implement the to_dict method because it is not used when generating the json file. Only Year-Week- and DaySchedule classes are used.

to_ref()[source]

Return a ref pointer to self.

validate()[source]

Validate object and fill in missing values.

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.

get_ref(ref)[source]

Get item matching reference id.

Parameters

ref

duplicate()[source]

Get copy of self.

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 all_values: numpy.ndarray

Return numpy array of schedule Values.

property allow_duplicates

Get or set the use of duplicates [bool].

extend(other, allow_duplicates)

Append other to self. Modify and return self.

Parameters

other (UmiBase) –

Returns

self

Return type

UmiBase

float_mean(other, attr, weights=None)

Calculates the average attribute value of two floats. Can provide weights.

Parameters
  • other (UmiBase) – The other UmiBase object to calculate average value with.

  • attr (str) – The attribute of the UmiBase object.

  • weights (iterable, optional) – Weights of [self, other] to calculate weighted average.

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

Create a Schedule from an epbunch.

Parameters
  • epbunch

  • strict

  • **kwargs

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.

rename(name)

renames self as well as the cached object

Parameters

name (str) – the name.

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