38 "Current output level.");
51 "Basal level of the stimulus",
55 "Amplitude of the first pulse in a sequence",
59 "Width of the first pulse in a sequence",
63 "Delay to start of the first pulse in a sequence",
67 "Amplitude of the second pulse in a sequence",
71 "Width of the second pulse in a sequence",
75 "Delay to start of of the second pulse in a sequence",
79 "Number of pulses in a sequence",
83 "Trigger mode for pulses in the sequence.\n"
84 " 0 : free-running mode where it keeps looping its output\n"
85 " 1 : external trigger, where it is triggered by an external input (and"
86 " stops after creating the first train of pulses)\n"
87 " 2 : external gate mode, where it keeps generating the pulses in a"
88 " loop as long as the input is high.",
92 "Level of the pulse at specified index",
96 "Width of the pulse at specified index",
100 "Delay of the pulse at specified index",
107 "Handle level value coming from other objects",
110 "Handle width value coming from other objects",
113 "Handle delay value coming from other objects",
117 "Handle incoming input that determines gating/triggering onset. "
118 "Note that although this is a double field, the underlying field is"
119 " integer. So fractional part of input will be truncated",
125 "Handles process call, updates internal time stamp.",
128 "Handles reinit call.",
130 static Finfo* processShared[] =
136 "This is a shared message to receive Process messages "
137 "from the scheduler objects."
138 "The first entry in the shared msg is a MsgDest "
139 "for the Process operation. It has a single argument, "
140 "ProcInfo, which holds lots of information about current "
141 "time, thread, dt and so on. The second entry is a MsgDest "
142 "for the Reinit operation. It also uses ProcInfo. ",
143 processShared,
sizeof( processShared ) /
sizeof(
Finfo* )
146 static Finfo* pulseGenFinfos[] = {
167 static string doc[] =
170 "Author",
"Subhasis Ray",
171 "Description",
"PulseGen: general purpose pulse generator. This can generate any "
172 "number of pulses with specified level and duration.",
178 sizeof(pulseGenFinfos)/
sizeof(
Finfo*),
181 sizeof(doc)/
sizeof(
string));
314 cout <<
"WARNING: invalid pulse count specified." << endl;
322 level_.resize(count, 0.0);
323 delay_.resize(count, 0.0);
324 width_.resize(count, 0.0);
334 if (index <
level_.size()){
337 cout <<
"WARNING: PulseGen::getLevel - invalid index." << endl;
344 if (index <
level_.size()){
347 cout <<
"WARNING: PulseGen::setLevel - invalid index. First set the number of pulses by setting 'count' field." << endl;
353 if (index <
width_.size()){
356 cout <<
"WARNING: PulseGen::getWidth - invalid index." << endl;
362 if ( index <
width_.size()){
365 cout <<
"WARNING: PulseGen::setWidth - invalid index. First set the number of pulses by setting 'count' field." << endl;
370 if ( index <
delay_.size()){
373 cout <<
"WARNING: PulseGen::getDelay - invalid index." << endl;
380 if ( index <
delay_.size() ){
383 cout <<
"WARNING: PulseGen::setDelay - invalid index. First set the number of pulses by setting 'count' field." << endl;
403 for (
unsigned int ii = 1; ii <
width_.size() && (
width_[ii] > 0.0 || delay_[ii] > 0.0); ++ii){
411 phase = fmod(currentTime, period);
439 phase = fmod(currentTime -
trigTime_, period);
444 cerr <<
"ERROR: PulseGen::newProcessFunc( const Conn* , ProcInfo ) - invalid triggerMode - " <<
trigMode_ << endl;
446 if (phase >= period){
452 for (
unsigned int ii = 0; ii <
width_.size(); ++ii){
453 if (phase < delay_[ii]){
456 }
else if (phase < delay_[ii] +
width_[ii]){
double getWidth(unsigned int index) const
static const Cinfo * initCinfo()
static const int EXT_GATE
void setWidth(unsigned int pulseNo, double width)
void setLevel(unsigned int pulseNo, double level)
double getSecondWidth() const
void reinit(const Eref &e, ProcPtr p)
void setCount(unsigned int count)
double getFirstWidth() const
int getPreviousInput() const
void setDelay(unsigned int pulseNo, double delay)
void setSecondWidth(double value)
double getBaseLevel() const
static SrcFinfo1< double > * output()
double getSecondDelay() const
void setSecondDelay(double value)
unsigned int getCount() const
double getFirstLevel() const
void setTrigMode(unsigned int value)
void setFirstWidth(double value)
void setFirstLevel(double value)
static const int FREE_RUN
unsigned int getTrigMode() const
double getLevel(unsigned int index) const
static const Cinfo * initCinfo()
static const int EXT_TRIG
void process(const Eref &e, ProcPtr p)
double getFirstDelay() const
void setBaseLevel(double value)
double getSecondLevel() const
double getDelay(unsigned int index) const
void setFirstDelay(double value)
void setSecondLevel(double value)
static const Cinfo * pulseGenCinfo
static SrcFinfo1< double > * outputOut()