pypowsybl
pypowsybl copied to clipboard
Dynawaltz integration
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
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
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...
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')
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 ?
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
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 ?
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.
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.
I also updated the events mapping with the new eventTime and their arguments. There are compilations errors due to commits on main.
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.