Skip to content

Commit

Permalink
Merge branch 'main' into fix-cost_om_annual_investment_fraction
Browse files Browse the repository at this point in the history
  • Loading branch information
brynpickering committed Aug 20, 2024
2 parents 3941491 + 4df903e commit 53b1766
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 11 deletions.
1 change: 1 addition & 0 deletions AUTHORS
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,4 @@ Francesco Lombardi, Politecnico di Milano <[email protected]>
Adriaan Hilbers, Imperial College London <[email protected]>
Jann Launer, TU Delft <[email protected]>
Ivan Ruiz Manuel, TU Delft <[email protected]>
Stefan Strömer, AIT Austrian Institute of Technology GmbH and TU Delft <[email protected]>
7 changes: 4 additions & 3 deletions src/calliope/backend/backend_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -1071,13 +1071,14 @@ def _get_variable_bound(
name,
f"Applying bound according to the {bound} parameter values.",
)
bound_array = self.get_parameter(bound).copy()
bound_array = self.get_parameter(bound)
fill_na = bound_array.attrs.get("default", fill_na)
references.add(bound)
else:
bound_array = xr.DataArray(bound)
bound_array.attrs = {}
return bound_array.fillna(fill_na)
filled_bound_array = bound_array.fillna(fill_na)
filled_bound_array.attrs = {}
return filled_bound_array

@contextmanager
def _datetime_as_string(self, data: xr.DataArray | xr.Dataset) -> Iterator:
Expand Down
4 changes: 2 additions & 2 deletions src/calliope/config/model_data_checks.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ fail:
- where: carrier_export and not any(carrier_out, over=nodes)
message: "Export carriers must be one of the technology outflow carriers."

- where: storage_initial>1
message: "storage_initial is a fraction; values larger than 1 are not allowed."
- where: storage_initial<0 OR storage_initial>1
message: "storage_initial is a fraction, requiring values within the interval [0, 1]."

- where: integer_dispatch=True AND NOT cap_method=integer
message: Cannot use the integer `integer_dispatch` unless the technology is using an integer unit capacities (`cap_method=integer`).
Expand Down
10 changes: 5 additions & 5 deletions src/calliope/config/model_def_schema.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -675,7 +675,7 @@ properties:
x-type: str
title: Sink unit
description: >-
Sets the unit of `Sink` to either `absolute` x-unit: energy), `per_area` x-unit: energy/area), or `per_cap` x-unit: energy/power).
Sets the unit of `Sink` to either `absolute` (unit: `energy`), `per_area` (unit: `energy/area`), or `per_cap` (unit: `energy/power`).
`per_area` uses the `area_use` decision variable to scale the sink while `per_cap` uses the `flow_cap` decision variable.
enum: [absolute, per_area, per_cap]

Expand All @@ -687,7 +687,7 @@ properties:
title: Minimum bound on sink.
description: >-
Minimum sink use to remove a carrier from the system (e.g., electricity demand, transport distance).
Unit dictated by `source_unit`.
Unit dictated by `sink_unit`.
sink_use_max:
$ref: "#/$defs/TechParamNullNumber"
Expand All @@ -697,7 +697,7 @@ properties:
title: Maximum bound on sink.
description: >-
Maximum sink use to remove a carrier from the system (e.g., electricity demand, transport distance).
Unit dictated by `source_unit`.
Unit dictated by `sink_unit`.
sink_use_equals:
$ref: "#/$defs/TechParamNullNumber"
Expand All @@ -707,7 +707,7 @@ properties:
title: Required sink use.
description: >-
Required amount of carrier removal from the system (e.g., electricity demand, transport distance).
Unit dictated by `source_unit`.
Unit dictated by `sink_unit`.
source_unit:
type: string
Expand All @@ -716,7 +716,7 @@ properties:
x-type: str
title: Source unit
description: >-
Sets the unit of `Source` to either `absolute` (e.g. kWh), `per_area` (e.g. kWh/m2), or `per_cap` (e.g. kWh/kW).
Sets the unit of `Source` to either `absolute` (unit: `energy`), `per_area` (unit: `energy/area`), or `per_cap` (unit: `energy/power`).
`per_area` uses the `area_use` decision variable to scale the source while `per_cap` uses the `flow_cap` decision variable.
enum: [absolute, per_area, per_cap]

Expand Down
4 changes: 3 additions & 1 deletion tests/test_backend_pyomo.py
Original file line number Diff line number Diff line change
Expand Up @@ -1605,7 +1605,9 @@ def test_storage_initial_fractional_value(self):

with pytest.raises(exceptions.ModelError) as error:
m.build()
assert check_error_or_warning(error, "values larger than 1 are not allowed")
assert check_error_or_warning(
error, "requiring values within the interval [0, 1]"
)


class TestNewBackend:
Expand Down

0 comments on commit 53b1766

Please sign in to comment.