how many are there open channel number in my stochastic mode

The basics of how to develop, test, and use models.
Post Reply
okanerkaymaz

how many are there open channel number in my stochastic mode

Post by okanerkaymaz »

hi , everbody

i want to sum open channel number while program is runing so i want to write function in hoc file and i loaded that hoc file
but it didn't find open channel number
t=0
proc findopen()
{

t+=DDINa[0].O
print t
}


findopen()

i am writing above codes in neuron hoc file
i dont understand why it doesn't run
unfortunately i didn't it
please help?


regards
ted
Site Admin
Posts: 6394
Joined: Wed May 18, 2005 4:50 pm
Location: Yale University School of Medicine
Contact:

Re: how many are there open channel number in my stochastic

Post by ted »

okanerkaymaz wrote:i want to sum open channel number while program is runing
First, avoid using a reserved keyword for the sum (in NEURON, t has a special
meaning: time). Second, the sum must be set to 0 during initialization, and the proc
must be executed at every fadvance(). This is easy to do if you are using the standard
run system--which you are almost certainly doing.

This code should do the job. proc advance() redefines the standard run system's own
advance(), so just be sure to load the following code _after_ load_file("nrngui.hoc")
and after loading any ses files.

Code: Select all

opensum=0

proc findopen {
  opensum+=DDINa[0].O
  print opensum
}

// use an FInitializeHandler to force opensum to 0 at initialization
objref fih
fih = new FInitializeHandler("opensum=0")  

// custom advance()
proc advance() {
  fadvance()
  findopen()
}
okanerkaymaz

Post by okanerkaymaz »

thanks Ted
But i don't work it .
i am sorry so much
i can't nmodl in Neuron

i loaded cell.hoc and channels.ses after
i loaded my.hoc
my.hoc file is folowing
Area = 100 // um2

// argument should be desired area in um2
proc setarea() {
L = Area/diam/PI
DDINa[0].Nsingle = 60 * Area
ddhhkp[0].Nsingle = 18 * Area
}

opensum=0

proc findopen {
opensum+=DDINa[0].O
print opensum
}

// use an FInitializeHandler to force opensum to 0 at initialization
objref fih
fih = new FInitializeHandler("opensum=0")

// custom advance()
proc advance() {
fadvance()
findopen()
}

setarea()

{
xpanel("ok", 0)
xvalue("Area (um2)","Area", 1,"setarea()", 0, 1 )
xpanel(431,392)
}


where am I doing wrong ?

i don't understand define a variable how i will use it
can you link me about nmodl application examples ?

regards
ted
Site Admin
Posts: 6394
Joined: Wed May 18, 2005 4:50 pm
Location: Yale University School of Medicine
Contact:

Post by ted »

where am I doing wrong ?
What did you expect to happen when you ran a simulation? What actually did happen?
i don't understand define a variable how i will use it
I don't understand your question.
can you link me about nmodl application examples ?

NMODL doesn't seem to have anything to do with making your program work--you're
apparently using the Channel Builder. If you absolutely must read about NMODL, see
chapter 9 of The NEURON Book, or read
"Expanding NEURON's Repertoire of Mechanisms with NMODL"
(see the Documentation page
http://www.neuron.yale.edu/neuron/docs
for a link to download that paper). But it's not going to help you make my.hoc work.


You can make your life easier by creating a new file called init.hoc
init.hoc should contain these statements:

Code: Select all

load_file("nrngui.hoc")
load_file("channels.ses") // Channel Builders
load_file("cell.hoc")
load_file("my.hoc")
Double clicking on init.hoc will make NEURON load all your ses and hoc files automatically.


my.hoc is disorganized. Program development and debugging will be easiest if you use
a modular programming style. Try to keep these separate from each other:
--specification of biological properties
--specification of user interface and "instrumentation" ("instrumentation" includes
stimulators and anything that displays or reports the values of variables during a
simulation)
--specification of simulation control

Here is an example of a properly structured my.hoc:

Code: Select all

/* this is part of specification of biological properties */

Area = 100 // um2

// argument should be desired area in um2
proc setarea() {
  L = Area/diam/PI
  DDINa[0].Nsingle = 60 * Area
  ddhhkp[0].Nsingle = 18 * Area
}

setarea()


/* this is part of specification of user interface and "instrumentation" */

{
xpanel("ok", 0)
xvalue("Area (um2)","Area", 1,"setarea()", 0, 1 )
xpanel(431,392)
}

opensum=0 

proc findopen { 
  opensum+=DDINa[0].O 
  print opensum 
} 


/* this is part of specification of simulation control */

// use an FInitializeHandler to force opensum to 0 at initialization 
objref fih 
fih = new FInitializeHandler("opensum=0") 

// custom advance() 
proc advance() { 
  fadvance() 
  findopen() 
}
okanerkaymaz

Post by okanerkaymaz »

dear Ted
i wrote your code and i run my simulation
but that code don't run in neuron also it created a error message in sh that is folowing message
////////////////
nrniv: syntax error
in bufonk.hoc near line 21
proc findopen {
^
xopen("bufonk.hoc" )
execute1("{xopen("bufonk.hoc")}" )
load_file("bufonk.hoc" )
0
nrniv: Segmentation violation
in bufonk.hoc near line 22
opensum+=DDINa[0].O
//////////////////////////////
ERROR code
where did i wrong ?
ted
Site Admin
Posts: 6394
Joined: Wed May 18, 2005 4:50 pm
Location: Yale University School of Medicine
Contact:

Post by ted »

Ouch. I made a mistake. Since this is a syntax error, the error message is a good
clue to what is wrong:

Code: Select all

nrniv: syntax error
 in bufonk.hoc near line 21
 proc findopen { 
               ^
Notice that the carat ^ points right at the place where the problem arises.

The definition of findopen should include (), like this:

Code: Select all

proc findopen() {
  opensum+=DDINa[0].O
  print opensum
}
This is exactly the kind of silly mistake that can cause a lot of headaches. Is there a
lesson here?
1. Anybody can make a mistake.
2. Be sure to check your work.
3. Be very sure to check everybody else's work.

A footnote: you can increase the legibility of code in these messages by selecting the
code with the mouse, then clicking on the Code button (just below the Subject line).
Post Reply