-
Notifications
You must be signed in to change notification settings - Fork 52
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Revision of power flow solver #284
base: master
Are you sure you want to change the base?
Changes from all commits
18135a8
8ec67dc
543bd03
9beb0e1
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Now there are 23 changed files. But it looks like in most of the files there are just a couple of lines with changed formatting. And a new formatting is different from the .clang-format rules, applied to the rest of the codebase.
I would then suggest to limit this PR to these 4 files (hope, I did not miss anything) |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -185,48 +185,48 @@ void PFSolver::determinePFBusType() { | |
// determine powerflow bus types according connected type of connected components | ||
// only PQ type component connected -> set as PQ bus | ||
if (!connectedPV && connectedPQ && !connectedVD) { | ||
SPDLOG_LOGGER_DEBUG( | ||
SPDLOG_LOGGER_INFO( | ||
mSLog, "{}: only PQ type component connected -> set as PQ bus", | ||
node->name()); | ||
mPQBusIndices.push_back(node->matrixNodeIndex()); | ||
mPQBuses.push_back(node); | ||
} // no component connected -> set as PQ bus (P & Q will be zero) | ||
else if (!connectedPV && !connectedPQ && !connectedVD) { | ||
SPDLOG_LOGGER_DEBUG(mSLog, "{}: no component connected -> set as PQ bus", | ||
node->name()); | ||
SPDLOG_LOGGER_INFO(mSLog, "{}: no component connected -> set as PQ bus", | ||
node->name()); | ||
mPQBusIndices.push_back(node->matrixNodeIndex()); | ||
mPQBuses.push_back(node); | ||
} // only PV type component connected -> set as PV bus | ||
else if (connectedPV && !connectedPQ && !connectedVD) { | ||
SPDLOG_LOGGER_DEBUG( | ||
SPDLOG_LOGGER_INFO( | ||
mSLog, "{}: only PV type component connected -> set as PV bus", | ||
node->name()); | ||
mPVBusIndices.push_back(node->matrixNodeIndex()); | ||
mPVBuses.push_back(node); | ||
} // PV and PQ type component connected -> set as PV bus (TODO: bus type should be modifiable by user afterwards) | ||
else if (connectedPV && connectedPQ && !connectedVD) { | ||
SPDLOG_LOGGER_DEBUG( | ||
SPDLOG_LOGGER_INFO( | ||
mSLog, "{}: PV and PQ type component connected -> set as PV bus", | ||
node->name()); | ||
mPVBusIndices.push_back(node->matrixNodeIndex()); | ||
mPVBuses.push_back(node); | ||
} // only VD type component connected -> set as VD bus | ||
else if (!connectedPV && !connectedPQ && connectedVD) { | ||
SPDLOG_LOGGER_DEBUG( | ||
SPDLOG_LOGGER_INFO( | ||
mSLog, "{}: only VD type component connected -> set as VD bus", | ||
node->name()); | ||
mVDBusIndices.push_back(node->matrixNodeIndex()); | ||
mVDBuses.push_back(node); | ||
} // VD and PV type component connect -> set as VD bus | ||
else if (connectedPV && !connectedPQ && connectedVD) { | ||
SPDLOG_LOGGER_DEBUG( | ||
SPDLOG_LOGGER_INFO( | ||
mSLog, "{}: VD and PV type component connect -> set as VD bus", | ||
node->name()); | ||
mVDBusIndices.push_back(node->matrixNodeIndex()); | ||
mVDBuses.push_back(node); | ||
} // VD, PV and PQ type component connect -> set as VD bus | ||
else if (connectedPV && connectedPQ && connectedVD) { | ||
SPDLOG_LOGGER_DEBUG( | ||
SPDLOG_LOGGER_INFO( | ||
mSLog, "{}: VD, PV and PQ type component connect -> set as VD bus", | ||
node->name()); | ||
mVDBusIndices.push_back(node->matrixNodeIndex()); | ||
|
@@ -321,6 +321,19 @@ void PFSolver::determineNodeBaseVoltages() { | |
"Choose base voltage {}V of {} to convert pu-solution of {}.", | ||
baseVoltage_, gen->name(), node->name()); | ||
break; | ||
} else if (std::shared_ptr<CPS::SP::Ph1::Load> load = | ||
std::dynamic_pointer_cast<CPS::SP::Ph1::Load>(comp)) { | ||
baseVoltage_ = load->attributeTyped<CPS::Real>("V_nom")->get(); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If |
||
mSLog->info("Choose base voltage of {}V to convert pu-solution of {}.", | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Maybe is better with There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, the macro variant can be optimized better if the log level is less than info. |
||
baseVoltage_, load->name(), node->name()); | ||
break; | ||
} else if (std::shared_ptr<CPS::SP::Ph1::NetworkInjection> extnet = | ||
std::dynamic_pointer_cast<CPS::SP::Ph1::NetworkInjection>( | ||
comp)) { | ||
baseVoltage_ = extnet->attributeTyped<CPS::Real>("base_Voltage")->get(); | ||
mSLog->info("Choose base voltage of {}V to convert pu-solution of {}.", | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think here is also |
||
baseVoltage_, extnet->name(), node->name()); | ||
break; | ||
} else { | ||
SPDLOG_LOGGER_WARN(mSLog, "Unable to get base voltage at {}", | ||
node->name()); | ||
|
@@ -471,4 +484,4 @@ void PFSolver::SolveTask::execute(Real time, Int timeStepCount) { | |
|
||
Task::List PFSolver::getTasks() { | ||
return Task::List{std::make_shared<SolveTask>(*this)}; | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see this is done the same way for the other components, but does
mBaseVoltage
really need to be ofAttribute<Real>::Ptr
type? ls there a specific functionality of Attributes that you'd like to use formBaseVoltage
, like logging, interfacing or task scheduling?If you just want to get the value of
mBaseVoltage
in PFSolver.cpp a more readable solution could be to have a getter function: