-
Notifications
You must be signed in to change notification settings - Fork 9
Open
Labels
bugSomething isn't workingSomething isn't working
Description
Please describe the bug
When running optimization, ZeroDivisionError occurs.
What are the steps to reproduce the bug?
- Create
.envwith following settings (the rest vars are not important for this issue)
TIMERESOLUTION=3600
# 604800 seconds = 1 week
CLUSTERLENGTH=604800
CLUSTERNUMBER=8
# 3600 seconds = 1 hour
DATARESOLUTION=3600
# 31536000 seconds = 1 year
DATALENGTH=31536000
- Run
e8_scenario_evaluation.pywhile using the created.env, for example,
data = Datahandler(scenario_name = "example",
env_path=r"D:\Git\districtgenerator\.env")- Following error should occur (if not try run it again :) )
...
File "D:\Git\districtgenerator\districtgenerator\functions\opti_central.py", line 473, in run_opti_central
model.addConstr(cool_dom["CC"][n][t] == power_dom["CC"][n][t] * param_dec_devs["CC"]["grade"]
File "src/gurobipy/linexpr.pxi", line 574, in gurobipy._core.LinExpr.__truediv__
ZeroDivisionError: float divisionSuggestion
Seems like following constraint is causing problem
districtgenerator/districtgenerator/functions/opti_central.py
Lines 472 to 475 in 48f7157
| # Compression chiller | |
| model.addConstr(cool_dom["CC"][n][t] == power_dom["CC"][n][t] * param_dec_devs["CC"]["grade"] | |
| * (273.15 + 5) / (T_e[t] - 5), | |
| name="CC_energybalance_cooling_" + str(n) + "_" + str(t)) |
Adding a small number, like
(T_e[t] - 5 + 1e-6), can avoid the problem when (T_e[t] - 5) is exactly 0Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working