sogno-platform / dpsim

Real-time power system simulator including powerflow, (dynamic) phasors and EMT
https://sogno.energy/dpsim/
Mozilla Public License 2.0
67 stars 49 forks source link

Missing "stop" function in the "Simulation" pybind binding #248

Closed leonardocarreras closed 11 months ago

leonardocarreras commented 12 months ago

When using dpsim with the python interface, there is an option to do simulations in steps.

After usingSimulation.start() to initiate the simulation and Simulation.step() in a loop to calculate the intermediate results, the Simulation.stop() method is called, but it does not exist and raises an exception.

One would expect this function present in the Simulation class https://github.com/sogno-platform/dpsim/blob/97f8e1ff6bad0a69abb1e3f6de76af7e8afcf593/dpsim/include/dpsim/Simulation.h#L215 to also be in the mapping class https://github.com/sogno-platform/dpsim/blob/97f8e1ff6bad0a69abb1e3f6de76af7e8afcf593/dpsim/src/pybind/main.cpp#L79 but is not.

This is now being used in a project context with jupyterlab, so it would be nice if we could have the changes also released in PyPI (to enable installation in an easy way).

leonardocarreras commented 12 months ago

PR #247 proposes a solution that solves the issue, thanks to @martinmoraga for the hints on how to tackle the problem.