132 Int freqIdx)
override;
142 Real mZeroCrossingTolerance = 1e-6;
143 Real mExponentialSwitchingTime = 0.01;
144 Real mTimeStep = 0.0;
147 Real mShiftOmega = 0.0;
149 std::array<Bool, 3> mPoleClosedPrev{{
false,
false,
false}};
150 std::array<Real, 3> mEffectiveResistancePrev{{0.0, 0.0, 0.0}};
152 Matrix mPreviousInstantaneousCurrent = Matrix::Zero(3, 1);
153 Real mPreviousCurrentTime = 0.0;
154 Bool mPreviousCurrentValid =
false;
156 Bool mResetZeroCrossingHistory =
false;
157 Bool mExponentialTransitionStarted =
false;
160 void setPoleClosed(
UInt phase,
Bool closed);
161 void setAllPoles(
Bool closed);
163 Bool allPolesClosed()
const;
164 Bool allPolesOpen()
const;
166 void resetZeroCrossingTimes();
168 Real effectiveResistance(
UInt phase)
const;
169 void setEffectiveResistance(
UInt phase,
Real resistance);
170 void synchronizeEffectiveResistance(
Bool closed);
172 void resetExponentialTransition();
173 void validateExponentialResistanceParameters()
const;
174 Real exponentialResistance(
UInt phase,
Real alpha)
const;
175 void updateExponentialTransition(
Real time);
179 Matrix reconstructInstantaneousCurrent(
Real time)
const;
180 void setInstantaneousCurrentAttributes(
const Matrix ¤t);
182 Bool currentCrossedZero(
Real previousCurrent,
Real current)
const;
184 Real interpolateZeroCrossingTime(
Real previousCurrent,
Real current,
185 Real previousTime,
Real currentTime)
const;
187 void setZeroCrossingTime(
UInt phase,
Real time);
188 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 mnaCompInitializeHarm(Real omega, Real timeStep, std::vector< Attribute< Matrix >::Ptr > leftVectors) override
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).