Skip to content

Commit

Permalink
2 small fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
BDonnot committed Sep 30, 2024
1 parent 03df698 commit 77c5594
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 5 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,9 @@ Next release
- [FIXED] an issue in the backend: if the backend failed to be
created the `_grid` attribute was set to `None` and not set back to
- [FIXED] the `self.skip_if_needed()` was missing for one of the test suite.
- [FIXED] an error in the descirption of the `educ_case14_storage` environment
(wrong sign for the slack generator)
- [IMPROVED] error message when forecasts are not correctly set-up

[1.10.3] - 2024-07-12
-------------------------
Expand Down
8 changes: 5 additions & 3 deletions grid2op/Chronics/gridStateFromFileWithForecasts.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,10 +71,10 @@ def __init__(
self._order_prod_p_forecasted = None
self._order_prod_v_forecasted = None
self._data_already_in_mem = False # says if the "main" value from the base class had to be reloaded (used for chunk)

self._nb_forecast = len(h_forecast)
self._h_forecast = copy.deepcopy(h_forecast)
self._check_hs_consistent(self._h_forecast, time_interval)

# init base class
GridStateFromFile.__init__(
self,
Expand All @@ -83,7 +83,7 @@ def __init__(
time_interval=time_interval,
max_iter=max_iter,
chunk_size=chunk_size,
)
)

def _clear(self):
super()._clear()
Expand All @@ -106,7 +106,9 @@ def _check_hs_consistent(self, h_forecast, time_interval):
if prev.total_seconds() // 60 != h:
raise ChronicsError("For now you cannot build non contiuguous forecast. "
"Forecast should look like [5, 10, 15, 20] "
"but not [10, 15, 20] (missing h=5mins) or [5, 10, 20] (missing h=15)")
"but not [10, 15, 20] (missing h=5mins) or [5, 10, 20] "
f"(missing h=15 in this example). Missing h={prev} "
f"at position {i}, found {h}")

def _get_next_chunk_forecasted(self):
load_p = None
Expand Down
4 changes: 2 additions & 2 deletions grid2op/data/educ_case14_storage/grid.json
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@
"gen": {
"_module": "pandas.core.frame",
"_class": "DataFrame",
"_object": "{\"columns\":[\"name\",\"bus\",\"p_mw\",\"vm_pu\",\"sn_mva\",\"min_q_mvar\",\"max_q_mvar\",\"scaling\",\"slack\",\"in_service\",\"type\",\"controllable\",\"min_p_mw\",\"max_p_mw\",\"slack_weight\",\"power_station_trafo\"],\"index\":[0,1,2,3,4,5],\"data\":[[null,1,40.0,1.045,null,-40.0,50.0,1.0,false,true,null,true,0.0,140.0,0.0,null],[null,2,0.0,1.01,null,0.0,40.0,1.0,false,true,null,true,0.0,100.0,0.0,null],[null,5,0.0,1.07,null,-6.0,24.0,1.0,false,true,null,true,0.0,100.0,0.0,null],[null,5,0.0,1.07,null,-6.0,24.0,1.0,false,true,null,true,0.0,100.0,0.0,null],[null,7,0.0,1.09,null,-6.0,24.0,1.0,false,true,null,true,0.0,100.0,0.0,null],[\"gen_0_5\",0,-219.0,1.06,null,-9999.0,9999.0,1.0,true,true,null,true,null,null,1.0,null]]}",
"_object": "{\"columns\":[\"name\",\"bus\",\"p_mw\",\"vm_pu\",\"sn_mva\",\"min_q_mvar\",\"max_q_mvar\",\"scaling\",\"slack\",\"in_service\",\"type\",\"controllable\",\"min_p_mw\",\"max_p_mw\",\"slack_weight\",\"power_station_trafo\"],\"index\":[0,1,2,3,4,5],\"data\":[[null,1,40.0,1.045,null,-40.0,50.0,1.0,false,true,null,true,0.0,140.0,0.0,null],[null,2,0.0,1.01,null,0.0,40.0,1.0,false,true,null,true,0.0,100.0,0.0,null],[null,5,0.0,1.07,null,-6.0,24.0,1.0,false,true,null,true,0.0,100.0,0.0,null],[null,5,0.0,1.07,null,-6.0,24.0,1.0,false,true,null,true,0.0,100.0,0.0,null],[null,7,0.0,1.09,null,-6.0,24.0,1.0,false,true,null,true,0.0,100.0,0.0,null],[\"gen_0_5\",0,219.0,1.06,null,-9999.0,9999.0,1.0,true,true,null,true,null,null,1.0,null]]}",
"orient": "split",
"dtype": {
"name": "object",
Expand Down Expand Up @@ -1763,4 +1763,4 @@
},
"user_pf_options": {}
}
}
}

0 comments on commit 77c5594

Please sign in to comment.