schedule

Package

Modules

piecewise_linear_schedule_system module

class PiecewiseLinearScheduleSystem(**kwargs)[source]

Bases: PiecewiseLinearSystem, ScheduleSystem

A schedule system using piecewise linear interpolation.

This class combines functionality from PiecewiseLinearSystem and ScheduleSystem to create a scheduling system that interpolates between schedule points using piecewise linear functions. It supports different schedules for weekdays, weekends, and individual days of the week.

Parameters:

**kwargs – Keyword arguments passed to parent classes. Supported parameters include: - weekDayRulesetDict: Schedule rules for weekdays - weekendRulesetDict: Schedule rules for weekends - mondayRulesetDict: Schedule rules for Monday - tuesdayRulesetDict: Schedule rules for Tuesday - wednesdayRulesetDict: Schedule rules for Wednesday - thursdayRulesetDict: Schedule rules for Thursday - fridayRulesetDict: Schedule rules for Friday - saturdayRulesetDict: Schedule rules for Saturday - sundayRulesetDict: Schedule rules for Sunday - add_noise: Whether to add noise to schedule values

Key Components

  • Supports multiple schedule types (weekday, weekend, individual days)

  • Uses piecewise linear interpolation between schedule points

  • Configurable noise addition

  • Real-time schedule value calculation

do_step(secondTime, dateTime, step_size, stepIndex)[source]

Execute one time step of the schedule system.

Gets the schedule value for the current time, updates the interpolation points, and calculates the output value using piecewise linear interpolation.

Parameters:
  • secondTime (float) – Current simulation time in seconds.

  • dateTime (datetime) – Current simulation datetime.

  • step_size (int) – Time step size in seconds.

  • stepIndex (int) – Current simulation step index.

Return type:

None

property config: Dict[str, List[str]]

Get the configuration parameters.

Returns:

Dictionary containing configuration parameter names.

Return type:

Dict[str, List[str]]

property input: dict

Get the input ports of the piecewise linear schedule system.

Returns:

Dictionary containing input ports (configured dynamically)

Return type:

dict

property output: dict

Get the output ports of the piecewise linear schedule system.

Returns:

Dictionary containing output ports (configured dynamically)

Return type:

dict

sp = [<twin4build.translator.translator.SignaturePattern object>]
get_signature_pattern()[source]

Create a signature pattern for PiecewiseLinearScheduleSystem.

Returns:

Pattern matching Schedule core class with priority 0.

Return type:

SignaturePattern

schedule_system module

class ScheduleSystem(weekDayRulesetDict=None, weekendRulesetDict=None, mondayRulesetDict=None, tuesdayRulesetDict=None, wednesdayRulesetDict=None, thursdayRulesetDict=None, fridayRulesetDict=None, saturdayRulesetDict=None, sundayRulesetDict=None, add_noise=False, useSpreadsheet=False, useDatabase=False, filename=None, datecolumn=0, valuecolumn=1, uuid=None, name=None, dbconfig=None, **kwargs)[source]

Bases: System

A system that either 1) generates a schedule value based on rulesets defined for different weekdays and times or 2) reads a schedule value from a spreadsheet or database.

This system provides a flexible way to create and apply different schedules for various days of the week. It supports both spreadsheet-based and database-based input methods.

Parameters:
  • weekDayRulesetDict (Optional[dict]) – A dictionary of rulesets for weekdays.

  • weekendRulesetDict (Optional[dict]) – A dictionary of rulesets for weekends.

  • mondayRulesetDict (Optional[dict]) – A dictionary of rulesets for Mondays.

  • tuesdayRulesetDict (Optional[dict]) – A dictionary of rulesets for Tuesdays.

  • wednesdayRulesetDict (Optional[dict]) – A dictionary of rulesets for Wednesdays.

  • thursdayRulesetDict (Optional[dict]) – A dictionary of rulesets for Thursdays.

  • fridayRulesetDict (Optional[dict]) – A dictionary of rulesets for Fridays.

  • saturdayRulesetDict (Optional[dict]) – A dictionary of rulesets for Saturdays.

  • sundayRulesetDict (Optional[dict]) – A dictionary of rulesets for Sundays.

  • add_noise (bool) – A boolean to add noise to the schedule value.

  • useSpreadsheet (bool) – A boolean to use a spreadsheet to read the schedule value.

  • useDatabase (bool) – A boolean to use a database to read the schedule value.

  • filename (Optional[str]) – The filename of the spreadsheet to read the schedule value.

  • datecolumn (int) – The column index of the date in the spreadsheet.

  • valuecolumn (int) – The column index of the value in the spreadsheet.

  • uuid (Optional[str]) – The uuid of the database to read the schedule value.

  • name (Optional[str]) – The name of the database to read the schedule value.

  • dbconfig (Optional[dict]) – The configuration of the database to read the schedule value.

do_step(secondTime, dateTime, step_size, stepIndex)[source]

simulates a schedule and calculates the schedule value based on rulesets defined for different weekdays and times. It also adds noise and bias to the calculated value.

Return type:

None

get_schedule_value(dateTime)[source]
initialize(start_time, end_time, step_size, simulator)[source]

Initialize the system.

Parameters:
  • start_time (datetime.datetime) – The start time of the simulation.

  • end_time (datetime.datetime) – The end time of the simulation.

  • step_size (int) – The step size of the simulation in seconds.

  • simulator (core.Simulator) – The simulator.

Return type:

None

validate(p)[source]
property config
sp = [<twin4build.translator.translator.SignaturePattern object>]
get_signature_pattern()[source]