pub struct TimeSliceInfo {
pub seasons: HashSet<Rc<str>>,
pub times_of_day: HashSet<Rc<str>>,
pub fractions: HashMap<TimeSliceID, f64>,
}
Expand description
Information about the time slices in the simulation, including names and fractions
Fields§
§seasons: HashSet<Rc<str>>
Names of seasons
times_of_day: HashSet<Rc<str>>
Names of times of day (e.g. “evening”)
fractions: HashMap<TimeSliceID, f64>
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) -> impl Iterator<Item = &TimeSliceID>
pub fn iter_ids(&self) -> impl Iterator<Item = &TimeSliceID>
Iterate over all TimeSliceID
s.
The order will be consistent each time this is called, but not every time the program is run.
Sourcepub fn iter(&self) -> impl Iterator<Item = (&TimeSliceID, f64)>
pub fn iter(&self) -> impl Iterator<Item = (&TimeSliceID, f64)>
Iterate over all time slices.
The order will be consistent each time this is called, but not every time the program is run.
Sourcepub fn iter_selection<'a>(
&'a self,
selection: &'a TimeSliceSelection,
) -> Box<dyn Iterator<Item = (&'a TimeSliceID, f64)> + 'a>
pub fn iter_selection<'a>( &'a self, selection: &'a TimeSliceSelection, ) -> Box<dyn Iterator<Item = (&'a TimeSliceID, f64)> + 'a>
Iterate over the subset of time slices indicated by selection
.
The order will be consistent each time this is called, but not every time the program is run.
Iterate over a subset of time slices calculating the relative duration of each.
The relative duration is specified as a fraction of the total time (proportion of year)
covered by selection
.
§Arguments
selection
- A subset of time slices
§Returns
An iterator of time slices along with the fraction of the total selection.
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