pandapower python: need OutputWriter before run_timeseries for updating net result

339 views Asked by At

My problem: I am composing a data source that I pass to the constControl(..., ds=ds, ...) that will be updated iteratively. It is the result of a series of calculations at every timestep coming from a model that I built. After passing the results of my model (loads) at every timestep, I want to call run_timeseries and store the results before going to the next iteration. Trying to store some results (e.g. net.res_bus.vm_pu, ...) into a list fails to update the values after every iteration as if the data source object had constant values throughout the iterations, which it doesn't.

My solution: I found that calling OutputWriter() before the run_timeseries() and letting it output an excel file at every iteration successfully updates the results I am simultaneously storing in that empty list. So it works now!

My question: I don't want to be forced to output excel files every time I run_timeseries() in order for the results to be stored and/or successfully updated in the next iteration. I do not even need excel files at the moment. Is there any way to not having to call OutputWriter() but store net's result values in an empty list?

1

There are 1 answers

0
Andre Geraldo On

You don't neet to use OutputWriter(). It depends in what you're trying to do, if you create a loop that make the same as run_timeseries() that might work.

In my case I wanted to change the load and make a new power flow calculation every time the change was made.

A overview of the steps taken:

  • Create a loop

  • Each step change the load using map to go through all item in net.load.p_mw for example.

  • Call the run_control(net) to make the new power flow calculation.

Then you can create a list to collect the data and convert it in JSON.

  • data = all bus data
  • json = { dataBuses: data }

Once it's in JSON format you can even send to a database by a post request or whatever you desire.