9 #define DECLARE_WEIGHT_UPDATE_MODEL(TYPE, NUM_PARAMS, NUM_VARS, NUM_PRE_VARS, NUM_POST_VARS) \ 10 DECLARE_SNIPPET(TYPE, NUM_PARAMS); \ 11 typedef Models::VarInitContainerBase<NUM_VARS> VarValues; \ 12 typedef Models::VarInitContainerBase<NUM_PRE_VARS> PreVarValues; \ 13 typedef Models::VarInitContainerBase<NUM_POST_VARS> PostVarValues 15 #define SET_SIM_CODE(SIM_CODE) virtual std::string getSimCode() const override{ return SIM_CODE; } 16 #define SET_EVENT_CODE(EVENT_CODE) virtual std::string getEventCode() const override{ return EVENT_CODE; } 17 #define SET_LEARN_POST_CODE(LEARN_POST_CODE) virtual std::string getLearnPostCode() const override{ return LEARN_POST_CODE; } 18 #define SET_SYNAPSE_DYNAMICS_CODE(SYNAPSE_DYNAMICS_CODE) virtual std::string getSynapseDynamicsCode() const override{ return SYNAPSE_DYNAMICS_CODE; } 19 #define SET_EVENT_THRESHOLD_CONDITION_CODE(EVENT_THRESHOLD_CONDITION_CODE) virtual std::string getEventThresholdConditionCode() const override{ return EVENT_THRESHOLD_CONDITION_CODE; } 21 #define SET_SIM_SUPPORT_CODE(SIM_SUPPORT_CODE) virtual std::string getSimSupportCode() const override{ return SIM_SUPPORT_CODE; } 22 #define SET_LEARN_POST_SUPPORT_CODE(LEARN_POST_SUPPORT_CODE) virtual std::string getLearnPostSupportCode() const override{ return LEARN_POST_SUPPORT_CODE; } 23 #define SET_SYNAPSE_DYNAMICS_SUPPORT_CODE(SYNAPSE_DYNAMICS_SUPPORT_CODE) virtual std::string getSynapseDynamicsSuppportCode() const override{ return SYNAPSE_DYNAMICS_SUPPORT_CODE; } 24 #define SET_PRE_SPIKE_CODE(PRE_SPIKE_CODE) virtual std::string getPreSpikeCode() const override{ return PRE_SPIKE_CODE; } 25 #define SET_POST_SPIKE_CODE(POST_SPIKE_CODE) virtual std::string getPostSpikeCode() const override{ return POST_SPIKE_CODE; } 27 #define SET_PRE_VARS(...) virtual VarVec getPreVars() const override{ return __VA_ARGS__; } 28 #define SET_POST_VARS(...) virtual VarVec getPostVars() const override{ return __VA_ARGS__; } 30 #define SET_NEEDS_PRE_SPIKE_TIME(PRE_SPIKE_TIME_REQUIRED) virtual bool isPreSpikeTimeRequired() const override{ return PRE_SPIKE_TIME_REQUIRED; } 31 #define SET_NEEDS_POST_SPIKE_TIME(POST_SPIKE_TIME_REQUIRED) virtual bool isPostSpikeTimeRequired() const override{ return POST_SPIKE_TIME_REQUIRED; } 210 SET_EVENT_CODE(
"$(addToInSyn, max(0.0, $(g) * tanh(($(V_pre) - $(Epre)) / $(Vslope))* DT));\n");
278 "gMax",
"gMid",
"gSlope",
"tauShift",
"gSyn0"});
282 "$(addToInSyn, $(g));\n" 283 "scalar dt = $(sT_post) - $(t) - ($(tauShift)); \n" 285 "if (dt > $(lim0)) \n" 286 " dg = -($(off0)) ; \n" 287 "else if (dt > 0) \n" 288 " dg = $(slope0) * dt + ($(off1)); \n" 289 "else if (dt > $(lim1)) \n" 290 " dg = $(slope1) * dt + ($(off1)); \n" 291 "else dg = - ($(off2)) ; \n" 293 "$(g)=$(gMax)/2 *(tanh($(gSlope)*($(gRaw) - ($(gMid))))+1); \n");
295 "scalar dt = $(t) - ($(sT_pre)) - ($(tauShift)); \n" 297 "if (dt > $(lim0)) \n" 298 " dg = -($(off0)) ; \n" 299 "else if (dt > 0) \n" 300 " dg = $(slope0) * dt + ($(off1)); \n" 301 "else if (dt > $(lim1)) \n" 302 " dg = $(slope1) * dt + ($(off1)); \n" 303 "else dg = -($(off2)) ; \n" 305 "$(g)=$(gMax)/2.0 *(tanh($(gSlope)*($(gRaw) - ($(gMid))))+1); \n");
308 {
"lim0", [](
const std::vector<double> &pars, double){
return (1/pars[4] + 1/pars[1]) * pars[0] / (2/pars[1]); }},
309 {
"lim1", [](
const std::vector<double> &pars, double){
return -((1/pars[3] + 1/pars[1]) * pars[0] / (2/pars[1])); }},
310 {
"slope0", [](
const std::vector<double> &pars, double){
return -2*pars[5]/(pars[1]*pars[0]); }},
311 {
"slope1", [](
const std::vector<double> &pars, double){
return 2*pars[5]/(pars[1]*pars[0]); }},
312 {
"off0", [](
const std::vector<double> &pars, double){
return pars[5] / pars[4]; }},
313 {
"off1", [](
const std::vector<double> &pars, double){
return pars[5] / pars[1]; }},
314 {
"off2", [](
const std::vector<double> &pars, double){
return pars[5] / pars[3]; }}});
virtual std::string getLearnPostSupportCode() const
Gets support code to be made available within learnSynapsesPost kernel/function.
Definition: weightUpdateModels.h:74
virtual std::string getEventCode() const
Gets code run when events (all the instances where event threshold condition is met) are received...
Definition: weightUpdateModels.h:49
#define SET_VARS(...)
Definition: models.h:22
#define SET_SIM_CODE(SIM_CODE)
Definition: weightUpdateModels.h:15
#define SET_NEEDS_PRE_SPIKE_TIME(PRE_SPIKE_TIME_REQUIRED)
Definition: weightUpdateModels.h:30
virtual std::string getSynapseDynamicsSuppportCode() const
Gets support code to be made available within the synapse dynamics kernel/function.
Definition: weightUpdateModels.h:80
virtual VarVec getPreVars() const
Definition: weightUpdateModels.h:96
#define SET_EVENT_CODE(EVENT_CODE)
Definition: weightUpdateModels.h:16
Definition: weightUpdateModels.h:36
Base class for all models - in addition to the parameters snippets have, models can have state variab...
Definition: models.h:129
virtual VarVec getPostVars() const
Definition: weightUpdateModels.h:100
static size_t getVarVecIndex(const std::string &varName, const VarVec &vars)
Definition: snippet.h:167
#define SET_LEARN_POST_CODE(LEARN_POST_CODE)
Definition: weightUpdateModels.h:17
virtual bool isPreSpikeTimeRequired() const
Whether presynaptic spike times are needed or not.
Definition: weightUpdateModels.h:103
This is a simple STDP rule including a time delay for the finite transmission speed of the synapse...
Definition: weightUpdateModels.h:272
#define DECLARE_MODEL(TYPE, NUM_PARAMS, NUM_VARS)
Definition: models.h:14
Base class for all weight update models.
Definition: weightUpdateModels.h:39
#define SET_EVENT_THRESHOLD_CONDITION_CODE(EVENT_THRESHOLD_CONDITION_CODE)
Definition: weightUpdateModels.h:19
size_t getPreVarIndex(const std::string &varName) const
Find the index of a named presynaptic variable.
Definition: weightUpdateModels.h:112
Pulse-coupled, static synapse with heterogenous dendritic delays.
Definition: weightUpdateModels.h:166
#define SET_NEEDS_POST_SPIKE_TIME(POST_SPIKE_TIME_REQUIRED)
Definition: weightUpdateModels.h:31
virtual std::string getSimCode() const
Gets simulation code run when 'true' spikes are received.
Definition: weightUpdateModels.h:46
#define SET_DERIVED_PARAMS(...)
Definition: snippet.h:36
virtual std::string getEventThresholdConditionCode() const
Gets codes to test for events.
Definition: weightUpdateModels.h:60
Pulse-coupled, static synapse.
Definition: weightUpdateModels.h:140
size_t getPostVarIndex(const std::string &varName) const
Find the index of a named postsynaptic variable.
Definition: weightUpdateModels.h:118
virtual std::string getLearnPostCode() const
Gets code to include in the learnSynapsesPost kernel/function.
Definition: weightUpdateModels.h:54
std::vector< Var > VarVec
Definition: snippet.h:148
virtual std::string getPostSpikeCode() const
Definition: weightUpdateModels.h:92
#define SET_PARAM_NAMES(...)
Definition: snippet.h:35
virtual std::string getSynapseDynamicsCode() const
Gets code for synapse dynamics which are independent of spike detection.
Definition: weightUpdateModels.h:57
virtual std::string getPreSpikeCode() const
Definition: weightUpdateModels.h:86
#define DECLARE_WEIGHT_UPDATE_MODEL(TYPE, NUM_PARAMS, NUM_VARS, NUM_PRE_VARS, NUM_POST_VARS)
Definition: weightUpdateModels.h:9
Graded-potential, static synapse.
Definition: weightUpdateModels.h:202
virtual std::string getSimSupportCode() const
Gets support code to be made available within the synapse kernel/function.
Definition: weightUpdateModels.h:68
virtual bool isPostSpikeTimeRequired() const
Whether postsynaptic spike times are needed or not.
Definition: weightUpdateModels.h:106