00001 #ifndef _GENERICNMDASYNAPSE_H_ 00002 #define _GENERICNMDASYNAPSE_H_ 00003 00004 #include "SimObject.h" 00005 #include "SimNetwork.h" 00006 #include "InputTargetTypes.h" 00007 #include "PCSIMException.h" 00008 00009 #include "ExponentialDecaySpikeResponse.h" 00010 #include "AlphaFunctionSpikeResponse.h" 00011 #include "DoubleExponentialSpikeResponse.h" 00012 00013 #include <cmath> 00014 00015 00017 00020 template<class Response> 00021 class GenericNMDASynapse : public Response 00022 { 00023 public: 00024 GenericNMDASynapse() 00025 { 00026 Erev = 0.0; 00027 Mg_conc = 1.2e-3; 00028 target = &dummyConductanceBasedSynapseTarget; 00029 }; 00030 00031 virtual ~GenericNMDASynapse() 00032 { // NOOP 00033 }; 00034 00036 float Erev; 00037 00039 float Mg_conc; 00040 00041 virtual int advance(AdvanceInfo const &ai) 00042 { 00043 double Vm=target->getVm(); 00044 double s=1.0/(1.0+exp(-62.0*Vm)*Mg_conc*1000.0/3.57); 00045 00046 // another possible implementation from Izhikevich, Edelmann 00047 // Vm=Vm*1000; 00048 // double s = pow(((Vm+80)/60), 2)/(1+pow(((Vm+80)/60), 2)); 00049 00050 target->conductanceInput(s*Response::psr, Erev); 00051 00052 return Response::advance(ai); 00053 } 00054 00056 virtual void outgoing(SimObject *receiver, SimObject::ID const& rec, SimObject::ID const& self, SimNetwork & net ) 00057 { 00058 ConductanceInputTarget *t = dynamic_cast<ConductanceInputTarget *>(receiver); 00059 if(t) { 00060 target = t; 00061 } 00062 else { 00063 throw( 00064 PCSIM::Exception( "GenericNMDASynapse::outgoing", make_string( "Object must be a ConductanceBasedSynapseTarget; which %s is not!\n", typeid(*receiver).name() ) ) 00065 ); 00066 } 00067 } 00068 00069 protected: 00071 ConductanceInputTarget *target; 00072 }; 00073 00074 00075 #endif //_GENERICNMDASYNAPSE_H_