Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 8 additions & 4 deletions oemoflex/facades.py
Original file line number Diff line number Diff line change
Expand Up @@ -127,15 +127,19 @@ def build_solph_components(self):

self.investment = Investment(
ep_costs=self.storage_capacity_cost,
maximum=getattr(self, "storage_capacity_potential", float("+inf")),
maximum=self._get_maximum_additional_invest(
"storage_capacity_potential", "storage_capacity"
),
minimum=getattr(self, "minimum_storage_capacity", 0),
existing=getattr(self, "storage_capacity", 0),
)

fi = Flow(
investment=Investment(
ep_costs=self.capacity_cost_charge,
maximum=getattr(self, "capacity_potential_charge", float("+inf")),
maximum=self._get_maximum_additional_invest(
"capacity_potential_charge", "capacity_charge"
),
existing=getattr(self, "capacity_charge", 0),
),
**self.input_parameters
Expand All @@ -144,8 +148,8 @@ def build_solph_components(self):
fo = Flow(
investment=Investment(
ep_costs=self.capacity_cost_discharge,
maximum=getattr(
self, "capacity_potential_discharge", float("+inf")
maximum=self._get_maximum_additional_invest(
"capacity_potential_discharge", "capacity_discharge"
),
existing=getattr(self, "capacity_discharge", 0),
),
Expand Down
119 changes: 119 additions & 0 deletions tests/_files/lp_files/asymmetric_storage_investment_brown_field.lp
Original file line number Diff line number Diff line change
@@ -0,0 +1,119 @@
\* Source Pyomo model name=Model *\

min
objective:
+1300 GenericInvestmentStorageBlock_invest(storage)
+130 InvestmentFlow_invest(electricity_storage)
+260 InvestmentFlow_invest(storage_electricity)

s.t.

c_e_Bus_balance(electricity_0)_:
-1 flow(electricity_storage_0)
+1 flow(storage_electricity_0)
= 0

c_e_Bus_balance(electricity_1)_:
-1 flow(electricity_storage_1)
+1 flow(storage_electricity_1)
= 0

c_e_Bus_balance(electricity_2)_:
-1 flow(electricity_storage_2)
+1 flow(storage_electricity_2)
= 0

c_u_InvestmentFlow_max(electricity_storage_0)_:
-1 InvestmentFlow_invest(electricity_storage)
+1 flow(electricity_storage_0)
<= 2

c_u_InvestmentFlow_max(electricity_storage_1)_:
-1 InvestmentFlow_invest(electricity_storage)
+1 flow(electricity_storage_1)
<= 2

c_u_InvestmentFlow_max(electricity_storage_2)_:
-1 InvestmentFlow_invest(electricity_storage)
+1 flow(electricity_storage_2)
<= 2

c_u_InvestmentFlow_max(storage_electricity_0)_:
-1 InvestmentFlow_invest(storage_electricity)
+1 flow(storage_electricity_0)
<= 3

c_u_InvestmentFlow_max(storage_electricity_1)_:
-1 InvestmentFlow_invest(storage_electricity)
+1 flow(storage_electricity_1)
<= 3

c_u_InvestmentFlow_max(storage_electricity_2)_:
-1 InvestmentFlow_invest(storage_electricity)
+1 flow(storage_electricity_2)
<= 3

c_u_GenericInvestmentStorageBlock_init_cap_limit(storage)_:
+1 GenericInvestmentStorageBlock_init_cap(storage)
-1 GenericInvestmentStorageBlock_invest(storage)
<= 6

c_e_GenericInvestmentStorageBlock_balance_first(storage)_:
+1 GenericInvestmentStorageBlock_capacity(storage_0)
-1 GenericInvestmentStorageBlock_init_cap(storage)
-0.90000000000000002 flow(electricity_storage_0)
+1.5625 flow(storage_electricity_0)
= 0

c_e_GenericInvestmentStorageBlock_balance(storage_1)_:
-1 GenericInvestmentStorageBlock_capacity(storage_0)
+1 GenericInvestmentStorageBlock_capacity(storage_1)
-0.90000000000000002 flow(electricity_storage_1)
+1.5625 flow(storage_electricity_1)
= 0

c_e_GenericInvestmentStorageBlock_balance(storage_2)_:
-1 GenericInvestmentStorageBlock_capacity(storage_1)
+1 GenericInvestmentStorageBlock_capacity(storage_2)
-0.90000000000000002 flow(electricity_storage_2)
+1.5625 flow(storage_electricity_2)
= 0

c_e_GenericInvestmentStorageBlock_balanced_cstr(storage)_:
+1 GenericInvestmentStorageBlock_capacity(storage_2)
-1 GenericInvestmentStorageBlock_init_cap(storage)
= 0

c_u_GenericInvestmentStorageBlock_max_capacity(storage_0)_:
+1 GenericInvestmentStorageBlock_capacity(storage_0)
-1 GenericInvestmentStorageBlock_invest(storage)
<= 6

c_u_GenericInvestmentStorageBlock_max_capacity(storage_1)_:
+1 GenericInvestmentStorageBlock_capacity(storage_1)
-1 GenericInvestmentStorageBlock_invest(storage)
<= 6

c_u_GenericInvestmentStorageBlock_max_capacity(storage_2)_:
+1 GenericInvestmentStorageBlock_capacity(storage_2)
-1 GenericInvestmentStorageBlock_invest(storage)
<= 6

c_e_ONE_VAR_CONSTANT:
ONE_VAR_CONSTANT = 1.0

bounds
0 <= flow(electricity_storage_0) <= +inf
0 <= flow(electricity_storage_1) <= +inf
0 <= flow(electricity_storage_2) <= +inf
0 <= flow(storage_electricity_0) <= +inf
0 <= flow(storage_electricity_1) <= +inf
0 <= flow(storage_electricity_2) <= +inf
0 <= InvestmentFlow_invest(electricity_storage) <= 3
0 <= InvestmentFlow_invest(storage_electricity) <= 4
0 <= GenericInvestmentStorageBlock_capacity(storage_0) <= +inf
0 <= GenericInvestmentStorageBlock_capacity(storage_1) <= +inf
0 <= GenericInvestmentStorageBlock_capacity(storage_2) <= +inf
0 <= GenericInvestmentStorageBlock_invest(storage) <= 4
0 <= GenericInvestmentStorageBlock_init_cap(storage) <= +inf
end
119 changes: 119 additions & 0 deletions tests/_files/lp_files/asymmetric_storage_investment_green_field.lp
Original file line number Diff line number Diff line change
@@ -0,0 +1,119 @@
\* Source Pyomo model name=Model *\

min
objective:
+1300 GenericInvestmentStorageBlock_invest(storage)
+130 InvestmentFlow_invest(electricity_storage)
+260 InvestmentFlow_invest(storage_electricity)

s.t.

c_e_Bus_balance(electricity_0)_:
-1 flow(electricity_storage_0)
+1 flow(storage_electricity_0)
= 0

c_e_Bus_balance(electricity_1)_:
-1 flow(electricity_storage_1)
+1 flow(storage_electricity_1)
= 0

c_e_Bus_balance(electricity_2)_:
-1 flow(electricity_storage_2)
+1 flow(storage_electricity_2)
= 0

c_u_InvestmentFlow_max(electricity_storage_0)_:
-1 InvestmentFlow_invest(electricity_storage)
+1 flow(electricity_storage_0)
<= 0

c_u_InvestmentFlow_max(electricity_storage_1)_:
-1 InvestmentFlow_invest(electricity_storage)
+1 flow(electricity_storage_1)
<= 0

c_u_InvestmentFlow_max(electricity_storage_2)_:
-1 InvestmentFlow_invest(electricity_storage)
+1 flow(electricity_storage_2)
<= 0

c_u_InvestmentFlow_max(storage_electricity_0)_:
-1 InvestmentFlow_invest(storage_electricity)
+1 flow(storage_electricity_0)
<= 0

c_u_InvestmentFlow_max(storage_electricity_1)_:
-1 InvestmentFlow_invest(storage_electricity)
+1 flow(storage_electricity_1)
<= 0

c_u_InvestmentFlow_max(storage_electricity_2)_:
-1 InvestmentFlow_invest(storage_electricity)
+1 flow(storage_electricity_2)
<= 0

c_u_GenericInvestmentStorageBlock_init_cap_limit(storage)_:
+1 GenericInvestmentStorageBlock_init_cap(storage)
-1 GenericInvestmentStorageBlock_invest(storage)
<= 0

c_e_GenericInvestmentStorageBlock_balance_first(storage)_:
+1 GenericInvestmentStorageBlock_capacity(storage_0)
-1 GenericInvestmentStorageBlock_init_cap(storage)
-0.90000000000000002 flow(electricity_storage_0)
+1.5625 flow(storage_electricity_0)
= 0

c_e_GenericInvestmentStorageBlock_balance(storage_1)_:
-1 GenericInvestmentStorageBlock_capacity(storage_0)
+1 GenericInvestmentStorageBlock_capacity(storage_1)
-0.90000000000000002 flow(electricity_storage_1)
+1.5625 flow(storage_electricity_1)
= 0

c_e_GenericInvestmentStorageBlock_balance(storage_2)_:
-1 GenericInvestmentStorageBlock_capacity(storage_1)
+1 GenericInvestmentStorageBlock_capacity(storage_2)
-0.90000000000000002 flow(electricity_storage_2)
+1.5625 flow(storage_electricity_2)
= 0

c_e_GenericInvestmentStorageBlock_balanced_cstr(storage)_:
+1 GenericInvestmentStorageBlock_capacity(storage_2)
-1 GenericInvestmentStorageBlock_init_cap(storage)
= 0

c_u_GenericInvestmentStorageBlock_max_capacity(storage_0)_:
+1 GenericInvestmentStorageBlock_capacity(storage_0)
-1 GenericInvestmentStorageBlock_invest(storage)
<= 0

c_u_GenericInvestmentStorageBlock_max_capacity(storage_1)_:
+1 GenericInvestmentStorageBlock_capacity(storage_1)
-1 GenericInvestmentStorageBlock_invest(storage)
<= 0

c_u_GenericInvestmentStorageBlock_max_capacity(storage_2)_:
+1 GenericInvestmentStorageBlock_capacity(storage_2)
-1 GenericInvestmentStorageBlock_invest(storage)
<= 0

c_e_ONE_VAR_CONSTANT:
ONE_VAR_CONSTANT = 1.0

bounds
0 <= flow(electricity_storage_0) <= +inf
0 <= flow(electricity_storage_1) <= +inf
0 <= flow(electricity_storage_2) <= +inf
0 <= flow(storage_electricity_0) <= +inf
0 <= flow(storage_electricity_1) <= +inf
0 <= flow(storage_electricity_2) <= +inf
0 <= InvestmentFlow_invest(electricity_storage) <= 5
0 <= InvestmentFlow_invest(storage_electricity) <= 7
0 <= GenericInvestmentStorageBlock_capacity(storage_0) <= +inf
0 <= GenericInvestmentStorageBlock_capacity(storage_1) <= +inf
0 <= GenericInvestmentStorageBlock_capacity(storage_2) <= +inf
0 <= GenericInvestmentStorageBlock_invest(storage) <= 10
0 <= GenericInvestmentStorageBlock_init_cap(storage) <= +inf
end
123 changes: 123 additions & 0 deletions tests/_files/lp_files/storage_investment_brown_field.lp
Original file line number Diff line number Diff line change
@@ -0,0 +1,123 @@
\* Source Pyomo model name=Model *\

min
objective:
+1300 GenericInvestmentStorageBlock_invest(storage)
+240 InvestmentFlow_invest(electricity_storage)

s.t.

c_e_Bus_balance(electricity_0)_:
-1 flow(electricity_storage_0)
+1 flow(storage_electricity_0)
= 0

c_e_Bus_balance(electricity_1)_:
-1 flow(electricity_storage_1)
+1 flow(storage_electricity_1)
= 0

c_e_Bus_balance(electricity_2)_:
-1 flow(electricity_storage_2)
+1 flow(storage_electricity_2)
= 0

c_u_InvestmentFlow_max(electricity_storage_0)_:
-1 InvestmentFlow_invest(electricity_storage)
+1 flow(electricity_storage_0)
<= 1

c_u_InvestmentFlow_max(electricity_storage_1)_:
-1 InvestmentFlow_invest(electricity_storage)
+1 flow(electricity_storage_1)
<= 1

c_u_InvestmentFlow_max(electricity_storage_2)_:
-1 InvestmentFlow_invest(electricity_storage)
+1 flow(electricity_storage_2)
<= 1

c_u_InvestmentFlow_max(storage_electricity_0)_:
-1 InvestmentFlow_invest(storage_electricity)
+1 flow(storage_electricity_0)
<= 1

c_u_InvestmentFlow_max(storage_electricity_1)_:
-1 InvestmentFlow_invest(storage_electricity)
+1 flow(storage_electricity_1)
<= 1

c_u_InvestmentFlow_max(storage_electricity_2)_:
-1 InvestmentFlow_invest(storage_electricity)
+1 flow(storage_electricity_2)
<= 1

c_u_GenericInvestmentStorageBlock_init_cap_limit(storage)_:
+1 GenericInvestmentStorageBlock_init_cap(storage)
-1 GenericInvestmentStorageBlock_invest(storage)
<= 2

c_e_GenericInvestmentStorageBlock_balance_first(storage)_:
+1 GenericInvestmentStorageBlock_capacity(storage_0)
-1 GenericInvestmentStorageBlock_init_cap(storage)
-0.90000000000000002 flow(electricity_storage_0)
+1.1111111111111112 flow(storage_electricity_0)
= 0

c_e_GenericInvestmentStorageBlock_balance(storage_1)_:
-1 GenericInvestmentStorageBlock_capacity(storage_0)
+1 GenericInvestmentStorageBlock_capacity(storage_1)
-0.90000000000000002 flow(electricity_storage_1)
+1.1111111111111112 flow(storage_electricity_1)
= 0

c_e_GenericInvestmentStorageBlock_balance(storage_2)_:
-1 GenericInvestmentStorageBlock_capacity(storage_1)
+1 GenericInvestmentStorageBlock_capacity(storage_2)
-0.90000000000000002 flow(electricity_storage_2)
+1.1111111111111112 flow(storage_electricity_2)
= 0

c_e_GenericInvestmentStorageBlock_balanced_cstr(storage)_:
+1 GenericInvestmentStorageBlock_capacity(storage_2)
-1 GenericInvestmentStorageBlock_init_cap(storage)
= 0

c_e_GenericInvestmentStorageBlock_power_coupled(storage)_:
-1 InvestmentFlow_invest(electricity_storage)
+1 InvestmentFlow_invest(storage_electricity)
= 0

c_u_GenericInvestmentStorageBlock_max_capacity(storage_0)_:
+1 GenericInvestmentStorageBlock_capacity(storage_0)
-1 GenericInvestmentStorageBlock_invest(storage)
<= 2

c_u_GenericInvestmentStorageBlock_max_capacity(storage_1)_:
+1 GenericInvestmentStorageBlock_capacity(storage_1)
-1 GenericInvestmentStorageBlock_invest(storage)
<= 2

c_u_GenericInvestmentStorageBlock_max_capacity(storage_2)_:
+1 GenericInvestmentStorageBlock_capacity(storage_2)
-1 GenericInvestmentStorageBlock_invest(storage)
<= 2

c_e_ONE_VAR_CONSTANT:
ONE_VAR_CONSTANT = 1.0

bounds
0 <= flow(electricity_storage_0) <= +inf
0 <= flow(electricity_storage_1) <= +inf
0 <= flow(electricity_storage_2) <= +inf
0 <= flow(storage_electricity_0) <= +inf
0 <= flow(storage_electricity_1) <= +inf
0 <= flow(storage_electricity_2) <= +inf
0 <= InvestmentFlow_invest(electricity_storage) <= 4
0 <= InvestmentFlow_invest(storage_electricity) <= +inf
0 <= GenericInvestmentStorageBlock_capacity(storage_0) <= +inf
0 <= GenericInvestmentStorageBlock_capacity(storage_1) <= +inf
0 <= GenericInvestmentStorageBlock_capacity(storage_2) <= +inf
0 <= GenericInvestmentStorageBlock_invest(storage) <= 8
0 <= GenericInvestmentStorageBlock_init_cap(storage) <= +inf
end
Loading