Skip to content

Commit

Permalink
#498 handle hvdcs in svc areas
Browse files Browse the repository at this point in the history
closes #498

Signed-off-by: Florentine Rosiere <[email protected]>
  • Loading branch information
rosiereflo authored and joyelfeghali committed Sep 21, 2023
1 parent ee85928 commit 54c2986
Show file tree
Hide file tree
Showing 54 changed files with 1,914 additions and 716 deletions.
2 changes: 1 addition & 1 deletion etc/Dictionaries/DFLError_en_GB.dic
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ UnknownProperty = couldn't find the property %1% in assembling
//------------------ Algo ---------------------------

//------------------ Outputs -----------------------
MissingGeneratorParameterInSettings = parameter %1% not found in settings file for generator %2%
MissingGeneratorHvdcParameterInSettings = parameter %1% not found in settings file for generator or hvdc %2%
NoSVCInFlatStartingPointMode = simulation of secondary voltage controls is not possible with 'FLAT' starting point mode
//------------------ Main ---------------------------
EnvVariableMissing = cannot find environnement variable %1% please check runtime environment
Expand Down
6 changes: 6 additions & 0 deletions etc/xsd/assembling.xsd
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ SPDX-License-Identifier: MPL-2.0 -->
<xs:attribute name="id" use="required" type="xs:string"/>
<xs:attribute name="index1" use="optional" type="xs:boolean"/>
<xs:attribute name="network" use="optional" type="xs:boolean"/>
<xs:attribute name="indexId" use="optional" type="xs:string"/>
</xs:complexType>

<xs:complexType name="Connection">
Expand Down Expand Up @@ -63,6 +64,7 @@ SPDX-License-Identifier: MPL-2.0 -->
<xs:choice maxOccurs="1">
<xs:element name="bus" type="Bus"/>
<xs:element name="line" type="Line"/>
<xs:element name="hvdcLine" type="HVDC"/>
<xs:element name="tfo" type="Transformer"/>
<xs:element name="shunt" type="SingleShunt"/>
</xs:choice>
Expand Down Expand Up @@ -116,6 +118,10 @@ SPDX-License-Identifier: MPL-2.0 -->
<xs:attribute name="name" use="required" type="xs:string"/>
</xs:complexType>

<xs:complexType name="HVDC">
<xs:attribute name="name" use="required" type="xs:string"/>
</xs:complexType>

<xs:complexType name="MacroConnect">
<xs:attribute name="macroConnection" use="required" type="xs:string"/>
<xs:attribute name="id" use="required" type="xs:string"/>
Expand Down
39 changes: 37 additions & 2 deletions scripts/envDFL.sh
Original file line number Diff line number Diff line change
Expand Up @@ -380,6 +380,38 @@ cmake_tests() {
return ${RETURN_CODE}
}


unittest_gdb() {
list_of_tests=($(find $DYNAFLOW_LAUNCHER_BUILD_DIR -executable -type f -exec basename {} \; | grep Test))
if [[ ${#list_of_tests[@]} == 0 ]]; then
echo "The list of tests is empty. This should not happen."
exit 1
fi
if [ -z "$2" ]; then
echo "You need to give the name of unittest to run."
echo "List of available unittests:"
for name in ${list_of_tests[@]}; do
echo " $name"
done
exit 1
fi
unittest_exe=$(find $DYNAFLOW_LAUNCHER_BUILD_DIR -name "$2")
if [ -z "$unittest_exe" ]; then
echo "The unittest you gave is not available."
echo "List of available unittests:"
for name in ${list_of_tests[@]}; do
echo " $name"
done
exit 1
fi

pushd $(dirname $unittest_exe) > /dev/null
gdb -q --args $unittest_exe
RETURN_CODE=$?
popd > /dev/null
return ${RETURN_CODE}

}
verify_browser() {
if [ ! -x "$(command -v $DYNAFLOW_LAUNCHER_BROWSER)" ]; then
error_exit "Specified browser DYNAFLOW_LAUNCHER_BROWSER=$DYNAFLOW_LAUNCHER_BROWSER not found."
Expand Down Expand Up @@ -441,10 +473,10 @@ build_tests_coverage() {

launch() {
if [ ! -f "$2" ]; then
error_exit "IIDM network file $1 doesn't exist"
error_exit "IIDM network file $2 doesn't exist"
fi
if [ ! -f "$3" ]; then
error_exit "DFL configuration file $2 doesn't exist"
error_exit "DFL configuration file $3 doesn't exist"
fi
$DYNAFLOW_LAUNCHER_INSTALL_DIR/bin/DynaFlowLauncher \
--log-level $DYNAFLOW_LAUNCHER_LOG_LEVEL \
Expand Down Expand Up @@ -723,6 +755,9 @@ case $CMD in
tests)
cmake_tests || error_exit "Failed to perform tests"
;;
tests-gdb)
unittest_gdb $ARGS || error_exit "Failed to perform tests with gdb"
;;
update-references)
update_references || error_exit "Failed to update MAIN references"
;;
Expand Down
34 changes: 22 additions & 12 deletions sources/Algo/include/DynModelDefinitionAlgorithm.h
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,8 @@ struct DynamicModelDefinition {
SHUNT, ///< Shunt type
AUTOMATON, ///< Dynamic Automaton
GENERATOR, ///< Generator type
LOAD ///< Load type
LOAD, ///< Load type
HVDC ///< HVDC type
};

/**
Expand All @@ -69,8 +70,10 @@ struct DynamicModelDefinition {
* @param macroid the macro connector id to use
* @param type type of the element to connect
* @param id the element id to connect
* @param indexId used to index the macroConnections
*/
MacroConnection(const MacroId &macroid, const ElementType &type, const ElementId &id) : id(macroid), elementType(type), connectedElementId(id) {}
MacroConnection(const MacroId &macroid, const ElementType &type, const ElementId &id, const std::string &indexId)
: id(macroid), elementType(type), connectedElementId(id), indexId(indexId) {}

/**
* @brief Equality operator
Expand Down Expand Up @@ -117,6 +120,7 @@ struct DynamicModelDefinition {
MacroId id; ///< Macro connector id
ElementType elementType; ///< Connected element type
ElementId connectedElementId; ///< Element id connected throught the macro connection
std::string indexId; ///< Id used to index the macroConnections
};

/**
Expand Down Expand Up @@ -256,14 +260,13 @@ class DynModelAlgorithm {
void extractMultiAssociationInfo(const inputs::AssemblingDataBase::DynamicAutomaton &automaton, const inputs::AssemblingDataBase::MacroConnect &macro,
bool shuntRegulationOn);


/**
* @brief Process model in case of dynamic automaton model connection
* @param automaton the dynamic automaton
* @param macro macro connection to process
*/
void connectMacroConnectionForDynAutomaton(const inputs::AssemblingDataBase::DynamicAutomaton& automaton,
const inputs::AssemblingDataBase::MacroConnect& macro);
void connectMacroConnectionForDynAutomaton(const inputs::AssemblingDataBase::DynamicAutomaton &automaton,
const inputs::AssemblingDataBase::MacroConnect &macro);

/**
* @brief Process node in case of dynamic automaton bus connection
Expand All @@ -275,7 +278,7 @@ class DynModelAlgorithm {
* @brief Process node in case of dynamic automaton shunt connection
* @param node node to process
*/
void connectMacroConnectionForMultipleShunts(const NodePtr& node);
void connectMacroConnectionForMultipleShunts(const NodePtr &node);

/**
* @brief Process node in case of dynamic automaton line connection
Expand All @@ -287,7 +290,7 @@ class DynModelAlgorithm {
* @brief Process node in case of dynamic automaton shunt connection
* @param shunt shunt to process
*/
void connectMacroConnectionForSingleShunt(const inputs::Shunt& shunt);
void connectMacroConnectionForSingleShunt(const inputs::Shunt &shunt);

/**
* @brief Process node in case of dynamic automaton transformer connection
Expand All @@ -307,6 +310,12 @@ class DynModelAlgorithm {
*/
void connectMacroConnectionForLoad(const inputs::Load &load);

/**
* @brief Process node in case of dynamic automaton hvdc line connection
* @param hvdcLine to process
*/
void connectMacroConnectionForHvdc(const inputs::HvdcLine &hvdcLine);

/**
* @brief Add macro connection to the dynamic model definition
*
Expand All @@ -325,13 +334,14 @@ class DynModelAlgorithm {
std::unordered_map<inputs::VoltageLevel::VoltageLevelId, std::unordered_set<MacroConnect, MacroConnectHash>>
macroConnectByVlForBusesId_; ///< macro connections for buses, by voltage level
std::unordered_map<inputs::VoltageLevel::VoltageLevelId, std::vector<MacroConnect>>
macroConnectByVlForShuntsId_; ///< macro connections for shunts, by voltage level
std::unordered_map<inputs::Line::LineId, std::vector<MacroConnect>> macroConnectByLineName_; ///< macro connections for lines, by line id
macroConnectByVlForShuntsId_; ///< macro connections for shunts, by voltage level
std::unordered_map<inputs::Line::LineId, std::vector<MacroConnect>> macroConnectByLineName_; ///< macro connections for lines, by line id
std::unordered_map<inputs::Shunt::ShuntId, std::vector<MacroConnect>> macroConnectByShuntName_; ///< macro connections for shunts, by shunt id
std::unordered_map<inputs::Tfo::TfoId, std::vector<MacroConnect>> macroConnectByTfoName_; ///< macro connections for transformer, by transformer id
std::unordered_map<inputs::Tfo::TfoId, std::vector<MacroConnect>> macroConnectByTfoName_; ///< macro connections for transformer, by transformer id
std::unordered_map<inputs::Generator::GeneratorId, std::vector<MacroConnect>>
macroConnectByGeneratorName_; ///< macro connections for generators, by generator id
std::unordered_map<inputs::Load::LoadId, std::vector<MacroConnect>> macroConnectByLoadName_; ///< macro connections for loads, by load id
macroConnectByGeneratorName_; ///< macro connections for generators, by generator id
std::unordered_map<inputs::Load::LoadId, std::vector<MacroConnect>> macroConnectByLoadName_; ///< macro connections for loads, by load id
std::unordered_map<inputs::HvdcLine::HvdcLineId, std::vector<MacroConnect>> macroConnectByHvdcName_; ///< macro connections for hvdc lines, by hvdc line id

const inputs::DynamicDataBaseManager &manager_; ///< dynamic database config manager
};
Expand Down
37 changes: 31 additions & 6 deletions sources/Algo/include/HVDCDefinitionAlgorithm.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
#pragma once

#include "AlgorithmsResults.h"
#include "DynamicDataBaseManager.h"
#include "HvdcLine.h"
#include "NetworkManager.h"
#include "Node.h"
Expand All @@ -40,11 +41,12 @@ class VSCDefinition {
* @param id the id of the converter
* @param qMax the maximum reactive power capability value of the converter
* @param qMin the minimum reactive power capability value of the converter
* @param q the reactive power value of the converter
* @param pMax the maximum active power capability value of the converter
* @param points the reactive curve points of the converter, if any
*/
VSCDefinition(const VSCId &id, double qMax, double qMin, double pMax, const std::vector<ReactiveCurvePoint> &points)
: id(id), qmax{qMax}, qmin{qMin}, pmax(pMax), pmin(-pMax), points(points) {}
VSCDefinition(const VSCId &id, double qMax, double qMin, double q, double pMax, const std::vector<ReactiveCurvePoint> &points)
: id(id), qmax{qMax}, qmin{qMin}, q(q), pmax(pMax), pmin(-pMax), points(points) {}

/**
* @brief Equality operator for VSCDefinition
Expand All @@ -60,6 +62,7 @@ class VSCDefinition {
VSCId id; ///< id of the converter
double qmax; ///< maximum reactive power capability value
double qmin; ///< minimum reactive power capability value
double q; ///< reactive power capability value
double pmax; ///< maximum active power capability value
double pmin; ///< minimum active power capability value, equals to -pmax
std::vector<ReactiveCurvePoint> points; ///< reactive curve points
Expand Down Expand Up @@ -115,6 +118,12 @@ class HVDCDefinition {
HvdcPVDiagramPQ,
HvdcPVDiagramPQEmulationSet,
HvdcPVEmulationSet,
HvdcPVEmulationSetRpcl2Side1,
HvdcPVDiagramPQEmulationSetRpcl2Side1,
HvdcPVRpcl2Side1,
HvdcPVDiagramPQRpcl2Side1,
HvdcPVDanglingRpcl2Side1,
HvdcPVDanglingDiagramPQRpcl2Side1
};

/**
Expand All @@ -124,7 +133,9 @@ class HVDCDefinition {
bool hasDiagramModel() const {
return model == HVDCModel::HvdcPTanPhiDanglingDiagramPQ || model == HVDCModel::HvdcPQPropDanglingDiagramPQ || model == HVDCModel::HvdcPVDanglingDiagramPQ ||
model == HVDCModel::HvdcPTanPhiDiagramPQ || model == HVDCModel::HvdcPQPropDiagramPQ || model == HVDCModel::HvdcPQPropDiagramPQEmulationSet ||
model == HVDCModel::HvdcPVDiagramPQ || model == HVDCModel::HvdcPVDiagramPQEmulationSet;
model == HVDCModel::HvdcPVDiagramPQ || model == HVDCModel::HvdcPVDiagramPQEmulationSet ||
model == HVDCModel::HvdcPVDiagramPQEmulationSetRpcl2Side1 || model == HVDCModel::HvdcPVDiagramPQRpcl2Side1 ||
model == HVDCModel::HvdcPVDanglingDiagramPQRpcl2Side1;
}

/**
Expand All @@ -133,7 +144,8 @@ class HVDCDefinition {
*/
bool hasEmulationModel() const {
return model == HVDCModel::HvdcPQPropEmulationSet || model == HVDCModel::HvdcPQPropDiagramPQEmulationSet || model == HVDCModel::HvdcPVEmulationSet ||
model == HVDCModel::HvdcPVDiagramPQEmulationSet;
model == HVDCModel::HvdcPVDiagramPQEmulationSet || model == HVDCModel::HvdcPVEmulationSetRpcl2Side1 ||
model == HVDCModel::HvdcPVDiagramPQEmulationSetRpcl2Side1;
}

/**
Expand All @@ -151,7 +163,18 @@ class HVDCDefinition {
*/
bool hasDanglingModel() const {
return model == HVDCModel::HvdcPTanPhiDangling || model == HVDCModel::HvdcPTanPhiDanglingDiagramPQ || model == HVDCModel::HvdcPQPropDangling ||
model == HVDCModel::HvdcPQPropDanglingDiagramPQ || model == HVDCModel::HvdcPVDangling || model == HVDCModel::HvdcPVDanglingDiagramPQ;
model == HVDCModel::HvdcPQPropDanglingDiagramPQ || model == HVDCModel::HvdcPVDangling || model == HVDCModel::HvdcPVDanglingDiagramPQ ||
model == HVDCModel::HvdcPVDanglingRpcl2Side1 || model == HVDCModel::HvdcPVDanglingDiagramPQRpcl2Side1;
}
/**
* @brief test is the HVDC definition has a reactive power control loop 2 for connection to the secondary voltage control
*
* @return @b true if the HVDC definition has a reactive power control loop 2 for connection to the secondary voltage control, @b false otherwise
*/
bool hasRpcl2() const {
return model == HVDCModel::HvdcPVEmulationSetRpcl2Side1 || model == HVDCModel::HvdcPVDiagramPQEmulationSetRpcl2Side1 ||
model == HVDCModel::HvdcPVRpcl2Side1 || model == HVDCModel::HvdcPVDiagramPQRpcl2Side1 || model == HVDCModel::HvdcPVDanglingRpcl2Side1 ||
model == HVDCModel::HvdcPVDanglingDiagramPQRpcl2Side1;
}

/**
Expand Down Expand Up @@ -244,10 +267,11 @@ class HVDCDefinitionAlgorithm {
* @param infiniteReactiveLimits the configuration data of whether we use infinite reactive limits
* @param vscConverters list of VSC converters
* @param mapBusVSCConvertersBusId the mapping of buses and their number of VSC converters regulating them
* @param manager the dynamic data base manager to use
*/
HVDCDefinitionAlgorithm(HVDCLineDefinitions &hvdcLinesDefinitions, bool infiniteReactiveLimits,
const std::unordered_set<std::shared_ptr<inputs::Converter>> &vscConverters,
const inputs::NetworkManager::BusMapRegulating &mapBusVSCConvertersBusId);
const inputs::NetworkManager::BusMapRegulating &mapBusVSCConvertersBusId, const inputs::DynamicDataBaseManager &manager);

/**
* @brief Perform the algorithm
Expand Down Expand Up @@ -351,6 +375,7 @@ class HVDCDefinitionAlgorithm {
const bool infiniteReactiveLimits_; ///< whether we use infinite reactive limits
const inputs::NetworkManager::BusMapRegulating &mapBusVSCConvertersBusId_; ///< the map of buses and the number of VSC converters regulating them
std::unordered_map<inputs::Converter::ConverterId, std::shared_ptr<inputs::Converter>> vscConverters_; ///< List of VSC converters to use
std::unordered_set<std::string> hvdcLinesInSVC; ///< If a hvdc line id is in this map then it belongs to a secondary voltage control area
};

} // namespace algo
Expand Down
Loading

0 comments on commit 54c2986

Please sign in to comment.