00001 #ifndef GENERICFACETSHWSYNAPSE_H_ 00002 #define GENERICFACETSHWSYNAPSE_H_ 00003 00004 #include "SimObject.h" 00005 00006 #include "ExponentialDecaySpikeResponse.h" 00007 #include "DoubleExponentialSpikeResponse.h" 00008 00009 #include "GenericCurrentBasedSpikingSynapse.h" 00010 #include "GenericConductanceBasedSpikingSynapse.h" 00011 00012 template<class SpikeResponse> 00013 class GenericFacetsHWDepressionSynapse : public SpikeResponse 00014 { 00015 public: 00016 GenericFacetsHWDepressionSynapse() : W(1e-9f), delay(2e-4f) 00017 { // NOOP 00018 }; 00019 00020 virtual ~GenericFacetsHWDepressionSynapse() 00021 { // NOOP 00022 }; 00023 00025 float W; 00026 00028 double inact; 00029 00031 double inact0; 00032 00034 double inact_tau; 00035 00037 double inact_step; 00038 00040 double max_dep; 00041 00043 00047 float delay; 00048 00049 virtual double getManagedDelay() const { return delay; }; 00050 00051 virtual int reset( double dt ) 00052 { 00053 inact = inact0; 00054 lastSpike = -1; 00055 00056 SpikeResponse::reset( dt ); 00057 00058 return 0; 00059 } 00060 00061 virtual int spikeHit( spikeport_t port, SpikeEvent const& spike ) 00062 { 00063 if ( lastSpike > 0 ) { 00064 float isi = (float)( spike.time() - lastSpike ); 00065 inact = inact*exp(-isi/inact_tau); 00066 } 00067 00068 double inact_old=inact; 00069 inact += inact_step*(1-inact); 00070 lastSpike = (float)spike.time(); 00071 00072 return SpikeResponse::spikeHit(port, SpikeEvent(spike, W*(1.0 - max_dep*inact_old))); 00073 } 00074 00075 private: 00077 float lastSpike; 00078 }; 00079 00080 00081 00082 template<class SpikeResponse> 00083 class GenericFacetsHWFacilitationSynapse : public SpikeResponse 00084 { 00085 public: 00086 GenericFacetsHWFacilitationSynapse() : W(1e-9f), delay(2e-4f) 00087 { // NOOP 00088 }; 00089 00090 virtual ~GenericFacetsHWFacilitationSynapse() 00091 { // NOOP 00092 }; 00093 00095 float W; 00096 00098 double act; 00099 00101 double act0; 00102 00104 double act_tau; 00105 00107 double act_step; 00108 00110 double max_fac; 00111 00113 double norm; 00114 00116 00120 float delay; 00121 virtual double getManagedDelay() const { return delay; }; 00122 00123 00124 virtual int reset( double dt ) 00125 { 00126 act = act0; 00127 lastSpike = -1; 00128 SpikeResponse::reset( dt ); 00129 00130 return 0; 00131 } 00132 00133 00134 virtual int spikeHit( spikeport_t port, SpikeEvent const& spike ) 00135 { 00136 if ( lastSpike > 0 ) { 00137 float isi = (float)( spike.time() - lastSpike ); 00138 act = act*exp(-isi/act_tau); 00139 } 00140 00141 double act_old=act; 00142 act += act_step*(1-act); 00143 lastSpike = (float)spike.time(); 00144 00145 return SpikeResponse::spikeHit(port, SpikeEvent( spike, W*(1 + max_fac*(act_old - norm) ))); 00146 } 00147 00148 private: 00150 float lastSpike; 00151 }; 00152 00153 #endif // GENERICFACETSHWSYNAPSE_H_