pub struct TimeSliceInfo {
pub times_of_day: IndexSet<TimeOfDay>,
pub seasons: IndexMap<Season, Year>,
pub time_slices: IndexMap<TimeSliceID, Year>,
}Expand description
Information about the time slices in the simulation, including names and durations
Fields§
§times_of_day: IndexSet<TimeOfDay>Names of times of day (e.g. “evening”)
seasons: IndexMap<Season, Year>Names and fraction of year occupied by each season
time_slices: IndexMap<TimeSliceID, Year>The fraction of the year that this combination of season and time of day occupies
Implementations§
Source§impl TimeSliceInfo
impl TimeSliceInfo
Sourcepub fn get_time_slice_id_from_str(
&self,
time_slice: &str,
) -> Result<TimeSliceID>
pub fn get_time_slice_id_from_str( &self, time_slice: &str, ) -> Result<TimeSliceID>
Get the TimeSliceID corresponding to the time_slice.
time_slice must be in the form “season.time_of_day”.
Sourcepub fn get_selection(&self, time_slice: &str) -> Result<TimeSliceSelection>
pub fn get_selection(&self, time_slice: &str) -> Result<TimeSliceSelection>
Get a TimeSliceSelection from the specified string.
If the string is empty, the default value is TimeSliceSelection::Annual.
Sourcepub fn iter_ids(&self) -> Keys<'_, TimeSliceID, Year>
pub fn iter_ids(&self) -> Keys<'_, TimeSliceID, Year>
Iterate over all TimeSliceIDs
Sourcepub fn iter_seasons(&self) -> Keys<'_, Season, Year>
pub fn iter_seasons(&self) -> Keys<'_, Season, Year>
Iterate over all seasons
Sourcepub fn iter(&self) -> impl Iterator<Item = (&TimeSliceID, Year)>
pub fn iter(&self) -> impl Iterator<Item = (&TimeSliceID, Year)>
Iterate over all time slices
Sourcepub fn iter_selections_at_level(
&self,
level: TimeSliceLevel,
) -> Box<dyn Iterator<Item = TimeSliceSelection> + '_>
pub fn iter_selections_at_level( &self, level: TimeSliceLevel, ) -> Box<dyn Iterator<Item = TimeSliceSelection> + '_>
Iterate over the different time slice selections for a given time slice level.
For example, if TimeSliceLevel::Season is specified, this function will return an
iterator of TimeSliceSelections covering each season.
Sourcepub fn length_for_selection(
&self,
selection: &TimeSliceSelection,
) -> Result<Year>
pub fn length_for_selection( &self, selection: &TimeSliceSelection, ) -> Result<Year>
Calculate the total length of a selection of time slices.
Share a value between a subset of time slices in proportion to their lengths.
For instance, you could use this function to compute how demand is distributed between the different time slices of winter.
§Arguments
selection- A subset of time slicesvalue- The value to be shared between the time slices
§Returns
An iterator of time slices along with a fraction of value.
Trait Implementations§
Source§impl Debug for TimeSliceInfo
impl Debug for TimeSliceInfo
Source§impl Default for TimeSliceInfo
impl Default for TimeSliceInfo
Source§impl PartialEq for TimeSliceInfo
impl PartialEq for TimeSliceInfo
impl StructuralPartialEq for TimeSliceInfo
Auto Trait Implementations§
impl Freeze for TimeSliceInfo
impl RefUnwindSafe for TimeSliceInfo
impl !Send for TimeSliceInfo
impl !Sync for TimeSliceInfo
impl Unpin for TimeSliceInfo
impl UnwindSafe for TimeSliceInfo
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
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