diff --git a/assume/markets/clearing_algorithms/nodal_pricing.py b/assume/markets/clearing_algorithms/nodal_pricing.py index 458b7185..4d04ee04 100644 --- a/assume/markets/clearing_algorithms/nodal_pricing.py +++ b/assume/markets/clearing_algorithms/nodal_pricing.py @@ -149,11 +149,24 @@ def clear( nodal_network = self.network.copy() # Update p_max_pu for generators - nodal_network.generators_t.p_max_pu.update(p_max_pu) - nodal_network.generators_t.p_min_pu.update(p_min_pu) + # Also add new columns which did not yet exist in nodal_network.generators_t + df_p_max_pu = nodal_network.generators_t.p_max_pu + df_p_max_pu.update(p_max_pu) + new_columns = p_max_pu.loc[:,~p_max_pu.columns.isin(df_p_max_pu.columns)] + nodal_network.generators_t.p_max_pu = pd.concat([df_p_max_pu, new_columns], axis=1) + + # Update p_min_pu for generators + df_p_min_pu = nodal_network.generators_t.p_min_pu + df_p_min_pu.update(p_min_pu) + new_columns = p_min_pu.loc[:,~p_min_pu.columns.isin(df_p_min_pu.columns)] + nodal_network.generators_t.p_min_pu = pd.concat([df_p_min_pu, new_columns], axis=1) # Update marginal costs for generators - nodal_network.generators_t.marginal_cost.update(costs) + df_costs = nodal_network.generators_t.marginal_cost + df_costs.update(costs) + new_columns = costs.loc[:,~costs.columns.isin(df_costs.columns)] + nodal_network.generators_t.marginal_cost = pd.concat([df_costs, new_columns], axis=1) + with suppress_output(): status, termination_condition = nodal_network.optimize(