DPsim
Loading...
Searching...
No Matches
Simulation.cpp
Go to the documentation of this file.
1// SPDX-License-Identifier: Apache-2.0
2
3#include <algorithm>
4#include <chrono>
5#include <cmath>
6#include <iomanip>
7#include <limits>
8#include <stdexcept>
9#include <typeindex>
10
11#include <dpsim-models/Utils.h>
13#include <dpsim/MNASolver.h>
18#include <dpsim/Simulation.h>
19#include <dpsim/Utils.h>
20
21#include <spdlog/sinks/stdout_color_sinks.h>
22
23#ifdef WITH_CIM
25#endif
26
27#ifdef WITH_SUNDIALS
29#include <dpsim/DAESolver.h>
30#include <dpsim/ODESolver.h>
31#endif
32
33using namespace CPS;
34using namespace DPsim;
35
52
71
73 // Logging
74 mLog =
75 Logger::get(**mName, mLogLevel, std::max(Logger::Level::info, mLogLevel));
76
77 Eigen::setNbThreads(1);
78
79 mInitialized = false;
80}
81
83 if (mInitialized)
84 return;
85
86 mSolvers.clear();
87
88 switch (mDomain) {
89 case Domain::SP:
90 // Treat SP as DP
91 case Domain::DP:
93 break;
94 case Domain::EMT:
96 break;
97 }
98
99 mTime = 0;
100 mTimeStepCount = 0;
101
102 schedule();
103
104 mInitialized = true;
105}
106
107template <typename VarType> void Simulation::createSolvers() {
108 Solver::Ptr solver;
109
110 switch (mSolverType) {
113 break;
114
115#ifdef WITH_SUNDIALS
117 solver = std::make_shared<DAESolver>(**mName, mSystem, **mTimeStep, 0.0);
118 mSolvers.push_back(solver);
119 break;
120#endif /* WITH_SUNDIALS */
121
122 case Solver::Type::NRP: {
123 std::shared_ptr<PFSolver> pfSolver;
124#if defined(WITH_KLU) || defined(WITH_SPARSE)
125 if (**mPFSolverUseSparse)
126 pfSolver = std::make_shared<PFSolverPowerPolarSparse>(
128 else
129 pfSolver = std::make_shared<PFSolverPowerPolar>(**mName, mSystem,
131#else
132 // No sparse linear solver available: fall back to the dense solver.
133 pfSolver = std::make_shared<PFSolverPowerPolar>(**mName, mSystem,
135#endif
136
137 pfSolver->setKeepLastSolution(**mPFKeepLastSolution);
138 pfSolver->setZeroSkipping(mZeroSkipping);
139 pfSolver->setBaseApparentPowerFallback(**mPFBaseApparentPowerFallback);
140 pfSolver->setMaxIterations(**mPFMaxIterations);
141 pfSolver->setEnforceReactiveLimits(**mPFEnforceReactiveLimits);
142 pfSolver->setBaseVoltageLooseTolerance(**mPFBaseVoltageLooseTolerance);
143 pfSolver->setBaseVoltageStrictTolerance(**mPFBaseVoltageStrictTolerance);
144
145 solver = pfSolver;
146
147 solver->doInitFromNodesAndTerminals(mInitFromNodesAndTerminals);
148 solver->setSolverAndComponentBehaviour(mSolverBehaviour);
149 solver->initialize();
150
151 mSolvers.push_back(solver);
152 break;
153 }
154
155 default:
157 }
158
159 // Some components require a dedicated ODE solver.
160 // This solver is independent of the system solver.
161#ifdef WITH_SUNDIALS
162 for (auto comp : mSystem.mComponents) {
163 auto odeComp = std::dynamic_pointer_cast<ODEInterface>(comp);
164 if (odeComp) {
165 // TODO explicit / implicit integration
166 auto odeSolver = std::make_shared<ODESolver>(
167 odeComp->mAttributeList->attributeTyped<String>("name")->get() +
168 "_ODE",
169 odeComp, false, **mTimeStep);
170 mSolvers.push_back(odeSolver);
171 }
172 }
173#endif /* WITH_SUNDIALS */
174}
175
176template <typename VarType> void Simulation::createMNASolver() {
178 Solver::Ptr solver;
179 std::vector<SystemTopology> subnets;
180 // The Diakoptics solver splits the system at a later point.
181 // That is why the system is not split here if tear components exist.
182 if (**mSplitSubnets && mTearComponents.size() == 0)
183 mSystem.splitSubnets<VarType>(subnets);
184 else
185 subnets.push_back(mSystem);
186
187 for (UInt net = 0; net < subnets.size(); ++net) {
188 String copySuffix;
189 if (subnets.size() > 1)
190 copySuffix = "_" + std::to_string(net);
191
192 // TODO: In the future, here we could possibly even use different
193 // solvers for different subnets if deemed useful
194 if (mTearComponents.size() > 0) {
196 throw std::logic_error("MNA state-space extraction does not support "
197 "Diakoptics/tearing.");
198 }
199 // Tear components available, use diakoptics
200 solver = std::make_shared<DiakopticsSolver<VarType>>(
201 **mName, subnets[net], mTearComponents, **mTimeStep, mLogLevel);
202 } else {
203 // Default case with lu decomposition from mna factory
204 auto mnaSolver = MnaSolverFactory::factory<VarType>(
205 **mName + copySuffix, mDomain, mLogLevel, mDirectImpl,
207
208 mnaSolver->doStateSpaceExtraction(mStateSpaceExtraction);
209
210 solver = mnaSolver;
211 solver->setTimeStep(**mTimeStep);
212 solver->setLogSolveTimes(mLogStepTimes);
213 solver->doSteadyStateInit(**mSteadyStateInit);
214 solver->doFrequencyParallelization(mFreqParallel);
215 solver->setSteadStIniTimeLimit(mSteadStIniTimeLimit);
216 solver->setSteadStIniAccLimit(mSteadStIniAccLimit);
217 solver->setSystem(subnets[net]);
218 solver->setSolverAndComponentBehaviour(mSolverBehaviour);
219 solver->doInitFromNodesAndTerminals(mInitFromNodesAndTerminals);
220 solver->setSystemMatrixRecomputationMode(mSystemMatrixRecomputationMode);
221 solver->setDirectLinearSolverConfiguration(
223 solver->setZeroSkipping(mZeroSkipping);
224 solver->initialize();
225 solver->setMaxNumberOfIterations(mMaxIterations);
226 }
227 solver->setZeroSkipping(mZeroSkipping);
228 mSolvers.push_back(solver);
229 }
230}
231
232void Simulation::sync() const {
233 SPDLOG_LOGGER_INFO(mLog, "Start synchronization with remotes on interfaces");
234
235 for (auto intf : mInterfaces) {
236 intf->syncExports();
237 intf->syncImports();
238 intf->syncExports();
239 }
240
241 SPDLOG_LOGGER_INFO(mLog, "Synchronized simulation start with remotes");
242}
243
245 mTasks.clear();
246 mTaskOutEdges.clear();
247 mTaskInEdges.clear();
248 for (auto solver : mSolvers) {
249 for (auto t : solver->getTasks()) {
250 mTasks.push_back(t);
251 }
252 }
253
254 for (auto intf : mInterfaces) {
255 for (auto t : intf->getTasks()) {
256 mTasks.push_back(t);
257 }
258 }
259
260 for (auto logger : mLoggers) {
261 mTasks.push_back(logger->getTask());
262 }
263 if (!mScheduler) {
264 mScheduler = std::make_shared<SequentialScheduler>();
265 }
267}
268
270 SPDLOG_LOGGER_INFO(mLog, "Scheduling tasks.");
271 prepSchedule();
272 mScheduler->createSchedule(mTasks, mTaskInEdges, mTaskOutEdges);
273 SPDLOG_LOGGER_INFO(mLog, "Scheduling done.");
274}
275
276#ifdef WITH_GRAPHVIZ
277Graph::Graph Simulation::dependencyGraph() {
278 if (!mInitialized)
279 initialize();
280
281 std::map<CPS::Task::Ptr, Scheduler::TaskTime> avgTimes;
282 std::map<CPS::Task::Ptr, String> fillColors;
283
284 auto isScheduled = [this](Task::Ptr task) -> Bool {
285 return !mTaskOutEdges[task].empty();
286 };
287
288 auto getColor = [](Task::Ptr task) -> String {
289 static std::map<std::type_index, String> colorMap;
290 auto tid = std::type_index(typeid(task.get()));
291
292 if (colorMap.find(tid) != colorMap.end()) {
293 colorMap[tid] =
294 String("/paired9/") + std::to_string(1 + colorMap.size() % 9);
295 }
296
297 return colorMap[tid];
298 };
299
300 auto avgTimeWorst = Scheduler::TaskTime::min();
301 for (auto task : mTasks) {
302 avgTimes[task] = mScheduler->getAveragedMeasurement(task);
303
304 if (avgTimes[task] > avgTimeWorst)
305 avgTimeWorst = avgTimes[task];
306 }
307
308 // TODO: For level-based Scheduler's we might want to
309 // maintain the level structure by setting the respective
310 // Graphviz 'rank' attributes and group each level into sub-graph
311
312 Graph::Graph g("dependencies", Graph::Type::directed);
313 for (auto task : mTasks) {
314 String name = task->toString();
315 String type = CPS::Utils::className(task.get(), "DPsim::");
316
317 auto *n = g.addNode(name);
318
319 std::stringstream label;
320
321 label << "<B>" << Utils::encodeXml(name) << "</B><BR/>";
322 label << "<FONT POINT-SIZE=\"10\" COLOR=\"gray28\">"
323 << Utils::encodeXml(type) << "<BR/>";
324
325 if (isScheduled(task))
326 label << "Avg. time: " << avgTimes[task].count() << "ns<BR/>";
327 else
328 label << "Unscheduled"
329 << "<BR/>";
330
331 label << "</FONT>";
332
333 n->set("color", getColor(task));
334 n->set("label", label.str(), true);
335 n->set("style", "rounded,filled,bold");
336 n->set("shape", "rectangle");
337
338 if (isScheduled(task)) {
339 if (avgTimeWorst > Scheduler::TaskTime(0)) {
340 auto grad = (float)avgTimes[task].count() / avgTimeWorst.count();
341 n->set("fillcolor", CPS::Utils::Rgb::gradient(grad).hex());
342 SPDLOG_LOGGER_INFO(mLog, "{} {}", task->toString(),
344 }
345 } else {
346 n->set("fillcolor", "white");
347 }
348 }
349 for (auto from : mTasks) {
350 for (auto to : mTaskOutEdges[from]) {
351 g.addEdge("", g.node(from->toString()), g.node(to->toString()));
352 }
353 }
354
355 g.set("splines", "ortho");
356 return g;
357}
358#endif
359
363
365
369
373
377
379
383
385
389
393
397
401
405
409
411 SPDLOG_LOGGER_INFO(mLog, "Initialize simulation: {}", **mName);
412 if (!mInitialized)
413 initialize();
414
415 for (auto lg : mLoggers)
416 lg->start();
417
418 SPDLOG_LOGGER_INFO(mLog, "Opening interfaces.");
419
420 for (auto intf : mInterfaces)
421 intf->open();
422
423 sync();
424
425 SPDLOG_LOGGER_INFO(mLog, "Start simulation: {}", **mName);
426 SPDLOG_LOGGER_INFO(mLog, "Time step: {:e}", **mTimeStep);
427 SPDLOG_LOGGER_INFO(mLog, "Final time: {:e}", **mFinalTime);
428
429 // In PF we dont log the initial conditions of the componentes because they are not calculated
430 // In dynamic simulations log initial values of attributes (t=0)
432 if (mLoggers.size() > 0)
433 mLoggers[0]->log(0, 0);
434
435 // In dynamic simulations increase simulation time to calculate first results at t=timestep
436 mTime += **mTimeStep;
437 }
438
439 mSimulationStartTimePoint = std::chrono::steady_clock::now();
440}
441
443
444 mSimulationEndTimePoint = std::chrono::steady_clock::now();
447 SPDLOG_LOGGER_INFO(mLog, "Simulation calculation time: {:.6f}",
449
450 mScheduler->stop();
451
452 for (auto intf : mInterfaces)
453 intf->close();
454
455 for (auto lg : mLoggers)
456 lg->stop();
457
458 SPDLOG_LOGGER_INFO(mLog, "Simulation finished.");
459 mLog->flush();
460}
461
464 step();
465 else
466 stop();
467
468 return mTime;
469}
470
472 start();
473
474 // Device-resident schedulers may own an entire deterministic run interval.
475 // Only allow that fast path when bypassing Simulation::step cannot skip
476 // events, user logging, interfaces, or requested per-step timing samples.
477 const Real stepSize = **mTimeStep;
478 const Real totalStepRatio = **mFinalTime / stepSize;
479 const Real roundedStepRatio = std::round(totalStepRatio);
480 const Bool hasIntegralStepCount =
481 std::isfinite(totalStepRatio) &&
482 std::abs(totalStepRatio - roundedStepRatio) <=
483 8.0 * std::numeric_limits<Real>::epsilon() *
484 std::max<Real>(1.0, std::abs(totalStepRatio));
485 if (!mLogStepTimes && mLoggers.empty() && mInterfaces.empty() &&
486 mEvents.empty() && hasIntegralStepCount && roundedStepRatio >= 0.0 &&
487 roundedStepRatio <= static_cast<Real>(std::numeric_limits<UInt>::max()) &&
488 mScheduler->runSimulation(mTime, mTimeStepCount,
489 static_cast<UInt>(roundedStepRatio))) {
490 mTime += roundedStepRatio * stepSize;
491 mTimeStepCount += static_cast<Int>(roundedStepRatio);
492 stop();
493 return;
494 }
495
496 while (mTime < **mFinalTime + DOUBLE_EPSILON) {
497 step();
498 }
499
500 stop();
501}
502
504 std::chrono::steady_clock::time_point start;
505 if (mLogStepTimes) {
506 start = std::chrono::steady_clock::now();
507 }
508
509 mEvents.handleEvents(mTime);
511
512 mTime += **mTimeStep;
514
515 if (mLogStepTimes) {
516 auto end = std::chrono::steady_clock::now();
517 std::chrono::duration<double> diff = end - start;
518 mStepTimes.push_back(diff.count());
519 }
520 return mTime;
521}
522
524 auto stepTimeLog = Logger::get(logName, Logger::Level::info);
525 if (!mLogStepTimes) {
526 SPDLOG_LOGGER_WARN(mLog, "Collection of step times has been disabled.");
527 return;
528 }
529 Logger::setLogPattern(stepTimeLog, "%v");
530 SPDLOG_LOGGER_INFO(stepTimeLog, "step_time");
531
532 Real stepTimeSum = 0;
533 for (auto meas : mStepTimes) {
534 stepTimeSum += meas;
535 SPDLOG_LOGGER_INFO(stepTimeLog, "{:.9f}", meas);
536 }
537 SPDLOG_LOGGER_INFO(mLog, "Average step time: {:.9f}",
538 stepTimeSum / mStepTimes.size());
539}
540
542 auto stepTimeLog = Logger::get(logName, Logger::Level::info);
543 Logger::setLogPattern(stepTimeLog, "%v");
544 SPDLOG_LOGGER_INFO(stepTimeLog, "overruns");
545
546 int overruns = 0;
547 for (auto meas : mStepTimes) {
548 if (meas > **mTimeStep) {
549 overruns++;
550 SPDLOG_LOGGER_INFO(mLog, "overrun detected {}: {:.9f}", overruns, meas);
551 }
552 }
553 SPDLOG_LOGGER_INFO(mLog, "Detected {} overruns.", overruns);
554}
555
557 for (auto solver : mSolvers) {
558 solver->logLUTimes();
559 }
560}
561
564 if (solverIndex >= mSolvers.size()) {
565 throw std::out_of_range(
566 "Simulation::getStateSpaceExtractor(): solver index out of range.");
567 }
568
569 if (const auto realMnaSolver =
570 std::dynamic_pointer_cast<MnaSolver<Real>>(mSolvers[solverIndex])) {
571 return realMnaSolver->getStateSpaceExtractor();
572 }
573
574 if (const auto complexMnaSolver =
575 std::dynamic_pointer_cast<MnaSolver<Complex>>(
576 mSolvers[solverIndex])) {
577 return complexMnaSolver->getStateSpaceExtractor();
578 }
579
580 throw std::logic_error(
581 "Simulation::getStateSpaceExtractor(): selected solver is not an "
582 "MNA solver.");
583}
584
586 const String &attr) {
587 IdentifiedObject::Ptr idObj = mSystem.component<IdentifiedObject>(comp);
588 if (!idObj) {
589 idObj = mSystem.node<TopologicalNode>(comp);
590 }
591
592 if (idObj) {
593 try {
594 CPS::AttributeBase::Ptr attrPtr = idObj->attribute(attr);
595 return attrPtr;
596 } catch (InvalidAttributeException &e) {
597 SPDLOG_LOGGER_ERROR(
598 mLog, "Attribute with name {} not found on component {}", attr, comp);
600 }
601 } else {
602 SPDLOG_LOGGER_ERROR(mLog, "Component or node with name {} not found", comp);
604 }
605}
606
607void Simulation::logIdObjAttribute(const String &comp, const String &attr) {
608 CPS::AttributeBase::Ptr attrPtr = getIdObjAttribute(comp, attr);
609 String name = comp + "." + attr;
610 logAttribute(name, attrPtr);
611}
612
614 if (mLoggers.size() > 0) {
615 mLoggers[0]->logAttribute(name, attr);
616 } else {
617 throw SystemError("Cannot log attributes when no logger is configured for "
618 "this simulation!");
619 }
620}
AttributePointer< AttributeBase > Ptr
Definition Attribute.h:122
std::shared_ptr< IdentifiedObject > Ptr
spdlog::level::level_enum Level
Definition Logger.h:33
static void setLogPattern(std::shared_ptr< spdlog::logger > logger, std::string pattern)
Definition Logger.cpp:25
static Log get(const std::string &name, Level filelevel=Level::info, Level clilevel=Level::off)
Definition Logger.cpp:139
std::shared_ptr< Task > Ptr
Definition Task.h:27
static std::shared_ptr< MnaSolver< VarType > > factory(String name, CPS::Domain domain=CPS::Domain::DP, CPS::Logger::Level logLevel=CPS::Logger::Level::info, DirectLinearSolverImpl implementation=mSupportedSolverImpls().back(), String pluginName="plugin.so")
sovlerImpl: choose the most advanced solver implementation available by default
Solver class using Modified Nodal Analysis (MNA).
Definition MNASolver.h:40
std::chrono::steady_clock::duration TaskTime
Time measurement for the task execution.
Definition Scheduler.h:34
void logIdObjAttribute(const String &comp, const String &attr)
Bool mStateSpaceExtraction
Enable extraction of the MNA-coupled discrete-time state matrix.
Definition Simulation.h:123
CPS::UInt getPFMaxIterations() const
std::chrono::duration< double > mSimulationCalculationTime
Measured calculation time for simulation.
Definition Simulation.h:94
void logLUTimes()
Write LU decomposition times measurements to log file.
String name() const
Definition Simulation.h:346
void sync() const
Synchronize simulation with remotes by exchanging intial state over interfaces.
CPS::IdentifiedObject::List mTearComponents
Definition Simulation.h:129
CPS::Logger::Level mLogLevel
Simulation log level.
Definition Simulation.h:98
void setPFSolverBaseVoltageLooseTolerance(Real tolerance)
DirectLinearSolverConfiguration mDirectLinearSolverConfiguration
Definition Simulation.h:116
Bool mInitFromNodesAndTerminals
Definition Simulation.h:118
virtual Real step()
Solve system A * x = z for x and current time.
Scheduler::Edges mTaskInEdges
Task dependencies as incoming / outgoing edges.
Definition Simulation.h:151
const CPS::Attribute< Real >::Ptr mTimeStep
Simulation timestep.
Definition Simulation.h:42
const CPS::Attribute< CPS::UInt >::Ptr mPFMaxIterations
Maximum number of Newton-Raphson iterations for the PF solver.
Definition Simulation.h:51
void setPFKeepLastSolution(Bool value)
const CPS::Attribute< Bool >::Ptr mSteadyStateInit
Definition Simulation.h:77
const CPS::Attribute< Real >::Ptr mPFBaseVoltageStrictTolerance
Strict tolerance between authoritative base-voltage sources in a zone; default 0.01.
Definition Simulation.h:66
Real next()
Run until next time step.
void logStepTimes(String logName)
Write step time measurements to log file.
Solver::List mSolvers
Definition Simulation.h:112
Bool getPFSolverEnforceReactiveLimits() const
String mSolverPluginName
If there we use a solver plugin, this specifies its name (excluding .so)
Definition Simulation.h:38
void initialize()
Create solver instances etc.
const CPS::Attribute< Bool >::Ptr mPFKeepLastSolution
Definition Simulation.h:44
void setPFMaxIterations(CPS::UInt value)
void setPFBaseApparentPowerFallback(Real value)
Bool getPFSolverUseSparse() const
std::vector< Real > mStepTimes
(Real) time needed for the timesteps
Definition Simulation.h:100
const CPS::Attribute< Real >::Ptr mFinalTime
Final time of the simulation.
Definition Simulation.h:40
void prepSchedule()
Prepare schedule for simulation.
Int mTimeStepCount
Number of step which have been executed for this simulation.
Definition Simulation.h:83
const CPS::Attribute< Real >::Ptr mPFBaseApparentPowerFallback
Definition Simulation.h:48
Real mSteadStIniTimeLimit
steady state initialization time limit
Definition Simulation.h:141
Solver::SystemMatrixRecomputationMode mSystemMatrixRecomputationMode
Requested system-matrix recomputation mode.
Definition Simulation.h:120
Solver::Behaviour mSolverBehaviour
Definition Simulation.h:110
Real getPFBaseApparentPowerFallback() const
Solver::Type mSolverType
Definition Simulation.h:108
DirectLinearSolverImpl mDirectImpl
Definition Simulation.h:114
CPS::Task::List mTasks
List of all tasks to be scheduled.
Definition Simulation.h:149
const CPS::Attribute< Bool >::Ptr mSplitSubnets
Definition Simulation.h:72
std::shared_ptr< Scheduler > mScheduler
Scheduler used for task scheduling.
Definition Simulation.h:147
Bool getPFKeepLastSolution() const
std::vector< Interface::Ptr > mInterfaces
Vector of Interfaces.
Definition Simulation.h:154
void setPFSolverUseSparse(Bool value)
Bool mLogStepTimes
activate collection of step times
Definition Simulation.h:102
void create()
Helper function for constructors.
void setPFSolverEnforceReactiveLimits(Bool value)
CPS::SystemTopology mSystem
System list.
Definition Simulation.h:87
void checkForOverruns(String logName)
Check for overruns.
Real getPFSolverBaseVoltageLooseTolerance() const
Simulation(String name, CommandLineArgs &args)
Creates simulation with name and CommandLineArgs.
const CPS::Attribute< Bool >::Ptr mPFEnforceReactiveLimits
Definition Simulation.h:60
CPS::AttributeBase::Ptr getIdObjAttribute(const String &comp, const String &attr)
CHECK: Can these be deleted? getIdObjAttribute + "**attr =" should suffice.
Real timeStep() const
Definition Simulation.h:350
void start()
Start simulation without advancing in time.
EventQueue mEvents
The simulation event queue.
Definition Simulation.h:85
CPS::Domain mDomain
Definition Simulation.h:106
void schedule()
Create the schedule for the independent tasks.
const CPS::Attribute< Bool >::Ptr mPFSolverUseSparse
Definition Simulation.h:56
std::chrono::time_point< std::chrono::steady_clock > mSimulationStartTimePoint
Start time point to measure calculation time.
Definition Simulation.h:90
Scheduler::Edges mTaskOutEdges
Definition Simulation.h:151
Real mTime
Time variable that is incremented at every step.
Definition Simulation.h:81
Real mSteadStIniAccLimit
steady state initialization accuracy limit
Definition Simulation.h:143
const CPS::Attribute< Real >::Ptr mPFBaseVoltageLooseTolerance
Loose tolerance for a zone's Load base-voltage vs. its rating; default 0.1.
Definition Simulation.h:63
void createMNASolver()
Subroutine for MNA only because there are many MNA options.
void run()
Run simulation until total time is elapsed.
void setPFSolverBaseVoltageStrictTolerance(Real tolerance)
void logAttribute(String name, CPS::AttributeBase::Ptr attr)
CHECK: Can we store the attribute name / UID intrinsically inside the attribute?
DataLoggerInterface::List mLoggers
The data loggers.
Definition Simulation.h:164
const MNAStateSpaceExtractor & getStateSpaceExtractor(UInt solverIndex=0) const
Bool mZeroSkipping
Skip exact zero matrix contributions. Enabled by default for all solvers.
Definition Simulation.h:125
void createSolvers()
Create solvers depending on simulation settings.
const CPS::Attribute< String >::Ptr mName
Simulation name.
Definition Simulation.h:36
Real getPFSolverBaseVoltageStrictTolerance() const
CPS::Logger::Log mLog
Simulation logger.
Definition Simulation.h:180
void stop()
Stop simulation including scheduler and interfaces.
std::chrono::time_point< std::chrono::steady_clock > mSimulationEndTimePoint
End time point to measure calculation time.
Definition Simulation.h:92
std::shared_ptr< Solver > Ptr
Definition Solver.h:37
static std::shared_ptr< AttributeList > make(Args &&...args)
Definition PtrFactory.h:19
#define DOUBLE_EPSILON
Definition Definitions.h:14
String className(T *ptr, const String &prefix="CPS::")
Definition Utils.h:21
unsigned int UInt
Definition Definitions.h:58
String encodeXml(String &data)
Definition Utils.cpp:333
CPS::Real Real
Definition Definitions.h:18
CPS::String String
Definition Definitions.h:20
CPS::Int Int
Definition Definitions.h:22
CPS::Bool Bool
Definition Definitions.h:21
CPS::UInt UInt
Definition Definitions.h:23
String hex()
Definition Utils.h:62
static Rgb gradient(double x)
Definition Utils.h:48