DPsim
CosineFMGenerator.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 
13 namespace CPS {
14 namespace Signal {
21  public SharedFactory<CosineFMGenerator> {
22 private:
24  Real mMagnitude;
26  Real mInitialPhase;
28  Real mBaseFrequency;
30  Real mModulationFrequency;
32  Real mModulationAmplitude;
34  bool mZigZag = false;
35 
36 public:
38  CosineFMGenerator(String name, Logger::Level logLevel = Logger::Level::off)
39  : SignalGenerator(name, logLevel), mZigZag(false) {
40  SPDLOG_LOGGER_INFO(mSLog, "Create {} {}", type(), name);
41  }
43  void setParameters(Complex initialPhasor, Real modulationFrequency,
44  Real modulationAmplitude, Real frequency = 0.0,
45  bool zigzag = false);
47  void step(Real time);
48 };
49 } // namespace Signal
50 } // namespace CPS
String type()
Get component type (cross-platform)
Model to generate signals containing a frequency ramp.
void setParameters(Complex initialPhasor, Real modulationFrequency, Real modulationAmplitude, Real frequency=0.0, bool zigzag=false)
set the source's parameters
CosineFMGenerator(String name, Logger::Level logLevel=Logger::Level::off)
init the identified object
void step(Real time)
implementation of inherited method step to update and return the current signal value
Model to generate generic signals.
Logger::Log mSLog
Component logger.