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

Incorrect Error Thrown to PySWMM #404

Open
bemcdonnell opened this issue Feb 9, 2024 · 0 comments
Open

Incorrect Error Thrown to PySWMM #404

bemcdonnell opened this issue Feb 9, 2024 · 0 comments
Assignees

Comments

@bemcdonnell
Copy link
Member

", line 48, in after_start_callback
    SU1.initial_depth=8
    ^^^^^^^^^^^^^^^^^
  File "/Users/bryant/local_development/pyswmm/_attic/venv/lib/python3.12/site-packages/pyswmm/nodes.py", line 430, in initial_depth
    self._model.setNodeParam(self._nodeid, NodeParams.initDepth.value,
  File "/Users/bryant/local_development/pyswmm/_attic/venv/lib/python3.12/site-packages/pyswmm/swmm5.py", line 701, in setNodeParam
    solver.node_set_parameter(index, parameter, value)
  File "/Users/bryant/local_development/pyswmm/_attic/venv/lib/python3.12/site-packages/swmm/toolkit/solver.py", line 1117, in node_set_parameter
    return _solver.node_set_parameter(index, param, value)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Exception: 
 API Key Error: Simulation Not Running
with Simulation('./SWMMExtCntrlModel.inp',
                './SWMMExtCntrlModel_2.rpt',
                './SWMMExtCntrlModel_2.out') as sim:

    SU1 = Nodes(sim)['SU1']

    def after_start_callback():
        '''Initialize '''
        SU1.initial_depth=8

    sim.add_after_start(after_start_callback)

    for ind, step in enumerate(sim):
        pass

Should throw "SIMULATION RUNNING"

https://github.com/pyswmm/Stormwater-Management-Model/blob/459db1d4dfc61ff994ae01f92eae64e378e08915/src/solver/include/toolkit_errors.txt#L16C1-L16C70

@bemcdonnell bemcdonnell self-assigned this Feb 9, 2024
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

1 participant