GeNN  3.3.0
GPU enhanced Neuronal Networks (GeNN)
currentSourceModels.h
Go to the documentation of this file.
1 #pragma once
2 
3 // Standard includes
4 #include <array>
5 #include <functional>
6 #include <string>
7 #include <tuple>
8 #include <vector>
9 #include <cmath>
10 
11 // GeNN includes
12 #include "codeGenUtils.h"
13 // #include "neuronModels.h"
14 #include "newModels.h"
15 
16 //----------------------------------------------------------------------------
17 // Macros
18 //----------------------------------------------------------------------------
19 #define SET_INJECTION_CODE(INJECTION_CODE) virtual std::string getInjectionCode() const override{ return INJECTION_CODE; }
20 #define SET_EXTRA_GLOBAL_PARAMS(...) virtual StringPairVec getExtraGlobalParams() const override{ return __VA_ARGS__; }
21 
22 //----------------------------------------------------------------------------
23 // CurrentSourceModels::Base
24 //----------------------------------------------------------------------------
26 {
28 class Base : public NewModels::Base
29 {
30 public:
31  //----------------------------------------------------------------------------
32  // Declared virtuals
33  //----------------------------------------------------------------------------
35  virtual std::string getInjectionCode() const{ return ""; }
36 
39 };
40 
41 //----------------------------------------------------------------------------
42 // CurrentSourceModels::DC
43 //----------------------------------------------------------------------------
45 
49 class DC : public Base
50 {
51  DECLARE_MODEL(DC, 1, 0);
52 
53  SET_INJECTION_CODE("$(injectCurrent, $(amp));\n");
54 
55  SET_PARAM_NAMES({"amp"});
56 };
57 
58 //----------------------------------------------------------------------------
59 // CurrentSourceModels::GaussianNoise
60 //----------------------------------------------------------------------------
62 
66 class GaussianNoise : public Base
67 {
69 
70  SET_INJECTION_CODE("$(injectCurrent, $(mean) + $(gennrand_normal) * $(sd));\n");
71 
72  SET_PARAM_NAMES({"mean", "sd"} );
73 };
74 } // CurrentSourceModels
#define SET_INJECTION_CODE(INJECTION_CODE)
Definition: currentSourceModels.h:19
Base class for all current source models.
Definition: currentSourceModels.h:28
Definition: currentSourceModels.h:25
DC source.
Definition: currentSourceModels.h:49
Base class for all models - in addition to the parameters snippets have, models can have state variab...
Definition: newModels.h:132
Noisy current source with noise drawn from normal distribution.
Definition: currentSourceModels.h:66
#define DECLARE_MODEL(TYPE, NUM_PARAMS, NUM_VARS)
Definition: newModels.h:18
virtual NewModels::Base::StringPairVec getExtraGlobalParams() const
Gets names and types (as strings) of additional parameters.
Definition: currentSourceModels.h:38
#define SET_PARAM_NAMES(...)
Definition: snippet.h:28
std::vector< std::pair< std::string, std::string > > StringPairVec
Definition: snippet.h:117
virtual std::string getInjectionCode() const
Gets the code that defines current injected each timestep.
Definition: currentSourceModels.h:35