diff --git a/cgmes/cgmes-conversion/src/main/java/com/powsybl/cgmes/conversion/export/EquipmentExport.java b/cgmes/cgmes-conversion/src/main/java/com/powsybl/cgmes/conversion/export/EquipmentExport.java index 9ba20c06f80..2f430e3b41e 100644 --- a/cgmes/cgmes-conversion/src/main/java/com/powsybl/cgmes/conversion/export/EquipmentExport.java +++ b/cgmes/cgmes-conversion/src/main/java/com/powsybl/cgmes/conversion/export/EquipmentExport.java @@ -47,6 +47,7 @@ public final class EquipmentExport { private static final String PHASE_TAP_CHANGER_REGULATION_MODE_ACTIVE_POWER = "activePower"; private static final String PHASE_TAP_CHANGER_REGULATION_MODE_CURRENT_FLOW = "currentFlow"; private static final String RATIO_TAP_CHANGER_REGULATION_MODE_VOLTAGE = "voltage"; + private static final String RATIO_TAP_CHANGER_REGULATION_MODE_REACTIVE_POWER = "reactivePower"; private static final String TERMINAL_BOUNDARY = "Terminal_Boundary"; private static final Logger LOG = LoggerFactory.getLogger(EquipmentExport.class); @@ -937,8 +938,11 @@ private static > void writeRatioTapChanger(C eq, RatioT String terminalId = CgmesExportUtil.getTerminalId(rtc.getRegulationTerminal(), context); cgmesRegulatingControlId = context.getNamingStrategy().getCgmesId(regulatingControlId.get()); if (!regulatingControlsWritten.contains(cgmesRegulatingControlId)) { - // Regulating control mode is always "voltage" - TapChangerEq.writeControl(cgmesRegulatingControlId, controlName, RATIO_TAP_CHANGER_REGULATION_MODE_VOLTAGE, terminalId, cimNamespace, writer, context); + String tccMode = RATIO_TAP_CHANGER_REGULATION_MODE_VOLTAGE; + if (rtc.getRegulationMode() == RatioTapChanger.RegulationMode.REACTIVE_POWER) { + tccMode = RATIO_TAP_CHANGER_REGULATION_MODE_REACTIVE_POWER; + } + TapChangerEq.writeControl(cgmesRegulatingControlId, controlName, tccMode, terminalId, cimNamespace, writer, context); regulatingControlsWritten.add(cgmesRegulatingControlId); } } diff --git a/cgmes/cgmes-conversion/src/main/java/com/powsybl/cgmes/conversion/export/SteadyStateHypothesisExport.java b/cgmes/cgmes-conversion/src/main/java/com/powsybl/cgmes/conversion/export/SteadyStateHypothesisExport.java index f697bf6d8f6..83d6d78fe5e 100644 --- a/cgmes/cgmes-conversion/src/main/java/com/powsybl/cgmes/conversion/export/SteadyStateHypothesisExport.java +++ b/cgmes/cgmes-conversion/src/main/java/com/powsybl/cgmes/conversion/export/SteadyStateHypothesisExport.java @@ -445,14 +445,21 @@ private static void addRegulatingControlView(TapChanger tc, CgmesTap RegulatingControlView rcv = null; if (tc instanceof RatioTapChanger ratioTapChanger && CgmesExportUtil.regulatingControlIsDefined(ratioTapChanger)) { + String unitMultiplier = switch (ratioTapChanger.getRegulationMode()) { + case VOLTAGE -> { + yield "k"; + } + case REACTIVE_POWER -> { + yield "M"; + } + }; rcv = new RegulatingControlView(controlId, RegulatingControlType.TAP_CHANGER_CONTROL, true, ratioTapChanger.isRegulating(), ratioTapChanger.getTargetDeadband(), - ratioTapChanger.getTargetV(), - // Unit multiplier is k for ratio tap changers (regulation value is a voltage in kV) - "k"); + ratioTapChanger.getRegulationValue(), + unitMultiplier); } else if (tc instanceof PhaseTapChanger phaseTapChanger && CgmesExportUtil.regulatingControlIsDefined(phaseTapChanger)) { boolean valid;