DPsim
Loading...
Searching...
No Matches
SignalGenerator.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/SimSignalComp.h>
12
13namespace CPS {
14namespace Signal {
19class SignalGenerator : public SimSignalComp {
20public:
21 typedef std::shared_ptr<SignalGenerator> Ptr;
22 typedef std::vector<Ptr> List;
23
24 const CPS::Attribute<Complex>::Ptr mSigOut;
25 const CPS::Attribute<Real>::Ptr mFreq;
26
27 SignalGenerator(String uid, String name,
28 Logger::Level logLevel = Logger::Level::off);
29
30 SignalGenerator(String name, Logger::Level logLevel = Logger::Level::off)
31 : SignalGenerator(name, name, logLevel) {
32 SPDLOG_LOGGER_INFO(mSLog, "Create {} {}", type(), name);
33 }
34
36 virtual void step(Real time) = 0;
38 Complex getSignal();
39};
40} // namespace Signal
41} // namespace CPS
String uid()
Returns unique id.
String type()
Get component type (cross-platform)
Complex getSignal()
returns current signal value without updating it
virtual void step(Real time)=0
updates current signal
Logger::Log mSLog
Component logger.