53 std::make_shared<DP::Ph1::Switch>(**
mName +
"_Lswitch",
mLogLevel);
68 std::make_shared<DP::Ph1::Switch>(**
mName +
"_Cswitch",
mLogLevel);
78 Real omega = 2. *
PI * frequency;
80 Real LInit = 1e6 / omega;
81 Real CInit = 1e-6 / omega;
88 Complex impedance = LImpedance * CImpedance / (LImpedance + CImpedance);
91 (**mIntfCurrent)(0, 0) = (**
mIntfVoltage)(0, 0) / impedance;
98 SPDLOG_LOGGER_INFO(
mSLog,
"Using Mechanical Model");
101 SPDLOG_LOGGER_INFO(
mSLog,
102 "\n --- Parameters ---"
103 "\n Controller: T = {} K = {}"
104 "\n Reference Voltage {} [kV]"
105 "\n Qmax = {} [var] -> BN = {} [S]"
106 "\n Bmax = {} Bmin = {} [p.u.]"
112 (**mIntfVoltage)(0, 0) - LImpedance * (**
mIntfCurrent)(0, 0);
115 (**mIntfVoltage)(0, 0) - CImpedance * (**
mIntfCurrent)(0, 0);
126 SPDLOG_LOGGER_INFO(
mSLog,
127 "\n--- Initialization from powerflow ---"
129 "\nVoltage across: {:s}"
131 "\nTerminal 0 voltage: {:s}"
132 "\n--- Initialization from powerflow finished ---",
198 Complex(a / (1. + b * b), -a * b / (1. + b * b));
200 Complex((1. - b * b) / (1. + b * b), -2. * b / (1. + b * b));
221 const Real gInductor =
223 const Real gCapacitor =
287 attributeDependencies.push_back(leftVector);
306 (**mIntfVoltage)(0, 0) =
324 (**mIntfCurrent)(0, 0) =
328 (**mIntfCurrent)(0, 0) = 0;
329 (**mIntfCurrent)(0, 0) +=
mSubInductor->intfCurrent()(0, 0);
330 (**mIntfCurrent)(0, 0) +=
mSubCapacitor->intfCurrent()(0, 0);
364 SPDLOG_LOGGER_INFO(
mSLog,
"Disconnect SVC because of overvoltage at {}",
393 Real B = (1 / (1 + Fac1)) *
409 Real inductance = 1 / (omega *
B *
mBN);
424 Real capacitance =
B *
mBN / (-omega);
473 SPDLOG_LOGGER_INFO(
mSLog,
475 "\nDecreasing Tap. Reason: Undervoltage"
476 "\nNew Tap Position: {}",
483 SPDLOG_LOGGER_INFO(
mSLog,
485 "\nIncreasing Tap. Reason: Overvoltag"
486 "\nNew Tap Position: {}",
496 SPDLOG_LOGGER_INFO(
mSLog,
"New inductance: {}", inductance);
507 SPDLOG_LOGGER_INFO(
mSLog,
"New capacitance: {}", capacitance);
517 SPDLOG_LOGGER_INFO(
mSLog,
519 "Tap Position: 0. Open both elements",
559 SPDLOG_LOGGER_INFO(
mSLog,
"Inductive Mode: Closed Inductor Switch");
564 SPDLOG_LOGGER_INFO(
mSLog,
"Inductive Mode: Opened Capacitor Switch");
569 SPDLOG_LOGGER_INFO(
mSLog,
"Capacitive Mode: Openend Inductor Switch");
573 SPDLOG_LOGGER_INFO(
mSLog,
"Capacitive Mode: Closed Capcitor Switch");
AttributePointer< Attribute< T > > Ptr
Attribute< Real >::Ptr mDeltaV
Attribute< Real >::Ptr mBPrev
Real mBMax
Maximium susceptance [p.u.].
Attribute< Real >::Ptr mViolationCounter
Real mNomVolt
Nominal Voltage.
Real mBMin
Minimium susceptance [p.u.].
Real mRefVolt
Reference Voltage.
void addMNASubComponent(typename SimPowerComp< Complex >::Ptr subc, MNA_SUBCOMP_TASK_ORDER preStepOrder, MNA_SUBCOMP_TASK_ORDER postStepOrder, Bool contributeToRightVector)
void mnaCompApplyRightSideVectorStamp(Matrix &rightVector) override
CompositePowerComp(String uid, String name, Bool hasPreStep, Bool hasPostStep, Logger::Level logLevel)
void initializeParentFromNodesAndTerminals(Real frequency) override
Initializes states from power flow data (parent-specific part).
void mnaParentPostStep(Real time, Int timeStepCount, Attribute< Matrix >::Ptr &leftVector) override
MNA post step operations (parent-specific)
void mnaCompUpdateCurrent(const Matrix &leftVector) override
Update interface current from MNA system results.
Bool mDirectCapacitorClosed
MatrixComp mDirectInductorAdmittance
const Attribute< Real >::Ptr mVpcc
void createSubComponents() override
Constructs subcomponents; idempotent.
std::shared_ptr< DP::Ph1::Capacitor > mSubCapacitor
Internal capacitor.
std::shared_ptr< DP::Ph1::Switch > mSubCapacitorSwitch
void mnaCompUpdateVoltage(const Matrix &leftVector) override
Update interface voltage from MNA system results.
MatrixComp mDirectCapacitorCurrent
MatrixComp mDirectCapacitorAdmittance
const Attribute< Real >::Ptr mVmeasPrev
Bool mDirectInductorClosed
void updateDirectCompanions()
void mechanicalModelUpdateSusceptance(Real time)
void mnaParentInitialize(Real omega, Real timeStep, Attribute< Matrix >::Ptr leftVector) override
void mnaParentApplySystemMatrixStamp(SparseMatrixRow &systemMatrix) override
MatrixComp mDirectInductorPrevCurrentFactor
void mnaParentApplyRightSideVectorStamp(Matrix &rightVector) override
void checkProtection(Real time)
std::shared_ptr< DP::Ph1::Inductor > mSubInductor
Internal inductor.
MatrixComp mDirectInductorCurrent
void mnaParentAddPostStepDependencies(AttributeBase::List &prevStepDependencies, AttributeBase::List &attributeDependencies, AttributeBase::List &modifiedAttributes, Attribute< Matrix >::Ptr &leftVector) override
add MNA post step dependencies (parent-specific)
MatrixComp mDirectCapacitorPrevVoltageFactor
MatrixComp mDirectInductorHistory
MatrixComp mDirectCapacitorVoltage
void mnaParentPreStep(Real time, Int timeStepCount) override
MNA pre step operations (parent-specific)
MatrixComp mDirectInductorVoltage
std::shared_ptr< DP::Ph1::Switch > mSubInductorSwitch
SVC(String uid, String name, Logger::Level logLevel=Logger::Level::off)
Defines UID, name and log level.
MatrixComp mDirectCapacitorHistory
void mnaParentAddPreStepDependencies(AttributeBase::List &prevStepDependencies, AttributeBase::List &attributeDependencies, AttributeBase::List &modifiedAttributes) override
add MNA pre step dependencies (parent-specific)
const Attribute< String >::Ptr mName
Human readable name.
String uid()
Returns unique id.
AttributeList::Ptr mAttributes
Attribute List.
spdlog::level::level_enum Level
static String phasorToString(const Complex &num)
Attribute< Matrix >::Ptr mRightVector
static void stampAdmittance(Complex admittance, SparseMatrixRow &mat, UInt node1Index, UInt node2Index, Bool isTerminal1NotGrounded, Bool isTerminal2NotGrounded, const Logger::Log &mSLog, Int maxFreq=1, Int freqIdx=0)
static Complex complexFromVectorElement(const Matrix &mat, Matrix::Index row, Int maxFreq=1, Int freqIdx=0)
static void setVectorElement(Matrix &mat, Matrix::Index row, Complex value, Int maxFreq=1, Int freqIdx=0, Matrix::Index colOffset=0)
static Real abs(Complex value)
UInt matrixNodeIndex(UInt nodeIndex)
const Attribute< MatrixVar< Complex > >::Ptr mIntfCurrent
SimTerminal< Complex >::List mTerminals
void setVirtualNodeNumber(UInt num)
const Attribute< MatrixVar< Complex > >::Ptr mIntfVoltage
SimNode< Complex >::Ptr virtualNode(UInt index)
SimNode< Complex >::List mVirtualNodes
Bool terminalNotGrounded(UInt index)
Complex initialSingleVoltage(UInt index)
void setTerminalNumber(UInt num)
Logger::Level mLogLevel
Component logger control for internal variables.
Logger::Log mSLog
Component logger.
Eigen::Matrix< Real, Eigen::Dynamic, Eigen::Dynamic, Eigen::ColMajor > Matrix
Dense matrix for real numbers.
std::complex< Real > Complex
Eigen::SparseMatrix< Real, Eigen::RowMajor > SparseMatrixRow
Sparse matrix for real numbers (row major).