diff --git a/src/oemof/solph/flows/_non_convex_flow_block.py b/src/oemof/solph/flows/_non_convex_flow_block.py index aa1cf457c..88eb76850 100644 --- a/src/oemof/solph/flows/_non_convex_flow_block.py +++ b/src/oemof/solph/flows/_non_convex_flow_block.py @@ -325,24 +325,13 @@ def _startup_costs(self): if self.STARTUPFLOWS: m = self.parent_block() - if m.es.periods is None: - for i, o in self.STARTUPFLOWS: - if m.flows[i, o].nonconvex.startup_costs[0] is not None: - startup_costs += sum( - self.startup[i, o, t] - * m.flows[i, o].nonconvex.startup_costs[t] - for t in m.TIMESTEPS - ) - else: - for i, o in self.STARTUPFLOWS: - if m.flows[i, o].nonconvex.startup_costs[0] is not None: - startup_costs += sum( - self.startup[i, o, t] - * m.flows[i, o].nonconvex.startup_costs[t] - * m.objective_weighting[t] - * ((1 + m.discount_rate) ** -m.es.periods_years[p]) - for p, t in m.TIMEINDEX - ) + for i, o in self.STARTUPFLOWS: + if m.flows[i, o].nonconvex.startup_costs[0] is not None: + startup_costs += sum( + self.startup[i, o, t] + * m.flows[i, o].nonconvex.startup_costs[t] + for t in m.TIMESTEPS + ) self.startup_costs = Expression(expr=startup_costs) @@ -359,24 +348,13 @@ def _shutdown_costs(self): if self.SHUTDOWNFLOWS: m = self.parent_block() - if m.es.periods is None: - for i, o in self.SHUTDOWNFLOWS: - if m.flows[i, o].nonconvex.shutdown_costs[0] is not None: - shutdown_costs += sum( - self.shutdown[i, o, t] - * m.flows[i, o].nonconvex.shutdown_costs[t] - for t in m.TIMESTEPS - ) - else: - for i, o in self.SHUTDOWNFLOWS: - if m.flows[i, o].nonconvex.shutdown_costs[0] is not None: - shutdown_costs += sum( - self.shutdown[i, o, t] - * m.flows[i, o].nonconvex.shutdown_costs[t] - * m.objective_weighting[t] - * ((1 + m.discount_rate) ** -m.es.periods_years[p]) - for p, t in m.TIMEINDEX - ) + for i, o in self.SHUTDOWNFLOWS: + if m.flows[i, o].nonconvex.shutdown_costs[0] is not None: + shutdown_costs += sum( + self.shutdown[i, o, t] + * m.flows[i, o].nonconvex.shutdown_costs[t] + for t in m.TIMESTEPS + ) self.shutdown_costs = Expression(expr=shutdown_costs) @@ -393,24 +371,13 @@ def _activity_costs(self): if self.ACTIVITYCOSTFLOWS: m = self.parent_block() - if m.es.periods is None: - for i, o in self.ACTIVITYCOSTFLOWS: - if m.flows[i, o].nonconvex.activity_costs[0] is not None: - activity_costs += sum( - self.status[i, o, t] - * m.flows[i, o].nonconvex.activity_costs[t] - for t in m.TIMESTEPS - ) - else: - for i, o in self.ACTIVITYCOSTFLOWS: - if m.flows[i, o].nonconvex.activity_costs[0] is not None: - activity_costs += sum( - self.status[i, o, t] - * m.flows[i, o].nonconvex.activity_costs[t] - * m.objective_weighting[t] - * ((1 + m.discount_rate) ** -m.es.periods_years[p]) - for p, t in m.TIMEINDEX - ) + for i, o in self.ACTIVITYCOSTFLOWS: + if m.flows[i, o].nonconvex.activity_costs[0] is not None: + activity_costs += sum( + self.status[i, o, t] + * m.flows[i, o].nonconvex.activity_costs[t] + for t in m.TIMESTEPS + ) self.activity_costs = Expression(expr=activity_costs) @@ -427,24 +394,13 @@ def _inactivity_costs(self): if self.INACTIVITYCOSTFLOWS: m = self.parent_block() - if m.es.periods is None: - for i, o in self.INACTIVITYCOSTFLOWS: - if m.flows[i, o].nonconvex.inactivity_costs[0] is not None: - inactivity_costs += sum( - (1 - self.status[i, o, t]) - * m.flows[i, o].nonconvex.inactivity_costs[t] - for t in m.TIMESTEPS - ) - else: - for i, o in self.INACTIVITYCOSTFLOWS: - if m.flows[i, o].nonconvex.inactivity_costs[0] is not None: - inactivity_costs += sum( - (1 - self.status[i, o, t]) - * m.flows[i, o].nonconvex.inactivity_costs[t] - * m.objective_weighting[t] - * ((1 + m.discount_rate) ** -m.es.periods_years[p]) - for p, t in m.TIMEINDEX - ) + for i, o in self.INACTIVITYCOSTFLOWS: + if m.flows[i, o].nonconvex.inactivity_costs[0] is not None: + inactivity_costs += sum( + (1 - self.status[i, o, t]) + * m.flows[i, o].nonconvex.inactivity_costs[t] + for t in m.TIMESTEPS + ) self.inactivity_costs = Expression(expr=inactivity_costs) diff --git a/tests/lp_files/activity_costs_multi_period.lp b/tests/lp_files/activity_costs_multi_period.lp deleted file mode 100644 index ee364020e..000000000 --- a/tests/lp_files/activity_costs_multi_period.lp +++ /dev/null @@ -1,160 +0,0 @@ -\* Source Pyomo model name=Model *\ - -min -objective: -+10 flow(cheap_plant_activity_costs_Bus_C_0) -+10 flow(cheap_plant_activity_costs_Bus_C_1) -+9.80392156862745 flow(cheap_plant_activity_costs_Bus_C_2) -+9.80392156862745 flow(cheap_plant_activity_costs_Bus_C_3) -+9.611687812379854 flow(cheap_plant_activity_costs_Bus_C_4) -+9.611687812379854 flow(cheap_plant_activity_costs_Bus_C_5) -+2 NonConvexFlowBlock_status(cheap_plant_activity_costs_Bus_C_0) -+2 NonConvexFlowBlock_status(cheap_plant_activity_costs_Bus_C_1) -+1.9607843137254901 NonConvexFlowBlock_status(cheap_plant_activity_costs_Bus_C_2) -+1.9607843137254901 NonConvexFlowBlock_status(cheap_plant_activity_costs_Bus_C_3) -+1.9223375624759707 NonConvexFlowBlock_status(cheap_plant_activity_costs_Bus_C_4) -+1.9223375624759707 NonConvexFlowBlock_status(cheap_plant_activity_costs_Bus_C_5) - -s.t. - -c_e_BusBlock_balance(Bus_C_0)_: -+1 flow(cheap_plant_activity_costs_Bus_C_0) -= 0 - -c_e_BusBlock_balance(Bus_C_1)_: -+1 flow(cheap_plant_activity_costs_Bus_C_1) -= 0 - -c_e_BusBlock_balance(Bus_C_2)_: -+1 flow(cheap_plant_activity_costs_Bus_C_2) -= 0 - -c_e_BusBlock_balance(Bus_C_3)_: -+1 flow(cheap_plant_activity_costs_Bus_C_3) -= 0 - -c_e_BusBlock_balance(Bus_C_4)_: -+1 flow(cheap_plant_activity_costs_Bus_C_4) -= 0 - -c_e_BusBlock_balance(Bus_C_5)_: -+1 flow(cheap_plant_activity_costs_Bus_C_5) -= 0 - -c_e_NonConvexFlowBlock_status_nominal_constraint(cheap_plant_activity_costs_Bus_C_0)_: --10 NonConvexFlowBlock_status(cheap_plant_activity_costs_Bus_C_0) -+1 NonConvexFlowBlock_status_nominal(cheap_plant_activity_costs_Bus_C_0) -= 0 - -c_e_NonConvexFlowBlock_status_nominal_constraint(cheap_plant_activity_costs_Bus_C_1)_: --10 NonConvexFlowBlock_status(cheap_plant_activity_costs_Bus_C_1) -+1 NonConvexFlowBlock_status_nominal(cheap_plant_activity_costs_Bus_C_1) -= 0 - -c_e_NonConvexFlowBlock_status_nominal_constraint(cheap_plant_activity_costs_Bus_C_2)_: --10 NonConvexFlowBlock_status(cheap_plant_activity_costs_Bus_C_2) -+1 NonConvexFlowBlock_status_nominal(cheap_plant_activity_costs_Bus_C_2) -= 0 - -c_e_NonConvexFlowBlock_status_nominal_constraint(cheap_plant_activity_costs_Bus_C_3)_: --10 NonConvexFlowBlock_status(cheap_plant_activity_costs_Bus_C_3) -+1 NonConvexFlowBlock_status_nominal(cheap_plant_activity_costs_Bus_C_3) -= 0 - -c_e_NonConvexFlowBlock_status_nominal_constraint(cheap_plant_activity_costs_Bus_C_4)_: --10 NonConvexFlowBlock_status(cheap_plant_activity_costs_Bus_C_4) -+1 NonConvexFlowBlock_status_nominal(cheap_plant_activity_costs_Bus_C_4) -= 0 - -c_e_NonConvexFlowBlock_status_nominal_constraint(cheap_plant_activity_costs_Bus_C_5)_: --10 NonConvexFlowBlock_status(cheap_plant_activity_costs_Bus_C_5) -+1 NonConvexFlowBlock_status_nominal(cheap_plant_activity_costs_Bus_C_5) -= 0 - -c_u_NonConvexFlowBlock_min(cheap_plant_activity_costs_Bus_C_0)_: --1 flow(cheap_plant_activity_costs_Bus_C_0) -+0.5 NonConvexFlowBlock_status_nominal(cheap_plant_activity_costs_Bus_C_0) -<= 0 - -c_u_NonConvexFlowBlock_min(cheap_plant_activity_costs_Bus_C_1)_: --1 flow(cheap_plant_activity_costs_Bus_C_1) -+0.5 NonConvexFlowBlock_status_nominal(cheap_plant_activity_costs_Bus_C_1) -<= 0 - -c_u_NonConvexFlowBlock_min(cheap_plant_activity_costs_Bus_C_2)_: --1 flow(cheap_plant_activity_costs_Bus_C_2) -+0.5 NonConvexFlowBlock_status_nominal(cheap_plant_activity_costs_Bus_C_2) -<= 0 - -c_u_NonConvexFlowBlock_min(cheap_plant_activity_costs_Bus_C_3)_: --1 flow(cheap_plant_activity_costs_Bus_C_3) -+0.5 NonConvexFlowBlock_status_nominal(cheap_plant_activity_costs_Bus_C_3) -<= 0 - -c_u_NonConvexFlowBlock_min(cheap_plant_activity_costs_Bus_C_4)_: --1 flow(cheap_plant_activity_costs_Bus_C_4) -+0.5 NonConvexFlowBlock_status_nominal(cheap_plant_activity_costs_Bus_C_4) -<= 0 - -c_u_NonConvexFlowBlock_min(cheap_plant_activity_costs_Bus_C_5)_: --1 flow(cheap_plant_activity_costs_Bus_C_5) -+0.5 NonConvexFlowBlock_status_nominal(cheap_plant_activity_costs_Bus_C_5) -<= 0 - -c_u_NonConvexFlowBlock_max(cheap_plant_activity_costs_Bus_C_0)_: -+1 flow(cheap_plant_activity_costs_Bus_C_0) --1 NonConvexFlowBlock_status_nominal(cheap_plant_activity_costs_Bus_C_0) -<= 0 - -c_u_NonConvexFlowBlock_max(cheap_plant_activity_costs_Bus_C_1)_: -+1 flow(cheap_plant_activity_costs_Bus_C_1) --1 NonConvexFlowBlock_status_nominal(cheap_plant_activity_costs_Bus_C_1) -<= 0 - -c_u_NonConvexFlowBlock_max(cheap_plant_activity_costs_Bus_C_2)_: -+1 flow(cheap_plant_activity_costs_Bus_C_2) --1 NonConvexFlowBlock_status_nominal(cheap_plant_activity_costs_Bus_C_2) -<= 0 - -c_u_NonConvexFlowBlock_max(cheap_plant_activity_costs_Bus_C_3)_: -+1 flow(cheap_plant_activity_costs_Bus_C_3) --1 NonConvexFlowBlock_status_nominal(cheap_plant_activity_costs_Bus_C_3) -<= 0 - -c_u_NonConvexFlowBlock_max(cheap_plant_activity_costs_Bus_C_4)_: -+1 flow(cheap_plant_activity_costs_Bus_C_4) --1 NonConvexFlowBlock_status_nominal(cheap_plant_activity_costs_Bus_C_4) -<= 0 - -c_u_NonConvexFlowBlock_max(cheap_plant_activity_costs_Bus_C_5)_: -+1 flow(cheap_plant_activity_costs_Bus_C_5) --1 NonConvexFlowBlock_status_nominal(cheap_plant_activity_costs_Bus_C_5) -<= 0 - -bounds - 0 <= flow(cheap_plant_activity_costs_Bus_C_0) <= 10.0 - 0 <= flow(cheap_plant_activity_costs_Bus_C_1) <= 10.0 - 0 <= flow(cheap_plant_activity_costs_Bus_C_2) <= 10.0 - 0 <= flow(cheap_plant_activity_costs_Bus_C_3) <= 10.0 - 0 <= flow(cheap_plant_activity_costs_Bus_C_4) <= 10.0 - 0 <= flow(cheap_plant_activity_costs_Bus_C_5) <= 10.0 - 0 <= NonConvexFlowBlock_status(cheap_plant_activity_costs_Bus_C_0) <= 1 - 0 <= NonConvexFlowBlock_status(cheap_plant_activity_costs_Bus_C_1) <= 1 - 0 <= NonConvexFlowBlock_status(cheap_plant_activity_costs_Bus_C_2) <= 1 - 0 <= NonConvexFlowBlock_status(cheap_plant_activity_costs_Bus_C_3) <= 1 - 0 <= NonConvexFlowBlock_status(cheap_plant_activity_costs_Bus_C_4) <= 1 - 0 <= NonConvexFlowBlock_status(cheap_plant_activity_costs_Bus_C_5) <= 1 - 0 <= NonConvexFlowBlock_status_nominal(cheap_plant_activity_costs_Bus_C_0) <= +inf - 0 <= NonConvexFlowBlock_status_nominal(cheap_plant_activity_costs_Bus_C_1) <= +inf - 0 <= NonConvexFlowBlock_status_nominal(cheap_plant_activity_costs_Bus_C_2) <= +inf - 0 <= NonConvexFlowBlock_status_nominal(cheap_plant_activity_costs_Bus_C_3) <= +inf - 0 <= NonConvexFlowBlock_status_nominal(cheap_plant_activity_costs_Bus_C_4) <= +inf - 0 <= NonConvexFlowBlock_status_nominal(cheap_plant_activity_costs_Bus_C_5) <= +inf -binary - NonConvexFlowBlock_status(cheap_plant_activity_costs_Bus_C_0) - NonConvexFlowBlock_status(cheap_plant_activity_costs_Bus_C_1) - NonConvexFlowBlock_status(cheap_plant_activity_costs_Bus_C_2) - NonConvexFlowBlock_status(cheap_plant_activity_costs_Bus_C_3) - NonConvexFlowBlock_status(cheap_plant_activity_costs_Bus_C_4) - NonConvexFlowBlock_status(cheap_plant_activity_costs_Bus_C_5) -end diff --git a/tests/lp_files/inactivity_costs_multi_period.lp b/tests/lp_files/inactivity_costs_multi_period.lp deleted file mode 100644 index 532b6b432..000000000 --- a/tests/lp_files/inactivity_costs_multi_period.lp +++ /dev/null @@ -1,162 +0,0 @@ -\* Source Pyomo model name=Model *\ - -min -objective: -+11.766243752402922 ONE_VAR_CONSTANT -+10 flow(cheap_plant_inactivity_costs_Bus_C_0) -+10 flow(cheap_plant_inactivity_costs_Bus_C_1) -+9.80392156862745 flow(cheap_plant_inactivity_costs_Bus_C_2) -+9.80392156862745 flow(cheap_plant_inactivity_costs_Bus_C_3) -+9.611687812379854 flow(cheap_plant_inactivity_costs_Bus_C_4) -+9.611687812379854 flow(cheap_plant_inactivity_costs_Bus_C_5) --2 NonConvexFlowBlock_status(cheap_plant_inactivity_costs_Bus_C_0) --2 NonConvexFlowBlock_status(cheap_plant_inactivity_costs_Bus_C_1) --1.9607843137254901 NonConvexFlowBlock_status(cheap_plant_inactivity_costs_Bus_C_2) --1.9607843137254901 NonConvexFlowBlock_status(cheap_plant_inactivity_costs_Bus_C_3) --1.9223375624759707 NonConvexFlowBlock_status(cheap_plant_inactivity_costs_Bus_C_4) --1.9223375624759707 NonConvexFlowBlock_status(cheap_plant_inactivity_costs_Bus_C_5) - -s.t. - -c_e_BusBlock_balance(Bus_C_0)_: -+1 flow(cheap_plant_inactivity_costs_Bus_C_0) -= 0 - -c_e_BusBlock_balance(Bus_C_1)_: -+1 flow(cheap_plant_inactivity_costs_Bus_C_1) -= 0 - -c_e_BusBlock_balance(Bus_C_2)_: -+1 flow(cheap_plant_inactivity_costs_Bus_C_2) -= 0 - -c_e_BusBlock_balance(Bus_C_3)_: -+1 flow(cheap_plant_inactivity_costs_Bus_C_3) -= 0 - -c_e_BusBlock_balance(Bus_C_4)_: -+1 flow(cheap_plant_inactivity_costs_Bus_C_4) -= 0 - -c_e_BusBlock_balance(Bus_C_5)_: -+1 flow(cheap_plant_inactivity_costs_Bus_C_5) -= 0 - -c_e_NonConvexFlowBlock_status_nominal_constraint(cheap_plant_inactivity_costs_Bus_C_0)_: --10 NonConvexFlowBlock_status(cheap_plant_inactivity_costs_Bus_C_0) -+1 NonConvexFlowBlock_status_nominal(cheap_plant_inactivity_costs_Bus_C_0) -= 0 - -c_e_NonConvexFlowBlock_status_nominal_constraint(cheap_plant_inactivity_costs_Bus_C_1)_: --10 NonConvexFlowBlock_status(cheap_plant_inactivity_costs_Bus_C_1) -+1 NonConvexFlowBlock_status_nominal(cheap_plant_inactivity_costs_Bus_C_1) -= 0 - -c_e_NonConvexFlowBlock_status_nominal_constraint(cheap_plant_inactivity_costs_Bus_C_2)_: --10 NonConvexFlowBlock_status(cheap_plant_inactivity_costs_Bus_C_2) -+1 NonConvexFlowBlock_status_nominal(cheap_plant_inactivity_costs_Bus_C_2) -= 0 - -c_e_NonConvexFlowBlock_status_nominal_constraint(cheap_plant_inactivity_costs_Bus_C_3)_: --10 NonConvexFlowBlock_status(cheap_plant_inactivity_costs_Bus_C_3) -+1 NonConvexFlowBlock_status_nominal(cheap_plant_inactivity_costs_Bus_C_3) -= 0 - -c_e_NonConvexFlowBlock_status_nominal_constraint(cheap_plant_inactivity_costs_Bus_C_4)_: --10 NonConvexFlowBlock_status(cheap_plant_inactivity_costs_Bus_C_4) -+1 NonConvexFlowBlock_status_nominal(cheap_plant_inactivity_costs_Bus_C_4) -= 0 - -c_e_NonConvexFlowBlock_status_nominal_constraint(cheap_plant_inactivity_costs_Bus_C_5)_: --10 NonConvexFlowBlock_status(cheap_plant_inactivity_costs_Bus_C_5) -+1 NonConvexFlowBlock_status_nominal(cheap_plant_inactivity_costs_Bus_C_5) -= 0 - -c_u_NonConvexFlowBlock_min(cheap_plant_inactivity_costs_Bus_C_0)_: --1 flow(cheap_plant_inactivity_costs_Bus_C_0) -+0.5 NonConvexFlowBlock_status_nominal(cheap_plant_inactivity_costs_Bus_C_0) -<= 0 - -c_u_NonConvexFlowBlock_min(cheap_plant_inactivity_costs_Bus_C_1)_: --1 flow(cheap_plant_inactivity_costs_Bus_C_1) -+0.5 NonConvexFlowBlock_status_nominal(cheap_plant_inactivity_costs_Bus_C_1) -<= 0 - -c_u_NonConvexFlowBlock_min(cheap_plant_inactivity_costs_Bus_C_2)_: --1 flow(cheap_plant_inactivity_costs_Bus_C_2) -+0.5 NonConvexFlowBlock_status_nominal(cheap_plant_inactivity_costs_Bus_C_2) -<= 0 - -c_u_NonConvexFlowBlock_min(cheap_plant_inactivity_costs_Bus_C_3)_: --1 flow(cheap_plant_inactivity_costs_Bus_C_3) -+0.5 NonConvexFlowBlock_status_nominal(cheap_plant_inactivity_costs_Bus_C_3) -<= 0 - -c_u_NonConvexFlowBlock_min(cheap_plant_inactivity_costs_Bus_C_4)_: --1 flow(cheap_plant_inactivity_costs_Bus_C_4) -+0.5 NonConvexFlowBlock_status_nominal(cheap_plant_inactivity_costs_Bus_C_4) -<= 0 - -c_u_NonConvexFlowBlock_min(cheap_plant_inactivity_costs_Bus_C_5)_: --1 flow(cheap_plant_inactivity_costs_Bus_C_5) -+0.5 NonConvexFlowBlock_status_nominal(cheap_plant_inactivity_costs_Bus_C_5) -<= 0 - -c_u_NonConvexFlowBlock_max(cheap_plant_inactivity_costs_Bus_C_0)_: -+1 flow(cheap_plant_inactivity_costs_Bus_C_0) --1 NonConvexFlowBlock_status_nominal(cheap_plant_inactivity_costs_Bus_C_0) -<= 0 - -c_u_NonConvexFlowBlock_max(cheap_plant_inactivity_costs_Bus_C_1)_: -+1 flow(cheap_plant_inactivity_costs_Bus_C_1) --1 NonConvexFlowBlock_status_nominal(cheap_plant_inactivity_costs_Bus_C_1) -<= 0 - -c_u_NonConvexFlowBlock_max(cheap_plant_inactivity_costs_Bus_C_2)_: -+1 flow(cheap_plant_inactivity_costs_Bus_C_2) --1 NonConvexFlowBlock_status_nominal(cheap_plant_inactivity_costs_Bus_C_2) -<= 0 - -c_u_NonConvexFlowBlock_max(cheap_plant_inactivity_costs_Bus_C_3)_: -+1 flow(cheap_plant_inactivity_costs_Bus_C_3) --1 NonConvexFlowBlock_status_nominal(cheap_plant_inactivity_costs_Bus_C_3) -<= 0 - -c_u_NonConvexFlowBlock_max(cheap_plant_inactivity_costs_Bus_C_4)_: -+1 flow(cheap_plant_inactivity_costs_Bus_C_4) --1 NonConvexFlowBlock_status_nominal(cheap_plant_inactivity_costs_Bus_C_4) -<= 0 - -c_u_NonConvexFlowBlock_max(cheap_plant_inactivity_costs_Bus_C_5)_: -+1 flow(cheap_plant_inactivity_costs_Bus_C_5) --1 NonConvexFlowBlock_status_nominal(cheap_plant_inactivity_costs_Bus_C_5) -<= 0 - -bounds - 1 <= ONE_VAR_CONSTANT <= 1 - 0 <= flow(cheap_plant_inactivity_costs_Bus_C_0) <= 10.0 - 0 <= flow(cheap_plant_inactivity_costs_Bus_C_1) <= 10.0 - 0 <= flow(cheap_plant_inactivity_costs_Bus_C_2) <= 10.0 - 0 <= flow(cheap_plant_inactivity_costs_Bus_C_3) <= 10.0 - 0 <= flow(cheap_plant_inactivity_costs_Bus_C_4) <= 10.0 - 0 <= flow(cheap_plant_inactivity_costs_Bus_C_5) <= 10.0 - 0 <= NonConvexFlowBlock_status(cheap_plant_inactivity_costs_Bus_C_0) <= 1 - 0 <= NonConvexFlowBlock_status(cheap_plant_inactivity_costs_Bus_C_1) <= 1 - 0 <= NonConvexFlowBlock_status(cheap_plant_inactivity_costs_Bus_C_2) <= 1 - 0 <= NonConvexFlowBlock_status(cheap_plant_inactivity_costs_Bus_C_3) <= 1 - 0 <= NonConvexFlowBlock_status(cheap_plant_inactivity_costs_Bus_C_4) <= 1 - 0 <= NonConvexFlowBlock_status(cheap_plant_inactivity_costs_Bus_C_5) <= 1 - 0 <= NonConvexFlowBlock_status_nominal(cheap_plant_inactivity_costs_Bus_C_0) <= +inf - 0 <= NonConvexFlowBlock_status_nominal(cheap_plant_inactivity_costs_Bus_C_1) <= +inf - 0 <= NonConvexFlowBlock_status_nominal(cheap_plant_inactivity_costs_Bus_C_2) <= +inf - 0 <= NonConvexFlowBlock_status_nominal(cheap_plant_inactivity_costs_Bus_C_3) <= +inf - 0 <= NonConvexFlowBlock_status_nominal(cheap_plant_inactivity_costs_Bus_C_4) <= +inf - 0 <= NonConvexFlowBlock_status_nominal(cheap_plant_inactivity_costs_Bus_C_5) <= +inf -binary - NonConvexFlowBlock_status(cheap_plant_inactivity_costs_Bus_C_0) - NonConvexFlowBlock_status(cheap_plant_inactivity_costs_Bus_C_1) - NonConvexFlowBlock_status(cheap_plant_inactivity_costs_Bus_C_2) - NonConvexFlowBlock_status(cheap_plant_inactivity_costs_Bus_C_3) - NonConvexFlowBlock_status(cheap_plant_inactivity_costs_Bus_C_4) - NonConvexFlowBlock_status(cheap_plant_inactivity_costs_Bus_C_5) -end diff --git a/tests/lp_files/min_max_runtime_multi_period.lp b/tests/lp_files/min_max_runtime_multi_period.lp deleted file mode 100644 index 61be72293..000000000 --- a/tests/lp_files/min_max_runtime_multi_period.lp +++ /dev/null @@ -1,271 +0,0 @@ -\* Source Pyomo model name=Model *\ - -min -objective: -+10 flow(cheap_plant_min_down_constraints_Bus_T_0) -+10 flow(cheap_plant_min_down_constraints_Bus_T_1) -+9.80392156862745 flow(cheap_plant_min_down_constraints_Bus_T_2) -+9.80392156862745 flow(cheap_plant_min_down_constraints_Bus_T_3) -+9.611687812379854 flow(cheap_plant_min_down_constraints_Bus_T_4) -+9.611687812379854 flow(cheap_plant_min_down_constraints_Bus_T_5) -+5 NonConvexFlowBlock_startup(cheap_plant_min_down_constraints_Bus_T_0) -+5 NonConvexFlowBlock_startup(cheap_plant_min_down_constraints_Bus_T_1) -+4.901960784313725 NonConvexFlowBlock_startup(cheap_plant_min_down_constraints_Bus_T_2) -+4.901960784313725 NonConvexFlowBlock_startup(cheap_plant_min_down_constraints_Bus_T_3) -+4.805843906189927 NonConvexFlowBlock_startup(cheap_plant_min_down_constraints_Bus_T_4) -+4.805843906189927 NonConvexFlowBlock_startup(cheap_plant_min_down_constraints_Bus_T_5) -+7 NonConvexFlowBlock_shutdown(cheap_plant_min_down_constraints_Bus_T_0) -+7 NonConvexFlowBlock_shutdown(cheap_plant_min_down_constraints_Bus_T_1) -+6.862745098039215 NonConvexFlowBlock_shutdown(cheap_plant_min_down_constraints_Bus_T_2) -+6.862745098039215 NonConvexFlowBlock_shutdown(cheap_plant_min_down_constraints_Bus_T_3) -+6.728181468665897 NonConvexFlowBlock_shutdown(cheap_plant_min_down_constraints_Bus_T_4) -+6.728181468665897 NonConvexFlowBlock_shutdown(cheap_plant_min_down_constraints_Bus_T_5) - -s.t. - -c_e_BusBlock_balance(Bus_T_0)_: -+1 flow(cheap_plant_min_down_constraints_Bus_T_0) -= 0 - -c_e_BusBlock_balance(Bus_T_1)_: -+1 flow(cheap_plant_min_down_constraints_Bus_T_1) -= 0 - -c_e_BusBlock_balance(Bus_T_2)_: -+1 flow(cheap_plant_min_down_constraints_Bus_T_2) -= 0 - -c_e_BusBlock_balance(Bus_T_3)_: -+1 flow(cheap_plant_min_down_constraints_Bus_T_3) -= 0 - -c_e_BusBlock_balance(Bus_T_4)_: -+1 flow(cheap_plant_min_down_constraints_Bus_T_4) -= 0 - -c_e_BusBlock_balance(Bus_T_5)_: -+1 flow(cheap_plant_min_down_constraints_Bus_T_5) -= 0 - -c_e_NonConvexFlowBlock_status_nominal_constraint(cheap_plant_min_down_constraints_Bus_T_0)_: -+1 NonConvexFlowBlock_status_nominal(cheap_plant_min_down_constraints_Bus_T_0) -= 10 - -c_e_NonConvexFlowBlock_status_nominal_constraint(cheap_plant_min_down_constraints_Bus_T_1)_: -+1 NonConvexFlowBlock_status_nominal(cheap_plant_min_down_constraints_Bus_T_1) -= 10 - -c_e_NonConvexFlowBlock_status_nominal_constraint(cheap_plant_min_down_constraints_Bus_T_2)_: -+1 NonConvexFlowBlock_status_nominal(cheap_plant_min_down_constraints_Bus_T_2) --10 NonConvexFlowBlock_status(cheap_plant_min_down_constraints_Bus_T_2) -= 0 - -c_e_NonConvexFlowBlock_status_nominal_constraint(cheap_plant_min_down_constraints_Bus_T_3)_: -+1 NonConvexFlowBlock_status_nominal(cheap_plant_min_down_constraints_Bus_T_3) --10 NonConvexFlowBlock_status(cheap_plant_min_down_constraints_Bus_T_3) -= 0 - -c_e_NonConvexFlowBlock_status_nominal_constraint(cheap_plant_min_down_constraints_Bus_T_4)_: -+1 NonConvexFlowBlock_status_nominal(cheap_plant_min_down_constraints_Bus_T_4) --10 NonConvexFlowBlock_status(cheap_plant_min_down_constraints_Bus_T_4) -= 0 - -c_e_NonConvexFlowBlock_status_nominal_constraint(cheap_plant_min_down_constraints_Bus_T_5)_: -+1 NonConvexFlowBlock_status_nominal(cheap_plant_min_down_constraints_Bus_T_5) --10 NonConvexFlowBlock_status(cheap_plant_min_down_constraints_Bus_T_5) -= 0 - -c_u_NonConvexFlowBlock_min(cheap_plant_min_down_constraints_Bus_T_0)_: --1 flow(cheap_plant_min_down_constraints_Bus_T_0) -+0.5 NonConvexFlowBlock_status_nominal(cheap_plant_min_down_constraints_Bus_T_0) -<= 0 - -c_u_NonConvexFlowBlock_min(cheap_plant_min_down_constraints_Bus_T_1)_: --1 flow(cheap_plant_min_down_constraints_Bus_T_1) -+0.5 NonConvexFlowBlock_status_nominal(cheap_plant_min_down_constraints_Bus_T_1) -<= 0 - -c_u_NonConvexFlowBlock_min(cheap_plant_min_down_constraints_Bus_T_2)_: --1 flow(cheap_plant_min_down_constraints_Bus_T_2) -+0.5 NonConvexFlowBlock_status_nominal(cheap_plant_min_down_constraints_Bus_T_2) -<= 0 - -c_u_NonConvexFlowBlock_min(cheap_plant_min_down_constraints_Bus_T_3)_: --1 flow(cheap_plant_min_down_constraints_Bus_T_3) -+0.5 NonConvexFlowBlock_status_nominal(cheap_plant_min_down_constraints_Bus_T_3) -<= 0 - -c_u_NonConvexFlowBlock_min(cheap_plant_min_down_constraints_Bus_T_4)_: --1 flow(cheap_plant_min_down_constraints_Bus_T_4) -+0.5 NonConvexFlowBlock_status_nominal(cheap_plant_min_down_constraints_Bus_T_4) -<= 0 - -c_u_NonConvexFlowBlock_min(cheap_plant_min_down_constraints_Bus_T_5)_: --1 flow(cheap_plant_min_down_constraints_Bus_T_5) -+0.5 NonConvexFlowBlock_status_nominal(cheap_plant_min_down_constraints_Bus_T_5) -<= 0 - -c_u_NonConvexFlowBlock_max(cheap_plant_min_down_constraints_Bus_T_0)_: -+1 flow(cheap_plant_min_down_constraints_Bus_T_0) --1 NonConvexFlowBlock_status_nominal(cheap_plant_min_down_constraints_Bus_T_0) -<= 0 - -c_u_NonConvexFlowBlock_max(cheap_plant_min_down_constraints_Bus_T_1)_: -+1 flow(cheap_plant_min_down_constraints_Bus_T_1) --1 NonConvexFlowBlock_status_nominal(cheap_plant_min_down_constraints_Bus_T_1) -<= 0 - -c_u_NonConvexFlowBlock_max(cheap_plant_min_down_constraints_Bus_T_2)_: -+1 flow(cheap_plant_min_down_constraints_Bus_T_2) --1 NonConvexFlowBlock_status_nominal(cheap_plant_min_down_constraints_Bus_T_2) -<= 0 - -c_u_NonConvexFlowBlock_max(cheap_plant_min_down_constraints_Bus_T_3)_: -+1 flow(cheap_plant_min_down_constraints_Bus_T_3) --1 NonConvexFlowBlock_status_nominal(cheap_plant_min_down_constraints_Bus_T_3) -<= 0 - -c_u_NonConvexFlowBlock_max(cheap_plant_min_down_constraints_Bus_T_4)_: -+1 flow(cheap_plant_min_down_constraints_Bus_T_4) --1 NonConvexFlowBlock_status_nominal(cheap_plant_min_down_constraints_Bus_T_4) -<= 0 - -c_u_NonConvexFlowBlock_max(cheap_plant_min_down_constraints_Bus_T_5)_: -+1 flow(cheap_plant_min_down_constraints_Bus_T_5) --1 NonConvexFlowBlock_status_nominal(cheap_plant_min_down_constraints_Bus_T_5) -<= 0 - -c_u_NonConvexFlowBlock_startup_constr(cheap_plant_min_down_constraints_Bus_T_0)_: --1 NonConvexFlowBlock_startup(cheap_plant_min_down_constraints_Bus_T_0) -<= 0 - -c_u_NonConvexFlowBlock_startup_constr(cheap_plant_min_down_constraints_Bus_T_1)_: --1 NonConvexFlowBlock_startup(cheap_plant_min_down_constraints_Bus_T_1) -<= 0 - -c_u_NonConvexFlowBlock_startup_constr(cheap_plant_min_down_constraints_Bus_T_2)_: --1 NonConvexFlowBlock_startup(cheap_plant_min_down_constraints_Bus_T_2) -+1 NonConvexFlowBlock_status(cheap_plant_min_down_constraints_Bus_T_2) -<= 1 - -c_u_NonConvexFlowBlock_startup_constr(cheap_plant_min_down_constraints_Bus_T_3)_: --1 NonConvexFlowBlock_startup(cheap_plant_min_down_constraints_Bus_T_3) --1 NonConvexFlowBlock_status(cheap_plant_min_down_constraints_Bus_T_2) -+1 NonConvexFlowBlock_status(cheap_plant_min_down_constraints_Bus_T_3) -<= 0 - -c_u_NonConvexFlowBlock_startup_constr(cheap_plant_min_down_constraints_Bus_T_4)_: --1 NonConvexFlowBlock_startup(cheap_plant_min_down_constraints_Bus_T_4) --1 NonConvexFlowBlock_status(cheap_plant_min_down_constraints_Bus_T_3) -+1 NonConvexFlowBlock_status(cheap_plant_min_down_constraints_Bus_T_4) -<= 0 - -c_u_NonConvexFlowBlock_startup_constr(cheap_plant_min_down_constraints_Bus_T_5)_: --1 NonConvexFlowBlock_startup(cheap_plant_min_down_constraints_Bus_T_5) --1 NonConvexFlowBlock_status(cheap_plant_min_down_constraints_Bus_T_4) -+1 NonConvexFlowBlock_status(cheap_plant_min_down_constraints_Bus_T_5) -<= 0 - -c_u_NonConvexFlowBlock_shutdown_constr(cheap_plant_min_down_constraints_Bus_T_0)_: --1 NonConvexFlowBlock_shutdown(cheap_plant_min_down_constraints_Bus_T_0) -<= 0 - -c_u_NonConvexFlowBlock_shutdown_constr(cheap_plant_min_down_constraints_Bus_T_1)_: --1 NonConvexFlowBlock_shutdown(cheap_plant_min_down_constraints_Bus_T_1) -<= 0 - -c_u_NonConvexFlowBlock_shutdown_constr(cheap_plant_min_down_constraints_Bus_T_2)_: --1 NonConvexFlowBlock_shutdown(cheap_plant_min_down_constraints_Bus_T_2) --1 NonConvexFlowBlock_status(cheap_plant_min_down_constraints_Bus_T_2) -<= -1 - -c_u_NonConvexFlowBlock_shutdown_constr(cheap_plant_min_down_constraints_Bus_T_3)_: --1 NonConvexFlowBlock_shutdown(cheap_plant_min_down_constraints_Bus_T_3) -+1 NonConvexFlowBlock_status(cheap_plant_min_down_constraints_Bus_T_2) --1 NonConvexFlowBlock_status(cheap_plant_min_down_constraints_Bus_T_3) -<= 0 - -c_u_NonConvexFlowBlock_shutdown_constr(cheap_plant_min_down_constraints_Bus_T_4)_: --1 NonConvexFlowBlock_shutdown(cheap_plant_min_down_constraints_Bus_T_4) -+1 NonConvexFlowBlock_status(cheap_plant_min_down_constraints_Bus_T_3) --1 NonConvexFlowBlock_status(cheap_plant_min_down_constraints_Bus_T_4) -<= 0 - -c_u_NonConvexFlowBlock_shutdown_constr(cheap_plant_min_down_constraints_Bus_T_5)_: --1 NonConvexFlowBlock_shutdown(cheap_plant_min_down_constraints_Bus_T_5) -+1 NonConvexFlowBlock_status(cheap_plant_min_down_constraints_Bus_T_4) --1 NonConvexFlowBlock_status(cheap_plant_min_down_constraints_Bus_T_5) -<= 0 - -c_u_NonConvexFlowBlock_min_uptime_constr(cheap_plant_min_down_constraints_Bus_T_3)_: --2 NonConvexFlowBlock_status(cheap_plant_min_down_constraints_Bus_T_2) -+1 NonConvexFlowBlock_status(cheap_plant_min_down_constraints_Bus_T_3) --1 NonConvexFlowBlock_status(cheap_plant_min_down_constraints_Bus_T_4) -<= 0 - -c_u_NonConvexFlowBlock_min_uptime_constr(cheap_plant_min_down_constraints_Bus_T_4)_: --2 NonConvexFlowBlock_status(cheap_plant_min_down_constraints_Bus_T_3) -+1 NonConvexFlowBlock_status(cheap_plant_min_down_constraints_Bus_T_4) --1 NonConvexFlowBlock_status(cheap_plant_min_down_constraints_Bus_T_5) -<= 0 - -c_u_NonConvexFlowBlock_min_downtime_constr(cheap_plant_min_down_constraints_Bus_T_3)_: -+4 NonConvexFlowBlock_status(cheap_plant_min_down_constraints_Bus_T_2) --3 NonConvexFlowBlock_status(cheap_plant_min_down_constraints_Bus_T_3) -+1 NonConvexFlowBlock_status(cheap_plant_min_down_constraints_Bus_T_4) -+1 NonConvexFlowBlock_status(cheap_plant_min_down_constraints_Bus_T_5) -<= 4 - -c_u_NonConvexFlowBlock_min_downtime_constr(cheap_plant_min_down_constraints_Bus_T_4)_: -+4 NonConvexFlowBlock_status(cheap_plant_min_down_constraints_Bus_T_3) --3 NonConvexFlowBlock_status(cheap_plant_min_down_constraints_Bus_T_4) -+1 NonConvexFlowBlock_status(cheap_plant_min_down_constraints_Bus_T_5) -<= 4 - -bounds - 0 <= flow(cheap_plant_min_down_constraints_Bus_T_0) <= 10.0 - 0 <= flow(cheap_plant_min_down_constraints_Bus_T_1) <= 10.0 - 0 <= flow(cheap_plant_min_down_constraints_Bus_T_2) <= 10.0 - 0 <= flow(cheap_plant_min_down_constraints_Bus_T_3) <= 10.0 - 0 <= flow(cheap_plant_min_down_constraints_Bus_T_4) <= 10.0 - 0 <= flow(cheap_plant_min_down_constraints_Bus_T_5) <= 10.0 - 0 <= NonConvexFlowBlock_startup(cheap_plant_min_down_constraints_Bus_T_0) <= 1 - 0 <= NonConvexFlowBlock_startup(cheap_plant_min_down_constraints_Bus_T_1) <= 1 - 0 <= NonConvexFlowBlock_startup(cheap_plant_min_down_constraints_Bus_T_2) <= 1 - 0 <= NonConvexFlowBlock_startup(cheap_plant_min_down_constraints_Bus_T_3) <= 1 - 0 <= NonConvexFlowBlock_startup(cheap_plant_min_down_constraints_Bus_T_4) <= 1 - 0 <= NonConvexFlowBlock_startup(cheap_plant_min_down_constraints_Bus_T_5) <= 1 - 0 <= NonConvexFlowBlock_shutdown(cheap_plant_min_down_constraints_Bus_T_0) <= 1 - 0 <= NonConvexFlowBlock_shutdown(cheap_plant_min_down_constraints_Bus_T_1) <= 1 - 0 <= NonConvexFlowBlock_shutdown(cheap_plant_min_down_constraints_Bus_T_2) <= 1 - 0 <= NonConvexFlowBlock_shutdown(cheap_plant_min_down_constraints_Bus_T_3) <= 1 - 0 <= NonConvexFlowBlock_shutdown(cheap_plant_min_down_constraints_Bus_T_4) <= 1 - 0 <= NonConvexFlowBlock_shutdown(cheap_plant_min_down_constraints_Bus_T_5) <= 1 - 0 <= NonConvexFlowBlock_status_nominal(cheap_plant_min_down_constraints_Bus_T_0) <= +inf - 0 <= NonConvexFlowBlock_status_nominal(cheap_plant_min_down_constraints_Bus_T_1) <= +inf - 0 <= NonConvexFlowBlock_status_nominal(cheap_plant_min_down_constraints_Bus_T_2) <= +inf - 0 <= NonConvexFlowBlock_status_nominal(cheap_plant_min_down_constraints_Bus_T_3) <= +inf - 0 <= NonConvexFlowBlock_status_nominal(cheap_plant_min_down_constraints_Bus_T_4) <= +inf - 0 <= NonConvexFlowBlock_status_nominal(cheap_plant_min_down_constraints_Bus_T_5) <= +inf - 0 <= NonConvexFlowBlock_status(cheap_plant_min_down_constraints_Bus_T_2) <= 1 - 0 <= NonConvexFlowBlock_status(cheap_plant_min_down_constraints_Bus_T_3) <= 1 - 0 <= NonConvexFlowBlock_status(cheap_plant_min_down_constraints_Bus_T_4) <= 1 - 0 <= NonConvexFlowBlock_status(cheap_plant_min_down_constraints_Bus_T_5) <= 1 -binary - NonConvexFlowBlock_startup(cheap_plant_min_down_constraints_Bus_T_0) - NonConvexFlowBlock_startup(cheap_plant_min_down_constraints_Bus_T_1) - NonConvexFlowBlock_startup(cheap_plant_min_down_constraints_Bus_T_2) - NonConvexFlowBlock_startup(cheap_plant_min_down_constraints_Bus_T_3) - NonConvexFlowBlock_startup(cheap_plant_min_down_constraints_Bus_T_4) - NonConvexFlowBlock_startup(cheap_plant_min_down_constraints_Bus_T_5) - NonConvexFlowBlock_shutdown(cheap_plant_min_down_constraints_Bus_T_0) - NonConvexFlowBlock_shutdown(cheap_plant_min_down_constraints_Bus_T_1) - NonConvexFlowBlock_shutdown(cheap_plant_min_down_constraints_Bus_T_2) - NonConvexFlowBlock_shutdown(cheap_plant_min_down_constraints_Bus_T_3) - NonConvexFlowBlock_shutdown(cheap_plant_min_down_constraints_Bus_T_4) - NonConvexFlowBlock_shutdown(cheap_plant_min_down_constraints_Bus_T_5) - NonConvexFlowBlock_status(cheap_plant_min_down_constraints_Bus_T_2) - NonConvexFlowBlock_status(cheap_plant_min_down_constraints_Bus_T_3) - NonConvexFlowBlock_status(cheap_plant_min_down_constraints_Bus_T_4) - NonConvexFlowBlock_status(cheap_plant_min_down_constraints_Bus_T_5) -end diff --git a/tests/multi_period_constraint_tests.py b/tests/multi_period_constraint_tests.py index 16a77d5d4..e555aee22 100644 --- a/tests/multi_period_constraint_tests.py +++ b/tests/multi_period_constraint_tests.py @@ -1385,70 +1385,6 @@ def test_periodical_investment_limit_missing(self): with pytest.raises(ValueError, match=msg): solph.constraints.investment_limit_per_period(om, limit=None) - def test_min_max_runtime(self): - """Testing min and max runtimes for nonconvex flows.""" - bus_t = solph.buses.Bus(label="Bus_T") - source = solph.components.Source( - label="cheap_plant_min_down_constraints", - outputs={ - bus_t: solph.flows.Flow( - nominal_value=10, - min=0.5, - max=1.0, - variable_costs=10, - nonconvex=solph.NonConvex( - minimum_downtime=4, - minimum_uptime=2, - initial_status=1, - startup_costs=5, - shutdown_costs=7, - ), - ) - }, - ) - self.energysystem.add(bus_t, source) - self.compare_lp_files("min_max_runtime_multi_period.lp") - - def test_activity_costs(self): - """Testing activity_costs attribute for nonconvex flows.""" - bus_t = solph.buses.Bus(label="Bus_C") - source = solph.components.Source( - label="cheap_plant_activity_costs", - outputs={ - bus_t: solph.flows.Flow( - nominal_value=10, - min=0.5, - max=1.0, - variable_costs=10, - nonconvex=solph.NonConvex( - activity_costs=2, - ), - ) - }, - ) - self.energysystem.add(bus_t, source) - self.compare_lp_files("activity_costs_multi_period.lp") - - def test_inactivity_costs(self): - """Testing inactivity_costs attribute for nonconvex flows.""" - bus_t = solph.buses.Bus(label="Bus_C") - source = solph.components.Source( - label="cheap_plant_inactivity_costs", - outputs={ - bus_t: solph.flows.Flow( - nominal_value=10, - min=0.5, - max=1.0, - variable_costs=10, - nonconvex=solph.NonConvex( - inactivity_costs=2, - ), - ) - }, - ) - self.energysystem.add(bus_t, source) - self.compare_lp_files("inactivity_costs_multi_period.lp") - def test_piecewise_linear_converter_cc(self): """Testing PiecewiseLinearConverter using CC formulation.""" bgas = solph.buses.Bus(label="gasBus")