DPsim
|
Extending Simulation class by real-time functionality. More...
#include <RealTimeSimulation.h>
Public Member Functions | |
RealTimeSimulation (String name, CommandLineArgs &args) | |
RealTimeSimulation (String name, CPS::Logger::Level logLevel=CPS::Logger::Level::info) | |
Standard constructor. | |
void | run (const Timer::StartClock::duration &startIn=std::chrono::seconds(1)) |
void | run (const Timer::StartClock::time_point &startAt) |
void | run (Int startIn) |
Public Member Functions inherited from DPsim::Simulation | |
Simulation (String name, CommandLineArgs &args) | |
Creates simulation with name and CommandLineArgs. | |
Simulation (String name, CPS::Logger::Level logLevel=CPS::Logger::Level::info) | |
Creates simulation with name and log level. | |
virtual | ~Simulation () |
Desctructor. | |
void | setSystem (const CPS::SystemTopology &system) |
void | setTimeStep (Real timeStep) |
void | setFinalTime (Real finalTime) |
void | setDomain (CPS::Domain domain=CPS::Domain::DP) |
void | setSolverType (Solver::Type solverType=Solver::Type::MNA) |
void | setSolverAndComponentBehaviour (Solver::Behaviour behaviour) |
set solver and component to initialization or simulation behaviour | |
void | setDirectLinearSolverImplementation (DirectLinearSolverImpl directImpl) |
void | setDirectLinearSolverConfiguration (const DirectLinearSolverConfiguration &configuration) |
void | setMaxNumberOfIterations (int maxIterations) |
void | doInitFromNodesAndTerminals (Bool f=true) |
void | doSplitSubnets (Bool splitSubnets=true) |
void | setTearingComponents (CPS::IdentifiedObject::List tearComponents=CPS::IdentifiedObject::List()) |
void | setScheduler (const std::shared_ptr< Scheduler > &scheduler) |
Set the scheduling method. | |
void | doFrequencyParallelization (Bool value) |
Compute phasors of different frequencies in parallel. | |
void | doSystemMatrixRecomputation (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 | initialize () |
Create solver instances etc. | |
void | start () |
Start simulation without advancing in time. | |
void | stop () |
Stop simulation including scheduler and interfaces. | |
Real | next () |
Run until next time step. | |
void | run () |
Run simulation until total time is elapsed. | |
virtual Real | step () |
Solve system A * x = z for x and current time. | |
void | sync () const |
Synchronize simulation with remotes by exchanging intial state over interfaces. | |
void | schedule () |
Create the schedule for the independent tasks. | |
void | addEvent (Event::Ptr e) |
Schedule an event in the simulation. | |
void | addLogger (DataLogger::Ptr logger) |
Add a new data logger. | |
void | logStepTimes (String logName) |
Write step time measurements to log file. | |
void | logLUTimes () |
Write LU decomposition times measurements to log file. | |
void | addInterface (Interface::Ptr eint) |
String | name () const |
Real | time () const |
Real | finalTime () const |
Int | timeStepCount () const |
Real | timeStep () const |
DataLogger::List & | loggers () |
std::shared_ptr< Scheduler > | scheduler () |
std::vector< Real > & | stepTimes () |
CPS::AttributeBase::Ptr | getIdObjAttribute (const String &comp, const String &attr) |
CHECK: Can these be deleted? getIdObjAttribute + "**attr =" should suffice. | |
void | logIdObjAttribute (const String &comp, const String &attr) |
void | logAttribute (String name, CPS::AttributeBase::Ptr attr) |
CHECK: Can we store the attribute name / UID intrinsically inside the attribute? | |
Public Member Functions inherited from CPS::AttributeList | |
const AttributeBase::Map & | attributes () const |
template<typename T > | |
Attribute< T >::Ptr | create (const String &name, T intitialValue=T()) |
template<typename T > | |
Attribute< T >::Ptr | createDynamic (const String &name) |
AttributeBase::Ptr | attribute (const String &name) const |
Return pointer to an attribute. | |
template<typename T > | |
Attribute< T >::Ptr | attributeTyped (const String &name) const |
Return pointer to an attribute. | |
Protected Attributes | |
Timer | mTimer |
Protected Attributes inherited from DPsim::Simulation | |
Real | mTime = 0 |
Time variable that is incremented at every step. | |
Int | mTimeStepCount = 0 |
Number of step which have been executed for this simulation. | |
EventQueue | mEvents |
The simulation event queue. | |
CPS::SystemTopology | mSystem |
System list. | |
std::chrono::time_point< std::chrono::steady_clock > | mSimulationStartTimePoint |
Start time point to measure calculation time. | |
std::chrono::time_point< std::chrono::steady_clock > | mSimulationEndTimePoint |
End time point to measure calculation time. | |
std::chrono::duration< double > | mSimulationCalculationTime |
Measured calculation time for simulation. | |
CPS::Logger::Level | mLogLevel |
Simulation log level. | |
std::vector< Real > | mStepTimes |
(Real) time needed for the timesteps | |
CPS::Domain | mDomain = CPS::Domain::DP |
Solver::Type | mSolverType = Solver::Type::MNA |
Solver::Behaviour | mSolverBehaviour = Solver::Behaviour::Simulation |
Solver::List | mSolvers |
DirectLinearSolverImpl | mDirectImpl = DirectLinearSolverImpl::Undef |
DirectLinearSolverConfiguration | mDirectLinearSolverConfiguration |
Bool | mInitFromNodesAndTerminals = true |
Bool | mSystemMatrixRecomputation = false |
Enable recomputation of system matrix during simulation. | |
CPS::IdentifiedObject::List | mTearComponents = CPS::IdentifiedObject::List() |
Bool | mFreqParallel = false |
Bool | mInitialized = false |
Real | mSteadStIniTimeLimit = 10 |
steady state initialization time limit | |
Real | mSteadStIniAccLimit = 0.0001 |
steady state initialization accuracy limit | |
std::shared_ptr< Scheduler > | mScheduler |
Scheduler used for task scheduling. | |
CPS::Task::List | mTasks |
List of all tasks to be scheduled. | |
Scheduler::Edges | mTaskInEdges |
Task dependencies as incoming / outgoing edges. | |
Scheduler::Edges | mTaskOutEdges |
std::vector< Interface::Ptr > | mInterfaces |
Vector of Interfaces. | |
DataLogger::List | mLoggers |
The data loggers. | |
int | mMaxIterations = 10 |
Additional Inherited Members | |
Public Types inherited from DPsim::Simulation | |
typedef std::shared_ptr< Simulation > | Ptr |
Public Types inherited from CPS::AttributeList | |
using | Ptr = std::shared_ptr< AttributeList > |
Static Public Member Functions inherited from SharedFactory< AttributeList > | |
static std::shared_ptr< AttributeList > | make (Args &&...args) |
Public Attributes inherited from DPsim::Simulation | |
const CPS::Attribute< String >::Ptr | mName |
Simulation name. | |
String | mSolverPluginName |
If there we use a solver plugin, this specifies its name (excluding .so) | |
const CPS::Attribute< Real >::Ptr | mFinalTime |
Final time of the simulation. | |
const CPS::Attribute< Real >::Ptr | mTimeStep |
Simulation timestep. | |
const CPS::Attribute< Bool >::Ptr | mSplitSubnets |
const CPS::Attribute< Bool >::Ptr | mSteadyStateInit |
CPS::Logger::Log | mLog |
Simulation logger. | |
Protected Member Functions inherited from DPsim::Simulation | |
void | create () |
Helper function for constructors. | |
template<typename VarType > | |
void | createSolvers () |
Create solvers depending on simulation settings. | |
template<typename VarType > | |
void | createMNASolver () |
Subroutine for MNA only because there are many MNA options. | |
void | prepSchedule () |
Prepare schedule for simulation. | |
Extending Simulation class by real-time functionality.
Definition at line 21 of file RealTimeSimulation.h.
void RealTimeSimulation::run | ( | const Timer::StartClock::duration & | startIn = std::chrono::seconds(1) | ) |
Perform the main simulation loop in real time.
@param startSynch If true, the simulation waits for the first external value before starting the timing.
Definition at line 27 of file RealTimeSimulation.cpp.