diff --git a/osier/models/dispatch.py b/osier/models/dispatch.py index 9cfda74..95f5483 100644 --- a/osier/models/dispatch.py +++ b/osier/models/dispatch.py @@ -148,7 +148,7 @@ class DispatchModel(): penalty : float The penalty applied to the objective function to eliminate simultaneous charging and discharging. Users may need to tune - this parameter. Default is 1e-4. + this parameter. Default is 1e-10. model_initialized : bool Indicates whether :attr:`DispatchModel.model` has been populated with equations yet. This is set to ``True`` after @@ -205,7 +205,7 @@ def __init__(self, oversupply=0.0, undersupply=0.0, verbosity=50, - penalty=1e-4, + penalty=1e-10, power_units=MW, curtailment=True, allow_blackout=False, diff --git a/osier/models/logic_dispatch.py b/osier/models/logic_dispatch.py index 925e4bd..abb9149 100644 --- a/osier/models/logic_dispatch.py +++ b/osier/models/logic_dispatch.py @@ -101,7 +101,7 @@ def _format_results(self): t.charge_history).to_ndarray() data["Curtailment"] = np.array( [v if v <= 0 else 0 for v in self.covered_demand]) - data["Shortfall"] = np.array( + data["LoadLoss"] = np.array( [v if v > 0 else 0 for v in self.covered_demand]) self.results = pd.DataFrame(data) return @@ -134,7 +134,7 @@ def solve(self): if self.verbosity <= 20: print( ('solve failed -- ' - 'too much overproduction ' + 'too much supply ' '(no curtailment allowed)')) raise ValueError diff --git a/osier/models/model.py b/osier/models/model.py index 675fe91..92d3711 100644 --- a/osier/models/model.py +++ b/osier/models/model.py @@ -41,10 +41,7 @@ def __init__(self, else: self.power_units = power_units - self.technology_list = synchronize_units( - technology_list, - unit_power=self.power_units, - unit_time=self.time_delta.units) + self.technology_list = technology_list @property def time_delta(self): diff --git a/osier/utils.py b/osier/utils.py index b7c5dcc..e5d00a9 100644 --- a/osier/utils.py +++ b/osier/utils.py @@ -562,12 +562,18 @@ def n_mga(results_obj, raise ValueError pf = results_obj.F + xpf = results_obj.X try: n_inds, n_objs = pf.shape except ValueError: n_inds = pf.shape[0] n_objs = 1 + try: + n_inds, n_vars = xpf.shape + except ValueError: + n_vars = xpf.shape[0] + pop_size = results_obj.algorithm.pop_size n_gen = results_obj.algorithm.n_gen - 1 @@ -576,7 +582,7 @@ def n_mga(results_obj, sense=sense) X_hist = np.array([hist.pop.get("X") for hist in results_obj.history]).reshape( - n_gen * pop_size, n_objs) + n_gen * pop_size, n_vars) F_hist = np.array([hist.pop.get("F") for hist in results_obj.history]).reshape( n_gen * pop_size, n_objs) try: