00001 #ifndef GENERICDYNAMICSPIKINGSYNAPSE_H_ 00002 #define GENERICDYNAMICSPIKINGSYNAPSE_H_ 00003 00004 #include "SimObject.h" 00005 00006 #include "ExponentialDecaySpikeResponse.h" 00007 #include "AlphaFunctionSpikeResponse.h" 00008 #include "DoubleExponentialSpikeResponse.h" 00009 #include "GABA_BResponse.h" 00010 #include "GABA_BResponseODE.h" 00011 #include "GenericNonLinGABASynapse.h" 00012 #include "AlphaInfiniteSpikeResponse.h" 00013 00014 #include "GenericCurrentBasedSpikingSynapse.h" 00015 #include "GenericConductanceBasedSpikingSynapse.h" 00016 00017 #include "GenericGlutamateSynapse.h" 00018 #include "GenericGABASynapse.h" 00019 #include "GenericNMDASynapse.h" 00020 00021 template<class SpikeResponse> 00022 class GenericDynamicSpikingSynapse : public SpikeResponse 00023 { 00024 public: 00025 GenericDynamicSpikingSynapse() : W(1e-9f), delay(2e-4f), U(0.2f), D(0.1f), F(0.4f), u0(0.2f), r0(1.0f) 00026 { /* NOOP */ }; 00027 00028 virtual ~GenericDynamicSpikingSynapse() 00029 { /* NOOP */ }; 00030 00032 float W; 00033 00035 00039 float delay; 00040 virtual double getManagedDelay() const { return delay; }; 00041 00043 float U; 00045 float D; 00047 float F; 00049 float u0; 00051 float r0; 00053 float f0; 00054 00055 00056 virtual int reset( double dt ) 00057 { 00058 if (f0 >= 0.0) { 00059 u0 = U / (1.0 - (1.0-U) * exp(-1.0/(f0*F)) ); 00060 r0 = (1.0 - exp(-1.0/(f0*D))) / (1.0 - (1.0-u0) * exp(-1.0/(f0*D)) ); 00061 } 00062 00063 u = u0; 00064 r = r0; 00065 lastSpike = -1; 00066 SpikeResponse::reset( dt ); 00067 00068 return 0; 00069 } 00070 00071 virtual int spikeHit( spikeport_t port, SpikeEvent const& spike ) 00072 { 00073 if ( lastSpike > 0 ) { 00074 float isi = (float)( spike.time() - lastSpike ); 00075 r = 1.0 + (r*(1.0 - u) - 1.0)*exp(-isi/D); 00076 u = U + u*(1.0 - U)*exp(-isi/F); 00077 } 00078 00079 lastSpike = (float)spike.time(); 00080 00081 return SpikeResponse::spikeHit( port, SpikeEvent( spike, W * u * r ) ); 00082 } 00083 00084 private: 00086 float u; 00087 00089 float r; 00090 00092 float lastSpike; 00093 }; 00094 00095 #endif /*GENERICDYNAMICSPIKINGSYNAPSE_H_*/