10 #define DECLARE_WEIGHT_UPDATE_MODEL(TYPE, NUM_PARAMS, NUM_VARS, NUM_PRE_VARS, NUM_POST_VARS) \ 11 DECLARE_SNIPPET(TYPE, NUM_PARAMS) \ 12 typedef NewModels::VarInitContainerBase<NUM_VARS> VarValues; \ 13 typedef NewModels::VarInitContainerBase<NUM_PRE_VARS> PreVarValues; \ 14 typedef NewModels::VarInitContainerBase<NUM_POST_VARS> PostVarValues; 16 #define SET_SIM_CODE(SIM_CODE) virtual std::string getSimCode() const override{ return SIM_CODE; } 17 #define SET_EVENT_CODE(EVENT_CODE) virtual std::string getEventCode() const override{ return EVENT_CODE; } 18 #define SET_LEARN_POST_CODE(LEARN_POST_CODE) virtual std::string getLearnPostCode() const override{ return LEARN_POST_CODE; } 19 #define SET_SYNAPSE_DYNAMICS_CODE(SYNAPSE_DYNAMICS_CODE) virtual std::string getSynapseDynamicsCode() const override{ return SYNAPSE_DYNAMICS_CODE; } 20 #define SET_EVENT_THRESHOLD_CONDITION_CODE(EVENT_THRESHOLD_CONDITION_CODE) virtual std::string getEventThresholdConditionCode() const override{ return EVENT_THRESHOLD_CONDITION_CODE; } 22 #define SET_SIM_SUPPORT_CODE(SIM_SUPPORT_CODE) virtual std::string getSimSupportCode() const override{ return SIM_SUPPORT_CODE; } 23 #define SET_LEARN_POST_SUPPORT_CODE(LEARN_POST_SUPPORT_CODE) virtual std::string getLearnPostSupportCode() const override{ return LEARN_POST_SUPPORT_CODE; } 24 #define SET_SYNAPSE_DYNAMICS_SUPPORT_CODE(SYNAPSE_DYNAMICS_SUPPORT_CODE) virtual std::string getSynapseDynamicsSuppportCode() const override{ return SYNAPSE_DYNAMICS_SUPPORT_CODE; } 25 #define SET_PRE_SPIKE_CODE(PRE_SPIKE_CODE) virtual std::string getPreSpikeCode() const override{ return PRE_SPIKE_CODE; } 26 #define SET_POST_SPIKE_CODE(POST_SPIKE_CODE) virtual std::string getPostSpikeCode() const override{ return POST_SPIKE_CODE; } 28 #define SET_PRE_VARS(...) virtual StringPairVec getPreVars() const override{ return __VA_ARGS__; } 29 #define SET_POST_VARS(...) virtual StringPairVec getPostVars() const override{ return __VA_ARGS__; } 31 #define SET_EXTRA_GLOBAL_PARAMS(...) virtual StringPairVec getExtraGlobalParams() const override{ return __VA_ARGS__; } 33 #define SET_NEEDS_PRE_SPIKE_TIME(PRE_SPIKE_TIME_REQUIRED) virtual bool isPreSpikeTimeRequired() const override{ return PRE_SPIKE_TIME_REQUIRED; } 34 #define SET_NEEDS_POST_SPIKE_TIME(POST_SPIKE_TIME_REQUIRED) virtual bool isPostSpikeTimeRequired() const override{ return POST_SPIKE_TIME_REQUIRED; } 265 SET_EVENT_CODE(
"$(addToInSyn, max(0.0, $(g) * tanh(($(V_pre) - $(Epre)) / $(Vslope))* DT));\n");
333 "gMax",
"gMid",
"gSlope",
"tauShift",
"gSyn0"});
337 "$(addToInSyn, $(g));\n" 338 "scalar dt = $(sT_post) - $(t) - ($(tauShift)); \n" 340 "if (dt > $(lim0)) \n" 341 " dg = -($(off0)) ; \n" 342 "else if (dt > 0) \n" 343 " dg = $(slope0) * dt + ($(off1)); \n" 344 "else if (dt > $(lim1)) \n" 345 " dg = $(slope1) * dt + ($(off1)); \n" 346 "else dg = - ($(off2)) ; \n" 348 "$(g)=$(gMax)/2 *(tanh($(gSlope)*($(gRaw) - ($(gMid))))+1); \n");
350 "scalar dt = $(t) - ($(sT_pre)) - ($(tauShift)); \n" 352 "if (dt > $(lim0)) \n" 353 " dg = -($(off0)) ; \n" 354 "else if (dt > 0) \n" 355 " dg = $(slope0) * dt + ($(off1)); \n" 356 "else if (dt > $(lim1)) \n" 357 " dg = $(slope1) * dt + ($(off1)); \n" 358 "else dg = -($(off2)) ; \n" 360 "$(g)=$(gMax)/2.0 *(tanh($(gSlope)*($(gRaw) - ($(gMid))))+1); \n");
363 {
"lim0", [](
const vector<double> &pars, double){
return (1/pars[4] + 1/pars[1]) * pars[0] / (2/pars[1]); }},
364 {
"lim1", [](
const vector<double> &pars, double){
return -((1/pars[3] + 1/pars[1]) * pars[0] / (2/pars[1])); }},
365 {
"slope0", [](
const vector<double> &pars, double){
return -2*pars[5]/(pars[1]*pars[0]); }},
366 {
"slope1", [](
const vector<double> &pars, double){
return 2*pars[5]/(pars[1]*pars[0]); }},
367 {
"off0", [](
const vector<double> &pars, double){
return pars[5] / pars[4]; }},
368 {
"off1", [](
const vector<double> &pars, double){
return pars[5] / pars[1]; }},
369 {
"off2", [](
const vector<double> &pars, double){
return pars[5] / pars[3]; }}});
virtual StringPairVec getExtraGlobalParams() const
Definition: newWeightUpdateModels.h:107
virtual std::string getLearnPostSupportCode() const
Gets support code to be made available within learnSynapsesPost kernel/function.
Definition: newWeightUpdateModels.h:77
virtual std::string getEventCode() const
Gets code run when events (all the instances where event threshold condition is met) are received...
Definition: newWeightUpdateModels.h:52
virtual std::string getSynapseDynamicsSuppportCode() const
Gets support code to be made available within the synapse dynamics kernel/function.
Definition: newWeightUpdateModels.h:83
#define DECLARE_WEIGHT_UPDATE_MODEL(TYPE, NUM_PARAMS, NUM_VARS, NUM_PRE_VARS, NUM_POST_VARS)
Definition: newWeightUpdateModels.h:10
Definition: newWeightUpdateModels.h:39
virtual bool isPreSpikeTimeRequired() const
Whether presynaptic spike times are needed or not.
Definition: newWeightUpdateModels.h:110
Wrapper around old-style models stored in global arrays and referenced by index.
Definition: newModels.h:170
This is a simple STDP rule including a time delay for the finite transmission speed of the synapse...
Definition: newWeightUpdateModels.h:327
Base class for all weight update models.
Definition: newWeightUpdateModels.h:42
#define SET_SIM_CODE(SIM_CODE)
Definition: newWeightUpdateModels.h:16
size_t getPreVarIndex(const std::string &varName) const
Find the index of a named presynaptic variable.
Definition: newWeightUpdateModels.h:119
Pulse-coupled, static synapse with heterogenous dendritic delays.
Definition: newWeightUpdateModels.h:221
#define SET_EVENT_CODE(EVENT_CODE)
Definition: newWeightUpdateModels.h:17
virtual StringPairVec getPostVars() const
Definition: newWeightUpdateModels.h:103
Base class for all models - in addition to the parameters snippets have, models can have state variab...
Definition: newModels.h:132
#define SET_NEEDS_PRE_SPIKE_TIME(PRE_SPIKE_TIME_REQUIRED)
Definition: newWeightUpdateModels.h:33
virtual std::string getSimCode() const
Gets simulation code run when 'true' spikes are received.
Definition: newWeightUpdateModels.h:49
#define SET_DERIVED_PARAMS(...)
Definition: snippet.h:29
virtual std::string getEventThresholdConditionCode() const
Gets codes to test for events.
Definition: newWeightUpdateModels.h:63
Class to hold the information that defines a weightupdate model (a model of how spikes affect synapti...
Definition: synapseModels.h:16
Pulse-coupled, static synapse.
Definition: newWeightUpdateModels.h:195
#define DECLARE_MODEL(TYPE, NUM_PARAMS, NUM_VARS)
Definition: newModels.h:18
size_t getPostVarIndex(const std::string &varName) const
Find the index of a named postsynaptic variable.
Definition: newWeightUpdateModels.h:125
virtual std::string getLearnPostCode() const
Gets code to include in the learnSynapsesPost kernel/function.
Definition: newWeightUpdateModels.h:57
virtual StringPairVec getPreVars() const
Definition: newWeightUpdateModels.h:99
LegacyWrapper(unsigned int legacyTypeIndex)
Definition: newWeightUpdateModels.h:139
Wrapper around legacy weight update models stored in weightUpdateModels array of weightUpdateModel ob...
Definition: newWeightUpdateModels.h:136
#define SET_EVENT_THRESHOLD_CONDITION_CODE(EVENT_THRESHOLD_CONDITION_CODE)
Definition: newWeightUpdateModels.h:20
virtual std::string getPostSpikeCode() const
Definition: newWeightUpdateModels.h:95
#define SET_PARAM_NAMES(...)
Definition: snippet.h:28
virtual std::string getSynapseDynamicsCode() const
Gets code for synapse dynamics which are independent of spike detection.
Definition: newWeightUpdateModels.h:60
vector< weightUpdateModel > weightUpdateModels
Global C++ vector containing all weightupdate model descriptions.
Definition: synapseModels.cc:31
#define SET_VARS(...)
Definition: newModels.h:26
#define SET_LEARN_POST_CODE(LEARN_POST_CODE)
Definition: newWeightUpdateModels.h:18
std::vector< std::pair< std::string, std::string > > StringPairVec
Definition: snippet.h:117
Definition: codeGenUtils.h:24
size_t getVarIndex(const std::string &varName) const
Find the index of a named variable.
Definition: newModels.h:145
virtual std::string getPreSpikeCode() const
Definition: newWeightUpdateModels.h:89
#define SET_NEEDS_POST_SPIKE_TIME(POST_SPIKE_TIME_REQUIRED)
Definition: newWeightUpdateModels.h:34
Graded-potential, static synapse.
Definition: newWeightUpdateModels.h:257
virtual std::string getSimSupportCode() const
Gets support code to be made available within the synapse kernel/function.
Definition: newWeightUpdateModels.h:71
virtual bool isPostSpikeTimeRequired() const
Whether postsynaptic spike times are needed or not.
Definition: newWeightUpdateModels.h:113