Commit e4baf100 authored by Philipp Fensch's avatar Philipp Fensch
Browse files

Adjusted Example-Files to pass cpp-check


Signed-off-by: Philipp Fensch's avatarPhilipp Fensch <philipp.fensch@rwth-aachen.de>
parent 2ee0830e
......@@ -106,13 +106,13 @@ int main(int argc, char* argv[]) {
UInt maxVoltageStepIdx = 10;
UInt maxFreqStepIdx = 10;
for (UInt stepIdx = 1; stepIdx <= maxTimeStepIdx; stepIdx++) {
for (UInt stepIdx = 1; stepIdx <= maxTimeStepIdx; ++stepIdx) {
timeStep = stepIdx * 0.00005;
EMT_RL_SourceStep(timeStep, finalTime, 0, 0, stepTime, "_T" + std::to_string(stepIdx));
DP_RL_SourceStep(timeStep, finalTime, 0, 0, stepTime, "_T" + std::to_string(stepIdx));
for (UInt voltageStepIdx = 1; voltageStepIdx <= maxVoltageStepIdx; voltageStepIdx++) {
for (UInt voltageStepIdx = 1; voltageStepIdx <= maxVoltageStepIdx; ++voltageStepIdx) {
voltageStep = voltageStepIdx * 100;
EMT_RL_SourceStep(timeStep, finalTime, voltageStep, 0, stepTime,
"_T" + std::to_string(stepIdx) + "_V" + std::to_string(voltageStepIdx));
......@@ -120,7 +120,7 @@ int main(int argc, char* argv[]) {
"_T" + std::to_string(stepIdx) + "_V" + std::to_string(voltageStepIdx));
}
for (UInt freqStepIdx = 1; freqStepIdx <= maxFreqStepIdx; freqStepIdx++) {
for (UInt freqStepIdx = 1; freqStepIdx <= maxFreqStepIdx; ++freqStepIdx) {
freqStep = freqStepIdx;
EMT_RL_SourceStep(timeStep, finalTime, 0, freqStep, stepTime,
"_T" + std::to_string(stepIdx) + "_F" + std::to_string(freqStepIdx));
......@@ -135,7 +135,7 @@ int main(int argc, char* argv[]) {
EMT_RL_SourceStep(timeStep, finalTime, 0, 0, stepTime, "_T" + std::to_string(stepIdx));
DP_RL_SourceStep(timeStep, finalTime, 0, 0, stepTime, "_T" + std::to_string(stepIdx));
for (UInt voltageStepIdx = 1; voltageStepIdx <= maxVoltageStepIdx; voltageStepIdx++) {
for (UInt voltageStepIdx = 1; voltageStepIdx <= maxVoltageStepIdx; ++voltageStepIdx) {
voltageStep = voltageStepIdx * 100;
EMT_RL_SourceStep(timeStep, finalTime, voltageStep, 0, stepTime,
"_T" + std::to_string(stepIdx) + "_V" + std::to_string(voltageStepIdx));
......@@ -143,7 +143,7 @@ int main(int argc, char* argv[]) {
"_T" + std::to_string(stepIdx) + "_V" + std::to_string(voltageStepIdx));
}
for (UInt freqStepIdx = 1; freqStepIdx <= maxFreqStepIdx; freqStepIdx++) {
for (UInt freqStepIdx = 1; freqStepIdx <= maxFreqStepIdx; ++freqStepIdx) {
freqStep = freqStepIdx;
EMT_RL_SourceStep(timeStep, finalTime, 0, freqStep, stepTime,
"_T" + std::to_string(stepIdx) + "_F" + std::to_string(freqStepIdx));
......
......@@ -165,11 +165,11 @@ int main(int argc, char* argv[]) {
UInt maxTimeStepIdx = 20;
UInt maxLoadStepIdx = 10;
for (UInt loadStepIdx = 0; loadStepIdx <= maxLoadStepIdx; loadStepIdx++) {
for (UInt loadStepIdx = 0; loadStepIdx <= maxLoadStepIdx; ++loadStepIdx) {
if (loadStepIdx == 0) breakerOpenR = 0;
else breakerOpenR = Rload / loadStepIdx;
for (UInt stepIdx = 1; stepIdx <= maxTimeStepIdx; stepIdx++) {
for (UInt stepIdx = 1; stepIdx <= maxTimeStepIdx; ++stepIdx) {
timeStep = stepIdx * 0.00005;
DP_SynGenDq7odODE_LoadStep(timeStep, finalTime, breakerOpenR,
......
......@@ -165,11 +165,11 @@ int main(int argc, char* argv[]) {
UInt maxTimeStepIdx = 20;
UInt maxLoadStepIdx = 10;
for (UInt loadStepIdx = 0; loadStepIdx <= maxLoadStepIdx; loadStepIdx++) {
for (UInt loadStepIdx = 0; loadStepIdx <= maxLoadStepIdx; ++loadStepIdx) {
if (loadStepIdx == 0) breakerOpenR = 0;
else breakerOpenR = Rload / loadStepIdx;
for (UInt stepIdx = 1; stepIdx <= maxTimeStepIdx; stepIdx++) {
for (UInt stepIdx = 1; stepIdx <= maxTimeStepIdx; ++stepIdx) {
timeStep = stepIdx * 0.00005;
DP_SynGenDq7odTrapez_LoadStep(timeStep, finalTime, breakerOpenR,
......
......@@ -80,12 +80,12 @@ namespace CIGREMV {
Real pvUnitNominalVoltage = 1500.;
Real pvUnitNominalPower = 50e3;
Real pvUnitPowerFactor = 1;
// calculate PV units per plant to reach penetration level
Int numberPVUnits = Int(totalLoad * penetrationLevel / pvUnitNominalPower);
Int numberPVPlants = 9;
Int numberPVUnitsPerPlant = numberPVUnits / numberPVPlants;
// PV controller parameters
Real scaling_P = 10.0;
Real scaling_I = 1000.0;
......@@ -127,7 +127,7 @@ namespace CIGREMV {
Real pvReactivePower = sqrt(std::pow(pvActivePower / scenario.pvUnitPowerFactor, 2) - std::pow(pvActivePower, 2));
// add PVs to network topology
for (Int n = 3; n <= 11; n++) {
for (Int n = 3; n <= 11; ++n) {
// TODO: cast to BaseAverageVoltageSourceInverter and move set functions out of case distinction
if (domain == Domain::SP) {
SimNode<Complex>::Ptr connectionNode = system.node<CPS::SimNode<Complex>>("N" + std::to_string(n));
......@@ -185,11 +185,11 @@ namespace CIGREMV {
logger->addAttribute(pv->name() + "_pll_output", pv->attribute("pll_output"));
logger->addAttribute(pv->name() + "_vsref", pv->attribute("Vsref"));
logger->addAttribute(pv->name() + "_vs", pv->attribute("Vs"));
}
}
}
std::shared_ptr<DPsim::SwitchEvent> createEventAddPowerConsumption(String nodeName, Real eventTime, Real additionalActivePower, SystemTopology& system, Domain domain, DPsim::DataLogger::Ptr logger) {
// TODO: use base classes ph1
if (domain == CPS::Domain::DP) {
auto loadSwitch = DP::Ph1::Switch::make("Load_Add_Switch_" + nodeName, Logger::Level::debug);
......@@ -217,7 +217,7 @@ namespace CIGREMV {
}
std::shared_ptr<DPsim::SwitchEvent3Ph> createEventAddPowerConsumption3Ph(String nodeName, Real eventTime, Real additionalActivePower, SystemTopology& system, Domain domain, DPsim::DataLogger::Ptr logger) {
// TODO: use base classes ph3
if (domain == CPS::Domain::EMT) {
auto loadSwitch = EMT::Ph3::Switch::make("Load_Add_Switch_" + nodeName, Logger::Level::debug);
......@@ -233,7 +233,7 @@ namespace CIGREMV {
return nullptr;
}
}
}
}
}
......@@ -64,8 +64,8 @@ int main(int argc, char** argv) {
std::cout << "Signal " << (i*2)+0 << ": Mag " << n->name() << std::endl;
std::cout << "Signal " << (i*2)+1 << ": Phas " << n->name() << std::endl;
intf.exportReal(v->mag(), (i*2)+0); o++;
intf.exportReal(v->phase(), (i*2)+1); o++;
intf.exportReal(v->mag(), (i*2)+0); ++o;
intf.exportReal(v->phase(), (i*2)+1); ++o;
}
sim.addInterface(&intf, false);
......
......@@ -100,8 +100,8 @@ int main(int argc, char** argv){
std::cout << "Signal " << (i*2)+0 << ": Mag " << n->name() << std::endl;
std::cout << "Signal " << (i*2)+1 << ": Phas " << n->name() << std::endl;
intf.exportReal(v->mag(), (i*2)+0); o++;
intf.exportReal(v->phase(), (i*2)+1); o++;
intf.exportReal(v->mag(), (i*2)+0); ++o;
intf.exportReal(v->phase(), (i*2)+1); ++o;
list_varnames[(i*2)+0] = n->name() + ".V.mag";
list_varnames[(i*2)+1] = n->name() + ".V.phase";
......
......@@ -88,7 +88,7 @@ int main(int argc, char *argv[]) {
continue;
}
i--;
--i;
auto n_dp = std::dynamic_pointer_cast<CPS::DP::SimNode>(n);
auto v = n_dp->attributeMatrixComp("v")->coeff(0, 0);
......@@ -96,8 +96,8 @@ int main(int argc, char *argv[]) {
std::cout << "Signal " << (i*2)+0 << ": Mag " << n->name() << std::endl;
std::cout << "Signal " << (i*2)+1 << ": Phas " << n->name() << std::endl;
intf.exportReal(v->mag(), (i*2)+0); o++;
intf.exportReal(v->phase(), (i*2)+1); o++;
intf.exportReal(v->mag(), (i*2)+0); ++o;
intf.exportReal(v->phase(), (i*2)+1); ++o;
logger->addAttribute(fmt::format("mag_{}", i), v->mag());
logger->addAttribute(fmt::format("phase_{}", i), v->phase());
......
......@@ -88,7 +88,7 @@ int main(int argc, char *argv[]) {
continue;
}
i--;
--i;
auto v = n->attributeComplex("v");
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment