00001 #ifndef ANALOGPOINTNEURON_H_ 00002 #define ANALOGPOINTNEURON_H_ 00003 00004 #include "InputTargetTypes.h" 00005 #include "SimObject.h" 00006 #include "ThreadSpecificRandomDistribution.h" 00007 00009 00026 class AnalogPointNeuron : public SimObject, public ConductanceInputTarget 00027 { 00028 public: 00029 AnalogPointNeuron(); 00030 virtual ~AnalogPointNeuron(); 00031 00033 double Vm; 00034 00036 double Inoise; 00037 00039 double Iinject; 00040 00042 double Rm; 00043 00044 virtual double getAnalogOutput(analog_port_id_t port = 0) const 00045 { 00046 return Vm; 00047 } 00048 00049 virtual void setAnalogInput(double i, analog_port_id_t port = 0) 00050 { 00051 Isyn += i; 00052 } 00053 00054 virtual int advance(AdvanceInfo const &) 00055 { 00056 if( Inoise > 0 ) { 00057 Vm = ( Isyn + Iinject + Inoise * noise() ) / ( Gsyn + 1.0 / Rm ); 00058 } else { 00059 Vm = ( Isyn + Iinject ) / ( Gsyn + 1.0 / Rm ); 00060 } 00061 // clear synaptic input for next time step 00062 clearSynapticInput(); 00063 return 0; 00064 } 00065 00066 virtual int reset( double dt ) 00067 { 00068 clearSynapticInput(); 00069 noise.set( NormalDistribution( 0.0, 1.0 ) ); 00070 advance( AdvanceInfo( Time::sec(dt) ) ); 00071 return 0; 00072 } 00073 00074 virtual double getManagedDelay() const { return 0; } 00075 virtual int nSpikeInputPorts() const { return 0; }; 00076 virtual int nSpikeOutputPorts() const { return 0; }; 00077 virtual int nAnalogInputPorts() const { return MAX_PORT_NUMBER; }; 00078 virtual int nAnalogOutputPorts() const { return 1; }; 00079 00080 virtual PortType outputPortType(port_t o) const 00081 { 00082 if( o<1 ) return analog; else return undefined; 00083 }; 00084 00085 virtual PortType inputPortType(port_t i) const 00086 { 00087 return analog; 00088 }; 00089 00090 virtual void clearSynapticInput(void); 00091 virtual void currentInput( double i ); 00092 virtual void conductanceInput( double g, double Erev ); 00093 00094 00095 protected: 00096 double Isyn; 00097 double Gsyn; 00098 00100 static ThreadSpecificRandomDistribution< NormalDistribution > noise; 00101 00102 }; 00103 00104 inline void AnalogPointNeuron::clearSynapticInput(void) 00105 { 00106 Isyn = Gsyn = 0; 00107 } 00108 00109 inline void AnalogPointNeuron::currentInput( double i ) 00110 { 00111 Isyn += i; 00112 } 00113 00114 inline void AnalogPointNeuron::conductanceInput( double g, double Erev ) 00115 { 00116 Gsyn += g; 00117 Isyn += (g*Erev); 00118 } 00119 00120 #endif /*ANALOGPOINTNEURON_H_*/