28 typename CPS::SimNode<VarType>::List nodes;
30 CPS::MNAInterface::List components;
42 std::shared_ptr<DirectLinearSolver> directLinearSolver;
44 SparseMatrix systemMatrix;
46 std::vector<std::pair<UInt, UInt>> listVariableEntries;
48 std::vector<UInt> tearColumns;
50 std::vector<const Matrix *> rightVectorStamps;
52 CPS::Attribute<Matrix>::Ptr leftVector;
55 CPS::MNAVariableCompInterface::List mVariableComps;
58 Real mSystemFrequency;
63 std::shared_ptr<DataLogger> mLeftVectorLog;
65 std::shared_ptr<DataLogger> mRightVectorLog;
67 std::vector<Subnet> mSubnets;
68 std::unordered_map<typename CPS::SimNode<VarType>::Ptr, Subnet *>
70 typename CPS::SimPowerComp<VarType>::List mTearComponents;
71 CPS::SimSignalComp::List mSimSignalComps;
73 Matrix mRightSideVector;
74 Matrix mLeftSideVector;
78 Matrix mSystemInverseTearTopology;
82 CPS::SparseMatrixRow mTearImpedance;
84 CPS::LUFactorized mTotalTearImpedance;
89 std::atomic<bool> mTearSchurNeedsRebuild{
false};
95 CPS::PhaseType mPhaseType;
99 void initSubnets(
const std::vector<CPS::SystemTopology> &subnets);
100 void collectVirtualNodes(
int net);
101 void assignMatrixNodeIndices(
int net);
102 void setSubnetSize(
int net, UInt nodes);
104 void setLogColumns();
106 void createMatrices();
107 void createTearMatrices(UInt totalSize);
109 void initComponents();
112 void applyTearComponentStamp(UInt compIdx);
114 void log(Real time, Int timeStepCount)
override;
124 CPS::IdentifiedObject::List tearComponents, Real timeStep,
125 CPS::Logger::Level logLevel);
127 CPS::Task::List
getTasks()
override;
131 SubnetSolveTask(DiakopticsSolver<VarType> &solver, UInt net)
132 : Task(solver.
mName +
".SubnetSolve_" + std::to_string(net)),
133 mSolver(solver), mSubnet(solver.mSubnets[net]) {
134 for (
auto it : mSubnet.components) {
135 if (it->getRightVector()->get().size() != 0) {
136 mAttributeDependencies.push_back(it->getRightVector());
142 void execute(Real time, Int timeStepCount);
143 void recomputeSubnetMatrix(Real time);
148 DiakopticsSolver<VarType> &mSolver;
155 PreSolveTask(DiakopticsSolver<VarType> &solver)
156 : Task(solver.
mName +
".PreSolve"), mSolver(solver) {
161 void execute(Real time, Int timeStepCount);
164 DiakopticsSolver<VarType> &mSolver;
169 SolveTask(DiakopticsSolver<VarType> &solver, UInt net)
170 : Task(solver.
mName +
".Solve_" + std::to_string(net)), mSolver(solver),
171 mSubnet(solver.mSubnets[net]) {
173 mModifiedAttributes.push_back(mSubnet.leftVector);
176 void execute(Real time, Int timeStepCount);
179 DiakopticsSolver<VarType> &mSolver;
185 PostSolveTask(DiakopticsSolver<VarType> &solver)
186 : Task(solver.
mName +
".PostSolve"), mSolver(solver) {
187 for (
auto &net : solver.mSubnets) {
188 mAttributeDependencies.push_back(net.leftVector);
189 for (UInt node = 0; node < net.mRealNetNodeNum; ++node) {
190 mModifiedAttributes.push_back(net.nodes[node]->attribute(
"v"));
193 mModifiedAttributes.push_back(Scheduler::external);
196 void execute(Real time, Int timeStepCount);
199 DiakopticsSolver<VarType> &mSolver;
204 LogTask(DiakopticsSolver<VarType> &solver)
205 : Task(solver.
mName +
".Log"), mSolver(solver) {
206 for (
auto &net : solver.mSubnets) {
207 mAttributeDependencies.push_back(net.leftVector);
209 mModifiedAttributes.push_back(Scheduler::external);
212 void execute(Real time, Int timeStepCount);
215 DiakopticsSolver<VarType> &mSolver;