GeNN  4.0.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 {
23 class Base : public Models::Base
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 //----------------------------------------------------------------------------
35 // PostsynapticModels::ExpCurr
36 //----------------------------------------------------------------------------
38 class ExpCurr : public Base
39 {
40 public:
42 
43  SET_DECAY_CODE("$(inSyn) *= $(expDecay);");
44 
45  SET_CURRENT_CONVERTER_CODE("$(init) * $(inSyn)");
46 
47  SET_PARAM_NAMES({"tau"});
48 
50  {"expDecay", [](const std::vector<double> &pars, double dt){ return std::exp(-dt / pars[0]); }},
51  {"init", [](const std::vector<double> &pars, double dt){ return (pars[0] * (1.0 - std::exp(-dt / pars[0]))) * (1.0 / dt); }}});
52 };
53 
54 //----------------------------------------------------------------------------
55 // PostsynapticModels::ExpCond
56 //----------------------------------------------------------------------------
58 
63 class ExpCond : public Base
64 {
65 public:
67 
68  SET_DECAY_CODE("$(inSyn)*=$(expDecay);");
69 
70  SET_CURRENT_CONVERTER_CODE("$(inSyn) * ($(E) - $(V))");
71 
72  SET_PARAM_NAMES({"tau", "E"});
73 
74  SET_DERIVED_PARAMS({{"expDecay", [](const std::vector<double> &pars, double dt){ return std::exp(-dt / pars[0]); }}});
75 };
76 
77 //----------------------------------------------------------------------------
78 // PostsynapticModels::DeltaCurr
79 //----------------------------------------------------------------------------
81 
82 class DeltaCurr : public Base
83 {
84 public:
86 
87  SET_CURRENT_CONVERTER_CODE("$(inSyn); $(inSyn) = 0");
88 };
89 }
#define SET_CURRENT_CONVERTER_CODE(CURRENT_CONVERTER_CODE)
Definition: postsynapticModels.h:13
Definition: postsynapticModels.h:20
Base class for all models - in addition to the parameters snippets have, models can have state variab...
Definition: models.h:129
#define SET_DECAY_CODE(DECAY_CODE)
Definition: postsynapticModels.h:12
Exponential decay with synaptic input treated as a current value.
Definition: postsynapticModels.h:38
Base class for all postsynaptic models.
Definition: postsynapticModels.h:23
#define DECLARE_MODEL(TYPE, NUM_PARAMS, NUM_VARS)
Definition: models.h:14
Simple delta current synapse.
Definition: postsynapticModels.h:82
#define SET_DERIVED_PARAMS(...)
Definition: snippet.h:36
Exponential decay with synaptic input treated as a conductance value.
Definition: postsynapticModels.h:63
#define SET_PARAM_NAMES(...)
Definition: snippet.h:35
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