ActivityLimits

Struct ActivityLimits 

Source
pub struct ActivityLimits {
    annual_limit: Option<RangeInclusive<Dimensionless>>,
    seasonal_limits: IndexMap<Season, RangeInclusive<Dimensionless>>,
    time_slice_limits: IndexMap<TimeSliceID, RangeInclusive<Dimensionless>>,
}
Expand description

Defines the activity limits for a process in a given region and year

Activity limits represent the minimum and maximum fraction of the potential annual activity that can be undertaken in each time slice, season, or the year as a whole. The limits stored and returned by this struct are dimensionless; to convert to actual activity limits for an asset, multiply by the capacity to activity factor of the process and the installed capacity of the asset. In other words, the limits stored and returned by this struct are the absolute limits on activity per 1/capacity_to_activity units of capacity.

All time slices must have an entry in self.time_slice_limits. If no specific availability limit is provided for a time slice, this will just represent the length of the time slice as a fraction of the year. Seasonal and annual limits may be stored if provided by the user, and only if they provide an extra level of constraint on top of the time slice limits.

Limits can be retrieved in three ways:

  • Retrieve the limit for a specific time slice using get_limit_for_time_slice().
  • Retrieve a limit for a specific time slice selection (time slice, season, or annual) using get_limit().
  • Retrieve all limits as an iterator using iter_limits(). Note: individual limits within this iterator cannot be relied upon, but the totality of these limits can be used to construct a set of constraints that ensures that all limits are respected.

Fields§

§annual_limit: Option<RangeInclusive<Dimensionless>>

Optional annual limit

§seasonal_limits: IndexMap<Season, RangeInclusive<Dimensionless>>

Optional limits for each season

§time_slice_limits: IndexMap<TimeSliceID, RangeInclusive<Dimensionless>>

Limits for each time slice (mandatory for all time slices)

Implementations§

Source§

impl ActivityLimits

Source

pub fn new_with_full_availability(time_slice_info: &TimeSliceInfo) -> Self

Create a new ActivityLimits with full availability for all time slices

Source

pub fn new_from_limits( limits: &HashMap<TimeSliceSelection, RangeInclusive<Dimensionless>>, time_slice_info: &TimeSliceInfo, ) -> Result<Self>

Create a new ActivityLimits from a map of limits for time slice selections

The limits provided here may be for individual time slices, seasons, or the entire year. Provided limits must reflect the fraction of potential annual activity available in the given time slice selection. In other words, these are the absolute limits on activity per 1/capacity_to_activity units of capacity.

It is not mandatory to provide any limits; if no limits are provided, full availability will be assumed for all time slices (limited only by time slice lengths). However, if limits are provided for any individual time slices, they must be provided for ALL time slices. Similarly, if limits are provided for any seasons, they must be provided for ALL seasons.

No calculations are done here to account for time slice lengths; this must be handled by the user when providing the limits. For example, a limit of 0..=0.1 for a time slice indicates that 10% of the potential annual activity can be undertaken in that time slice. If the time slice is 10% of the year, then this provides no additional constraint.

Checks are done to ensure that provided limits are compatible with each other. For example, a limit of “..0.01” for “winter” would be incompatible with a limit of “0.2..” for “winter.day” (i.e. if activity must be >0.2 in “winter.night”, then if cannot possibly be ≤0.01 in winter as a whole).

Source

pub fn add_time_slice_limit( &mut self, ts_id: TimeSliceID, limit: RangeInclusive<Dimensionless>, )

Add a limit for a specific time slice

Source

fn add_seasonal_limit( &mut self, season: Season, limit: RangeInclusive<Dimensionless>, ) -> Result<()>

Add a limit for a specific season

Source

fn add_annual_limit( &mut self, limit: RangeInclusive<Dimensionless>, ) -> Result<()>

Add an annual limit

Source

pub fn get_limit( &self, time_slice_selection: &TimeSliceSelection, ) -> RangeInclusive<Dimensionless>

Get the limit for a given time slice selection

Source

pub fn get_limit_for_time_slice( &self, time_slice: &TimeSliceID, ) -> RangeInclusive<Dimensionless>

Get the limit for a given time slice

Source

fn get_limit_for_season(&self, season: &Season) -> RangeInclusive<Dimensionless>

Get the limit for a given season

Source

fn get_limit_for_year(&self) -> RangeInclusive<Dimensionless>

Get the limit for the entire year

Source

pub fn iter_limits( &self, ) -> impl Iterator<Item = (TimeSliceSelection, &RangeInclusive<Dimensionless>)>

Iterate over all limits

This first iterates over all individual timeslice limits, followed by seasonal limits (if any), and finally the annual limit (if any).

Trait Implementations§

Source§

impl Clone for ActivityLimits

Source§

fn clone(&self) -> ActivityLimits

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for ActivityLimits

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl PartialEq for ActivityLimits

Source§

fn eq(&self, other: &ActivityLimits) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl StructuralPartialEq for ActivityLimits

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.