Skip to content

Commit

Permalink
Add shortcircuit extensions (#384) (#436)
Browse files Browse the repository at this point in the history
* Add GeneratorShortCircuit extension
* Add IdentifiableShortCircuit extension
* Add units in documentation for getIpMax/setIpMax and add missing check for nan values in setIpMax

Signed-off-by: Sébastien LAIGRE <[email protected]>
  • Loading branch information
sebalaig authored Jul 12, 2022
1 parent bf18900 commit d9fbb6f
Show file tree
Hide file tree
Showing 11 changed files with 744 additions and 0 deletions.
6 changes: 6 additions & 0 deletions extensions/iidm/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,16 @@ set(EXT_SOURCES
src/DiscreteMeasurementsAdder.cpp
src/DiscreteMeasurementsXmlSerializer.cpp
src/DiscreteMeasurementValidationUtil.cpp
src/GeneratorShortCircuit.cpp
src/GeneratorShortCircuitAdder.cpp
src/HvdcAngleDroopActivePowerControl.cpp
src/HvdcAngleDroopActivePowerControlAdder.cpp
src/HvdcAngleDroopActivePowerControlXmlSerializer.cpp
src/HvdcOperatorActivePowerRange.cpp
src/HvdcOperatorActivePowerRangeAdder.cpp
src/HvdcOperatorActivePowerRangeXmlSerializer.cpp
src/IdentifiableShortCircuit.cpp
src/IdentifiableShortCircuitAdder.cpp
src/Iidm.cpp
src/InjectionObservability.cpp
src/InjectionObservabilityAdder.cpp
Expand Down Expand Up @@ -65,9 +69,11 @@ set(UNIT_TEST_SOURCES
test/BranchObservabilityTest.cpp
test/CoordinatedReactiveControlTest.cpp
test/DiscreteMeasurementsTest.cpp
test/GeneratorShortCircuitTest.cpp
test/HvdcAngleDroopActivePowerControlTest.cpp
test/HvdcOperatorActivePowerRangeTest.cpp
test/iidm.cpp
test/IdentifiableShortCircuitTest.cpp
test/InjectionObservabilityTest.cpp
test/MeasurementsTest.cpp
test/RemoteReactivePowerControlTest.cpp
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
/**
* Copyright (c) 2022, 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/.
*/

#ifndef POWSYBL_IIDM_EXTENSIONS_IIDM_GENERATORSHORTCIRCUIT_HPP
#define POWSYBL_IIDM_EXTENSIONS_IIDM_GENERATORSHORTCIRCUIT_HPP

#include <powsybl/iidm/Extension.hpp>

namespace powsybl {

namespace iidm {

class Generator;

namespace extensions {

namespace iidm {

class GeneratorShortCircuit : public Extension {
public: // Extension
const std::string& getName() const override;

const std::type_index& getType() const override;

public:
/**
* Get the direct-axis subtransient reactance (also known as X''d)
*/
double getDirectSubtransX() const;

/**
* Get the direct-axis transient reactance (also known as X'd)
*/
double getDirectTransX() const;

/**
* Get the step-up transformer reactance if the generator has a non-modeled step-up transformer.
*/
double getStepUpTransformerX() const;

/**
* Set the direct-axis subtransient reactance (also known as X''d)
*/
GeneratorShortCircuit& setDirectSubtransX(double directSubtransX);

/**
* Set the direct-axis transient reactance (also known as X'd)
*/
GeneratorShortCircuit& setDirectTransX(double directTransX);

/**
* Set the step-up transformer reactance
*/
GeneratorShortCircuit& setStepUpTransformerX(double setUpTransformerX);

private: // Extension
void assertExtendable(const stdcxx::Reference<Extendable>& extendable) const override;

private:
GeneratorShortCircuit(Generator& generator, double directSubtransX, double directTransX, double stepUpTransformerX);

friend class GeneratorShortCircuitAdder;

private:
double m_directSubtransX;

double m_directTransX;

double m_stepUpTransformerX;
};

} // namespace iidm

} // namespace extensions

} // namespace iidm

} // namespace powsybl

#endif // POWSYBL_IIDM_EXTENSIONS_IIDM_GENERATORSHORTCIRCUIT_HPP
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
/**
* Copyright (c) 2022, 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/.
*/

#ifndef POWSYBL_IIDM_EXTENSIONS_IIDM_GENERATORSHORTCIRCUITADDER_HPP
#define POWSYBL_IIDM_EXTENSIONS_IIDM_GENERATORSHORTCIRCUITADDER_HPP

#include <powsybl/iidm/ExtensionAdder.hpp>
#include <powsybl/stdcxx/math.hpp>

namespace powsybl {

namespace iidm {

namespace extensions {

namespace iidm {

class GeneratorShortCircuitAdder : public ExtensionAdder {
public:
/**
* Constructor
*/
explicit GeneratorShortCircuitAdder(Extendable& extendable);

/**
* Copy constructor
*/
GeneratorShortCircuitAdder(const GeneratorShortCircuitAdder&) = default;

/**
* Move constructor
*/
GeneratorShortCircuitAdder(GeneratorShortCircuitAdder&&) = default;

/**
* Destructor
*/
~GeneratorShortCircuitAdder() noexcept override = default;

/**
* Copy assignment operator
*/
GeneratorShortCircuitAdder& operator=(const GeneratorShortCircuitAdder&) = delete;

/**
* Move assignment operator
*/
GeneratorShortCircuitAdder& operator=(GeneratorShortCircuitAdder&&) = delete;

/**
* Set the direct-axis subtransient reactance (also known as X''d)
*/
GeneratorShortCircuitAdder& withDirectSubtransX(double directSubtransX);

/**
* Set the direct-axis transient reactance (also known as X'd)
*/
GeneratorShortCircuitAdder& withDirectTransX(double directTransX);

/**
* Set the step-up transformer reactance
*/
GeneratorShortCircuitAdder& withStepUpTransformerX(double stepUpTransformerX);

protected:
/**
* Creates the GeneratorShortCircuit extension.
*
* @param extendable the extendable
*
* @return the extension
*/
std::unique_ptr<Extension> createExtension(Extendable& extendable) const override;

private:
double m_directTransX = 0.0;

double m_directSubtransX = stdcxx::nan();

double m_stepUpTransformerX = stdcxx::nan();
};

} // namespace iidm

} // namespace extensions

} // namespace iidm

} // namespace powsybl

#endif // POWSYBL_IIDM_EXTENSIONS_IIDM_GENERATORSHORTCIRCUITADDER_HPP
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
/**
* Copyright (c) 2022, 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/.
*/

#ifndef POWSYBL_IIDM_EXTENSIONS_IIDM_IDENTIFIABLESHORTCIRCUIT_HPP
#define POWSYBL_IIDM_EXTENSIONS_IIDM_IDENTIFIABLESHORTCIRCUIT_HPP

#include <powsybl/iidm/Extension.hpp>

namespace powsybl {

namespace iidm {

class Identifiable;

namespace extensions {

namespace iidm {

class IdentifiableShortCircuit : public Extension {
public: // Extension
const std::string& getName() const override;

const std::type_index& getType() const override;

public:
/**
* Get maximum allowable peak short-circuit current [A]
*/
double getIpMax() const;

/**
* Get minimum allowable peak short-circuit current [A]
*/
double getIpMin() const;

/**
* Set maximum allowable peak short-circuit current [A]
*/
IdentifiableShortCircuit& setIpMax(double ipMax);

/**
* Set minimum allowable peak short-circuit current [A]
*/
IdentifiableShortCircuit& setIpMin(double ipMin);

private: // Extension
void assertExtendable(const stdcxx::Reference<Extendable>& extendable) const override;

private:
IdentifiableShortCircuit(Identifiable& identifiable, double ipMin, double ipMax);

friend class IdentifiableShortCircuitAdder;

private:
/**
* Minimum allowable peak short-circuit current
*/
double m_ipMin;

/**
* Maximum allowable peak short-circuit current
*/
double m_ipMax;
};

} // namespace iidm

} // namespace extensions

} // namespace iidm

} // namespace powsybl

#endif // POWSYBL_IIDM_EXTENSIONS_IIDM_IDENTIFIABLESHORTCIRCUIT_HPP
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
/**
* Copyright (c) 2022, 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/.
*/

#ifndef POWSYBL_IIDM_EXTENSIONS_IIDM_IDENTIFIABLESHORTCIRCUITADDER_HPP
#define POWSYBL_IIDM_EXTENSIONS_IIDM_IDENTIFIABLESHORTCIRCUITADDER_HPP

#include <powsybl/iidm/ExtensionAdder.hpp>
#include <powsybl/stdcxx/math.hpp>

namespace powsybl {

namespace iidm {

namespace extensions {

namespace iidm {

class IdentifiableShortCircuitAdder : public ExtensionAdder {
public:
/**
* Constructor
*/
explicit IdentifiableShortCircuitAdder(Extendable& extendable);

/**
* Copy constructor
*/
IdentifiableShortCircuitAdder(const IdentifiableShortCircuitAdder&) = default;

/**
* Move constructor
*/
IdentifiableShortCircuitAdder(IdentifiableShortCircuitAdder&&) = default;

/**
* Destructor
*/
~IdentifiableShortCircuitAdder() noexcept override = default;

/**
* Copy assignment operator
*/
IdentifiableShortCircuitAdder& operator=(const IdentifiableShortCircuitAdder&) = delete;

/**
* Move assignment operator
*/
IdentifiableShortCircuitAdder& operator=(IdentifiableShortCircuitAdder&&) = delete;

IdentifiableShortCircuitAdder& withIpMax(double ipMax);

IdentifiableShortCircuitAdder& withIpMin(double ipMin);

protected:
/**
* Creates the IdentifiableShortCircuit extension.
*
* @param extendable the extendable
*
* @return the extension
*/
std::unique_ptr<Extension> createExtension(Extendable& extendable) const override;

private:
double m_ipMin = stdcxx::nan();

double m_ipMax = stdcxx::nan();
};

} // namespace iidm

} // namespace extensions

} // namespace iidm

} // namespace powsybl

#endif // POWSYBL_IIDM_EXTENSIONS_IIDM_IDENTIFIABLESHORTCIRCUITADDER_HPP
Loading

0 comments on commit d9fbb6f

Please sign in to comment.