 |
helics
3.3.0
|
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);
53 virtual defV generate(
Time signalTime) = 0;
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);
164 virtual void loadJsonFile(
const std::string& jsonString)
override;
168 Time runSourceLoop(
Time currentTime);
171 std::deque<SourceObject> sources;
172 std::vector<std::shared_ptr<SignalGenerator>> generators;
173 std::map<std::string_view, int> generatorLookup;
174 std::vector<Endpoint> endpoints;
175 std::map<std::string_view, int> pubids;
176 Time defaultPeriod = 1.0;
constexpr Time timeZero
Definition: helicsTime.hpp:31
std::variant< double, int64_t, std::string, std::complex< double >, std::vector< double >, std::vector< std::complex< double > >, NamedPoint > defV
Definition: HelicsPrimaryTypes.hpp:34
void addPublication(std::string_view key, DataType type, Time period, std::string_view units=std::string_view())
Definition: Source.hpp:136
std::shared_ptr< SignalGenerator > getGenerator(int index)
Definition: Source.cpp:306
virtual void set(std::string_view parameter, double val)
Definition: Source.cpp:30
Definition: Source.hpp:24
void setStartTime(std::string_view key, Time startTime)
Definition: Source.cpp:315
int addSignalGenerator(std::string_view name, std::string_view type)
Definition: Source.cpp:290
virtual void initialize() override
Definition: Source.cpp:185
TimeRepresentation< count_time< 9 > > Time
Definition: helicsTime.hpp:27
@ HELICS_FLAG_SOURCE_ONLY
Definition: helics_enums.h:107
Definition: helicsCLI11.hpp:42
std::string masterFileName
the name of the master file used to do the construction
Definition: helicsApp.hpp:132
DataType
Definition: helicsTypes.hpp:273
void loadJsonFileConfiguration(const std::string &appName, const std::string &jsonString)
Definition: helicsApp.cpp:158
Definition: core-exceptions.hpp:48
void linkPublicationToGenerator(std::string_view key, std::string_view generator)
Definition: Source.cpp:332
Definition: FederateInfo.hpp:24
virtual void runTo(Time stopTime_input) override
Definition: Source.cpp:224
Definition: Source.hpp:64
virtual void setString(std::string_view parameter, std::string_view val)
Definition: Source.cpp:32
Definition: Source.hpp:37
Definition: Publications.hpp:25
void publish(double val)
Definition: Publications.cpp:71
the main namespace for the helics co-simulation library User functions will be in the helics namespac...
Definition: AsyncFedCallInfo.hpp:14
void setTime(Time indexTime)
Definition: Source.hpp:55
std::shared_ptr< CombinationFederate > fed
the federate created for the Player
Definition: helicsApp.hpp:130
void addPublication(std::string_view key, std::string_view generator, DataType type, Time period, std::string_view units=std::string_view())
Definition: Source.cpp:261
void setPeriod(std::string_view key, Time period)
Definition: Source.cpp:323
Definition: helicsApp.hpp:29
const std::string & typeNameStringRef(DataType type)
Definition: helicsTypes.cpp:58
constexpr Time timeEpsilon
Definition: helicsTime.hpp:33
void loadFile(const std::string &filename)
Definition: helicsApp.cpp:123