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

ERROR: division by zero inPL/pgSQL function otg_calc_transformer_specifications() #17

Open
IsGut opened this issue Oct 21, 2024 · 3 comments

Comments

@IsGut
Copy link

IsGut commented Oct 21, 2024

https://github.com/openego/osmTGmod/blob/features/egon/sql-scripts/functions.sql#L2502C21-L2502C33

Hi, unfortunately, this leading to error

NOTICE: v_branch.branch_id: 24907
NOTICE: v_branch.f_bus: 31814
NOTICE: v_branch.t_bus: 31815
NOTICE: v_S_long_MVA_sum_min: 0
NOTICE: v_U_OS: 380000
NOTICE: v_U_US: 110000
NOTICE: v_numb_transformers: 0
NOTICE: v_Srt: 3e+08
NOTICE: v_u_kr: 14
NOTICE: v_Z_TOS: 67.386665
NOTICE: v_X_TOS: 67.386665
NOTICE: v_Bl_TOS: -0.014839731
NOTICE: v_Bl_TOS_all: -0

ERROR: division by zero

e.g. [2024-10-19, 16:29:46 UTC] {init.py:484} ERROR - Exception raised with command 260. Check *** and code and restart with 'python ego_otg.py status2019 260'.
Traceback (most recent call last):
File "/home/ise/execution_folder/powerd-data/src/egon/data/datasets/osmtgmod/init.py", line 481, in osmtgmod
cur.execute(command)
psycopg2.errors.DivisionByZero: division by zero
CONTEXT: PL/pgSQL function otg_calc_transformer_specifications() line 54 at assignment

Executing SQL statement 260: called here https://github.com/openego/powerd-data/blob/features/auto-update-function/src/egon/data/datasets/osmtgmod/__init__.py#L484

@IsGut
Copy link
Author

IsGut commented Oct 21, 2024

As quickfix I would suggest something like take max if min is 0, e.g.

NOTICE: v_branch.branch_id: 24485
NOTICE: v_branch.f_bus: 28165
NOTICE: v_branch.t_bus: 28166
NOTICE: v_S_long_MVA_sum_min: 0
NOTICE: v_S_long_MVA_sum_max: 1040
NOTICE: v_U_OS: 220000
NOTICE: v_U_US: 110000
NOTICE: v_numb_transformers: 0 <- leading to v_Bl_TOS_all is 0
NOTICE: v_numb_transformers_max: 6
NOTICE: v_Srt: 2e+08
NOTICE: v_u_kr: 12
NOTICE: v_Z_TOS: 29.04
NOTICE: v_X_TOS: 29.04
NOTICE: v_Bl_TOS: -0.03443526
NOTICE: v_Bl_TOS_all: -0 <- due to v_numb_transformers is 0

@IsGut
Copy link
Author

IsGut commented Oct 21, 2024

Hi @ulfmueller @ClaraBuettner
as mentioned in our last jour fix, I faced an issue with osmtgmod. I assume for min, we don't have valid data for whole Germany, thus, Exception raised with command 260. Check *** and code and restart with 'python ego_otg.py status2019 260'. called here https://github.com/openego/powerd-data/blob/features/auto-update-function/src/egon/data/datasets/osmtgmod/__init__.py#L484

And resulting in an empty schemas.osmtgmod_results.branch_data & an empty schemas.osmtgmod_results.bus_data table

Testing with SH was working for me.

@ClaraBuettner
Copy link

We fixed this problem in #18

There were some issues with two substations, both of them are not inside Schleswig-Holstein, so the test mode worked.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants