help please, Step input of current

NMODL and the Channel Builder.
Post Reply
shrbert724

help please, Step input of current

Post 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
}
}
ted
Site Admin
Posts: 6398
Joined: Wed May 18, 2005 4:50 pm
Location: Yale University School of Medicine
Contact:

Re: help please, Step input of current

Post 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?
shrbert724

Thank you

Post 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.
ted
Site Admin
Posts: 6398
Joined: Wed May 18, 2005 4:50 pm
Location: Yale University School of Medicine
Contact:

Re: Thank you

Post 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.
Post Reply