From b4e751dc7d1349f5f592e80481d946e1d0ffbe8e Mon Sep 17 00:00:00 2001 From: Bernard Knueven Date: Mon, 15 Nov 2021 18:47:01 -0700 Subject: [PATCH] updating mutable params --- egret/common/lazy_ptdf_utils.py | 2 +- egret/model_library/unit_commitment/services.py | 15 ++++++++++----- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/egret/common/lazy_ptdf_utils.py b/egret/common/lazy_ptdf_utils.py index db3c9edf..7dfe4d75 100644 --- a/egret/common/lazy_ptdf_utils.py +++ b/egret/common/lazy_ptdf_utils.py @@ -697,7 +697,7 @@ def _add_contingency_violations(lazy_violations, flows, mb, md, solver, ptdf_opt contingencies_monitored.append((cn, i_b)) if new_slacks: m = model - obj_coef = pyo.value(m.TimePeriodLengthHours*m.SystemContingencyLimitPenalty) + obj_coef = m.TimePeriodLengthHours*m.SystemContingencyLimitPenalty if persistent_solver: m_model = m.model() diff --git a/egret/model_library/unit_commitment/services.py b/egret/model_library/unit_commitment/services.py index d9c88010..b69b5b8a 100644 --- a/egret/model_library/unit_commitment/services.py +++ b/egret/model_library/unit_commitment/services.py @@ -275,23 +275,28 @@ def _check_for_requirement( requirement ): default_reg_pen = value(model.LoadMismatchPenalty+model.ReserveShortfallPenalty)/2. ## set these penalties in relation to each other, from higher quality service to lower model.RegulationPenalty = Param(within=NonNegativeReals, - initialize=system.get('regulation_penalty_price', default_reg_pen)) + initialize=system.get('regulation_penalty_price', default_reg_pen), + mutable=True) default_spin_pen = value(model.RegulationPenalty+model.ReserveShortfallPenalty)/2. model.SpinningReservePenalty = Param(within=NonNegativeReals, - initialize=system.get('spinning_reserve_penalty_price', default_spin_pen)) + initialize=system.get('spinning_reserve_penalty_price', default_spin_pen), + mutable=True) default_nspin_pen = value(model.SpinningReservePenalty+model.ReserveShortfallPenalty)/2. model.NonSpinningReservePenalty = Param(within=NonNegativeReals, - initialize=system.get('non_spinning_reserve_penalty_price', default_nspin_pen)) + initialize=system.get('non_spinning_reserve_penalty_price', default_nspin_pen), + mutable=True) default_supp_pen = value(model.NonSpinningReservePenalty+model.ReserveShortfallPenalty)/2. model.SupplementalReservePenalty = Param(within=NonNegativeReals, - initialize=system.get('supplemental_reserve_penalty_price', default_supp_pen)) + initialize=system.get('supplemental_reserve_penalty_price', default_supp_pen), + mutable=True) default_flex_pen = value(model.NonSpinningReservePenalty+model.SpinningReservePenalty)/2. model.FlexRampPenalty = Param(within=NonNegativeReals, - initialize=system.get('flexible_ramp_penalty_price', default_flex_pen)) + initialize=system.get('flexible_ramp_penalty_price', default_flex_pen), + mutable=True) thermal_gen_attrs = md.attributes(element_type='generator', generator_type='thermal')