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