37 SPDLOG_LOGGER_INFO(
mSLog,
"General Parameters:");
38 SPDLOG_LOGGER_INFO(
mSLog,
"Active Power={} [W] Reactive Power={} [VAr]",
63 SPDLOG_LOGGER_INFO(
mSLog,
"Control Parameters:");
64 SPDLOG_LOGGER_INFO(
mSLog,
"Power Loop: K_i = {}, K_p = {}", Kp_powerCtrl,
66 SPDLOG_LOGGER_INFO(
mSLog,
"Current Loop: K_i = {}, K_p = {}", Kp_currCtrl,
68 SPDLOG_LOGGER_INFO(
mSLog,
"Cut-Off Frequency = {}", Omega_cutoff);
71 mA << -
mOmegaCutoff, 0, 0, 0, 0, 0, 0, -
mOmegaCutoff, 0, 0, 0, 0, -1, 0, 0, 0,
72 0, 0, 0, 1, 0, 0, 0, 0, -
mKpPowerCtrld, 0,
mKiPowerCtrld, 0, 0, 0, 0,
75 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,
76 mKpPowerCtrld, 0, 0, 0, -1, 0, 0, -
mKpPowerCtrlq, 0, 0, 0, -1;
85 SPDLOG_LOGGER_INFO(
mSLog,
"State space matrices:");
86 SPDLOG_LOGGER_INFO(
mSLog,
"A = \n{}",
mA);
87 SPDLOG_LOGGER_INFO(
mSLog,
"B = \n{}",
mB);
88 SPDLOG_LOGGER_INFO(
mSLog,
"C = \n{}",
mC);
89 SPDLOG_LOGGER_INFO(
mSLog,
"D = \n{}",
mD);
104 SPDLOG_LOGGER_INFO(
mSLog,
"Initial State Value Parameters:");
105 SPDLOG_LOGGER_INFO(
mSLog,
"PInit = {}, QInit = {}", pInit, qInit);
106 SPDLOG_LOGGER_INFO(
mSLog,
"Phi_dInit = {}, Phi_qInit = {}", phi_dInit,
108 SPDLOG_LOGGER_INFO(
mSLog,
"Gamma_dInit = {}, Gamma_qInit = {}", gamma_dInit,
122 SPDLOG_LOGGER_INFO(
mSLog,
"Initialization of input: \n" +
128 SPDLOG_LOGGER_INFO(
mSLog,
"Initialization of states: \n" +
133 SPDLOG_LOGGER_INFO(
mSLog,
"Initialization of output: \n" +
157 attributeDependencies.push_back(
mVc_d);
158 attributeDependencies.push_back(
mVc_q);
159 attributeDependencies.push_back(
mIrc_d);
160 attributeDependencies.push_back(
mIrc_q);
173 "Time {}\n: inputCurr = \n{}\n , inputPrev = \n{}\n , statePrev = \n{}",
183 SPDLOG_LOGGER_DEBUG(
mSLog,
"Output values: outputCurr = \n{}", **
mOutputCurr);
195 {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)
static Matrix StateSpaceTrapezoidal(Matrix states, Matrix A, Matrix B, Real dt, Matrix u_new, Matrix u_old)
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 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 signalPreStep(Real time, Int timeStepCount)
pre step operations
const Attribute< Matrix >::Ptr mOutputCurr
Current Output.
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.