From 77c5594ea28b24f3e780abd37b5b7fa061ece4ce Mon Sep 17 00:00:00 2001 From: DONNOT Benjamin Date: Mon, 30 Sep 2024 15:21:56 +0200 Subject: [PATCH 1/3] 2 small fixes --- CHANGELOG.rst | 3 +++ grid2op/Chronics/gridStateFromFileWithForecasts.py | 8 +++++--- grid2op/data/educ_case14_storage/grid.json | 4 ++-- 3 files changed, 10 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 16c8e7561..e90e7bdf5 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -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 ------------------------- diff --git a/grid2op/Chronics/gridStateFromFileWithForecasts.py b/grid2op/Chronics/gridStateFromFileWithForecasts.py index 3e60ed4ad..8dadcdb4c 100644 --- a/grid2op/Chronics/gridStateFromFileWithForecasts.py +++ b/grid2op/Chronics/gridStateFromFileWithForecasts.py @@ -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, @@ -83,7 +83,7 @@ def __init__( time_interval=time_interval, max_iter=max_iter, chunk_size=chunk_size, - ) + ) def _clear(self): super()._clear() @@ -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 diff --git a/grid2op/data/educ_case14_storage/grid.json b/grid2op/data/educ_case14_storage/grid.json index 2f27b3528..f19d375d4 100644 --- a/grid2op/data/educ_case14_storage/grid.json +++ b/grid2op/data/educ_case14_storage/grid.json @@ -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", @@ -1763,4 +1763,4 @@ }, "user_pf_options": {} } -} \ No newline at end of file +} From 7157d82d036c3610d1701d10c0f6cd789d86d89a Mon Sep 17 00:00:00 2001 From: DONNOT Benjamin Date: Mon, 30 Sep 2024 15:53:54 +0200 Subject: [PATCH 2/3] fix CI --- .github/workflows/main.yml | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 1e8054ad0..185443976 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -14,6 +14,7 @@ jobs: container: quay.io/pypa/manylinux2014_x86_64 env: ACTIONS_ALLOW_USE_UNSECURE_NODE_VERSION: true + GHA_USE_NODE_20: false strategy: matrix: python: @@ -46,7 +47,7 @@ jobs: steps: - name: Checkout sources - uses: actions/checkout@v1 + uses: actions/checkout@v3 with: submodules: true @@ -159,13 +160,13 @@ jobs: run: python setup.py sdist - name: Upload wheel - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v4 with: name: grid2op-wheel-${{ matrix.config.name }}-${{ matrix.python.name }} path: dist/*.whl - name: Upload source archive - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v4 if: matrix.config.name == 'darwin' && matrix.python.name == 'cp310' with: name: grid2op-sources @@ -238,12 +239,12 @@ jobs: steps: - name: Download wheels - uses: actions/download-artifact@v2 + uses: actions/download-artifact@v4 with: path: download - name: Upload wheels - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v4 with: name: grid2op-wheels path: | From df61eaf07a6aa29a4bfc57710abf617c9d2ec2df Mon Sep 17 00:00:00 2001 From: DONNOT Benjamin Date: Mon, 30 Sep 2024 16:17:24 +0200 Subject: [PATCH 3/3] fix CI --- grid2op/tests/test_MakeEnv.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/grid2op/tests/test_MakeEnv.py b/grid2op/tests/test_MakeEnv.py index 964383dc7..9bdfbd1af 100644 --- a/grid2op/tests/test_MakeEnv.py +++ b/grid2op/tests/test_MakeEnv.py @@ -763,7 +763,7 @@ def test_hash_l2rpn_case14_sandbox(self): def test_hash_educ_case14_storage(self): # the file "storage_units_charac" was not used when hashing the environment, which was a bug self.aux_test_hash_l2rpn_case14_sandbox("educ_case14_storage", - "c5192c21b778129ae4201ff5c992c1d7605fda26280c7267858d3e87cf03adbc15a15913355908b39a7c0839811eec399bed82714d4cd78e5fcae7d984bd641b") + "fb8cfe8d2cd7ab24558c90ca0309303600343091d41c43eae50abb09ad56c0fc8bec321bfefb0239c28ebdb4f2e75fc11948b4dd8dc967e4a10303eac41c7176") if __name__ == "__main__": unittest.main()