Skip to content

Commit

Permalink
IIDM v1.9.0: fix shunt P serialization
Browse files Browse the repository at this point in the history
Signed-off-by: Frédéric Vallée <[email protected]>
  • Loading branch information
Frédéric Vallée authored and gautierbureau committed Nov 15, 2023
1 parent 921bebc commit 5a020cc
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 4 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ cmake_minimum_required(VERSION 3.12 FATAL_ERROR)
project(powsybl-iidm4cpp)

set(IIDM_VERSION_MAJOR 1)
set(IIDM_VERSION_MINOR 8)
set(IIDM_VERSION_MINOR 9)
set(IIDM_VERSION_PATCH 0)
set(IIDM_VERSION ${IIDM_VERSION_MAJOR}.${IIDM_VERSION_MINOR}.${IIDM_VERSION_PATCH})
set(IIDM_SOVERSION ${IIDM_VERSION_MAJOR})
Expand Down
1 change: 1 addition & 0 deletions extensions/entsoe/src/MergedXnodeXmlSerializer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ MergedXnodeXmlSerializer::MergedXnodeXmlSerializer() :
.put(converter::xml::IidmXmlVersion::V1_6(), {"1.0", "1.1"})
.put(converter::xml::IidmXmlVersion::V1_7(), {"1.0", "1.1"})
.put(converter::xml::IidmXmlVersion::V1_8(), {"1.0", "1.1"})
.put(converter::xml::IidmXmlVersion::V1_9(), {"1.0", "1.1"})
.build(),
stdcxx::MapBuilder<std::string, std::string>()
.put("1.0", "http://www.itesla_project.eu/schema/iidm/ext/merged_xnode/1_0")
Expand Down
5 changes: 5 additions & 0 deletions include/powsybl/iidm/converter/xml/IidmXmlVersion.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,11 @@ class IidmXmlVersion {
*/
static const IidmXmlVersion& V1_8();

/**
* IIDM V1.9 (http://www.powsybl.org)
*/
static const IidmXmlVersion& V1_9();

public:
/**
* Return the list of all supported XIIDM versions
Expand Down
10 changes: 8 additions & 2 deletions src/iidm/converter/xml/IidmXmlVersion.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -69,14 +69,15 @@ const IidmXmlVersions& IidmXmlVersion::all() {
std::cref(IidmXmlVersion::V1_5()),
std::cref(IidmXmlVersion::V1_6()),
std::cref(IidmXmlVersion::V1_7()),
std::cref(IidmXmlVersion::V1_8())
std::cref(IidmXmlVersion::V1_8()),
std::cref(IidmXmlVersion::V1_9())
}};

return s_versions;
}

const IidmXmlVersion& IidmXmlVersion::CURRENT_IIDM_XML_VERSION() {
return V1_8();
return V1_9();
}

const IidmXmlVersion& IidmXmlVersion::fromNamespaceURI(const std::string& namespaceURI) {
Expand Down Expand Up @@ -169,6 +170,11 @@ const IidmXmlVersion& IidmXmlVersion::V1_8() {
return V1_8;
}

const IidmXmlVersion& IidmXmlVersion::V1_9() {
static IidmXmlVersion V1_9("powsybl.org", {{1, 9}});
return V1_9;
}

} // namespace xml

} // namespace converter
Expand Down
3 changes: 2 additions & 1 deletion src/iidm/converter/xml/ShuntCompensatorXml.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,8 @@ void ShuntCompensatorXml::writeRootElementAttributes(const ShuntCompensator& shu
IidmXmlUtil::writeDoubleAttributeFromMinimumVersion(SHUNT, TARGET_V, shuntCompensator.getTargetV(), ErrorMessage::NOT_DEFAULT_NOT_SUPPORTED, IidmXmlVersion::V1_2(), context);
IidmXmlUtil::writeDoubleAttributeFromMinimumVersion(SHUNT, TARGET_DEADBAND, shuntCompensator.getTargetDeadband(), ErrorMessage::NOT_DEFAULT_NOT_SUPPORTED, IidmXmlVersion::V1_2(), context);
writeNodeOrBus(shuntCompensator.getTerminal(), context);
writePQ(shuntCompensator.getTerminal(), context.getWriter());
IidmXmlUtil::runFromMinimumVersion(IidmXmlVersion::V1_9(), context.getVersion(), [&context, &shuntCompensator]() { context.getWriter().writeOptionalAttribute(P, shuntCompensator.getTerminal().getP()); });
context.getWriter().writeOptionalAttribute(Q, shuntCompensator.getTerminal().getQ());
}

void ShuntCompensatorXml::writeSubElements(const ShuntCompensator& sc, const VoltageLevel& /*voltageLevel*/, NetworkXmlWriterContext& context) const {
Expand Down
1 change: 1 addition & 0 deletions src/iidm/extensions/SlackTerminalXmlSerializer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ SlackTerminalXmlSerializer::SlackTerminalXmlSerializer() :
.put(converter::xml::IidmXmlVersion::V1_6(), {"1.2"})
.put(converter::xml::IidmXmlVersion::V1_7(), {"1.2"})
.put(converter::xml::IidmXmlVersion::V1_8(), {"1.2"})
.put(converter::xml::IidmXmlVersion::V1_9(), {"1.2"})
.build(),
stdcxx::MapBuilder<std::string, std::string>()
.put("1.0", "http://www.powsybl.org/schema/iidm/ext/slack_terminal/1_0")
Expand Down

0 comments on commit 5a020cc

Please sign in to comment.