Skip to content

Commit 07f1f53

Browse files
authored
Merge pull request #955 from EnergySystemsModellingLab/fix-availability-lower-bound
Fix: If lower bound specified for availability, upper bound should be 1.0
2 parents 9f77d38 + e6a9c63 commit 07f1f53

1 file changed

Lines changed: 4 additions & 3 deletions

File tree

src/input/process/availability.rs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,10 @@ impl ProcessAvailabilityRaw {
4444
/// `capacity_to_activity` units of capacity.
4545
fn to_bounds(&self, ts_length: Year) -> RangeInclusive<Dimensionless> {
4646
// We know ts_length also represents a fraction of a year, so this is ok.
47-
let value = self.value * ts_length / Year(1.0);
47+
let ts_frac = ts_length / Year(1.0);
48+
let value = self.value * ts_frac;
4849
match self.limit_type {
49-
LimitType::LowerBound => value..=Dimensionless(f64::INFINITY),
50+
LimitType::LowerBound => value..=ts_frac,
5051
LimitType::UpperBound => Dimensionless(0.0)..=value,
5152
LimitType::Equality => value..=value,
5253
}
@@ -310,7 +311,7 @@ mod tests {
310311
// Lower bound
311312
let raw = create_process_availability_raw(LimitType::LowerBound, Dimensionless(0.5));
312313
let bounds = raw.to_bounds(ts_length);
313-
assert_eq!(bounds, Dimensionless(0.05)..=Dimensionless(f64::INFINITY));
314+
assert_eq!(bounds, Dimensionless(0.05)..=Dimensionless(0.1));
314315

315316
// Upper bound
316317
let raw = create_process_availability_raw(LimitType::UpperBound, Dimensionless(0.5));

0 commit comments

Comments
 (0)