File: compartment.g

package info (click to toggle)
genesis 2.1-1.1
  • links: PTS
  • area: main
  • in suites: potato
  • size: 14,288 kB
  • ctags: 10,667
  • sloc: ansic: 111,959; makefile: 2,240; yacc: 1,797; lex: 976; csh: 54; sh: 13
file content (48 lines) | stat: -rw-r--r-- 1,254 bytes parent folder | download | duplicates (5)
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
//genesis
/* compartment.g

	functions defined in this script
=============================================================================
	FUNCTION NAME		ARGUMENTS
=============================================================================
	makecompartment		(path,l,d,Erest)
	setcompartment		(path,l,d,Erest)
=============================================================================
*/

//=================================================
//                    COMPARTMENT
//=================================================
function makecompartment(path, l, d, Erest)
    str path
    float l, d
    float Erest
    float area = l*{PI}*d
    float xarea = {PI}*d*d/4
    /* global variables defined in cable.g
    float RM				// Kohm-cm^2
    float CM				// uF/cm^2
    float RA				// Kohm-cm
*/
    create compartment {path}
    // mV
    // Kohm
    // uF
    // Kohm
    setfield {path} Em {Erest} Rm {{RM}/area} Cm {{CM}*area}  \
        Ra {{RA}*l/xarea}
end

function setcompartment(path, l, d, Erest)
    str path
    float l, d
    float Erest
    float area = l*{PI}*d
    float xarea = {PI}*d*d/4
    // mV
    // Kohm
    // uF
    // Kohm
    setfield {path} Em {Erest} Rm {{RM}/area} Cm {{CM}*area}  \
        Ra {{RA}*l/xarea}
end