DPsim
|
Solver class using the nonlinear powerflow (PF) formulation. More...
#include <PFSolver.h>
Classes | |
class | SolveTask |
Public Member Functions | |
PFSolver (CPS::String name, CPS::SystemTopology system, Real timeStep, CPS::Logger::Level logLevel) | |
Constructor to be used in simulation examples. | |
void | setVDNode (CPS::String name) |
Set a node to VD using its name. | |
void | modifyPowerFlowBusComponent (CPS::String name, CPS::PowerflowBusType powerFlowBusType) |
Allows to modify the powerflow bus type of a specific component. | |
void | setSolverAndComponentBehaviour (Solver::Behaviour behaviour) override |
set solver and component to initialization or simulation behaviour | |
![]() | |
Solver (String name, CPS::Logger::Level logLevel) | |
void | setTimeStep (Real timeStep) |
void | doFrequencyParallelization (Bool freqParallel) |
virtual void | setSystem (const CPS::SystemTopology &system) |
void | doSystemMatrixRecomputation (Bool value) |
void | setLogSolveTimes (Bool value) |
void | doSteadyStateInit (Bool f) |
activate steady state initialization | |
void | setSteadStIniTimeLimit (Real v) |
set steady state initialization time limit | |
void | setSteadStIniAccLimit (Real v) |
set steady state initialization accuracy limit | |
void | doInitFromNodesAndTerminals (Bool f) |
activate powerflow initialization | |
virtual void | setDirectLinearSolverConfiguration (DirectLinearSolverConfiguration &) |
set direct linear solver configuration (only available in MNA for now) | |
virtual void | logLUTimes () |
log LU decomposition times, if applicable | |
virtual void | log (Real time, Int timeStepCount) |
Log results. | |
void | setMaxNumberOfIterations (int maxIterations) |
Protected Member Functions | |
virtual void | generateInitialSolution (Real time, bool keep_last_solution=false)=0 |
Generate initial solution for current time step. | |
virtual void | calculateMismatch ()=0 |
Calculate mismatch. | |
virtual void | calculateJacobian ()=0 |
Calculate the Jacobian. | |
virtual void | updateSolution ()=0 |
Update solution in each iteration. | |
virtual void | setSolution ()=0 |
Set final solution. | |
void | initialize () override |
Initialization of the solver. | |
void | initializeComponents () |
Initialization of individual components. | |
void | assignMatrixNodeIndices () |
Assignment of matrix indices for nodes. | |
void | setBaseApparentPower () |
Set apparent base power of per-unit system. | |
void | determinePFBusType () |
Determine bus type for all buses. | |
void | determineNodeBaseVoltages () |
Determine base voltages for each node. | |
void | composeAdmittanceMatrix () |
Compose admittance matrix. | |
CPS::Real | G (int i, int j) |
Gets the real part of admittance matrix element. | |
CPS::Real | B (int i, int j) |
Gets the imaginary part of admittance matrix element. | |
Bool | solvePowerflow () |
Solves the powerflow problem. | |
CPS::Bool | checkConvergence () |
Check whether below tolerance. | |
CPS::String | logVector (std::vector< CPS::UInt > indexVector) |
Logging for integer vectors. | |
CPS::Task::List | getTasks () override |
Get tasks for scheduler. | |
Protected Attributes | |
UInt | mNumPQBuses = 0 |
Number of PQ nodes. | |
UInt | mNumPVBuses = 0 |
Number of PV nodes. | |
UInt | mNumVDBuses = 0 |
Number of PV nodes. | |
UInt | mNumUnknowns = 0 |
Number of unknowns, defining system dimension. | |
CPS::TopologicalNode::List | mPQBuses |
Vector of nodes characterized as PQ buses. | |
CPS::TopologicalNode::List | mPVBuses |
Vector of nodes characterized as PV buses. | |
CPS::TopologicalNode::List | mVDBuses |
Vector of nodes characterized as VD buses. | |
std::vector< CPS::UInt > | mPQBusIndices |
Vector with indices of PQ buses. | |
std::vector< CPS::UInt > | mPVBusIndices |
Vector with indices of PV buses. | |
std::vector< CPS::UInt > | mVDBusIndices |
Vector with indices of VD buses. | |
std::vector< CPS::UInt > | mPQPVBusIndices |
Vector with indices of both PQ and PV buses. | |
CPS::SparseMatrixCompRow | mY |
Admittance matrix. | |
CPS::Matrix | mJ |
Jacobian matrix. | |
CPS::Vector | mX |
Solution vector. | |
CPS::Vector | mF |
Vector of mismatch values. | |
CPS::SystemTopology | mSystem |
System list. | |
std::vector< std::shared_ptr< CPS::SP::Ph1::Transformer > > | mTransformers |
Vector of transformer components. | |
std::vector< std::shared_ptr< CPS::SP::Ph1::SolidStateTransformer > > | mSolidStateTransformers |
Vector of solid state transformer components. | |
std::vector< std::shared_ptr< CPS::SP::Ph1::SynchronGenerator > > | mSynchronGenerators |
Vector of synchronous generator components. | |
std::vector< std::shared_ptr< CPS::SP::Ph1::Load > > | mLoads |
Vector of load components. | |
std::vector< std::shared_ptr< CPS::SP::Ph1::PiLine > > | mLines |
Vector of line components. | |
std::vector< std::shared_ptr< CPS::SP::Ph1::Shunt > > | mShunts |
Vector of shunt components. | |
std::vector< std::shared_ptr< CPS::SP::Ph1::NetworkInjection > > | mExternalGrids |
Vector of external grid components. | |
std::vector< std::shared_ptr< CPS::SP::Ph1::AvVoltageSourceInverterDQ > > | mAverageVoltageSourceInverters |
Vector of average voltage source inverters. | |
std::map< CPS::TopologicalNode::Ptr, CPS::Real > | mBaseVoltageAtNode |
Map providing determined base voltages for each node. | |
Real | mTolerance = 1e-8 |
Solver tolerance. | |
CPS::UInt | mMaxIterations = 9 |
Maximum number of iterations. | |
CPS::UInt | mIterations |
Actual number of iterations. | |
CPS::Real | mBaseApparentPower |
Base power of per-unit system. | |
CPS::Bool | isConverged = false |
Convergence flag. | |
CPS::Bool | solutionInitialized = false |
Flag whether solution vectors are initialized. | |
CPS::Bool | solutionComplexInitialized = false |
Flag whether complex solution vectors are initialized. | |
![]() | |
String | mName |
Name for logging. | |
CPS::Logger::Level | mLogLevel |
Logging level. | |
Bool | mLogSolveTimes = true |
Collect step time for logging. | |
CPS::Logger::Log | mSLog |
Logger. | |
Real | mTimeStep |
Time step for fixed step solvers. | |
Bool | mFrequencyParallel = false |
Activates parallelized computation of frequencies. | |
Real | mSteadStIniTimeLimit = 10 |
steady state initialization time limit | |
Real | mSteadStIniAccLimit = 0.0001 |
steady state initialization accuracy limit | |
Bool | mSteadyStateInit = false |
Activates steady state initialization. | |
Bool | mIsInInitialization = false |
Determines if solver is in initialization phase, which requires different behavior. | |
Bool | mInitFromNodesAndTerminals = true |
Bool | mSystemMatrixRecomputation = false |
Enable recomputation of system matrix during simulation. | |
Behaviour | mBehaviour = Solver::Behaviour::Simulation |
Solver behaviour initialization or simulation. | |
Additional Inherited Members | |
![]() | |
enum | Behaviour { Initialization , Simulation } |
enum class | Type { MNA , DAE , NRP } |
typedef std::shared_ptr< Solver > | Ptr |
typedef std::vector< Ptr > | List |
![]() | |
int | mMaxIterations = 10 |
Solver class using the nonlinear powerflow (PF) formulation.
Definition at line 21 of file PFSolver.h.
PFSolver::PFSolver | ( | CPS::String | name, |
CPS::SystemTopology | system, | ||
CPS::Real | timeStep, | ||
CPS::Logger::Level | logLevel ) |
Constructor to be used in simulation examples.
Definition at line 16 of file PFSolver.cpp.
|
inlinevirtual |
Definition at line 145 of file PFSolver.h.
|
protected |
Assignment of matrix indices for nodes.
Definition at line 68 of file PFSolver.cpp.
|
protected |
Gets the imaginary part of admittance matrix element.
Definition at line 432 of file PFSolver.cpp.
|
protectedpure virtual |
Calculate the Jacobian.
Implemented in DPsim::PFSolverPowerPolar.
|
protectedpure virtual |
Calculate mismatch.
Implemented in DPsim::PFSolverPowerPolar.
|
protected |
Check whether below tolerance.
Definition at line 434 of file PFSolver.cpp.
|
protected |
Compose admittance matrix.
Definition at line 405 of file PFSolver.cpp.
|
protected |
Determine base voltages for each node.
Definition at line 260 of file PFSolver.cpp.
|
protected |
Determine bus type for all buses.
Definition at line 147 of file PFSolver.cpp.
|
protected |
Gets the real part of admittance matrix element.
Definition at line 430 of file PFSolver.cpp.
|
protectedpure virtual |
Generate initial solution for current time step.
Implemented in DPsim::PFSolverPowerPolar.
|
overrideprotectedvirtual |
|
overrideprotectedvirtual |
Initialization of the solver.
Reimplemented from DPsim::Solver.
Definition at line 23 of file PFSolver.cpp.
|
protected |
Initialization of individual components.
Definition at line 82 of file PFSolver.cpp.
|
inlineprotected |
Logging for integer vectors.
Definition at line 131 of file PFSolver.h.
void PFSolver::modifyPowerFlowBusComponent | ( | CPS::String | name, |
CPS::PowerflowBusType | powerFlowBusType ) |
Allows to modify the powerflow bus type of a specific component.
Definition at line 362 of file PFSolver.cpp.
|
protected |
Set apparent base power of per-unit system.
Definition at line 124 of file PFSolver.cpp.
|
protectedpure virtual |
Set final solution.
Implemented in DPsim::PFSolverPowerPolar.
|
overridevirtual |
set solver and component to initialization or simulation behaviour
Reimplemented from DPsim::Solver.
Definition at line 377 of file PFSolver.cpp.
void PFSolver::setVDNode | ( | CPS::String | name | ) |
Set a node to VD using its name.
Definition at line 345 of file PFSolver.cpp.
|
protected |
Solves the powerflow problem.
Definition at line 443 of file PFSolver.cpp.
|
protectedpure virtual |
Update solution in each iteration.
Implemented in DPsim::PFSolverPowerPolar.
|
protected |
Convergence flag.
Definition at line 89 of file PFSolver.h.
|
protected |
Vector of average voltage source inverters.
Definition at line 76 of file PFSolver.h.
|
protected |
Base power of per-unit system.
Definition at line 87 of file PFSolver.h.
|
protected |
Map providing determined base voltages for each node.
Definition at line 78 of file PFSolver.h.
|
protected |
Vector of external grid components.
Definition at line 73 of file PFSolver.h.
|
protected |
Vector of mismatch values.
Definition at line 54 of file PFSolver.h.
|
protected |
Actual number of iterations.
Definition at line 85 of file PFSolver.h.
|
protected |
Jacobian matrix.
Definition at line 50 of file PFSolver.h.
|
protected |
Vector of line components.
Definition at line 69 of file PFSolver.h.
|
protected |
Vector of load components.
Definition at line 67 of file PFSolver.h.
|
protected |
Maximum number of iterations.
Definition at line 83 of file PFSolver.h.
|
protected |
Number of PQ nodes.
Definition at line 24 of file PFSolver.h.
|
protected |
Number of PV nodes.
Definition at line 26 of file PFSolver.h.
|
protected |
Number of unknowns, defining system dimension.
Definition at line 30 of file PFSolver.h.
|
protected |
Number of PV nodes.
Definition at line 28 of file PFSolver.h.
|
protected |
Vector of nodes characterized as PQ buses.
Definition at line 32 of file PFSolver.h.
|
protected |
Vector with indices of PQ buses.
Definition at line 38 of file PFSolver.h.
|
protected |
Vector with indices of both PQ and PV buses.
Definition at line 44 of file PFSolver.h.
|
protected |
Vector of nodes characterized as PV buses.
Definition at line 34 of file PFSolver.h.
|
protected |
Vector with indices of PV buses.
Definition at line 40 of file PFSolver.h.
|
protected |
Vector of shunt components.
Definition at line 71 of file PFSolver.h.
|
protected |
Vector of solid state transformer components.
Definition at line 62 of file PFSolver.h.
|
protected |
Vector of synchronous generator components.
Definition at line 65 of file PFSolver.h.
|
protected |
System list.
Definition at line 57 of file PFSolver.h.
|
protected |
Solver tolerance.
Definition at line 81 of file PFSolver.h.
|
protected |
Vector of transformer components.
Definition at line 59 of file PFSolver.h.
|
protected |
Vector of nodes characterized as VD buses.
Definition at line 36 of file PFSolver.h.
|
protected |
Vector with indices of VD buses.
Definition at line 42 of file PFSolver.h.
|
protected |
Solution vector.
Definition at line 52 of file PFSolver.h.
|
protected |
Admittance matrix.
Definition at line 47 of file PFSolver.h.
|
protected |
Flag whether complex solution vectors are initialized.
Definition at line 93 of file PFSolver.h.
|
protected |
Flag whether solution vectors are initialized.
Definition at line 91 of file PFSolver.h.