MOOSE - Multiscale Object Oriented Simulation Environment
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
SpikeGen Class Reference

#include <SpikeGen.h>

+ Collaboration diagram for SpikeGen:

Public Member Functions

bool getEdgeTriggered () const
 
bool getFired () const
 
double getRefractT () const
 
double getThreshold () const
 
void handleVm (double val)
 
void process (const Eref &e, ProcPtr p)
 
void reinit (const Eref &e, ProcPtr p)
 
void setEdgeTriggered (bool yes)
 
void setRefractT (double val)
 
void setThreshold (double threshold)
 
 SpikeGen ()
 

Static Public Member Functions

static const CinfoinitCinfo ()
 

Private Attributes

bool edgeTriggered_
 
bool fired_
 
double lastEvent_
 
double refractT_
 
double threshold_
 
double V_
 

Detailed Description

Definition at line 13 of file SpikeGen.h.

Constructor & Destructor Documentation

SpikeGen::SpikeGen ( )

Definition at line 122 of file SpikeGen.cpp.

123  : threshold_(0.0),
124  refractT_(0.0),
125  lastEvent_(0.0),
126  V_(0.0),
127  fired_( 0 ),
128  edgeTriggered_(1)
129 {;}
double threshold_
Definition: SpikeGen.h:49
double refractT_
Definition: SpikeGen.h:50
double V_
Definition: SpikeGen.h:52
double lastEvent_
Definition: SpikeGen.h:51
bool edgeTriggered_
Definition: SpikeGen.h:54
bool fired_
Definition: SpikeGen.h:53

Member Function Documentation

bool SpikeGen::getEdgeTriggered ( ) const

Definition at line 183 of file SpikeGen.cpp.

References edgeTriggered_.

Referenced by initCinfo().

184 {
185  return edgeTriggered_;
186 }
bool edgeTriggered_
Definition: SpikeGen.h:54

+ Here is the caller graph for this function:

bool SpikeGen::getFired ( ) const

Definition at line 174 of file SpikeGen.cpp.

References fired_.

Referenced by initCinfo().

175 {
176  return fired_;
177 }
bool fired_
Definition: SpikeGen.h:53

+ Here is the caller graph for this function:

double SpikeGen::getRefractT ( ) const

Definition at line 149 of file SpikeGen.cpp.

References refractT_.

Referenced by initCinfo().

150 {
151  return refractT_;
152 }
double refractT_
Definition: SpikeGen.h:50

+ Here is the caller graph for this function:

double SpikeGen::getThreshold ( ) const

Definition at line 140 of file SpikeGen.cpp.

References threshold_.

Referenced by initCinfo().

141 {
142  return threshold_;
143 }
double threshold_
Definition: SpikeGen.h:49

+ Here is the caller graph for this function:

void SpikeGen::handleVm ( double  val)

Definition at line 214 of file SpikeGen.cpp.

References V_.

Referenced by initCinfo(), and SpikeGenStruct::send().

215 {
216  V_ = val;
217 }
double V_
Definition: SpikeGen.h:52

+ Here is the caller graph for this function:

const Cinfo * SpikeGen::initCinfo ( )
static

Definition at line 22 of file SpikeGen.cpp.

References getEdgeTriggered(), getFired(), getRefractT(), getThreshold(), handleVm(), Neutral::initCinfo(), process(), reinit(), setEdgeTriggered(), setRefractT(), setThreshold(), spikeGenCinfo, and spikeOut().

Referenced by HSolveActive::readSynapses().

23 {
25  // Shared message definitions
27  static DestFinfo process( "process",
28  "Handles process call",
30  static DestFinfo reinit( "reinit",
31  "Handles reinit call",
33 
34  static Finfo* processShared[] =
35  {
36  &process, &reinit
37  };
38 
39  static SharedFinfo proc( "proc",
40  "Shared message to receive Process message from scheduler",
41  processShared, sizeof( processShared ) / sizeof( Finfo* ) );
42 
44  // Dest Finfos.
46  static DestFinfo Vm( "Vm",
47  "Handles Vm message coming in from compartment",
49 
51  // Value Finfos.
53 
54  static ValueFinfo< SpikeGen, double > threshold( "threshold",
55  "Spiking threshold, must cross it going up",
58  );
59  static ValueFinfo< SpikeGen, double > refractT( "refractT",
60  "Refractory Time.",
63  );
64  static ValueFinfo< SpikeGen, double > absRefract( "abs_refract",
65  "Absolute refractory time. Synonym for refractT.",
68  );
69  static ReadOnlyValueFinfo< SpikeGen, bool > hasFired( "hasFired",
70  "True if SpikeGen has just fired",
72  );
73  static ValueFinfo< SpikeGen, bool > edgeTriggered( "edgeTriggered",
74  "When edgeTriggered = 0, the SpikeGen will fire an event in each "
75  "timestep while incoming Vm is > threshold and at least abs_refract"
76  "time has passed since last event. This may be problematic if the "
77  "incoming Vm remains above threshold for longer than abs_refract. "
78  "Setting edgeTriggered to 1 resolves this as the SpikeGen generates"
79  "an event only on the rising edge of the incoming Vm and will "
80  "remain idle unless the incoming Vm goes below threshold.",
83  );
84 
85  static Finfo* spikeGenFinfos[] =
86  {
87  spikeOut(), // SrcFinfo
88  &proc, // Shared
89  &Vm, // Dest
90  &threshold, // Value
91  &refractT, // Value
92  &absRefract, // Value
93  &hasFired, // ReadOnlyValue
94  &edgeTriggered, // Value
95 
96  };
97 
98  static string doc[] =
99  {
100  "Name", "SpikeGen",
101  "Author", "Upi Bhalla",
102  "Description", "SpikeGen object, for detecting threshold crossings."
103  "The threshold detection can work in multiple modes.\n "
104  "If the refractT < 0.0, then it fires an event only at the rising "
105  "edge of the input voltage waveform"
106  };
107  static Dinfo< SpikeGen > dinfo;
108  static Cinfo spikeGenCinfo(
109  "SpikeGen",
111  spikeGenFinfos, sizeof( spikeGenFinfos ) / sizeof( Finfo* ),
112  &dinfo,
113  doc,
114  sizeof(doc)/sizeof(string)
115  );
116 
117  return &spikeGenCinfo;
118 }
Definition: Dinfo.h:60
void setThreshold(double threshold)
Definition: SpikeGen.cpp:136
bool getEdgeTriggered() const
Definition: SpikeGen.cpp:183
static const Cinfo * spikeGenCinfo
Definition: SpikeGen.cpp:120
double getThreshold() const
Definition: SpikeGen.cpp:140
static SrcFinfo1< double > * spikeOut()
Definition: SpikeGen.cpp:16
void process(const Eref &e, ProcPtr p)
Definition: SpikeGen.cpp:192
void handleVm(double val)
Definition: SpikeGen.cpp:214
Definition: OpFunc.h:27
void setEdgeTriggered(bool yes)
Definition: SpikeGen.cpp:179
static const Cinfo * initCinfo()
Definition: Neutral.cpp:16
bool getFired() const
Definition: SpikeGen.cpp:174
void reinit(const Eref &e, ProcPtr p)
Definition: SpikeGen.cpp:209
double getRefractT() const
Definition: SpikeGen.cpp:149
Definition: Cinfo.h:18
Definition: Finfo.h:12
void setRefractT(double val)
Definition: SpikeGen.cpp:145

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void SpikeGen::process ( const Eref e,
ProcPtr  p 
)

Definition at line 192 of file SpikeGen.cpp.

References ProcInfo::currTime, ProcInfo::dt, edgeTriggered_, fired_, lastEvent_, refractT_, spikeOut(), threshold_, and V_.

Referenced by initCinfo(), and SpikeGenStruct::send().

193 {
194  double t = p->currTime;
195  if ( V_ > threshold_ ) {
196  if ((t + p->dt/2.0) >= (lastEvent_ + refractT_)) {
197  if ( !( edgeTriggered_ && fired_ ) ) {
198  spikeOut()->send( e, t );
199  lastEvent_ = t;
200  fired_ = true;
201  }
202  }
203  } else {
204  fired_ = false;
205  }
206 }
double threshold_
Definition: SpikeGen.h:49
double currTime
Definition: ProcInfo.h:19
double refractT_
Definition: SpikeGen.h:50
static SrcFinfo1< double > * spikeOut()
Definition: SpikeGen.cpp:16
double V_
Definition: SpikeGen.h:52
double lastEvent_
Definition: SpikeGen.h:51
double dt
Definition: ProcInfo.h:18
bool edgeTriggered_
Definition: SpikeGen.h:54
bool fired_
Definition: SpikeGen.h:53

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void SpikeGen::reinit ( const Eref e,
ProcPtr  p 
)

Definition at line 209 of file SpikeGen.cpp.

References lastEvent_, and refractT_.

Referenced by initCinfo(), and SpikeGenStruct::reinit().

210 {
211  lastEvent_ = -refractT_ ;
212 }
double refractT_
Definition: SpikeGen.h:50
double lastEvent_
Definition: SpikeGen.h:51

+ Here is the caller graph for this function:

void SpikeGen::setEdgeTriggered ( bool  yes)

Definition at line 179 of file SpikeGen.cpp.

References edgeTriggered_.

Referenced by initCinfo().

180 {
181  edgeTriggered_ = yes;
182 }
bool edgeTriggered_
Definition: SpikeGen.h:54

+ Here is the caller graph for this function:

void SpikeGen::setRefractT ( double  val)

Definition at line 145 of file SpikeGen.cpp.

References refractT_.

Referenced by initCinfo().

146 {
147  refractT_ = val;
148 }
double refractT_
Definition: SpikeGen.h:50

+ Here is the caller graph for this function:

void SpikeGen::setThreshold ( double  threshold)

Definition at line 136 of file SpikeGen.cpp.

References threshold_.

Referenced by initCinfo().

137 {
138  threshold_ = threshold;
139 }
double threshold_
Definition: SpikeGen.h:49

+ Here is the caller graph for this function:

Member Data Documentation

bool SpikeGen::edgeTriggered_
private

Definition at line 54 of file SpikeGen.h.

Referenced by getEdgeTriggered(), process(), and setEdgeTriggered().

bool SpikeGen::fired_
private

Definition at line 53 of file SpikeGen.h.

Referenced by getFired(), and process().

double SpikeGen::lastEvent_
private

Definition at line 51 of file SpikeGen.h.

Referenced by process(), and reinit().

double SpikeGen::refractT_
private

Definition at line 50 of file SpikeGen.h.

Referenced by getRefractT(), process(), reinit(), and setRefractT().

double SpikeGen::threshold_
private

Definition at line 49 of file SpikeGen.h.

Referenced by getThreshold(), process(), and setThreshold().

double SpikeGen::V_
private

Definition at line 52 of file SpikeGen.h.

Referenced by handleVm(), and process().


The documentation for this class was generated from the following files: