00001 #ifndef _GENERICGABASYNAPSE_H_
00002 #define _GENERICGABASYNAPSE_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 "DoubleExponentialSpikeResponse.h"
00011 #include "AlphaFunctionSpikeResponse.h"
00012
00013 #include <cmath>
00014
00016
00019 template<class Response>
00020 class GenericGABASynapse : public Response
00021 {
00022 public:
00023 GenericGABASynapse()
00024 {
00025 fract_A = 0.5;
00026 scale_B = 1.0;
00027
00028 Erev_A = -70.0e-3;
00029 Erev_B = -90.0e-3;
00030
00031 target = &dummyConductanceBasedSynapseTarget;
00032 };
00033
00034 virtual ~GenericGABASynapse()
00035 {
00036 };
00037
00039 float Erev_A;
00040
00042 float Erev_B;
00043
00045 float fract_A;
00046
00048 float scale_B;
00049
00050
00052 virtual int adjust(double dt)
00053 {
00054 resp_A.adjust(dt);
00055 return Response::adjust(dt);
00056 }
00057
00059 virtual int reset(double dt)
00060 {
00061 resp_A.reset(dt);
00062 return Response::reset(dt);
00063 }
00064
00065 virtual int spikeHit(spikeport_t port, SpikeEvent const& spike)
00066 {
00067 resp_A.spikeHit(port, spike);
00068 return Response::spikeHit(port, spike);
00069 }
00070
00071 virtual int advance(AdvanceInfo const &ai)
00072 {
00073 target->conductanceInput(fract_A*resp_A.psr, Erev_A);
00074 target->conductanceInput((1.0-fract_A)*scale_B*Response::psr, Erev_B);
00075
00076 resp_A.advance(ai);
00077 return Response::advance(ai);
00078 };
00079
00081 virtual void outgoing(SimObject *receiver, SimObject::ID const& rec, SimObject::ID const& self, SimNetwork & net )
00082 {
00083 ConductanceInputTarget *t = dynamic_cast<ConductanceInputTarget *>(receiver);
00084 if(t) {
00085 target = t;
00086 }
00087 else {
00088 throw(
00089 PCSIM::Exception( "GenericGlutamateSynapse::outgoing", make_string( "Object must be a ConductanceBasedSynapseTarget; which %s is not!\n", typeid(*receiver).name() ) )
00090 );
00091 }
00092 }
00093
00094 virtual double getAnalogOutput(analog_port_id_t p) const
00095 {
00096 if (p == 0)
00097 return resp_A.psr;
00098
00099 return Response::getAnalogOutput(p-1);
00100 };
00101
00102 protected:
00104 Response resp_A;
00105
00107 ConductanceInputTarget *target;
00108 };
00109
00110
00111 #endif //_GENERICGABASYNAPSE_H_