10 #include <plog/Severity.h> 11 #include <plog/Appenders/ConsoleAppender.h> 27 Simulator(plog::Severity logLevel = plog::warning);
28 Simulator(
const std::string &experimentXML,
const std::string &overrideOutputPath =
"", plog::Severity logLevel = plog::warning);
35 void load(
const std::string &experimentXML,
const std::string &overrideOutputPath =
"");
47 double getDT()
const{
return m_DT; }
77 typedef HMODULE LibraryHandle;
79 typedef void* LibraryHandle;
83 typedef void (*VoidFunction)(void);
86 typedef std::map<std::string, std::pair<std::set<std::string>, std::set<std::string>>> ComponentEventPorts;
90 typedef std::tuple<unsigned int*, unsigned int*, unsigned int*, VoidFunction, VoidFunction> NeuronPopSpikeVars;
97 void *getLibrarySymbol(
const char *name,
bool allowMissing =
false)
const;
100 NeuronPopSpikeVars getNeuronPopSpikeVars(
const std::string &popName)
const;
102 void addPropertiesAndSizes(
const filesystem::path &basePath,
const pugi::xml_node &node,
103 const pugi::xml_node &modelNode,
const std::string &geNNPopName,
104 unsigned int popSize, std::map<std::string, unsigned int> &sizes,
105 const std::vector<unsigned int> *remapIndices =
nullptr);
108 std::unique_ptr<Input::Base> createInput(
const pugi::xml_node &node,
109 const std::map<std::string, unsigned int> &componentSizes,
110 const std::map<std::string, std::string> &componentURLs,
111 const ComponentEventPorts &componentEventPorts);
113 std::unique_ptr<LogOutput::Base> createLogOutput(
const pugi::xml_node &node,
const filesystem::path &logPath,
114 const std::map<std::string, unsigned int> &componentSizes,
115 const std::map<std::string, std::string> &componentURLs,
116 const ComponentEventPorts &componentEventPorts);
119 unsigned int getComponentSize(
const std::string &componentName,
120 const std::map<std::string, unsigned int> &componentSizes);
123 bool isEventSendPort(
const std::string &targetName,
const std::string &portName,
124 const std::map<std::string, std::string> &componentURLs,
125 const ComponentEventPorts &componentEventPorts)
const;
128 bool isEventReceivePort(
const std::string &targetName,
const std::string &portName,
129 const std::map<std::string, std::string> &componentURLs,
130 const ComponentEventPorts &componentEventPorts)
const;
134 void addEventPorts(
const filesystem::path &basePath,
const pugi::xml_node &node,
135 std::map<std::string, std::string> &componentURLs,
136 ComponentEventPorts &componentEventPorts);
142 LibraryHandle m_ModelLibrary;
145 VoidFunction m_StepTime;
148 float *m_SimulationTime;
151 unsigned long long *m_SimulationTimestep;
165 std::vector<std::unique_ptr<LogOutput::Base>> m_Loggers;
168 std::vector<std::unique_ptr<Input::Base>> m_Inputs;
171 std::map<std::string, std::map<std::string, std::unique_ptr<ModelProperty::Base>>> m_ComponentProperties;
174 std::map<std::string, const LogOutput::AnalogueExternal*> m_ExternalLoggers;
177 std::map<std::string, InputValue::External*> m_ExternalInputs;
180 plog::ConsoleAppender<plog::TxtFormatter> m_ConsoleAppender;
double getInitSparseTime() const
Definition: simulator.cc:417
double getNeuronUpdateTime() const
Timings of individual kernels provided by GeNN.
Definition: simulator.cc:392
double getLogMs() const
Definition: simulator.h:55
const LogOutput::AnalogueExternal * getExternalLogger(const std::string &name) const
Get an external logger by name.
Definition: simulator.cc:370
~Simulator()
Definition: simulator.cc:70
InputValue::External * getExternalInput(const std::string &name) const
Get an external input by name.
Definition: simulator.cc:381
double getSynapseDynamicsTime() const
Definition: simulator.cc:412
Definition: simulator.h:24
void stepTime()
Advance simulation by one timestep.
Definition: simulator.cc:329
double getInputMs() const
Get the total times accumulated in each stage of the simulation.
Definition: simulator.h:53
double getDurationMs() const
Get duration of simulation read from experiment in ms.
Definition: simulator.h:50
Simulator(plog::Severity logLevel=plog::warning)
Definition: simulator.cc:57
double getInitTime() const
Definition: simulator.cc:397
Definition: connectors.h:25
void load(const std::string &experimentXML, const std::string &overrideOutputPath="")
Load model from XML file.
Definition: simulator.cc:82
unsigned long long calcNumTimesteps() const
Calculate duration of simulation read from experiment in timesteps.
Definition: simulator.h:66
double getDT() const
Get the simulation timestep (in ms)
Definition: simulator.h:47
double getPresynapticUpdateTime() const
Definition: simulator.cc:402
Definition: logOutput.h:128
double getPostsynapticUpdateTime() const
Definition: simulator.cc:407
double getSimulateMs() const
Definition: simulator.h:54