Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG]: Exception in visualize #451

Open
RobertHerter opened this issue Feb 10, 2025 · 0 comments
Open

[BUG]: Exception in visualize #451

RobertHerter opened this issue Feb 10, 2025 · 0 comments
Labels
bug Something isn't working

Comments

@RobertHerter
Copy link

Describe the issue:

optimize results in exception.

Reproduceable code example:

#    report.create_line_chart_date(                                                                                                                                                                                                                             
#       next_full_hour_date,                                                                                                                                                                                                                                    
#        [                                                                                                                                                                                                                                                      
#            np.full(                                                                                                                                                                                                                                           
#                len(parameters.ems.gesamtlast) - start_hour,                                                                                                                                                                                                   
#                parameters.ems.einspeiseverguetung_euro_pro_wh,                                                                                                                                                                                                
#            )                                                                                                                                                                                                                                                  
#        ],                                                                                                                                                                                                                                                     
#        title="Remuneration",                                                                                                                                                                                                                                  
#        # xlabel="Hours", # not enough space                                                                                                                                                                                                                   
#        ylabel="€/Wh",                                                                                                                                                                                                                                         
#        x2label=None,  # not enough space                                                                                                                                                                                                                      
#    )

Error message:

<details>
Feb 10 08:36:38 openhab fastapi[203759]: Time evaluate inner: 84.2737 sec.
Feb 10 08:36:38 openhab fastapi[203759]:       INFO   192.168.71.12:34946 - "POST /optimize HTTP/1.1" 500
Feb 10 08:36:38 openhab fastapi[203759]:      ERROR   Exception in ASGI application
Feb 10 08:36:38 openhab fastapi[203759]: Traceback (most recent call last):
Feb 10 08:36:38 openhab fastapi[203759]:   File "/opt/EOS/.venv/lib/python3.11/site-packages/uvicorn/protocols/http/httptools_impl.py", line 409, in run_asgi
Feb 10 08:36:38 openhab fastapi[203759]:     result = await app(  # type: ignore[func-returns-value]
Feb 10 08:36:38 openhab fastapi[203759]:              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Feb 10 08:36:38 openhab fastapi[203759]:   File "/opt/EOS/.venv/lib/python3.11/site-packages/uvicorn/middleware/proxy_headers.py", line 60, in __call__
Feb 10 08:36:38 openhab fastapi[203759]:     return await self.app(scope, receive, send)
Feb 10 08:36:38 openhab fastapi[203759]:            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Feb 10 08:36:38 openhab fastapi[203759]:   File "/opt/EOS/.venv/lib/python3.11/site-packages/fastapi/applications.py", line 1054, in __call__
Feb 10 08:36:38 openhab fastapi[203759]:     await super().__call__(scope, receive, send)
Feb 10 08:36:38 openhab fastapi[203759]:   File "/opt/EOS/.venv/lib/python3.11/site-packages/starlette/applications.py", line 112, in __call__
Feb 10 08:36:38 openhab fastapi[203759]:     await self.middleware_stack(scope, receive, send)
Feb 10 08:36:38 openhab fastapi[203759]:   File "/opt/EOS/.venv/lib/python3.11/site-packages/starlette/middleware/errors.py", line 187, in __call__
Feb 10 08:36:38 openhab fastapi[203759]:     raise exc
Feb 10 08:36:38 openhab fastapi[203759]:   File "/opt/EOS/.venv/lib/python3.11/site-packages/starlette/middleware/errors.py", line 165, in __call__
Feb 10 08:36:38 openhab fastapi[203759]:     await self.app(scope, receive, _send)
Feb 10 08:36:38 openhab fastapi[203759]:   File "/opt/EOS/.venv/lib/python3.11/site-packages/starlette/middleware/exceptions.py", line 62, in __call__
Feb 10 08:36:38 openhab fastapi[203759]:     await wrap_app_handling_exceptions(self.app, conn)(scope, receive, send)
Feb 10 08:36:38 openhab fastapi[203759]:   File "/opt/EOS/.venv/lib/python3.11/site-packages/starlette/_exception_handler.py", line 53, in wrapped_app
Feb 10 08:36:38 openhab fastapi[203759]:     raise exc
Feb 10 08:36:38 openhab fastapi[203759]:   File "/opt/EOS/.venv/lib/python3.11/site-packages/starlette/_exception_handler.py", line 42, in wrapped_app
Feb 10 08:36:38 openhab Node-RED[205792]: 10 Feb 08:36:38 - [warn] [http request:31d21009fe6e6f10] JSON-Parse-Fehler
Feb 10 08:36:38 openhab Node-RED[205792]: 10 Feb 08:36:38 - [error] [function:Store Solution] TypeError: Cannot read properties of undefined (reading 'Last_Wh_pro_Stunde')
Feb 10 08:36:38 openhab fastapi[203759]:     await app(scope, receive, sender)
Feb 10 08:36:38 openhab fastapi[203759]:   File "/opt/EOS/.venv/lib/python3.11/site-packages/starlette/routing.py", line 715, in __call__
Feb 10 08:36:38 openhab fastapi[203759]:     await self.middleware_stack(scope, receive, send)
Feb 10 08:36:38 openhab fastapi[203759]:   File "/opt/EOS/.venv/lib/python3.11/site-packages/starlette/routing.py", line 735, in app
Feb 10 08:36:38 openhab fastapi[203759]:     await route.handle(scope, receive, send)
Feb 10 08:36:38 openhab fastapi[203759]:   File "/opt/EOS/.venv/lib/python3.11/site-packages/starlette/routing.py", line 288, in handle
Feb 10 08:36:38 openhab fastapi[203759]:     await self.app(scope, receive, send)
Feb 10 08:36:38 openhab fastapi[203759]:   File "/opt/EOS/.venv/lib/python3.11/site-packages/starlette/routing.py", line 76, in app
Feb 10 08:36:38 openhab fastapi[203759]:     await wrap_app_handling_exceptions(app, request)(scope, receive, send)
Feb 10 08:36:38 openhab fastapi[203759]:   File "/opt/EOS/.venv/lib/python3.11/site-packages/starlette/_exception_handler.py", line 53, in wrapped_app
Feb 10 08:36:38 openhab fastapi[203759]:     raise exc
Feb 10 08:36:38 openhab fastapi[203759]:   File "/opt/EOS/.venv/lib/python3.11/site-packages/starlette/_exception_handler.py", line 42, in wrapped_app
Feb 10 08:36:38 openhab fastapi[203759]:     await app(scope, receive, sender)
Feb 10 08:36:38 openhab fastapi[203759]:   File "/opt/EOS/.venv/lib/python3.11/site-packages/starlette/routing.py", line 73, in app
Feb 10 08:36:38 openhab fastapi[203759]:     response = await f(request)
Feb 10 08:36:38 openhab fastapi[203759]:                ^^^^^^^^^^^^^^^^
Feb 10 08:36:38 openhab fastapi[203759]:   File "/opt/EOS/.venv/lib/python3.11/site-packages/fastapi/routing.py", line 301, in app
Feb 10 08:36:38 openhab fastapi[203759]:     raw_response = await run_endpoint_function(
Feb 10 08:36:38 openhab fastapi[203759]:                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Feb 10 08:36:38 openhab fastapi[203759]:   File "/opt/EOS/.venv/lib/python3.11/site-packages/fastapi/routing.py", line 214, in run_endpoint_function
Feb 10 08:36:38 openhab fastapi[203759]:     return await run_in_threadpool(dependant.call, **values)
Feb 10 08:36:38 openhab fastapi[203759]:            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Feb 10 08:36:38 openhab fastapi[203759]:   File "/opt/EOS/.venv/lib/python3.11/site-packages/starlette/concurrency.py", line 37, in run_in_threadpool
Feb 10 08:36:38 openhab fastapi[203759]:     return await anyio.to_thread.run_sync(func)
Feb 10 08:36:38 openhab fastapi[203759]:            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Feb 10 08:36:38 openhab fastapi[203759]:   File "/opt/EOS/.venv/lib/python3.11/site-packages/anyio/to_thread.py", line 56, in run_sync
Feb 10 08:36:38 openhab fastapi[203759]:     return await get_async_backend().run_sync_in_worker_thread(
Feb 10 08:36:38 openhab fastapi[203759]:            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Feb 10 08:36:38 openhab fastapi[203759]:   File "/opt/EOS/.venv/lib/python3.11/site-packages/anyio/_backends/_asyncio.py", line 2461, in run_sync_in_worker_thread
Feb 10 08:36:38 openhab fastapi[203759]:     return await future
Feb 10 08:36:38 openhab fastapi[203759]:            ^^^^^^^^^^^^
Feb 10 08:36:38 openhab fastapi[203759]:   File "/opt/EOS/.venv/lib/python3.11/site-packages/anyio/_backends/_asyncio.py", line 962, in run
Feb 10 08:36:38 openhab fastapi[203759]:     result = context.run(func, *args)
Feb 10 08:36:38 openhab fastapi[203759]:              ^^^^^^^^^^^^^^^^^^^^^^^^
Feb 10 08:36:38 openhab fastapi[203759]:   File "/opt/EOS/src/akkudoktoreos/server/eos.py", line 838, in fastapi_optimize
Feb 10 08:36:38 openhab fastapi[203759]:     result = opt_class.optimierung_ems(parameters=parameters, start_hour=start_hour)
Feb 10 08:36:38 openhab fastapi[203759]:              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Feb 10 08:36:38 openhab fastapi[203759]:   File "/opt/EOS/src/akkudoktoreos/optimization/genetic.py", line 670, in optimierung_ems
Feb 10 08:36:38 openhab fastapi[203759]:     prepare_visualize(parameters, visualize, start_hour=start_hour)
Feb 10 08:36:38 openhab fastapi[203759]:   File "/opt/EOS/src/akkudoktoreos/utils/visualize.py", line 455, in prepare_visualize
Feb 10 08:36:38 openhab fastapi[203759]:     #            np.full(
Feb 10 08:36:38 openhab fastapi[203759]:                 ^^^^^^^^^
Feb 10 08:36:38 openhab fastapi[203759]:   File "/opt/EOS/.venv/lib/python3.11/site-packages/numpy/_core/numeric.py", line 353, in full
Feb 10 08:36:38 openhab fastapi[203759]:     multiarray.copyto(a, fill_value, casting='unsafe')
Feb 10 08:36:38 openhab fastapi[203759]: ValueError: could not broadcast input array from shape (48,) into shape (40,)
</details>

Version information:

master

@RobertHerter RobertHerter added the bug Something isn't working label Feb 10, 2025
@RobertHerter RobertHerter changed the title [BUG]: Exception in visualize aktual master [BUG]: Exception in visualize Feb 10, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant