Skip to content

Commit

Permalink
TwoWindings and ThreeWindings new Cgmes conversion (#1066)
Browse files Browse the repository at this point in the history
* Refact generator regulating control

Signed-off-by: José Antonio Marqués <marquesja@aia.es>
Signed-off-by: Luma Zamarreño <zamarrenolm@aia.es>

* Two windings tranformer regulating control refactoring
* Static Var Compensator Regulating Control refactoring
* Merge master into branch T3xRegulatingControl
* Warning message
* Sonar Fixes
* Unitary test: three windings transformer with two regulating controls enabled.
* Reviewer comments
* CorrectlySet adjustments
* class names and method names: uniformization
* Reviewer comments, merge some methods
* Add phaseAngleClock to twoWindingsTransformer as an extension
* Only one regulating control enabled
* Delete unnecessary code
* Test adjustments (Now only one regulating control enabled is allowed)
* PhaseTapChanger. Fix regulationMode - Regulating
* apply previous reviewer comments
* Adjust warning message
* T3x new api
* Only one phaseAngleClock in twoWindingsTransformer
* Add phaseAngleClock in ThreeWindingsTransformer as an extension
* Improve phaseAngleClock test
* pretty code
* Test adjustment
* ThreeWindingsTransformer: Check if there is more than one tap changer on the leg
* Add the method setPhaseAngleClock in the test
* Add the methods setPhaseAngleClockLeg2 and setPhaseAngleClockLeg3 in tests
* Rename old classes. Add new classes with minimal code.
* Apply reviewer comments
* extend twoWindingsTransformer phaseAngleClock reviewer comments to threeWindingsTransformer
* TxConversion, cgmesModel load
* Rename classes
* TwoWindingsTransformer and ThreeWindingsTransformer: interpreted model
* Add regulating. Pretty code
* TwoWindingsTransformer and ThreeWindingsTransformer: set to IIDM
* Set phaseAngleClock to IIDM
* TwoWindingsTransformer and ThreeWindingsTransformer: RegulatingControl context
* Improve isSymmetrical method
* Fix alpha in getStepXforAsymmetrical and getStepXforSymmetrical
* Fix merging view
* add phaseTapChanger compare in threeWindingsTransformer
* Sonar fixes
* add new tests to increase coverage
* Fix warning ratio and phase on the leg
* add xml test for a three windings transformer with all tap changers
* Fix ThreeWindingsTransformer phaseAngleClock test to the current xml converter version
* TwoWindingsTransformer and ThreeWindingsTransformer instead of Connectable
* Extend some methods to all tap changers of the threeWindingsTransformer
* Do not discard the tapChanger if tapPosition is outside limits. An exception will be generated.
* warning when a tapChanger is fixed
* Update Three Windings Transformer javadoc
* PhaseAngleClock adjustment
* Loadflow validation and loadflow resultscompletion adjustments
* Use alphaRatio to clarify the code
* Symmetrical and Asymmetrical phaseTapChanger refactorization
* Update Copyright
* Xfmr2RatioPhaseRtc should be Xfmr2RatioPhaseX
* Xfmr2 only one negate. Add negate to Xfmr3. Delete Rtc option in ratio0Xfmr2.
* Delete unnecessary functions

Signed-off-by: José Antonio Marqués <marquesja@aia.es>

* Verify interpretation for the location of CGMES tap changers relative to transmission impedance of the corresponding transformer end
* current conversion uses configuration for considering phase angle clock

Signed-off-by: Luma Zamarreño <zamarrenolm@aia.es>

* Set deprecated functions

Signed-off-by: José Antonio Marqués <marquesja@aia.es>

* check same identifiers instead of ensuring equivalent objects
* Identifiables may be null

Signed-off-by: Luma Zamarreño <zamarrenolm@aia.es>

* Compare current conversion and new conversion. JavaDoc interpretation alternatives.

Signed-off-by: José Antonio Marqués <marquesja@aia.es>

* consider PhaseTapChangerLinear to keep conversion identical to previous one
* Allow PhaseTapChangerTablePoint without angle attribute
Although CGMES says it is required, it has been found as a common error in some test cases

Signed-off-by: Luma Zamarreño <zamarrenolm@aia.es>

* Improve and fix configuration of alternatives

Signed-off-by: José Antonio Marqués <marquesja@aia.es>

* flows on 3-windings transformer: take into account ratio tap changer at leg 1
* additional tests; avoid static flag to select between current/new transformer conversion

Signed-off-by: Luma Zamarreño <zamarrenolm@aia.es>

* Fix step adjustment in TwtData

Signed-off-by: José Antonio Marqués <marquesja@aia.es>

* Delete profiling

Signed-off-by: RALAMBOTIANA MIORA <miora.ralambotiana@rte-france.com>

* keep angle required in phase tap changer table point, following standard

Signed-off-by: Luma Zamarreño <zamarrenolm@aia.es>

* structuralRatio instead of ratio0 to be more understable
* Delete all conversion code associated with phaseAngleClock
* Do the shunt admittance conversion at the convert stage.

Signed-off-by: José Antonio Marqués <marquesja@aia.es>

* reorganize code to enhance readability

Signed-off-by: Luma Zamarreño <zamarrenolm@aia.es>

* Review and initial documentation of conversion methods to enhance readability
* Xfmr2ShuntInterpretationAlternative: Fix END1_END2 as default
* Fix ShuntAdmittance bug in BranchData and TwtData. Test adjustments.
* Delete xfmr2PhaseNegate and xfmr3PhaseNegate alternatives
* CgmesT2xModel, InterpretedT2xModel, ConvertedT2xModel, CgmesT3xModel, InterpretedT3xModel and ConvertedT3xModel in separated classes
* Reduce duplicated code
* Delete unnecessary code
* Apply reviewer comments

Signed-off-by: José Antonio Marqués <marquesja@aia.es>

* Fix code smells

Signed-off-by: RALAMBOTIANA MIORA <miora.ralambotiana@rte-france.com>

Signed-off-by: José Antonio Marqués <marquesja@aia.es>
Co-authored-by: Luma <zamarrenolm@aia.es>
Co-authored-by: MioRtia <miora.ralambotiana@rte-france.com>
  • Loading branch information
3 people committed Jan 14, 2020
1 parent 6a9bd09 commit 0b81084
Show file tree
Hide file tree
Showing 50 changed files with 3,802 additions and 332 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,12 @@ private Conversion.Config config(Properties p) {
getFormat(),
p,
STORE_CGMES_CONVERSION_CONTEXT_AS_NETWORK_EXTENSION_PARAMETER,
defaultValueConfig))
.setUseNewTransformerConversion(
ConversionParameters.readBooleanParameter(
getFormat(),
p,
TEMP_USE_NEW_TRANSFORMER_CONVERSION_PARAMETER,
defaultValueConfig));
}

Expand Down Expand Up @@ -289,6 +295,11 @@ private void copyStream(ReadOnlyDataSource from, DataSource to, String fromName,
"Store the initial CGMES model as a network extension",
Boolean.TRUE)
.addAdditionalNames("storeCgmesModelAsNetworkExtension");
private static final Parameter TEMP_USE_NEW_TRANSFORMER_CONVERSION_PARAMETER = new Parameter(
"tempUseNewTransformerConversion",
ParameterType.BOOLEAN,
"Temporal parameter to configure which version of transformer conversion to use",
Boolean.TRUE);

private static final List<Parameter> STATIC_PARAMETERS = ImmutableList.of(
ALLOW_UNSUPPORTED_TAP_CHANGERS_PARAMETER,
Expand All @@ -299,7 +310,8 @@ private void copyStream(ReadOnlyDataSource from, DataSource to, String fromName,
POST_PROCESSORS_PARAMETER,
POWSYBL_TRIPLESTORE_PARAMETER,
STORE_CGMES_CONVERSION_CONTEXT_AS_NETWORK_EXTENSION_PARAMETER,
STORE_CGMES_MODEL_AS_NETWORK_EXTENSION_PARAMETER);
STORE_CGMES_MODEL_AS_NETWORK_EXTENSION_PARAMETER,
TEMP_USE_NEW_TRANSFORMER_CONVERSION_PARAMETER);

private final Parameter boundaryLocationParameter;
private final Map<String, CgmesImportPostProcessor> postProcessors;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,12 @@
import com.powsybl.cgmes.conversion.Conversion.Config;
import com.powsybl.cgmes.conversion.elements.ACLineSegmentConversion;
import com.powsybl.cgmes.model.CgmesModel;
import com.powsybl.cgmes.model.CgmesNames;
import com.powsybl.cgmes.model.PowerFlow;
import com.powsybl.iidm.network.ConnectableType;
import com.powsybl.iidm.network.Network;
import com.powsybl.iidm.network.Terminal;
import com.powsybl.triplestore.api.PropertyBag;
import com.powsybl.triplestore.api.PropertyBags;

/**
Expand Down Expand Up @@ -48,8 +50,12 @@ public Context(CgmesModel cgmes, Config config, Network network) {
currentLimitsMapping = new CurrentLimitsMapping(this);
regulatingControlMapping = new RegulatingControlMapping(this);
nodeMapping = new NodeMapping();

ratioTapChangerTables = new HashMap<>();
phaseTapChangerTables = new HashMap<>();
reactiveCapabilityCurveData = new HashMap<>();
powerTransformerRatioTapChangers = new HashMap<>();
powerTransformerPhaseTapChangers = new HashMap<>();
}

public CgmesModel cgmes() {
Expand Down Expand Up @@ -143,6 +149,28 @@ public PropertyBags reactiveCapabilityCurveData(String curveId) {
return reactiveCapabilityCurveData.get(curveId);
}

public void loadRatioTapChangers() {
cgmes.ratioTapChangers().forEach(ratio -> {
String id = ratio.getId(CgmesNames.RATIO_TAP_CHANGER);
powerTransformerRatioTapChangers.put(id, ratio);
});
}

public PropertyBag ratioTapChanger(String id) {
return powerTransformerRatioTapChangers.get(id);
}

public void loadPhaseTapChangers() {
cgmes.phaseTapChangers().forEach(phase -> {
String id = phase.getId(CgmesNames.PHASE_TAP_CHANGER);
powerTransformerPhaseTapChangers.put(id, phase);
});
}

public PropertyBag phaseTapChanger(String id) {
return powerTransformerPhaseTapChangers.get(id);
}

public void loadRatioTapChangerTables() {
PropertyBags rtcpoints = cgmes.ratioTapChangerTablesPoints();
if (rtcpoints == null) {
Expand All @@ -154,10 +182,25 @@ public void loadRatioTapChangerTables() {
});
}

public void loadPhaseTapChangerTables() {
PropertyBags ptcpoints = cgmes.phaseTapChangerTablesPoints();
if (ptcpoints == null) {
return;
}
ptcpoints.forEach(p -> {
String tableId = p.getId("PhaseTapChangerTable");
phaseTapChangerTables.computeIfAbsent(tableId, tid -> new PropertyBags()).add(p);
});
}

public PropertyBags ratioTapChangerTable(String tableId) {
return ratioTapChangerTables.get(tableId);
}

public PropertyBags phaseTapChangerTable(String tableId) {
return phaseTapChangerTables.get(tableId);
}

public void startLinesConversion() {
countLines = 0;
countLinesWithSvPowerFlowsAtEnds = 0;
Expand Down Expand Up @@ -222,7 +265,10 @@ public void missing(String what, double defaultValue) {
private final RegulatingControlMapping regulatingControlMapping;

private final Map<String, PropertyBags> ratioTapChangerTables;
private final Map<String, PropertyBags> phaseTapChangerTables;
private final Map<String, PropertyBags> reactiveCapabilityCurveData;
private final Map<String, PropertyBag> powerTransformerRatioTapChangers;
private final Map<String, PropertyBag> powerTransformerPhaseTapChangers;

private int countLines;
private int countLinesWithSvPowerFlowsAtEnds;
Expand Down
Loading

0 comments on commit 0b81084

Please sign in to comment.