39 SPDLOG_LOGGER_INFO(
mSLog,
"General Parameters:");
40 SPDLOG_LOGGER_INFO(
mSLog,
"Active Power={} [W] Reactive Power={} [VAr]",
65 SPDLOG_LOGGER_INFO(
mSLog,
"Control Parameters:");
66 SPDLOG_LOGGER_INFO(
mSLog,
"Power Loop: K_i = {}, K_p = {}", Kp_powerCtrl,
68 SPDLOG_LOGGER_INFO(
mSLog,
"Current Loop: K_i = {}, K_p = {}", Kp_currCtrl,
70 SPDLOG_LOGGER_INFO(
mSLog,
"Cut-Off Frequency = {}", Omega_cutoff);
73 mA << -
mOmegaCutoff, 0, 0, 0, 0, 0, 0, -
mOmegaCutoff, 0, 0, 0, 0, -1, 0, 0, 0,
74 0, 0, 0, 1, 0, 0, 0, 0, -
mKpPowerCtrld, 0,
mKiPowerCtrld, 0, 0, 0, 0,
77 mB << 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, -1, 0, 0, 0, 0,
78 mKpPowerCtrld, 0, 0, 0, -1, 0, 0, -
mKpPowerCtrlq, 0, 0, 0, -1;
87 SPDLOG_LOGGER_INFO(
mSLog,
"State space matrices:");
88 SPDLOG_LOGGER_INFO(
mSLog,
"A = \n{}",
mA);
89 SPDLOG_LOGGER_INFO(
mSLog,
"B = \n{}",
mB);
90 SPDLOG_LOGGER_INFO(
mSLog,
"C = \n{}",
mC);
91 SPDLOG_LOGGER_INFO(
mSLog,
"D = \n{}",
mD);
107 SPDLOG_LOGGER_INFO(
mSLog,
"Initial State Value Parameters:");
108 SPDLOG_LOGGER_INFO(
mSLog,
"PInit = {}, QInit = {}", pInit, qInit);
109 SPDLOG_LOGGER_INFO(
mSLog,
"Phi_dInit = {}, Phi_qInit = {}", phi_dInit,
111 SPDLOG_LOGGER_INFO(
mSLog,
"Gamma_dInit = {}, Gamma_qInit = {}", gamma_dInit,
148 const Matrix identity = Matrix::Identity(
mA.rows(),
mA.cols());
157 SPDLOG_LOGGER_INFO(
mSLog,
"Initialization of input: \n" +
163 SPDLOG_LOGGER_INFO(
mSLog,
"Initialization of states: \n" +
168 SPDLOG_LOGGER_INFO(
mSLog,
"Initialization of output: \n" +
192 attributeDependencies.push_back(
mVc_d);
193 attributeDependencies.push_back(
mVc_q);
194 attributeDependencies.push_back(
mIrc_d);
195 attributeDependencies.push_back(
mIrc_q);
208 "Time {}\n: inputCurr = \n{}\n , inputPrev = \n{}\n , statePrev = \n{}",
214 (**mStateCurr).noalias() =
220 SPDLOG_LOGGER_DEBUG(
mSLog,
"Output values: outputCurr = \n{}", **
mOutputCurr);
232 {std::make_shared<PreStep>(*
this), std::make_shared<Step>(*
this)});
AttributePointer< Attribute< T > > Ptr
String type()
Get component type (cross-platform)
AttributeList::Ptr mAttributes
Attribute List.
spdlog::level::level_enum Level
static String matrixToString(const Matrix &mat)
Real mTimeStep
Simulation time step.
void setControllerParameters(Real Kp_powerCtrl, Real Ki_powerCtrl, Real Kp_currCtrl, Real Ki_currCtrl, Real Omega_cutoff)
Setter for parameters of control loops.
const Attribute< Matrix >::Ptr mInputPrev
Previous Input.
Matrix mDiscreteA
Cached trapezoidal factors; A and time step are constant during a run.
Matrix mD
matrix D of state space model
Matrix mC
matrix C of state space model
void setParameters(Real Pref, Real Qref)
Setter for general parameters.
void signalAddStepDependencies(AttributeBase::List &prevStepDependencies, AttributeBase::List &attributeDependencies, AttributeBase::List &modifiedAttributes)
add step dependencies
const Attribute< Real >::Ptr mVc_q
Real mPInit
initial values for states
void setInitialStateValues(Real pInit, Real qInit, Real phi_dInit, Real phi_qInit, Real gamma_dInit, Real gamma_qInit)
Setter for initial state values.
const Attribute< Real >::Ptr mIrc_q
void updateBMatrixStateSpaceModel()
Update B matrix due to its dependence on the input.
const Attribute< Matrix >::Ptr mStateCurr
Current State.
void signalStep(Real time, Int timeStepCount)
step operations
PowerControllerVSI(String name, Logger::Level logLevel=Logger::Level::off)
void initializeStateSpaceModel(Real omega, Real timeStep, Attribute< Matrix >::Ptr leftVector)
Initialize vectors of state space model.
const Attribute< Real >::Ptr mVc_d
These are never explicitely set to reference anything, so the outside code is responsible for setting...
void initializeSteadyState(Real pRef, Real qRef, Real iD, Real iQ, Real vSourceD, Real vSourceQ)
void signalPreStep(Real time, Int timeStepCount)
pre step operations
const Attribute< Matrix >::Ptr mOutputCurr
Current Output.
Bool mInitialStatesExplicit
void signalAddPreStepDependencies(AttributeBase::List &prevStepDependencies, AttributeBase::List &attributeDependencies, AttributeBase::List &modifiedAttributes)
pre step dependencies
const Attribute< Matrix >::Ptr mInputCurr
Current Input.
const Attribute< Matrix >::Ptr mStatePrev
Previous State.
Matrix mA
matrix A of state space model
const Attribute< Matrix >::Ptr mOutputPrev
Previous Output.
const Attribute< Real >::Ptr mIrc_d
Matrix mB
matrix B of state space model
SimSignalComp(String uid, String name, Logger::Level logLevel=Logger::Level::off)
Logger::Log mSLog
Component logger.
Eigen::Matrix< Real, Eigen::Dynamic, Eigen::Dynamic, Eigen::ColMajor > Matrix
Dense matrix for real numbers.