146 Int freqIdx)
override;
163 Real mZeroCrossingTolerance = 1e-6;
167 Real mExponentialSwitchingTime = 0.01;
171 Real mTimeStep = 0.0;
173 std::array<Bool, 3> mPoleClosedPrev{{
false,
false,
false}};
174 std::array<Real, 3> mEffectiveResistancePrev{{0.0, 0.0, 0.0}};
176 Matrix mPreviousCurrent = Matrix::Zero(3, 1);
177 Real mPreviousCurrentTime = 0.0;
178 Bool mPreviousCurrentValid =
false;
180 Bool mResetZeroCrossingHistory =
false;
182 Bool mExponentialTransitionStarted =
false;
185 void setPoleClosed(
UInt phase,
Bool closed);
186 void setAllPoles(
Bool closed);
188 Bool allPolesClosed()
const;
189 Bool allPolesOpen()
const;
191 void resetZeroCrossingTimes();
193 Real effectiveResistance(
UInt phase)
const;
194 void setEffectiveResistance(
UInt phase,
Real resistance);
195 void synchronizeEffectiveResistance(
Bool closed);
197 void resetExponentialTransition();
198 void validateExponentialResistanceParameters()
const;
199 Real exponentialResistance(
UInt phase,
Real alpha)
const;
200 void updateExponentialTransition(
Real time);
204 Bool currentCrossedZero(
Real previousCurrent,
Real current)
const;
206 Real interpolateZeroCrossingTime(
Real previousCurrent,
Real current,
207 Real previousTime,
Real currentTime)
const;
209 void setZeroCrossingTime(
UInt phase,
Real time);
210 void updateZeroCrossingState(
Real time);
AttributePointer< Attribute< T > > Ptr
Common base for three-phase switches.
void mnaCompUpdateCurrent(const Matrix &leftVector) override
const Attribute< Bool >::Ptr mPoleClosedB
void setSwitchingMode(SwitchingMode mode)
Select switching model. Configure before simulation initialization.
const Attribute< Real >::Ptr mExponentialTransitionStartTime
const Attribute< Real >::Ptr mExponentialProgress
Bool hasParameterChanged() override
Returns true if one of the element paramters has changed.
const Attribute< Real >::Ptr mEffectiveResistanceC
SimPowerComp< Real >::Ptr clone(String name) override
Returns a modified copy of the component with the given suffix added to the name and without.
const Attribute< Bool >::Ptr mOpeningRequested
const Attribute< Bool >::Ptr mPoleClosedC
const Attribute< Real >::Ptr mExponentialTransitionEndTime
void mnaCompApplySwitchSystemMatrixStamp(Bool closed, SparseMatrixRow &systemMatrix, Int freqIdx) override
const Attribute< Real >::Ptr mEffectiveResistanceB
void closeSwitch() override
void mnaCompPostStep(Real time, Int timeStepCount, Attribute< Matrix >::Ptr &leftVector) override
Real exponentialSwitchingTime() const
const Attribute< Real >::Ptr mZeroCrossingTimeB
Switch(String uid, String name, Logger::Level logLevel=Logger::Level::off)
void setExponentialSwitchingTime(Real switchingTime)
Set total transition time for ExponentialZCSEmulation [s].
@ ExponentialZCSEmulation
Real zeroCrossingTolerance() const
void mnaCompUpdateVoltage(const Matrix &leftVector) override
void mnaCompInitialize(Real omega, Real timeStep, Attribute< Matrix >::Ptr leftVector) override
void initializeFromNodesAndTerminals(Real frequency) override
Initializes Component variables according to power flow data stored in Nodes.
Bool supportsPrecomputedSystemMatrices() const override
Only Ideal is representable by the conventional two precomputed matrices.
void openSwitch() override
SwitchingMode switchingMode() const
const Attribute< Bool >::Ptr mExponentialTransitionClosing
True while the active exponential transition is a closing transition.
void mnaCompApplySystemMatrixStamp(SparseMatrixRow &systemMatrix) override
void setZeroCrossingTolerance(Real tolerance)
Absolute current tolerance used by CurrentZero mode [A].
const Attribute< Real >::Ptr mEffectiveResistanceA
Effective phase resistances currently stamped into the MNA matrix [ohm].
const Attribute< Bool >::Ptr mExponentialTransitionActive
Exponential-transition diagnostics.
Switch(String name, Logger::Level logLevel=Logger::Level::off)
void mnaCompAddPostStepDependencies(AttributeBase::List &prevStepDependencies, AttributeBase::List &attributeDependencies, AttributeBase::List &modifiedAttributes, Attribute< Matrix >::Ptr &leftVector) override
void mnaCompApplyRightSideVectorStamp(Matrix &rightVector) override
const Attribute< Bool >::Ptr mPoleClosedA
Physical pole states.
const Attribute< Real >::Ptr mZeroCrossingTimeC
Bool mnaIsClosed() override
Check if switch is closed.
const Attribute< Real >::Ptr mZeroCrossingTimeA
Estimated physical zero-crossing times [s], -1 if none has been detected.
String uid()
Returns unique id.
spdlog::level::level_enum Level
MNASimPowerComp(String uid, String name, Bool hasPreStep, Bool hasPostStep, Logger::Level logLevel)
MNA interface to be used by switching devices.
MNA interface to be used by elements that require recomputing of the system matrix.
std::shared_ptr< SimPowerComp< VarType > > Ptr
Eigen::Matrix< Real, Eigen::Dynamic, Eigen::Dynamic, Eigen::ColMajor > Matrix
Dense matrix for real numbers.
Eigen::Matrix< Real, rows, cols, Eigen::ColMajor > MatrixFixedSize
Dense matrix for real numbers with fixed dimension.
Eigen::SparseMatrix< Real, Eigen::RowMajor > SparseMatrixRow
Sparse matrix for real numbers (row major).