Hi all, i am struggling quite a bit with the MPC optimization. The day ahead optimization works fine, but i can’t get the MPC to start running.
I always get an error:
[2025-02-20 23:51:51 +0100] [49] [INFO] Retrieve hass get data method initiated...
[2025-02-20 23:51:51 +0100] [49] [ERROR] Exception on /action/naive-mpc-optim [POST]
Traceback (most recent call last):
File "/app/.venv/lib/python3.12/site-packages/flask/app.py", line 1511, in wsgi_app
response = self.full_dispatch_request()
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/app/.venv/lib/python3.12/site-packages/flask/app.py", line 919, in full_dispatch_request
rv = self.handle_user_exception(e)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/app/.venv/lib/python3.12/site-packages/flask/app.py", line 917, in full_dispatch_request
rv = self.dispatch_request()
^^^^^^^^^^^^^^^^^^^^^^^
File "/app/.venv/lib/python3.12/site-packages/flask/app.py", line 902, in dispatch_request
return self.ensure_sync(self.view_functions[rule.endpoint])(**view_args) # type: ignore[no-any-return]
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/app/src/emhass/web_server.py", line 414, in action_call
input_data_dict = set_input_data_dict(
^^^^^^^^^^^^^^^^^^^^
File "/app/src/emhass/command_line.py", line 262, in set_input_data_dict
if not rh.prepare_data(
^^^^^^^^^^^^^^^^
File "/app/src/emhass/retrieve_hass.py", line 397, in prepare_data
self.df_final[new_var_replace_zero] = self.df_final[
^^^^^^^^^^^^^^
File "/app/.venv/lib/python3.12/site-packages/pandas/core/frame.py", line 4108, in __getitem__
indexer = self.columns._get_indexer_strict(key, "columns")[1]
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/app/.venv/lib/python3.12/site-packages/pandas/core/indexes/base.py", line 6200, in _get_indexer_strict
self._raise_if_missing(keyarr, indexer, axis_name)
File "/app/.venv/lib/python3.12/site-packages/pandas/core/indexes/base.py", line 6252, in _raise_if_missing
raise KeyError(f"{not_found} not in index")
KeyError: "[''] not in index"
the curl command supplied is:
curl -i -H 'Content-Type:application/json' -X POST -d '{"pv_power_forecast":[1, 70, 141, 246, 513, 753, 1049, 1797, 1697, 3078], "prediction_horizon":10, "operating_hours_of_each_deferrable_load":2, "start_timesteps_of_each_deferrable_load":0, "end_timesteps_of_each_deferrable_load":0}' http://192.168.178.80:5000/action/naive-mpc-optim
the log states that runtime parameters are parsed correctly, so that doesn’t seem to be it. I also tried several more simple curl commands, e.g. with only 1 deferrable load + prediction horizon only. Also copying examples from the documentation doesn’t seem to work.
Does anyone have any tips or advice how to solve this?