9 #include <dpsim-models/Signal/FrequencyRampGenerator.h>
14 Real freqStart, Real rocof,
18 mMagnitude = Math::abs(initialPhasor);
19 mInitialPhase = Math::phase(initialPhasor);
21 mFreqStart = freqStart;
23 mTimeStart = timeStart;
25 mFreqEnd = freqStart + rocof * duration;
28 mSmoothRamp = smoothRamp;
30 **mSigOut = initialPhasor;
33 SPDLOG_LOGGER_INFO(
mSLog,
"Parameters:");
34 SPDLOG_LOGGER_INFO(
mSLog,
36 "\nStart Frequency={} [Hz]"
40 Logger::phasorToString(initialPhasor), freqStart, rocof,
45 if (mUseAbsoluteCalc) {
52 Real timestep = time - mOldTime;
55 currPhase = Math::phase(attributeTyped<Complex>(
"sigOut")->get());
57 if (time <= mTimeStart) {
58 currFreq = mFreqStart;
59 }
else if (time <= mTimeStart + mDuration) {
60 currFreq = mFreqStart + mRocof * (time - mTimeStart);
64 currPhase += 2. * PI * currFreq * timestep;
66 **mSigOut = mMagnitude * Complex(cos(currPhase), sin(currPhase));
71 Real currPhase = mInitialPhase + 2 * PI * time * mFreqStart;
72 Real currFreq = mFreqStart;
74 if (time > mTimeStart + mDuration) {
75 currPhase += 2 * PI * mRocof / 2 * pow(mDuration, 2);
77 2 * PI * mRocof * mDuration * (time - (mTimeStart + mDuration));
79 }
else if (time > mTimeStart) {
82 currPhase += 2 * PI * (mFreqEnd - mFreqStart) / 2 *
83 ((time - mTimeStart) -
84 2 * mDuration / (2 * PI) *
85 sin(2 * PI / (2 * mDuration) * (time - mTimeStart)));
86 currFreq += (mFreqEnd - mFreqStart) / 2 *
87 (1 - cos(2 * PI / (2 * mDuration) * (time - mTimeStart)));
89 currPhase += 2 * PI * mRocof * pow(time - mTimeStart, 2) / 2;
90 currFreq += mRocof * (time - mTimeStart);
94 **mSigOut = mMagnitude * Complex(cos(currPhase), sin(currPhase));
void stepAbsolute(Real time)
implementation of inherited method step to update and return the current signal value
void setParameters(Complex initialPhasor, Real freqStart, Real ramp, Real timeStart, Real duration, bool smoothRamp=true)
set frequency ramp specific parameters
void step(Real time)
implementation of inherited method step to update and return the current signal value
Logger::Log mSLog
Component logger.