00001 #ifndef DblExpSpikeResponse_H_
00002 #define DblExpSpikeResponse_H_
00003
00004 #include "EvSimObject.h"
00005 #include "DirectEventSender.h"
00006 #include "SpikeResponse.h"
00007 #include "EvSimObjectTypeUtils.h"
00008
00009
00010 class DblExpSpikeResponse : public SpikeResponse, public DirectEventSender {
00011
00012 EV_SIM_OBJECT( DblExpSpikeResponse )
00013
00014 public:
00015
00016 DblExpSpikeResponse(double tau_rise, double tau_fall, Time t_update)
00017 : t_update(t_update), tau_rise(tau_rise), tau_fall(tau_fall)
00018 {}
00019
00020 virtual ~DblExpSpikeResponse() {};
00021
00022 virtual void eventHit(SimContext & sim_info, Time time, port_id_t port);
00023
00024 virtual void updateState(SimContext &sim_info, Time time, update_id_t upd_id) {};
00025
00026 virtual unsigned numInputPorts() const
00027 {
00028 return 2;
00029 };
00030
00031 virtual unsigned numOutputPorts() const
00032 {
00033 return 1;
00034 };
00035
00036
00037 virtual PortType getInputPortType(port_id_t p) const
00038 {
00039 if (p < 2)
00040 return eventPortDirect;
00041 return portUndefined;
00042 };
00043
00044 virtual PortType getOutputPortType(port_id_t p) const
00045 {
00046 if (p == 0)
00047 return eventPortDirect;
00048 return portUndefined;
00049 };
00050
00051 virtual void reset(SimContext &sim_ctxt)
00052 {
00053 last_update_time = 0;
00054 r = r_old = r_rise = r_fall = 0;
00055 };
00056
00057 virtual void postAddedInNetwork(EvSimNetwork &net, EvSimObject::ID self);
00058
00059 protected:
00060 static const double MIN_VM = 10E-5;
00061 const Time t_update;
00062 const double tau_rise;
00063 const double tau_fall;
00064
00065 double r_rise;
00066 double r_fall;
00067
00068 Time last_update_time;
00069 };
00070
00071 #endif
00072