Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 11 additions & 7 deletions docs/grid_model/extensions.md
Original file line number Diff line number Diff line change
Expand Up @@ -300,13 +300,17 @@ This extension is provided in the `com.powsybl:powsybl-iidm-extensions` module.

This extension models the homopolar line data to be used for asymmetrical short-circuit calculations.

| Attribute | Type | Unit | Required | Default value | Description |
|------------|---------|------|----------|---------------|----------------------------------------------|
| rz | double | Ω | no | - | The zero-sequence resistance of the line |
| xz | double | Ω | no | - | The zero-sequence reactance of the line |
| openPhaseA | boolean | - | no | false | Indicates if the phase A of the line is open |
| openPhaseB | boolean | - | no | false | Indicates if the phase B of the line is open |
| openPhaseC | boolean | - | no | false | Indicates if the phase C of the line is open |
| Attribute | Type | Unit | Required | Default value | Description |
|------------|---------|------|----------|---------------|-----------------------------------------------------|
| rz | double | Ω | no | - | The zero-sequence resistance of the line |
| xz | double | Ω | no | - | The zero-sequence reactance of the line |
| g1z | double | S | no | - | The zero-sequence conductance of the line on side 1 |
| g2z | double | S | no | - | The zero-sequence conductance of the line on side 2 |
| b1z | double | S | no | - | The zero-sequence susceptance of the line on side 1 |
| b2z | double | S | no | - | The zero-sequence susceptance of the line on side 2 |
| openPhaseA | boolean | - | no | false | Indicates if the phase A of the line is open |
| openPhaseB | boolean | - | no | false | Indicates if the phase B of the line is open |
| openPhaseC | boolean | - | no | false | Indicates if the phase C of the line is open |

This extension is provided in the `com.powsybl:powsybl-iidm-extensions` module.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,4 +48,20 @@ default String getName() {
boolean isOpenPhaseC();

void setOpenPhaseC(boolean openPhaseC);

double getB1z();

void setB1z(double b1z);

double getB2z();

void setB2z(double b2z);

double getG1z();

void setG1z(double g1z);

double getG2z();

void setG2z(double g2z);
}
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,12 @@ public interface LineFortescueAdder extends ExtensionAdder<Line, LineFortescue>
LineFortescueAdder withOpenPhaseB(boolean openPhaseB);

LineFortescueAdder withOpenPhaseC(boolean openPhaseC);

LineFortescueAdder withB1z(double b1z);

LineFortescueAdder withB2z(double b2z);

LineFortescueAdder withG1z(double g1z);

LineFortescueAdder withG2z(double g2z);
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,13 @@
public class LineFortescueAdderImpl extends AbstractExtensionAdder<Line, LineFortescue> implements LineFortescueAdder {

private double rz = Double.NaN;

private double xz = Double.NaN;

private double b1z = Double.NaN;
private double b2z = Double.NaN;
private double g1z = Double.NaN;
private double g2z = Double.NaN;

private boolean openPhaseA = false;
private boolean openPhaseB = false;
private boolean openPhaseC = false;
Expand All @@ -37,7 +41,7 @@ public Class<? super LineFortescue> getExtensionClass() {

@Override
protected LineFortescueImpl createExtension(Line line) {
return new LineFortescueImpl(line, rz, xz, openPhaseA, openPhaseB, openPhaseC);
return new LineFortescueImpl(line, rz, xz, b1z, b2z, g1z, g2z, openPhaseA, openPhaseB, openPhaseC);
}

@Override
Expand Down Expand Up @@ -69,4 +73,29 @@ public LineFortescueAdder withOpenPhaseC(boolean openPhaseC) {
this.openPhaseC = openPhaseC;
return this;
}

@Override
public LineFortescueAdderImpl withB1z(double b1z) {
this.b1z = b1z;
return this;
}

@Override
public LineFortescueAdderImpl withB2z(double b2z) {
this.b2z = b2z;
return this;
}

@Override
public LineFortescueAdderImpl withG1z(double g1z) {
this.g1z = g1z;
return this;
}

@Override
public LineFortescueAdderImpl withG2z(double g2z) {
this.g2z = g2z;
return this;
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,23 @@ public class LineFortescueImpl extends AbstractExtension<Line> implements LineFo
private double rz;
private double xz;

private double b1z;
private double b2z;
private double g1z;
private double g2z;

private boolean openPhaseA;
private boolean openPhaseB;
private boolean openPhaseC;

public LineFortescueImpl(Line line, double rz, double xz, boolean openPhaseA, boolean openPhaseB, boolean openPhaseC) {
public LineFortescueImpl(Line line, double rz, double xz, double b1z, double b2z, double g1z, double g2z, boolean openPhaseA, boolean openPhaseB, boolean openPhaseC) {
super(line);
this.rz = rz;
this.xz = xz;
this.b1z = b1z;
this.b2z = b2z;
this.g1z = g1z;
this.g2z = g2z;
this.openPhaseA = openPhaseA;
this.openPhaseB = openPhaseB;
this.openPhaseC = openPhaseC;
Expand Down Expand Up @@ -82,4 +91,44 @@ public boolean isOpenPhaseC() {
public void setOpenPhaseC(boolean openPhaseC) {
this.openPhaseC = openPhaseC;
}

@Override
public double getB1z() {
return b1z;
}

@Override
public void setB1z(double b1z) {
this.b1z = b1z;
}

@Override
public double getB2z() {
return b2z;
}

@Override
public void setB2z(double b2z) {
this.b2z = b2z;
}

@Override
public double getG1z() {
return g1z;
}

@Override
public void setG1z(double g1z) {
this.g1z = g1z;
}

@Override
public double getG2z() {
return g2z;
}

@Override
public void setG2z(double g2z) {
this.g2z = g2z;
}
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

/**
* Copyright (c) 2023, RTE (http://www.rte-france.com)
* This Source Code Form is subject to the terms of the Mozilla Public
Expand All @@ -9,30 +8,54 @@
package com.powsybl.iidm.serde.extensions;

import com.google.auto.service.AutoService;
import com.powsybl.commons.extensions.AbstractExtensionSerDe;
import com.powsybl.commons.extensions.ExtensionSerDe;
import com.powsybl.commons.io.DeserializerContext;
import com.powsybl.commons.io.SerializerContext;
import com.powsybl.iidm.network.Line;
import com.powsybl.iidm.network.extensions.LineFortescue;
import com.powsybl.iidm.network.extensions.LineFortescueAdder;
import com.powsybl.iidm.serde.IidmVersion;

/**
* @author Geoffroy Jamgotchian {@literal <geoffroy.jamgotchian at rte-france.com>}
*/
@AutoService(ExtensionSerDe.class)
public class LineFortescueSerDe extends AbstractExtensionSerDe<Line, LineFortescue> {
public class LineFortescueSerDe extends AbstractVersionableNetworkExtensionSerDe<Line, LineFortescue, LineFortescueSerDe.Version> {

public enum Version implements SerDeVersion<Version> {
V_1_0("/xsd/lineFortescue_V1_0.xsd", "http://www.powsybl.org/schema/iidm/ext/line_fortescue/1_0",
new VersionNumbers(1, 0), IidmVersion.V_1_0, IidmVersion.V_1_16),
V_1_1("/xsd/lineFortescue_V1_1.xsd", "http://www.powsybl.org/schema/iidm/ext/line_fortescue/1_1",
new VersionNumbers(1, 1), IidmVersion.V_1_0, null);

private final VersionInfo versionInfo;

Version(String xsdResourcePath, String namespaceUri, VersionNumbers versionNumbers, IidmVersion minIidmVersionIncluded, IidmVersion maxIidmVersionExcluded) {
this.versionInfo = new VersionInfo(xsdResourcePath, namespaceUri, "lf", versionNumbers,
minIidmVersionIncluded, maxIidmVersionExcluded, LineFortescue.NAME);
}

@Override
public VersionInfo getVersionInfo() {
return versionInfo;
}
}

public LineFortescueSerDe() {
super("lineFortescue", "network", LineFortescue.class,
"lineFortescue_V1_0.xsd", "http://www.powsybl.org/schema/iidm/ext/line_fortescue/1_0",
"lf");
super("lineFortescue", LineFortescue.class, Version.values());
}

@Override
public void write(LineFortescue lineFortescue, SerializerContext context) {
context.getWriter().writeDoubleAttribute("rz", lineFortescue.getRz(), Double.NaN);
context.getWriter().writeDoubleAttribute("xz", lineFortescue.getXz(), Double.NaN);
Version extVersion = getExtensionVersionToExport(context);
if (extVersion.isGreaterThan(Version.V_1_0)) {
context.getWriter().writeDoubleAttribute("g1z", lineFortescue.getG1z(), Double.NaN);
context.getWriter().writeDoubleAttribute("g2z", lineFortescue.getG2z(), Double.NaN);
context.getWriter().writeDoubleAttribute("b1z", lineFortescue.getB1z(), Double.NaN);
context.getWriter().writeDoubleAttribute("b2z", lineFortescue.getB2z(), Double.NaN);
}
context.getWriter().writeBooleanAttribute("openPhaseA", lineFortescue.isOpenPhaseA(), false);
context.getWriter().writeBooleanAttribute("openPhaseB", lineFortescue.isOpenPhaseB(), false);
context.getWriter().writeBooleanAttribute("openPhaseC", lineFortescue.isOpenPhaseC(), false);
Expand All @@ -42,13 +65,28 @@ public void write(LineFortescue lineFortescue, SerializerContext context) {
public LineFortescue read(Line line, DeserializerContext context) {
double rz = context.getReader().readDoubleAttribute("rz");
double xz = context.getReader().readDoubleAttribute("xz");
double g1z = Double.NaN;
double g2z = Double.NaN;
double b1z = Double.NaN;
double b2z = Double.NaN;
Version extVersion = getExtensionVersionImported(context);
if (extVersion.isGreaterThan(Version.V_1_0)) {
g1z = context.getReader().readDoubleAttribute("g1z");
g2z = context.getReader().readDoubleAttribute("g2z");
b1z = context.getReader().readDoubleAttribute("b1z");
b2z = context.getReader().readDoubleAttribute("b2z");
}
boolean openPhaseA = context.getReader().readBooleanAttribute("openPhaseA", false);
boolean openPhaseB = context.getReader().readBooleanAttribute("openPhaseB", false);
boolean openPhaseC = context.getReader().readBooleanAttribute("openPhaseC", false);
context.getReader().readEndNode();
return line.newExtension(LineFortescueAdder.class)
.withRz(rz)
.withXz(xz)
.withG1z(g1z)
.withG2z(g2z)
.withB1z(b1z)
.withB2z(b2z)
.withOpenPhaseA(openPhaseA)
.withOpenPhaseB(openPhaseB)
.withOpenPhaseC(openPhaseC)
Expand Down
28 changes: 28 additions & 0 deletions iidm/iidm-serde/src/main/resources/xsd/lineFortescue_V1_1.xsd
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--

Copyright (c) 2026, RTE (http://www.rte-france.com)
This Source Code Form is subject to the terms of the Mozilla Public
License, v. 2.0. If a copy of the MPL was not distributed with this
file, You can obtain one at http://mozilla.org/MPL/2.0/.
SPDX-License-Identifier: MPL-2.0

-->
<xs:schema version="1.0"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
targetNamespace="http://www.powsybl.org/schema/iidm/ext/line_fortescue/1_1"
elementFormDefault="qualified">
<xs:element name="lineFortescue">
<xs:complexType>
<xs:attribute name="rz" type="xs:double"/>
<xs:attribute name="xz" type="xs:double"/>
<xs:attribute name="g1z" type="xs:double"/>
<xs:attribute name="g2z" type="xs:double"/>
<xs:attribute name="b1z" type="xs:double"/>
<xs:attribute name="b2z" type="xs:double"/>
<xs:attribute name="openPhaseA" type="xs:boolean"/>
<xs:attribute name="openPhaseB" type="xs:boolean"/>
<xs:attribute name="openPhaseC" type="xs:boolean"/>
</xs:complexType>
</xs:element>
</xs:schema>
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,17 @@
import com.powsybl.iidm.network.extensions.LineFortescueAdder;
import com.powsybl.iidm.network.test.EurostagTutorialExample1Factory;
import com.powsybl.iidm.serde.AbstractIidmSerDeTest;
import com.powsybl.iidm.serde.ExportOptions;
import com.powsybl.iidm.serde.IidmVersion;
import org.junit.jupiter.api.Test;

import java.io.IOException;
import java.time.ZonedDateTime;

import static org.junit.jupiter.api.Assertions.*;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.junit.jupiter.api.Assertions.assertNotNull;
import static org.junit.jupiter.api.Assertions.assertTrue;

/**
* @author Geoffroy Jamgotchian {@literal <geoffroy.jamgotchian at rte-france.com>}
Expand All @@ -34,6 +39,10 @@ void testXmlSerializer() throws IOException {
LineFortescue fortescue = l.newExtension(LineFortescueAdder.class)
.withRz(0.1d)
.withXz(2d)
.withG1z(3d)
.withG2z(4d)
.withB1z(5d)
.withB2z(6d)
.withOpenPhaseA(true)
.withOpenPhaseC(true)
.add();
Expand All @@ -47,6 +56,48 @@ void testXmlSerializer() throws IOException {

assertEquals(fortescue.getRz(), fortescue2.getRz(), 0);
assertEquals(fortescue.getXz(), fortescue2.getXz(), 0);
assertEquals(fortescue.getG1z(), fortescue2.getG1z(), 0);
assertEquals(fortescue.getB1z(), fortescue2.getB1z(), 0);
assertEquals(fortescue.getG2z(), fortescue2.getG2z(), 0);
assertEquals(fortescue.getB2z(), fortescue2.getB2z(), 0);
assertTrue(fortescue2.isOpenPhaseA());
assertFalse(fortescue2.isOpenPhaseB());
assertTrue(fortescue2.isOpenPhaseC());
}

@Test
void testV10() throws IOException {
Network network = EurostagTutorialExample1Factory.create();
network.setCaseDate(ZonedDateTime.parse("2016-12-07T11:18:52.881+01:00"));
Line l = network.getLine("NHV1_NHV2_1");
assertNotNull(l);
LineFortescue fortescue = l.newExtension(LineFortescueAdder.class)
.withRz(0.1d)
.withXz(2d)
.withG1z(3d)
.withG2z(4d)
.withB1z(5d)
.withB2z(6d)
.withOpenPhaseA(true)
.withOpenPhaseC(true)
.add();

Network network2 = allFormatsRoundTripTest(network, "/fortescue/lineFortescueRef_V1_0.xml",
new ExportOptions()
.addExtensionVersion(LineFortescue.NAME, "1.0")
.setVersion(IidmVersion.V_1_15.toString(".")));

Line l2 = network2.getLine("NHV1_NHV2_1");
assertNotNull(l2);
LineFortescue fortescue2 = l2.getExtension(LineFortescue.class);
assertNotNull(fortescue2);

assertEquals(fortescue.getRz(), fortescue2.getRz(), 0);
assertEquals(fortescue.getXz(), fortescue2.getXz(), 0);
assertTrue(Double.isNaN(fortescue2.getG1z()));
assertTrue(Double.isNaN(fortescue2.getG2z()));
assertTrue(Double.isNaN(fortescue2.getB1z()));
assertTrue(Double.isNaN(fortescue2.getB2z()));
assertTrue(fortescue2.isOpenPhaseA());
assertFalse(fortescue2.isOpenPhaseB());
assertTrue(fortescue2.isOpenPhaseC());
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<iidm:network xmlns:iidm="http://www.powsybl.org/schema/iidm/1_16" xmlns:lf="http://www.powsybl.org/schema/iidm/ext/line_fortescue/1_0" xmlns:las="http://www.powsybl.org/schema/iidm/ext/load_asymmetrical/1_0" xmlns:gf="http://www.powsybl.org/schema/iidm/ext/generator_fortescue/1_0" xmlns:slt="http://www.powsybl.org/schema/iidm/ext/slack_terminal/1_5" xmlns:t2f="http://www.powsybl.org/schema/iidm/ext/two_windings_transformer_fortescue/1_0" id="EuropeanLvTestFeeder" caseDate="2023-04-11T23:59:00.000+01:00" forecastDistance="0" sourceFormat="csv" minimumValidationLevel="STEADY_STATE_HYPOTHESIS">
<iidm:network xmlns:iidm="http://www.powsybl.org/schema/iidm/1_16" xmlns:lf="http://www.powsybl.org/schema/iidm/ext/line_fortescue/1_1" xmlns:las="http://www.powsybl.org/schema/iidm/ext/load_asymmetrical/1_0" xmlns:gf="http://www.powsybl.org/schema/iidm/ext/generator_fortescue/1_0" xmlns:slt="http://www.powsybl.org/schema/iidm/ext/slack_terminal/1_5" xmlns:t2f="http://www.powsybl.org/schema/iidm/ext/two_windings_transformer_fortescue/1_0" id="EuropeanLvTestFeeder" caseDate="2023-04-11T23:59:00.000+01:00" forecastDistance="0" sourceFormat="csv" minimumValidationLevel="STEADY_STATE_HYPOTHESIS">
<iidm:substation id="Substation-1">
<iidm:voltageLevel id="SourceVoltageLevel" nominalV="11.0" topologyKind="BUS_BREAKER">
<iidm:busBreakerTopology>
Expand Down
Loading