reV.losses.scheduled.SingleOutageScheduler

class SingleOutageScheduler(outage, scheduler)[source]

Bases: object

A scheduler for a single outage.

Given information about a single type of outage, this class facilitates the (randomized) scheduling of all requested instances of the outage. See SingleOutageScheduler.calculate() for specific details about the scheduling process.

outage

The user-provided Outage containing info about the outage to be scheduled.

Type:

Outage

scheduler

A scheduler object that keeps track of the total hourly losses from the input outage as well as any other outages it has already scheduled.

Type:

OutageScheduler

can_schedule_more

A boolean array (of length 8760) indicating wether or not more losses can be scheduled for a given hour. This is specific to the input outage only.

Type:

np.array

Warning

It is possible that not all outages input by the user can be scheduled. This can happen when there is not enough time allowed for all of the input outages. To avoid this issue, always be sure to allow a large enough month range for long outages that take up a big portion of the farm and try to allow outage overlap whenever possible.

See also

OutageScheduler

Scheduler for multiple outages.

Outage

Specifications for a single outage.

Parameters:
  • outage (Outage) – An outage object containing info about the outage to be scheduled.

  • scheduler (OutageScheduler) – A scheduler object that keeps track of the total hourly losses from the input outage as well as any other outages it has already scheduled.

Methods

calculate()

Calculate losses from stochastically scheduled outages.

find_random_outage_slice([seed])

Find a random slot of time for this type of outage.

schedule_losses(outage_slice)

Schedule the input outage during the given slice of time.

update_when_can_schedule()

Update can_schedule_more using OutageScheduler.

update_when_can_schedule_from_months()

Update can_schedule_more using Outage.allowed_months.

Attributes

MAX_ITER

Max number of extra attempts to schedule outages.

MAX_ITER = 10000

Max number of extra attempts to schedule outages.

calculate()[source]

Calculate losses from stochastically scheduled outages.

This function attempts to schedule outages according to the specification provided in the Outage input. Specifically, it checks the available hours based on the main Scheduler (which may have other outages already scheduled) and attempts to randomly add new outages with the specified duration and percent of losses. The function terminates when the desired number of outages (specified by Outage.count) have been successfully scheduled, or when the number of attempts exceeds MAX_ITER + Outage.count.

Warns:

reVLossesWarning – If the number of requested outages could not be scheduled.

update_when_can_schedule_from_months()[source]

Update can_schedule_more using Outage.allowed_months.

This function sets the can_schedule_more bool array to True for all of the months in Outage.allowed_months.

update_when_can_schedule()[source]

Update can_schedule_more using OutageScheduler.

This function sets the can_schedule_more bool array to True wherever OutageScheduler.can_schedule_more is also True and wherever the losses from this outage would not cause the OutageScheduler.total_losses to exceed 100%.

find_random_outage_slice(seed=None)[source]

Find a random slot of time for this type of outage.

This function randomly selects a starting time for this outage given the allowed times in can_schedule_more. It does not verify that the outage can be scheduled for the entire requested duration.

Parameters:

seed (int, optional) – Integer used to seed the np.random.choice() call. If None, seed is not used.

Returns:

slice – A slice corresponding to the random slot of time for this type of outage.

schedule_losses(outage_slice)[source]

Schedule the input outage during the given slice of time.

Given a slice in the hourly loss array, add the losses from this outage (which is equivalent to scheduling them).

Parameters:

outage_slice (slice) – A slice corresponding to the slot of time to schedule this outage.