GeNN  4.9.0
GPU enhanced Neuronal Networks (GeNN)
postsynapticModels.h
Go to the documentation of this file.
1 #pragma once
2 
3 // Standard C includes
4 #include <cmath>
5 
6 // GeNN includes
7 #include "models.h"
8 
9 //----------------------------------------------------------------------------
10 // Macros
11 //----------------------------------------------------------------------------
12 #define SET_DECAY_CODE(DECAY_CODE) virtual std::string getDecayCode() const override{ return DECAY_CODE; }
13 #define SET_CURRENT_CONVERTER_CODE(CURRENT_CONVERTER_CODE) virtual std::string getApplyInputCode() const override{ return "$(Isyn) += " CURRENT_CONVERTER_CODE ";"; }
14 #define SET_APPLY_INPUT_CODE(APPLY_INPUT_CODE) virtual std::string getApplyInputCode() const override{ return APPLY_INPUT_CODE; }
15 #define SET_SUPPORT_CODE(SUPPORT_CODE) virtual std::string getSupportCode() const override{ return SUPPORT_CODE; }
16 
17 //----------------------------------------------------------------------------
18 // PostsynapticModels::Base
19 //----------------------------------------------------------------------------
21 {
24 {
25 public:
26  //----------------------------------------------------------------------------
27  // Declared virtuals
28  //----------------------------------------------------------------------------
29  virtual std::string getDecayCode() const{ return ""; }
30  virtual std::string getApplyInputCode() const{ return ""; }
31  virtual std::string getSupportCode() const{ return ""; }
32 
33  //----------------------------------------------------------------------------
34  // Public API
35  //----------------------------------------------------------------------------
37  boost::uuids::detail::sha1::digest_type getHashDigest() const;
38 
40  void validate() const;
41 };
42 
43 //----------------------------------------------------------------------------
44 // PostsynapticModels::ExpCurr
45 //----------------------------------------------------------------------------
47 
49 class ExpCurr : public Base
50 {
51 public:
53 
54  SET_DECAY_CODE("$(inSyn) *= $(expDecay);");
55 
56  SET_CURRENT_CONVERTER_CODE("$(init) * $(inSyn)");
57 
58  SET_PARAM_NAMES({"tau"});
59 
61  {"expDecay", [](const std::vector<double> &pars, double dt){ return std::exp(-dt / pars[0]); }},
62  {"init", [](const std::vector<double> &pars, double dt){ return (pars[0] * (1.0 - std::exp(-dt / pars[0]))) * (1.0 / dt); }}});
63 };
64 
65 //----------------------------------------------------------------------------
66 // PostsynapticModels::ExpCond
67 //----------------------------------------------------------------------------
69 
74 class ExpCond : public Base
75 {
76 public:
78 
79  SET_DECAY_CODE("$(inSyn)*=$(expDecay);");
80 
81  SET_CURRENT_CONVERTER_CODE("$(inSyn) * ($(E) - $(V))");
82 
83  SET_PARAM_NAMES({"tau", "E"});
84 
85  SET_DERIVED_PARAMS({{"expDecay", [](const std::vector<double> &pars, double dt){ return std::exp(-dt / pars[0]); }}});
86 };
87 
88 //----------------------------------------------------------------------------
89 // PostsynapticModels::DeltaCurr
90 //----------------------------------------------------------------------------
92 
93 class DeltaCurr : public Base
94 {
95 public:
97 
98  SET_CURRENT_CONVERTER_CODE("$(inSyn); $(inSyn) = 0");
99 };
100 }
#define SET_CURRENT_CONVERTER_CODE(CURRENT_CONVERTER_CODE)
Definition: postsynapticModels.h:13
Definition: postsynapticModels.h:20
Definition: models.h:48
#define GENN_EXPORT
Definition: gennExport.h:13
#define SET_DECAY_CODE(DECAY_CODE)
Definition: postsynapticModels.h:12
Exponential decay with synaptic input treated as a current value.
Definition: postsynapticModels.h:49
Base class for all postsynaptic models.
Definition: postsynapticModels.h:23
#define DECLARE_MODEL(TYPE, NUM_PARAMS, NUM_VARS)
Definition: models.h:31
Simple delta current synapse.
Definition: postsynapticModels.h:93
#define SET_DERIVED_PARAMS(...)
Definition: snippet.h:37
Exponential decay with synaptic input treated as a conductance value.
Definition: postsynapticModels.h:74
#define SET_PARAM_NAMES(...)
Definition: snippet.h:36
virtual std::string getDecayCode() const
Definition: postsynapticModels.h:29
virtual std::string getSupportCode() const
Definition: postsynapticModels.h:31
virtual std::string getApplyInputCode() const
Definition: postsynapticModels.h:30