Page 1 of 1

help please, Step input of current

Posted: Tue Jun 12, 2007 2:14 pm
by shrbert724
How do I change the current during a simulation at a specific time step. i've tried using a if (t>400) { app_stn.Iamp=100 } statement both within the stn declaration and outside the stn declaration but nothing is changing.


load_file("nrngui.hoc")
create stn
stn {
insert STN

el_STN = -60.0
ek = -80.0
ena = 55.0
eca = 140.0
ett = 140.0
eahp = -80.0


cm = 100
diam = 5.5
L = 11

app_stn=new ISine(0.5)
app_stn.Ibase = 5
app_stn.Iamp = 50
app_stn.Ifreq = 12

vstn = new Vector()
apstn = new APCount(0.5)
apstn.record(vstn)
}

forall nseg=1
access stn

I want to change the app_stn.Iamp at a certain time, and then change it back but I can't even figure out how to change it.


this is my Isine mod file
NEURON {
POINT_PROCESS ISine
RANGE Ibase, Iamp, Ifreq, i
ELECTRODE_CURRENT i
}

UNITS {
(nA) = (nanoamp)
}


PARAMETER {
Ibase (nA)
Iamp (nA)
Ifreq (1/ms)
}

ASSIGNED { i (nA) }

INITIAL {
i = 0
}

BREAKPOINT {
i = Ibase + (Iamp * sin((2*3.14/1000)*Ifreq * t))
if (i< Ibase) {
i = Ibase
} else {
i = i
}
}

Re: help please, Step input of current

Posted: Tue Jun 12, 2007 4:15 pm
by ted
shrbert724 wrote:I want to change the app_stn.Iamp at a certain time, and then change it back
Use FInitializeHandler and cvode.event. See
"How to change parameters during a simulation"
https://www.neuron.yale.edu/phpBB2/viewtopic.php?t=163

Questions about this:

Code: Select all

BREAKPOINT {
	i = Ibase + (Iamp * sin((2*3.14/1000)*Ifreq * t))
        if (i< Ibase) {
            i = Ibase
        } else {
            i = i 
        }
}
1. Why not use PI instead of 3.14?
2. If frequency has units (/ms) then it is a mistake to divide 2*PI by 1000.
3. Why have an else { } clause?

Thank you

Posted: Wed Jun 13, 2007 2:39 pm
by shrbert724
Thank you, I'm working to make someone else's code better than it was and its a very fluid process. I keep running into new problems and its my first time using neuron. I figured out how to change the current with some if statements based on timing and changing the components of the current at those times.

Re: Thank you

Posted: Wed Jun 13, 2007 2:46 pm
by ted
shrbert724 wrote:I'm working to make someone else's code better than it was
If that is your goal, you definitely do not want to
change the current with some if statements based on timing and changing the components of the current at those times.
Instead you should use the facilities offered by the standard run system for accomplishing
parameter changes in mid-run under program control--specifically FInitializeHandler and
cvode.event.