1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55
|
COMMENT
ipulse3.mod
Generates a current pulse when it receives an input event.
User specifies dur (pulse duration).
Ignores events that arrive during an ongoing pulse.
2/3/2012 NTC
ENDCOMMENT
NEURON {
POINT_PROCESS Ipulse3
RANGE dur, amp, i
ELECTRODE_CURRENT i
}
UNITS {
(nA) = (nanoamp)
}
PARAMETER {
dur (ms) <0, 1e9> : duration of ON phase
amp (nA) : how big
}
ASSIGNED {
ival (nA)
i (nA)
on
}
INITIAL {
on = 0
i = 0
ival = 0
}
BREAKPOINT {
i = ival
}
NET_RECEIVE (w) {
if (flag == 0) { : not a self event
if (on == 0) {
: turn it on
ival = amp
on = 1
: prepare to turn it off
net_send(dur, 1)
}
} else { : a self event
: turn it off
ival = 0
on = 0
}
}
|