DPsim
Loading...
Searching...
No Matches
FrequencyRampGenerator.h
1/* Copyright 2017-2021 Institute for Automation of Complex Power Systems,
2 * EONERC, RWTH Aachen University
3 *
4 * This Source Code Form is subject to the terms of the Mozilla Public
5 * License, v. 2.0. If a copy of the MPL was not distributed with this
6 * file, You can obtain one at https://mozilla.org/MPL/2.0/.
7 *********************************************************************************/
8
9#pragma once
10
11#include <dpsim-models/Signal/SignalGenerator.h>
12
13namespace CPS {
14namespace Signal {
20class FrequencyRampGenerator : public SignalGenerator,
21 public SharedFactory<FrequencyRampGenerator> {
22private:
24 Real mMagnitude;
26 Real mInitialPhase;
27
29 Real mFreqStart;
31 Real mFreqEnd;
33 Real mRocof;
35 Real mTimeStart;
37 Real mDuration;
39 Real mOldTime;
40
43 bool mUseAbsoluteCalc = true;
46 bool mSmoothRamp;
47
48public:
49 FrequencyRampGenerator(String name,
50 Logger::Level logLevel = Logger::Level::off)
51 : SignalGenerator(name, logLevel) {
52 SPDLOG_LOGGER_INFO(mSLog, "Create {} {}", type(), name);
53 }
55 void setParameters(Complex initialPhasor, Real freqStart, Real ramp,
56 Real timeStart, Real duration, bool smoothRamp = true);
58 void step(Real time);
60 void stepAbsolute(Real time);
62 void stepSmooth(Real time);
63};
64} // namespace Signal
65} // namespace CPS
String type()
Get component type (cross-platform)
void stepAbsolute(Real time)
implementation of inherited method step to update and return the current signal value
void stepSmooth(Real time)
update and return signal value using a cosine shaped ramp
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.