11 #include <dpsim-models/AttributeList.h>
12 #include <dpsim-models/SimSignalComp.h>
13 #include <dpsim-models/Solver/MNAInterface.h>
14 #include <dpsim/DataLogger.h>
15 #include <dpsim/Solver.h>
17 #include <unordered_map>
20 template <
typename VarType>
25 typename CPS::SimNode<VarType>::List nodes;
27 CPS::MNAInterface::List components;
39 CPS::LUFactorized luFactorization;
41 std::vector<const Matrix *> rightVectorStamps;
47 Real mSystemFrequency;
52 std::shared_ptr<DataLogger> mLeftVectorLog;
54 std::shared_ptr<DataLogger> mRightVectorLog;
56 std::vector<Subnet> mSubnets;
57 std::unordered_map<typename CPS::SimNode<VarType>::Ptr, Subnet *>
59 typename CPS::SimPowerComp<VarType>::List mTearComponents;
60 CPS::SimSignalComp::List mSimSignalComps;
62 Matrix mRightSideVector;
63 Matrix mLeftSideVector;
67 Matrix mSystemInverse;
71 CPS::SparseMatrixRow mTearImpedance;
74 CPS::LUFactorized mTotalTearImpedance;
82 void initSubnets(
const std::vector<CPS::SystemTopology> &subnets);
83 void collectVirtualNodes(
int net);
84 void assignMatrixNodeIndices(
int net);
85 void setSubnetSize(
int net, UInt nodes);
89 void createMatrices();
90 void createTearMatrices(UInt totalSize);
92 void initComponents();
95 void applyTearComponentStamp(UInt compIdx);
97 void log(Real time, Int timeStepCount)
override;
107 CPS::IdentifiedObject::List tearComponents, Real timeStep,
108 CPS::Logger::Level logLevel);
110 CPS::Task::List
getTasks()
override;
115 : Task(solver.
mName +
".SubnetSolve_" + std::to_string(net)),
116 mSolver(solver), mSubnet(solver.mSubnets[net]) {
117 for (
auto it : mSubnet.components) {
118 if (it->getRightVector()->get().size() != 0) {
119 mAttributeDependencies.push_back(it->getRightVector());
125 void execute(Real time, Int timeStepCount);
136 : Task(solver.
mName +
".PreSolve"), mSolver(solver) {
141 void execute(Real time, Int timeStepCount);
150 : Task(solver.
mName +
".Solve_" + std::to_string(net)), mSolver(solver),
151 mSubnet(solver.mSubnets[net]) {
153 mModifiedAttributes.push_back(mSubnet.leftVector);
156 void execute(Real time, Int timeStepCount);
166 : Task(solver.
mName +
".PostSolve"), mSolver(solver) {
167 for (
auto &net : solver.mSubnets) {
168 mAttributeDependencies.push_back(net.leftVector);
170 mModifiedAttributes.push_back(Scheduler::external);
173 void execute(Real time, Int timeStepCount);
182 : Task(solver.
mName +
".Log"), mSolver(solver) {
183 for (
auto &net : solver.mSubnets) {
184 mAttributeDependencies.push_back(net.leftVector);
186 mModifiedAttributes.push_back(Scheduler::external);
189 void execute(Real time, Int timeStepCount);
Base class of objects having attributes to access member variables.
Tasks to be defined by every component.
CPS::Task::List getTasks() override
Get tasks for scheduler.
const CPS::Attribute< Matrix >::Ptr mOrigLeftSideVector
Solutions of the split systems.
const CPS::Attribute< Matrix >::Ptr mMappedTearCurrents
Currents through the removed network (as "seen" from the other subnets)
Base class for more specific solvers such as MNA, ODE or IDA.
String mName
Name for logging.