9 #include <dpsim-models/Signal/Integrator.h>
12 using namespace CPS::Signal;
14 Integrator::Integrator(String name, Logger::Level logLevel)
16 mInputRef(mAttributes->createDynamic<Real>(
"input_ref")),
18 mInputPrev(mAttributes->create<Real>(
"input_prev")),
19 mStatePrev(mAttributes->create<Real>(
"state_prev")),
20 mOutputPrev(mAttributes->create<Real>(
"output_prev")),
21 mInputCurr(mAttributes->create<Real>(
"input_curr")),
22 mStateCurr(mAttributes->create<Real>(
"state_curr")),
23 mOutputCurr(mAttributes->create<Real>(
"output_curr")) {}
25 void Integrator::setParameters(Real timestep) {
37 SPDLOG_LOGGER_INFO(
mSLog,
"Initial values:");
39 mSLog,
"inputCurrInit = {}, stateCurrInit = {}, outputCurrInit = {}",
44 AttributeBase::List &prevStepDependencies,
45 AttributeBase::List &attributeDependencies,
46 AttributeBase::List &modifiedAttributes) {
60 AttributeBase::List &prevStepDependencies,
61 AttributeBase::List &attributeDependencies,
62 AttributeBase::List &modifiedAttributes) {
63 attributeDependencies.push_back(
mInputRef);
71 SPDLOG_LOGGER_INFO(
mSLog,
"Time {}:", time);
73 mSLog,
"Input values: inputCurr = {}, inputPrev = {}, statePrev = {}",
80 SPDLOG_LOGGER_INFO(
mSLog,
"State values: stateCurr = {}", **
mStateCurr);
84 Task::List Integrator::getTasks() {
86 {std::make_shared<PreStep>(*
this), std::make_shared<Step>(*
this)});
const Attribute< Real >::Ptr mInputRef
This is never explicitely set to reference anything, so the outside code is responsible for setting u...
const Attribute< Real >::Ptr mOutputCurr
Current Output.
const Attribute< Real >::Ptr mOutputPrev
Previous Output.
Real mTimeStep
Integration time step.
const Attribute< Real >::Ptr mStateCurr
Current State.
void signalAddStepDependencies(AttributeBase::List &prevStepDependencies, AttributeBase::List &attributeDependencies, AttributeBase::List &modifiedAttributes)
add step dependencies
void signalPreStep(Real time, Int timeStepCount)
pre step operations
const Attribute< Real >::Ptr mInputPrev
Previous Input.
void setInitialValues(Real input_init, Real state_init, Real output_init)
Setter for initial values.
void signalAddPreStepDependencies(AttributeBase::List &prevStepDependencies, AttributeBase::List &attributeDependencies, AttributeBase::List &modifiedAttributes)
pre step dependencies
const Attribute< Real >::Ptr mStatePrev
Previous State.
void signalStep(Real time, Int timeStepCount)
step operations
const Attribute< Real >::Ptr mInputCurr
Current Input.
Logger::Log mSLog
Component logger.