Accessing Netcon.weight from NMODL before first Netcon event
Posted: Thu Dec 18, 2008 9:34 am
In a synaptic mechanism I wrote in NMODL, I attempted to read the value of the connecting Netcon.weight at intialization time. Specifically, my NET_RECEIVE block contained this line:
which executed *before* the first Netcon event occurred.
This didn't work. If I understand correctly, that's because NET_RECEIVE is a *function* (or a procedure, or a function-with-side-effects) and weight is a parameter passed to it when NEURON calls the function, which happens at the time of an event associated with the connecting Netcon. Prior to that, the weight parameter is undefined. The following code (Example 1) ...
... results in a bus error.
Seems to me NET_RECEIVE is both a function and not a function, depending on how one enters the code block. So, my first question is: Have I understood this correctly so far?
I next tried the following (Example 2):
This also doesn't work.
However, it fails *silently* No bus error -- it's just that the value of gmax is unaffected by this code as of t=0. The fact that there's no bus error makes me wonder if I've either 1) misunderstood what was going on in the previous example or 2) there's something about the nested NET_RECEIVE{INITIAL{}} block I don't understand.
So, my second question is: What exactly is going on here? When, exactly does the NET_RECEIVE{INITIAL{}} block execute (and does it execute once for each separate input stream?).
Finally, my third, broadest question is: can I, using only NMODL code, read the value of a connecting Netcon.weight *before* the first event associated with that Netcon (specificially, can I read it at initialization time)? (The mechanism must be compatable with existing, unmodified model in NEURON, so solutions involving modifications to the NEURON code are considered 'cheating.')
Code: Select all
gmax = weight
This didn't work. If I understand correctly, that's because NET_RECEIVE is a *function* (or a procedure, or a function-with-side-effects) and weight is a parameter passed to it when NEURON calls the function, which happens at the time of an event associated with the connecting Netcon. Prior to that, the weight parameter is undefined. The following code (Example 1) ...
Code: Select all
...
INITIAL {
...
net_send(0,99)
...
}
...
NET_RECEIVE (weight) {
...
IF (flag == 99) {
gmax = weight
}
}
Seems to me NET_RECEIVE is both a function and not a function, depending on how one enters the code block. So, my first question is: Have I understood this correctly so far?
I next tried the following (Example 2):
Code: Select all
NET_RECEIVE (weight) {
INITIAL {
gmax = weight
}
...
}
However, it fails *silently* No bus error -- it's just that the value of gmax is unaffected by this code as of t=0. The fact that there's no bus error makes me wonder if I've either 1) misunderstood what was going on in the previous example or 2) there's something about the nested NET_RECEIVE{INITIAL{}} block I don't understand.
So, my second question is: What exactly is going on here? When, exactly does the NET_RECEIVE{INITIAL{}} block execute (and does it execute once for each separate input stream?).
Finally, my third, broadest question is: can I, using only NMODL code, read the value of a connecting Netcon.weight *before* the first event associated with that Netcon (specificially, can I read it at initialization time)? (The mechanism must be compatable with existing, unmodified model in NEURON, so solutions involving modifications to the NEURON code are considered 'cheating.')