129 Int freqIdx)
override;
139 Real mZeroCrossingTolerance = 1e-6;
140 Real mExponentialSwitchingTime = 0.01;
141 Real mTimeStep = 0.0;
144 Real mShiftOmega = 0.0;
146 std::array<Bool, 3> mPoleClosedPrev{{
false,
false,
false}};
147 std::array<Real, 3> mEffectiveResistancePrev{{0.0, 0.0, 0.0}};
149 Matrix mPreviousInstantaneousCurrent = Matrix::Zero(3, 1);
150 Real mPreviousCurrentTime = 0.0;
151 Bool mPreviousCurrentValid =
false;
153 Bool mResetZeroCrossingHistory =
false;
154 Bool mExponentialTransitionStarted =
false;
157 void setPoleClosed(
UInt phase,
Bool closed);
158 void setAllPoles(
Bool closed);
160 Bool allPolesClosed()
const;
161 Bool allPolesOpen()
const;
163 void resetZeroCrossingTimes();
165 Real effectiveResistance(
UInt phase)
const;
166 void setEffectiveResistance(
UInt phase,
Real resistance);
167 void synchronizeEffectiveResistance(
Bool closed);
169 void resetExponentialTransition();
170 void validateExponentialResistanceParameters()
const;
171 Real exponentialResistance(
UInt phase,
Real alpha)
const;
172 void updateExponentialTransition(
Real time);
176 Matrix reconstructInstantaneousCurrent(
Real time)
const;
177 void setInstantaneousCurrentAttributes(
const Matrix ¤t);
179 Bool currentCrossedZero(
Real previousCurrent,
Real current)
const;
181 Real interpolateZeroCrossingTime(
Real previousCurrent,
Real current,
182 Real previousTime,
Real currentTime)
const;
184 void setZeroCrossingTime(
UInt phase,
Real time);
185 void updateZeroCrossingState(
Real time);
AttributePointer< Attribute< T > > Ptr
Common base for three-phase switches.
const Attribute< Bool >::Ptr mPoleClosedA
Bool hasParameterChanged() override
Returns true if one of the element paramters has changed.
void closeSwitch() override
const Attribute< Bool >::Ptr mPoleClosedB
const Attribute< Real >::Ptr mInstantCurrentA
Reconstructed physical instantaneous currents [A].
void mnaCompUpdateCurrent(const Matrix &leftVector) override
void setZeroCrossingTolerance(Real tolerance)
void setExponentialSwitchingTime(Real switchingTime)
const Attribute< Bool >::Ptr mExponentialTransitionActive
Exponential-transition diagnostics.
const Attribute< Real >::Ptr mEffectiveResistanceA
Effective phase resistances currently stamped into the MNA matrix [ohm].
const Attribute< Real >::Ptr mExponentialTransitionStartTime
@ ExponentialZCSEmulation
Real exponentialSwitchingTime() const
const Attribute< Bool >::Ptr mExponentialTransitionClosing
True while the active exponential transition is a closing transition.
void mnaCompUpdateVoltage(const Matrix &leftVector) override
Switch(String uid, String name, Logger::Level loglevel=Logger::Level::off)
const Attribute< Real >::Ptr mZeroCrossingTimeB
Bool mnaIsClosed() override
Check if switch is closed.
Switch(String name, Logger::Level logLevel=Logger::Level::off)
void setSwitchingMode(SwitchingMode mode)
SwitchingMode switchingMode() const
const Attribute< Real >::Ptr mExponentialTransitionEndTime
const Attribute< Real >::Ptr mZeroCrossingTimeA
const Attribute< Bool >::Ptr mPoleClosedC
void openSwitch() override
Bool supportsPrecomputedSystemMatrices() const override
SimPowerComp< Complex >::Ptr clone(String name) override
Returns a modified copy of the component with the given suffix added to the name and without.
void mnaCompPostStep(Real time, Int timeStepCount, Attribute< Matrix >::Ptr &leftVector) override
const Attribute< Real >::Ptr mInstantCurrentC
const Attribute< Real >::Ptr mEffectiveResistanceB
const Attribute< Real >::Ptr mInstantCurrentB
void initializeFromNodesAndTerminals(Real frequency) override
Initializes Component variables according to power flow data stored in Nodes.
void mnaCompApplySystemMatrixStamp(SparseMatrixRow &systemMatrix) override
const Attribute< Bool >::Ptr mOpeningRequested
void mnaCompApplySwitchSystemMatrixStamp(Bool closed, SparseMatrixRow &systemMatrix, Int freqIdx) override
void mnaCompAddPostStepDependencies(AttributeBase::List &prevStepDependencies, AttributeBase::List &attributeDependencies, AttributeBase::List &modifiedAttributes, Attribute< Matrix >::Ptr &leftVector) override
void mnaCompInitialize(Real omega, Real timeStep, Attribute< Matrix >::Ptr leftVector) override
const Attribute< Real >::Ptr mEffectiveResistanceC
const Attribute< Real >::Ptr mExponentialProgress
const Attribute< Real >::Ptr mZeroCrossingTimeC
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< Complex, rows, cols, Eigen::ColMajor > MatrixFixedSizeComp
Dense matrix for complex numbers with fixed dimension.
Eigen::SparseMatrix< Real, Eigen::RowMajor > SparseMatrixRow
Sparse matrix for real numbers (row major).