pypowsybl icon indicating copy to clipboard operation
pypowsybl copied to clipboard

Dynawaltz integration

Open nicolas-pierr opened this issue 2 years ago • 3 comments

Please check if the PR fulfills these requirements (please use '[x]' to check the checkboxes, or submit the PR and then click the checkboxes)

  • [x] The commit message follows our guidelines
  • [x] Tests for the changes have been added (for bug fixes / features)
  • [ ] Docs have been added / updated (for bug fixes / features)
  • [x] Licence headers

Does this PR already have an issue describing the problem ? Fixes #506

nicolas-pierr avatar Oct 19 '22 12:10 nicolas-pierr

Hello @geofjamg and @flo-dup I'm basing the dynawaltz integration on the powsybl-dynawo api. In the given part of the example, you want to add dynamically events with their timestep :

simu = pp.dynamic.Simulation()
simu.add_event(10, pp.dynamic.EventType.BRANCH_DISCONNECTION, 'l1')
simu.add_event(15, pp.dynamic.EventType.SWITCH_CLOSE, 's1')

However, powsybl-dynawo doesn't allow it, it is only able to load via a parameter file (model.par).

Do you want this feature to be added or should it work like the current powsybl-dynawo way and load configurations and parameters from files ?

Also does this conversation should be in the issue or in this PR ?

Thank you

nicolas-pierr avatar Oct 25 '22 09:10 nicolas-pierr

Indeed the timestep is set through the .par file. Therefore you need to modify that file to put the timestep defined by the user. I think this needs to be done in powsybl-dynawo though, because it makes sense for any user to define the timestep in the event and not among some values in the .par file. So far the .par file is seen as an input or a config file in powsybl-dynawo, we need to change this...

flo-dup avatar Oct 27 '22 11:10 flo-dup

We could change the API in the meantime (I mean before powsybl-dynawo is modified to enable time step modifications);

simu = pp.dynamic.Simulation()
simu.add_event(parametersSetId1, pp.dynamic.EventType.BRANCH_DISCONNECTION, 'l1')
simu.add_event(parametersSetId2, pp.dynamic.EventType.SWITCH_CLOSE, 's1')

flo-dup avatar Oct 27 '22 13:10 flo-dup

I rebased on main, I saw that the omega_ref is automaticaly mapped to every synchronized generator. Do you confirm that the user will never have to map omega_ref ?

nicolas-pierr avatar Dec 15 '22 10:12 nicolas-pierr

Also I made a branch on pypowsyb-notebooks with an example to run. All data asssociated (config, network and .par files) is provided. Specific branch is here

nicolas-pierr avatar Dec 15 '22 10:12 nicolas-pierr

Hello, some changes from this morning broke my compilation. I see that the generators models have changed completly. Can you confirm that GeneratorSynchronous and GeneratorFictious are the new mapping for generators that must be done ? And that GeneratorSynchronousThreeWindings and its friends were deleted from powsybl-dynawaltz ?

nicolas-pierr avatar Feb 10 '23 13:02 nicolas-pierr

Indeed, all synchronous generators have been merged into one GeneratorSynchronous class, which takes the library name as new parameter. Therefore you have to change these mappings so that they each give a GeneratorSynchronousAdder which will retain the correct corresponding library name.

flo-dup avatar Feb 13 '23 11:02 flo-dup

I updated the mappings to GeneratorSynchronous variants already implemented. They now use the GeneratorSynchronous class. I also created a DynamicMappingAdder for GeneratorSynchronous, it allows to add via dataframe different types of GeneratorSynchronous with a single call of python.

nicolas-pierr avatar Feb 13 '23 14:02 nicolas-pierr

I also updated the events mapping with the new eventTime and their arguments. There are compilations errors due to commits on main.

nicolas-pierr avatar Feb 13 '23 15:02 nicolas-pierr

Some information about some changes under the hood:

  • I moved a Dataframe function createSeriesMetadata from NetworkCUtil to CTypeUtil, as it is not specific to Network and i needed it to add dynawaltz mapping with dataframes.
  • I also modified some typings in dataframes.py as I called them with enum and not standard python types. And added _add_index_to_kwargs that creates an explicit index for a kwargs that will be used as Dataframe.

nicolas-pierr avatar Feb 14 '23 09:02 nicolas-pierr