Skip to content

Commit 8a89d22

Browse files
authored
Merge pull request #1212 from EnergySystemsModellingLab/prices_tidy
Tidy prices module
2 parents f346f05 + b6364c7 commit 8a89d22

3 files changed

Lines changed: 414 additions & 436 deletions

File tree

src/graph/validate.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,11 +68,11 @@ fn prepare_commodities_graph_for_validation(
6868
filtered_graph
6969
}
7070

71-
/// Checks if a process can be active for a particular timeslice in a given year and region
71+
/// Checks if a process can be active for a particular time slice in a given year and region
7272
///
7373
/// It considers all commission years that can lead to a running process in the target region and
7474
/// year, accounting for the process lifetime, and then checks if, for any of those, the process
75-
/// is active in the required timeslice. In other words, this checks if there is the _possibility_
75+
/// is active in the required time slice. In other words, this checks if there is the _possibility_
7676
/// of having an active process, although there is no guarantee of that happening since it depends
7777
/// on the investment.
7878
fn can_be_active(

src/process.rs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -290,7 +290,7 @@ impl ActivityLimits {
290290
let lower = *ts_limit.start();
291291
let mut upper = *ts_limit.end();
292292

293-
// If there's a seasonal/annual limit, we must cap the timeslice limit to ensure that it
293+
// If there's a seasonal/annual limit, we must cap the time slice limit to ensure that it
294294
// doesn't exceed the upper bound of the season/year
295295
if let Some(seasonal_limit) = self.seasonal_limits.get(&time_slice.season) {
296296
upper = upper.min(*seasonal_limit.end());
@@ -356,7 +356,7 @@ impl ActivityLimits {
356356

357357
/// Iterate over all limits
358358
///
359-
/// This first iterates over all individual timeslice limits, followed by seasonal limits (if
359+
/// This first iterates over all individual time slice limits, followed by seasonal limits (if
360360
/// any), and finally the annual limit (if any).
361361
pub fn iter_limits(
362362
&self,
@@ -1030,10 +1030,10 @@ mod tests {
10301030
fn new_with_full_availability(time_slice_info2: TimeSliceInfo) {
10311031
let limits = ActivityLimits::new_with_full_availability(&time_slice_info2);
10321032

1033-
// Each timeslice from the info should be present in the limits
1033+
// Each time slice from the info should be present in the limits
10341034
for (ts_id, ts_len) in time_slice_info2.iter() {
10351035
let l = limits.get_limit_for_time_slice(ts_id);
1036-
// Lower bound should be zero and upper bound equal to timeslice length
1036+
// Lower bound should be zero and upper bound equal to time slice length
10371037
assert_eq!(*l.start(), Dimensionless(0.0));
10381038
assert_eq!(*l.end(), Dimensionless(ts_len.value()));
10391039
}
@@ -1048,15 +1048,15 @@ mod tests {
10481048
fn new_from_limits_with_seasonal_limit_applied(time_slice_info2: TimeSliceInfo) {
10491049
let mut limits = HashMap::new();
10501050

1051-
// Set a seasonal upper limit that is stricter than the sum of timeslices
1051+
// Set a seasonal upper limit that is stricter than the sum of time slices
10521052
limits.insert(
10531053
TimeSliceSelection::Season("winter".into()),
10541054
Dimensionless(0.0)..=Dimensionless(0.01),
10551055
);
10561056

10571057
let result = ActivityLimits::new_from_limits(&limits, &time_slice_info2).unwrap();
10581058

1059-
// Each timeslice upper bound should be capped by the seasonal upper bound (0.01)
1059+
// Each time slice upper bound should be capped by the seasonal upper bound (0.01)
10601060
for (ts_id, _ts_len) in time_slice_info2.iter() {
10611061
let ts_limit = result.get_limit_for_time_slice(ts_id);
10621062
assert_eq!(*ts_limit.end(), Dimensionless(0.01));
@@ -1071,15 +1071,15 @@ mod tests {
10711071
fn new_from_limits_with_annual_limit_applied(time_slice_info2: TimeSliceInfo) {
10721072
let mut limits = HashMap::new();
10731073

1074-
// Set an annual upper limit that is stricter than the sum of timeslices
1074+
// Set an annual upper limit that is stricter than the sum of time slices
10751075
limits.insert(
10761076
TimeSliceSelection::Annual,
10771077
Dimensionless(0.0)..=Dimensionless(0.01),
10781078
);
10791079

10801080
let result = ActivityLimits::new_from_limits(&limits, &time_slice_info2).unwrap();
10811081

1082-
// Each timeslice upper bound should be capped by the annual upper bound (0.01)
1082+
// Each time slice upper bound should be capped by the annual upper bound (0.01)
10831083
for (ts_id, _ts_len) in time_slice_info2.iter() {
10841084
let ts_limit = result.get_limit_for_time_slice(ts_id);
10851085
assert_eq!(*ts_limit.end(), Dimensionless(0.01));
@@ -1098,7 +1098,7 @@ mod tests {
10981098
fn new_from_limits_missing_timeslices_error(time_slice_info2: TimeSliceInfo) {
10991099
let mut limits = HashMap::new();
11001100

1101-
// Add a single timeslice limit but do not provide limits for all timeslices
1101+
// Add a single time slice limit but do not provide limits for all time slices
11021102
let first_ts = time_slice_info2.iter().next().unwrap().0.clone();
11031103
limits.insert(
11041104
TimeSliceSelection::Single(first_ts),

0 commit comments

Comments
 (0)