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[]);
88 Source(std::string_view name,
89 const std::shared_ptr<Core>& core,
102 Source(std::string_view name,
const std::string& configString);
113 virtual void initialize()
override;
118 virtual void runTo(
Time stopTime_input)
override;
127 void addPublication(std::string_view key,
128 std::string_view generator,
131 std::string_view units = std::string_view());
142 std::string_view units = std::string_view())
144 addPublication(key, std::string_view(), type, period, units);
149 int addSignalGenerator(std::string_view name, std::string_view type);
151 void setStartTime(std::string_view key,
Time startTime);
153 void setPeriod(std::string_view key,
Time period);
155 void linkPublicationToGenerator(std::string_view key, std::string_view generator);
157 void linkPublicationToGenerator(std::string_view key,
int genIndex);
159 std::shared_ptr<SignalGenerator> getGenerator(
int index);
169 virtual void loadJsonFile(
const std::string& jsonString,
170 bool enableFederateInterfaceRegistration)
override;
174 Time runSourceLoop(
Time currentTime);
177 std::deque<SourceObject> sources;
178 std::vector<std::shared_ptr<SignalGenerator>> generators;
179 std::map<std::string_view, int> generatorLookup;
180 std::vector<Endpoint> endpoints;
181 std::map<std::string_view, int> pubids;
182 Time defaultPeriod = 1.0;
Definition: FederateInfo.hpp:28
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:139
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