9 #include "../application_api/Endpoints.hpp"
10 #include "../application_api/HelicsPrimaryTypes.hpp"
11 #include "../application_api/Publications.hpp"
12 #include "helicsApp.hpp"
28 int generatorIndex{-1};
29 std::string generatorName;
48 virtual void set(std::string_view parameter,
double val);
50 virtual void setString(std::string_view parameter, std::string_view val);
56 const std::string& getName() {
return mName; }
71 explicit Source(std::vector<std::string> args);
76 Source(
int argc,
char* argv[]);
87 Source(std::string_view name,
const std::shared_ptr<Core>& core,
const FederateInfo& fi);
99 Source(std::string_view name,
const std::string& configString);
110 virtual void initialize()
override;
115 virtual void runTo(
Time stopTime_input)
override;
124 void addPublication(std::string_view key,
125 std::string_view generator,
128 std::string_view units = std::string_view());
139 std::string_view units = std::string_view())
141 addPublication(key, std::string_view(), type, period, units);
146 int addSignalGenerator(std::string_view name, std::string_view type);
148 void setStartTime(std::string_view key,
Time startTime);
150 void setPeriod(std::string_view key,
Time period);
152 void linkPublicationToGenerator(std::string_view key, std::string_view generator);
154 void linkPublicationToGenerator(std::string_view key,
int genIndex);
156 std::shared_ptr<SignalGenerator> getGenerator(
int index);
166 virtual void loadJsonFile(
const std::string& jsonString,
167 bool enableFederateInterfaceRegistration)
override;
171 Time runSourceLoop(
Time currentTime);
174 std::deque<SourceObject> sources;
175 std::vector<std::shared_ptr<SignalGenerator>> generators;
176 std::map<std::string_view, int> generatorLookup;
177 std::vector<Endpoint> endpoints;
178 std::map<std::string_view, int> pubids;
179 Time defaultPeriod = 1.0;
Definition: FederateInfo.hpp:29
Definition: Publications.hpp:25
Definition: helicsApp.hpp:32
Definition: Source.hpp:37
void setTime(Time indexTime)
Definition: Source.hpp:55
virtual defV generate(Time signalTime)=0
Definition: Source.hpp:64
void addPublication(std::string_view key, DataType type, Time period, std::string_view units=std::string_view())
Definition: Source.hpp:136
Source & operator=(Source &&fed)=default
Source(Source &&other_source)=default
the main namespace for the helics co-simulation library User functions will be in the helics namespac...
Definition: AsyncFedCallInfo.hpp:14
DataType
Definition: helicsTypes.hpp:273
constexpr Time timeZero
Definition: helicsTime.hpp:31
TimeRepresentation< count_time< 9 > > Time
Definition: helicsTime.hpp:27
std::variant< double, int64_t, std::string, std::complex< double >, std::vector< double >, std::vector< std::complex< double > >, NamedPoint > defV
Definition: HelicsPrimaryTypes.hpp:37
Definition: Source.hpp:24