13#include <dpsim/Config.h>
33 typedef std::shared_ptr<Simulation>
Ptr;
329 eint->setLogger(
mLog);
AttributePointer< AttributeBase > Ptr
AttributePointer< Attribute< T > > Ptr
Base class of objects having attributes to access member variables.
spdlog::level::level_enum Level
std::shared_ptr< spdlog::logger > Log
std::shared_ptr< DataLogger > Ptr
std::vector< DataLoggerInterface::Ptr > List
std::shared_ptr< DataLoggerInterface > Ptr
std::shared_ptr< Event > Ptr
std::shared_ptr< Interface > Ptr
std::unordered_map< CPS::Task::Ptr, std::deque< CPS::Task::Ptr > > Edges
void setDirectLinearSolverImplementation(DirectLinearSolverImpl directImpl)
void doFrequencyParallelization(Bool value)
Compute phasors of different frequencies in parallel.
void logIdObjAttribute(const String &comp, const String &attr)
Bool mStateSpaceExtraction
Enable extraction of the MNA-coupled discrete-time state matrix.
void setSteadStIniAccLimit(Real v)
set steady state initialization accuracy limit
CPS::UInt getPFMaxIterations() const
std::chrono::duration< double > mSimulationCalculationTime
Measured calculation time for simulation.
void logLUTimes()
Write LU decomposition times measurements to log file.
void setSolverType(Solver::Type solverType=Solver::Type::MNA)
void setSystem(const CPS::SystemTopology &system)
void sync() const
Synchronize simulation with remotes by exchanging intial state over interfaces.
void setFinalTime(Real finalTime)
CPS::IdentifiedObject::List mTearComponents
CPS::Logger::Level mLogLevel
Simulation log level.
void setPFSolverBaseVoltageLooseTolerance(Real tolerance)
std::shared_ptr< Scheduler > scheduler()
DirectLinearSolverConfiguration mDirectLinearSolverConfiguration
Bool mInitFromNodesAndTerminals
void setSystemMatrixRecomputationMode(Solver::SystemMatrixRecomputationMode mode)
Set the system-matrix recomputation mode.
Int timeStepCount() const
virtual Real step()
Solve system A * x = z for x and current time.
Scheduler::Edges mTaskInEdges
Task dependencies as incoming / outgoing edges.
const CPS::Attribute< Real >::Ptr mTimeStep
Simulation timestep.
void setSteadStIniTimeLimit(Real v)
set steady state initialization time limit
const CPS::Attribute< CPS::UInt >::Ptr mPFMaxIterations
Maximum number of Newton-Raphson iterations for the PF solver.
std::vector< Real > & stepTimes()
void setTimeStep(Real timeStep)
void setTearingComponents(CPS::IdentifiedObject::List tearComponents=CPS::IdentifiedObject::List())
void setPFKeepLastSolution(Bool value)
const CPS::Attribute< Bool >::Ptr mSteadyStateInit
const CPS::Attribute< Real >::Ptr mPFBaseVoltageStrictTolerance
Strict tolerance between authoritative base-voltage sources in a zone; default 0.01.
Real next()
Run until next time step.
void logStepTimes(String logName)
Write step time measurements to log file.
void setDirectLinearSolverConfiguration(const DirectLinearSolverConfiguration &configuration)
Bool getPFSolverEnforceReactiveLimits() const
void addLogger(DataLoggerInterface::Ptr logger)
Add a new data logger.
String mSolverPluginName
If there we use a solver plugin, this specifies its name (excluding .so)
void setMaxNumberOfIterations(int maxIterations)
void initialize()
Create solver instances etc.
const CPS::Attribute< Bool >::Ptr mPFKeepLastSolution
void doInitFromNodesAndTerminals(Bool f=true)
void setPFMaxIterations(CPS::UInt value)
void setPFBaseApparentPowerFallback(Real value)
Bool getPFSolverUseSparse() const
void setScheduler(const std::shared_ptr< Scheduler > &scheduler)
Set the scheduling method.
std::vector< Real > mStepTimes
(Real) time needed for the timesteps
void doSplitSubnets(Bool splitSubnets=true)
const CPS::Attribute< Real >::Ptr mFinalTime
Final time of the simulation.
void prepSchedule()
Prepare schedule for simulation.
void setSolverAndComponentBehaviour(Solver::Behaviour behaviour)
set solver and component to initialization or simulation behaviour
Int mTimeStepCount
Number of step which have been executed for this simulation.
const CPS::Attribute< Real >::Ptr mPFBaseApparentPowerFallback
Real mSteadStIniTimeLimit
steady state initialization time limit
void setDomain(CPS::Domain domain=CPS::Domain::DP)
Solver::SystemMatrixRecomputationMode mSystemMatrixRecomputationMode
Requested system-matrix recomputation mode.
Solver::Behaviour mSolverBehaviour
Real getPFBaseApparentPowerFallback() const
DirectLinearSolverImpl mDirectImpl
virtual ~Simulation()
Desctructor.
CPS::Task::List mTasks
List of all tasks to be scheduled.
const CPS::Attribute< Bool >::Ptr mSplitSubnets
std::shared_ptr< Scheduler > mScheduler
Scheduler used for task scheduling.
Bool getPFKeepLastSolution() const
void setLogStepTimes(Bool f)
std::vector< Interface::Ptr > mInterfaces
Vector of Interfaces.
void setPFSolverUseSparse(Bool value)
Bool mLogStepTimes
activate collection of step times
void create()
Helper function for constructors.
void setPFSolverEnforceReactiveLimits(Bool value)
CPS::SystemTopology mSystem
System list.
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
CPS::AttributeBase::Ptr getIdObjAttribute(const String &comp, const String &attr)
CHECK: Can these be deleted? getIdObjAttribute + "**attr =" should suffice.
void addInterface(Interface::Ptr eint)
std::shared_ptr< Simulation > Ptr
void start()
Start simulation without advancing in time.
EventQueue mEvents
The simulation event queue.
void doSteadyStateInit(Bool f)
activate steady state initialization
DataLogger::List & loggers()
void addEvent(Event::Ptr e)
Schedule an event in the simulation.
void doStateSpaceExtraction(Bool value=true)
Enable extraction of the MNA-coupled discrete-time state matrix.
void schedule()
Create the schedule for the independent tasks.
const CPS::Attribute< Bool >::Ptr mPFSolverUseSparse
std::chrono::time_point< std::chrono::steady_clock > mSimulationStartTimePoint
Start time point to measure calculation time.
Scheduler::Edges mTaskOutEdges
Real mTime
Time variable that is incremented at every step.
Real mSteadStIniAccLimit
steady state initialization accuracy limit
const CPS::Attribute< Real >::Ptr mPFBaseVoltageLooseTolerance
Loose tolerance for a zone's Load base-voltage vs. its rating; default 0.1.
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.
const MNAStateSpaceExtractor & getStateSpaceExtractor(UInt solverIndex=0) const
void createSolvers()
Create solvers depending on simulation settings.
const CPS::Attribute< String >::Ptr mName
Simulation name.
Real getPFSolverBaseVoltageStrictTolerance() const
CPS::Logger::Log mLog
Simulation logger.
void stop()
Stop simulation including scheduler and interfaces.
std::chrono::time_point< std::chrono::steady_clock > mSimulationEndTimePoint
End time point to measure calculation time.
void doSystemMatrixRecomputation(Bool value)
SystemMatrixRecomputationMode
System-matrix recomputation mode for MNA solvers.
@ Enabled
Always enable system-matrix recomputation.
@ Auto
Select the mode automatically based on the system topology.
@ Disabled
Always disable system-matrix recomputation.
UInt downsampling
Downsampling.
DataLogger::Ptr logger
Simulation data logger.