Changeset 11977 in project
- Timestamp:
- 09/22/08 09:46:59 (12 years ago)
- Location:
- release/3/nemo/trunk
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
release/3/nemo/trunk/SXML.scm
r11944 r11977 41 41 (define (sxml:kidn name node) 42 42 ((select-first-kid (lambda (x) (eq? (car x) name))) node)) 43 44 ;; obtain non-empty child named n of a node 45 (define (sxml:kidn* name node) 46 ((select-first-kid (lambda (x) (and (eq? (car x) name) (not (null? (cdr x)))))) node)) 43 47 44 48 ;; obtain the cdr of child named n -
release/3/nemo/trunk/core.scm
r11944 r11977 251 251 (environment-extend! env (nemo-intern 'name) (SYSNAME name)) 252 252 (environment-extend! env (nemo-intern 'exports) (EXPORTS (list))) 253 (environment-extend! env (nemo-intern 'toplevel) (COMPONENT 'toplevel (list))) 253 254 env)) 254 255 … … 311 312 (environment-extend! nemo-env sym (CONST name initial)))) 312 313 313 (('tscomp) (let ((power (or (lookup-def 'power alst) 1)) 314 (('tscomp) (begin 315 (let ((power (or (lookup-def 'power alst) 1)) 314 316 (transitions (map (lambda (t) 315 (print "t = " t)316 317 `(-> ,(second t) ,(third t) ,(normalize-expr (fourth t )))) 317 318 (or (alist-ref 'transitions alst) (list)))) … … 327 328 " requires an integer power (" power " was given)")) 328 329 (let ((en (TSCOMP name initial open transitions power))) 329 (environment-extend! nemo-env sym en)))) 330 (environment-extend! nemo-env sym en))))) 330 331 331 332 (('asgn) (let ((rhs (lookup-def 'rhs alst))) … … 401 402 (('if . es) (fold (enumconsts lb) ax es)) 402 403 ((s . es) (if (symbol? s) (cons s (fold (enumconsts lb) ax es)) ax)) 403 (s (cond 404 ((and (symbol? s) (not (member s lb)) (environment-includes? base-env s)) 405 (cons s ax) ) 406 ((and (symbol? s) (not (member s lb))) 407 (nemo:error 'defun ": quantity " s " not defined")) 408 (else ax)))))))) 404 (s (begin 405 (print "lb = " lb) 406 (print "s = " s) 407 (print "(member s lb) = " (member s lb)) 408 (cond 409 ((and (symbol? s) (not (member s lb)) (environment-includes? base-env s)) 410 (cons s ax) ) 411 ((and (symbol? s) (not (member s lb))) 412 (nemo:error 'defun ": quantity " s " not defined")) 413 (else ax))))))))) 409 414 (if (environment-has-binding? nemo-env sym) 410 415 (nemo:error 'defun! ": quantity " sym " already defined") … … 496 501 (cases nemo:quantity x 497 502 (COMPONENT (type lst) 498 (let ((en1 (COMPONENT type ( cons sym lst))))503 (let ((en1 (COMPONENT type (append lst (list sym))))) 499 504 (environment-set! nemo-env comp en1))) 500 505 (else (nemo:error 'component-extend! ": invalid component " comp))) … … 525 530 (else #f))))) 526 531 (environment-symbols nemo-env))) 532 527 533 528 534 … … 569 575 (environment-symbols nemo-env))) 570 576 571 577 (define (toplevel nemo-env) 578 (cases nemo:quantity (environment-ref nemo-env (nemo-intern 'toplevel)) 579 (COMPONENT (type lst) `(,type ,lst)))) 572 580 573 581 (define (exam nemo-env) … … 789 797 ((exports) exports) 790 798 ((imports) imports) 799 ((toplevel) toplevel) 791 800 ((components) components) 792 801 ((component-symbols) component-symbols) … … 812 821 (define (eval-nemo-system-decls nemo-core name sys declarations) 813 822 (define (eval-const x) (and x ((nemo-core 'eval-const) sys x))) 814 (let loop ((ds declarations) (qs (list))) 815 (if (null? ds) qs 823 (let loop ((ds declarations) (qs (list)) (top #t)) 824 (if (null? ds) (let ((qs (reverse qs))) 825 (if top (let* ((top-syms ((nemo-core 'component-symbols ) sys (nemo-intern 'toplevel))) 826 (top-syms1 (append qs top-syms))) 827 (environment-set! sys (nemo-intern 'toplevel) (COMPONENT 'toplevel top-syms1)))) 828 qs) 816 829 (let ((decl (car ds))) 817 830 (let ((qs1 (match decl … … 888 901 "defun id (arg1 arg2 ...) expr")))) 889 902 890 ;; compiled cnemoprimitives903 ;; compiled primitives 891 904 (('prim id value) 892 905 (cond ((symbol? id) (((nemo-core 'env-extend!) sys) id '(prim) value)) … … 896 909 897 910 (('component ('type typ) ('name name) . lst) 898 (let* ((cqs (loop lst (list) ))911 (let* ((cqs (loop lst (list) #f)) 899 912 (comp (COMPONENT typ cqs)) 900 913 (sym (string->symbol (->string name)))) … … 904 917 905 918 (('component ('type typ) . lst) 906 (let* ((cqs (loop lst (list) ))919 (let* ((cqs (loop lst (list) #f)) 907 920 (comp (COMPONENT typ cqs)) 908 921 (sym (qname "comp"))) … … 912 925 913 926 (('sysname name) (if (symbol? name) 914 (environment-set! sys (nemo-intern 'name) 927 (environment-set! sys (nemo-intern 'name) (SYSNAME name)) 915 928 (nemo:error 'eval-nemo-system-decls 916 929 "system name must be a symbol"))) … … 970 983 971 984 972 (loop (cdr ds) qs1 )))985 (loop (cdr ds) qs1 top))) 973 986 )) 974 987 sys) -
release/3/nemo/trunk/examples/AKP06/PotIhCa.scm
r11944 r11977 1 1 ;; -*- Hen -*- 2 2 3 4 (require-extension nemo-macros) 5 (require-extension nemo-nmodl) 6 (require-extension nemo-hh) 7 8 (define PotIhCa 9 (nemo-model PotIhCa 10 ((input v cai cao) 11 12 (const Vrest = -68) 13 (const diam = 20) 14 (const celsius = 24) 15 16 (const temp_adj = (pow 3 (/ (- celsius 22) 10))) 17 18 (defun ghk (v celsius ci co) 19 (let ((F 96485.0) (R 8.3145)) 20 (let ((zeta (/ (* 2e-3 F v) (* R (+ 273.19 celsius))))) 21 (if (< (abs (- 1.0 (exp (neg zeta)))) 1e-6) 22 (* 1e-6 (* 2 F) (- ci (* co (exp (neg zeta)))) (+ 1.0 (/ zeta 2))) 23 (/ (* 1e-6 (* 2 zeta F) (- ci (* co (exp (neg zeta))))) (- 1.0 (exp (neg zeta)))))))) 24 25 26 (component (type ion-channel) ;; Kv1 current 27 28 (component (type gate) 29 30 ;; rate functions 31 (const cma = 0.12889) 32 (const cka = -33.90877) 33 (const cva = 45) 34 35 (defun Kv1_amf (v cma cva cka temp_adj) (* temp_adj cma (exp (neg (/ (+ v cva) cka))))) 36 37 (const cmb = 0.12889) 38 (const ckb = 12.42101) 39 (const cvb = 45) 40 (defun Kv1_bmf (v cmb cvb ckb temp_adj) (* temp_adj cmb (exp (neg (/ (+ v cvb) ckb))))) 41 42 (hh-ionic-conductance 43 (Kv1 ;; ion name: exported variables will be of the form {ion}_{id} 44 (initial-m (/ (Kv1_amf Vrest cma cva cka temp_adj) 45 (+ (Kv1_amf Vrest cma cva cka temp_adj) 46 (Kv1_bmf Vrest cmb cvb ckb temp_adj)))) 47 (m-power 4) 48 (h-power 0) 49 (m-alpha (Kv1_amf v cma cva cka temp_adj) ) 50 (m-beta (Kv1_bmf v cmb cvb ckb temp_adj) ))) 51 52 ) 53 54 (component (type pore) 55 (const gbar_Kv1 = 0.011) 56 (output gbar_Kv1 )) 57 58 (component (type permeating-substance) (name k) 59 (const e_Kv1 = -85) 60 (output e_Kv1 )) 61 62 ) ;; end Kv1 current 63 64 65 (component (type ion-channel) ;; Kv4 current 66 67 (component (type gate) 68 69 ;; rate functions 70 71 (const can = 0.15743) 72 (const ckan = -32.19976) 73 (const cvan = 57) 74 75 (defun Kv4_amf (v can cvan ckan temp_adj) (* temp_adj can (exp (neg (/ (+ v cvan) ckan))))) 76 77 (const cbn = 0.15743) 78 (const ckbn = 37.51346) 79 (const cvbn = 57) 3 (nemo-model PotIhCa 4 ((input v cai cao) 5 6 (const Vrest = -68) 7 (const diam = 20) 8 (const celsius = 24) 9 10 (const temp_adj = (pow 3 (/ (- celsius 22) 10))) 11 12 (defun ghk (v celsius ci co) 13 (let ((F 96485.0) (R 8.3145)) 14 (let ((zeta (/ (* 2e-3 F v) (* R (+ 273.19 celsius))))) 15 (if (< (abs (- 1.0 (exp (neg zeta)))) 1e-6) 16 (* 1e-6 (* 2 F) (- ci (* co (exp (neg zeta)))) (+ 1.0 (/ zeta 2))) 17 (/ (* 1e-6 (* 2 zeta F) (- ci (* co (exp (neg zeta))))) (- 1.0 (exp (neg zeta)))))))) 18 19 20 (component (type ion-channel) ;; Kv1 current 21 22 (component (type gate) 23 24 ;; rate functions 25 (const cma = 0.12889) 26 (const cka = -33.90877) 27 (const cva = 45) 28 29 (defun Kv1_amf (v cma cva cka temp_adj) (* temp_adj cma (exp (neg (/ (+ v cva) cka))))) 30 31 (const cmb = 0.12889) 32 (const ckb = 12.42101) 33 (const cvb = 45) 34 (defun Kv1_bmf (v cmb cvb ckb temp_adj) (* temp_adj cmb (exp (neg (/ (+ v cvb) ckb))))) 35 36 (hh-ionic-conductance 37 (Kv1 ;; ion name: exported variables will be of the form {ion}_{id} 38 (initial-m (/ (Kv1_amf Vrest cma cva cka temp_adj) 39 (+ (Kv1_amf Vrest cma cva cka temp_adj) 40 (Kv1_bmf Vrest cmb cvb ckb temp_adj)))) 41 (m-power 4) 42 (h-power 0) 43 (m-alpha (Kv1_amf v cma cva cka temp_adj) ) 44 (m-beta (Kv1_bmf v cmb cvb ckb temp_adj) ))) 45 46 ) 47 48 (component (type pore) 49 (const gbar_Kv1 = 0.011) 50 (output gbar_Kv1 )) 51 52 (component (type permeating-substance) (name k) 53 (const e_Kv1 = -85) 54 (output e_Kv1 )) 55 56 ) ;; end Kv1 current 57 58 59 (component (type ion-channel) ;; Kv4 current 60 61 (component (type gate) 62 63 ;; rate functions 64 65 (const can = 0.15743) 66 (const ckan = -32.19976) 67 (const cvan = 57) 68 69 (defun Kv4_amf (v can cvan ckan temp_adj) 70 (* temp_adj can (exp (neg (/ (+ v cvan) ckan))))) 71 72 (const cbn = 0.15743) 73 (const ckbn = 37.51346) 74 (const cvbn = 57) 80 75 81 76 (defun Kv4_bmf (v cbn cvbn ckbn temp_adj) (* temp_adj cbn (exp (neg (/ (+ v cvbn) ckbn))))) … … 97 92 (Kv4 ;; ion name: exported variables will be of the form {ion}_{id} 98 93 (initial-m (/ (Kv4_amf Vrest can cvan ckan temp_adj) 99 (+ (Kv4_amf Vrest vcan cvan ckan temp_adj)94 (+ (Kv4_amf Vrest can cvan ckan temp_adj) 100 95 (Kv4_bmf Vrest cbn cvbn ckbn temp_adj)))) 101 96 (initial-h (/ (Kv4_ahf Vrest cah cvh ckah temp_adj) … … 275 270 276 271 277 ) 278 279 (let ((PotIhCa-1 (nemo:hh-transformer PotIhCa))) 280 (print "dependency graph: " ((nemo 'depgraph*) PotIhCa-1)) 281 (print "exports: " ((nemo 'exports) PotIhCa-1)) 282 (print "imports: " ((nemo 'imports) PotIhCa-1)) 283 (for-each (lambda (x) 284 (print "component " x ": " ((nemo 'component-exports) PotIhCa-1 (second x))) 285 (print "component " x " subcomponents: " ((nemo 'component-subcomps) PotIhCa-1 (second x)))) 286 ((nemo 'components) PotIhCa-1)) 287 (nemo:nmodl-translator PotIhCa-1 'cnexp #t -150 150 1) 288 289 )) 290 ) 272 )) ;; end model -
release/3/nemo/trunk/examples/AKP06/PotIhCa.sxml
r11898 r11977 1 (*TOP* (*PI* (xml (@ (version 1.0)))) 2 (ncml:model 3 (@ (name PotIhCa) (xmlns:ncml ncml)) 4 (ncml:input (@ (id v))) 5 (ncml:input (@ (id cai))) 6 (ncml:input (@ (id cao))) 7 (ncml:const (@ (id Vrest)) (ncml:expr -68)) 8 (ncml:const (@ (id diam)) (ncml:expr 20)) 9 (ncml:const (@ (id celsius)) (ncml:expr 24)) 10 (ncml:const (@ (id F)) (ncml:expr 96485.0)) 11 (ncml:const (@ (id R)) (ncml:expr 8.3145)) 12 (ncml:const 13 (@ (id temp_adj)) 14 (ncml:expr (ncml:pow 3 (ncml:div (ncml:sub (ncml:id celsius) 22) 10)))) 15 (ncml:component 16 (@ (type ion-channel)) 17 (ncml:component 18 (@ (type pore)) 19 (ncml:const (@ (id gbar_Kv1)) (ncml:expr 0.011)) 20 (ncml:output (@ (id gbar_Kv1)))) 21 (ncml:component 22 (@ (type "permeating-substance") (name k)) 23 (ncml:const (@ (id e_Kv1)) (ncml:expr -85)) 24 (ncml:output (@ (id e_Kv1)))) 25 (ncml:component 26 (@ (type gate)) 27 (ncml:const (@ (id cma)) (ncml:expr 0.12889)) 28 (ncml:const (@ (id cka)) (ncml:expr -33.90877)) 29 (ncml:const (@ (id cva)) (ncml:expr 45)) 30 (ncml:defun 31 (@ (id Kv1_amf)) 32 (ncml:arg v) 33 (ncml:body 34 (ncml:mul 35 (ncml:id temp_adj) 36 (ncml:id cma) 37 (ncml:exp 38 (ncml:neg 39 (ncml:div 40 (ncml:sum (ncml:id v) (ncml:id cva)) 41 (ncml:id cka))))))) 42 (ncml:const (@ (id cmb)) (ncml:expr 0.12889)) 43 (ncml:const (@ (id ckb)) (ncml:expr 12.42101)) 44 (ncml:const (@ (id cvb)) (ncml:expr 45)) 45 (ncml:defun 46 (@ (id Kv1_bmf)) 47 (ncml:arg v) 48 (ncml:body 49 (ncml:mul 50 (ncml:id temp_adj) 51 (ncml:id cmb) 52 (ncml:exp 53 (ncml:neg 54 (ncml:div 55 (ncml:sum (ncml:id v) (ncml:id cvb)) 56 (ncml:id ckb))))))) 57 (ncml:hh_ionic_conductance 58 (@ (id Kv1)) 59 (ncml:initial_m 60 (ncml:div 61 (ncml:apply (ncml:id Kv1_amf) (ncml:id Vrest)) 62 (ncml:sum 63 (ncml:apply (ncml:id Kv1_amf) (ncml:id Vrest)) 64 (ncml:apply (ncml:id Kv1_bmf) (ncml:id Vrest))))) 65 (ncml:m_power 4) 66 (ncml:h_power 0) 67 (ncml:m_alpha (ncml:apply (ncml:id Kv1_amf) (ncml:id v))) 68 (ncml:m_beta (ncml:apply (ncml:id Kv1_bmf) (ncml:id v)))))))) 1 (ncml:model 2 (@ (name PotIhCa)) 3 (ncml:input (@ (id v)) (as v)) 4 (ncml:input (@ (id cai)) (as cai)) 5 (ncml:input (@ (id cao)) (as cao)) 6 (ncml:const (@ (id Vrest)) (ncml:expr -68.0)) 7 (ncml:const (@ (id diam)) (ncml:expr 20.0)) 8 (ncml:const (@ (id celsius)) (ncml:expr 24.0)) 9 (ncml:const (@ (id temp_adj)) (ncml:expr 1.24573093961552)) 10 (ncml:defun 11 (@ (id ghk)) 12 (ncml:arg v) 13 (ncml:arg celsius) 14 (ncml:arg ci) 15 (ncml:arg co) 16 (ncml:body 17 (ncml:let 18 (ncml:bnds 19 (ncml:bnd (@ (id F)) (ncml:expr 96485.0)) 20 (ncml:bnd (@ (id R)) (ncml:expr 8.3145))) 21 (ncml:expr 22 (ncml:let 23 (ncml:bnds 24 (ncml:bnd 25 (@ (id zeta)) 26 (ncml:expr 27 (ncml:div 28 (ncml:mul (ncml:mul 0.002 (ncml:id F)) (ncml:id v)) 29 (ncml:mul 30 (ncml:id R) 31 (ncml:sum 273.19 (ncml:id celsius))))))) 32 (ncml:expr 33 (ncml:apply 34 (@ (id if)) 35 (ncml:lt 36 (ncml:abs 37 (ncml:sum 38 1.0 39 (ncml:neg (ncml:exp (ncml:neg (ncml:id zeta)))))) 40 1e-06) 41 (ncml:mul 42 (ncml:mul 1e-06 (ncml:mul 2.0 (ncml:id F))) 43 (ncml:mul 44 (ncml:sum 45 (ncml:id ci) 46 (ncml:neg 47 (ncml:mul 48 (ncml:id co) 49 (ncml:exp (ncml:neg (ncml:id zeta)))))) 50 (ncml:sum 1.0 (ncml:div (ncml:id zeta) 2.0)))) 51 (ncml:div 52 (ncml:mul 53 (ncml:mul 54 1e-06 55 (ncml:mul (ncml:mul 2.0 (ncml:id zeta)) (ncml:id F))) 56 (ncml:sum 57 (ncml:id ci) 58 (ncml:neg 59 (ncml:mul 60 (ncml:id co) 61 (ncml:exp (ncml:neg (ncml:id zeta))))))) 62 (ncml:sum 63 1.0 64 (ncml:neg (ncml:exp (ncml:neg (ncml:id zeta))))))))))))) 65 (ncml:component 66 (@ (name comp2) (type ion-channel)) 67 (ncml:component 68 (@ (name comp0) (type gate)) 69 (ncml:const (@ (id cma)) (ncml:expr 0.12889)) 70 (ncml:const (@ (id cka)) (ncml:expr -33.90877)) 71 (ncml:const (@ (id cva)) (ncml:expr 45.0)) 72 (ncml:defun 73 (@ (id Kv1_amf)) 74 (ncml:arg v) 75 (ncml:arg cma) 76 (ncml:arg cva) 77 (ncml:arg cka) 78 (ncml:arg temp_adj) 79 (ncml:body 80 (ncml:mul 81 (ncml:mul (ncml:id temp_adj) (ncml:id cma)) 82 (ncml:exp 83 (ncml:neg 84 (ncml:div 85 (ncml:sum (ncml:id v) (ncml:id cva)) 86 (ncml:id cka))))))) 87 (ncml:const (@ (id cmb)) (ncml:expr 0.12889)) 88 (ncml:const (@ (id ckb)) (ncml:expr 12.42101)) 89 (ncml:const (@ (id cvb)) (ncml:expr 45.0)) 90 (ncml:defun 91 (@ (id Kv1_bmf)) 92 (ncml:arg v) 93 (ncml:arg cmb) 94 (ncml:arg cvb) 95 (ncml:arg ckb) 96 (ncml:arg temp_adj) 97 (ncml:body 98 (ncml:mul 99 (ncml:mul (ncml:id temp_adj) (ncml:id cmb)) 100 (ncml:exp 101 (ncml:neg 102 (ncml:div 103 (ncml:sum (ncml:id v) (ncml:id cvb)) 104 (ncml:id ckb))))))) 105 (ncml:state_complex 106 (@ (id Kv1_m)) 107 (ncml:open Kv1_mO) 108 (ncml:initial 0.0737822020422147) 109 (ncml:transitions 110 (ncml:transition 111 (@ (src Kv1_mC) (dst Kv1_mO)) 112 (ncml:rate 113 (ncml:apply 114 (@ (id Kv1_amf)) 115 (ncml:id v) 116 (ncml:id cma) 117 (ncml:id cva) 118 (ncml:id cka) 119 (ncml:id temp_adj)))) 120 (ncml:transition 121 (@ (src Kv1_mO) (dst Kv1_mC)) 122 (ncml:rate 123 (ncml:apply 124 (@ (id Kv1_bmf)) 125 (ncml:id v) 126 (ncml:id cmb) 127 (ncml:id cvb) 128 (ncml:id ckb) 129 (ncml:id temp_adj))))) 130 (ncml:power 4.0)) 131 (ncml:output (@ (id Kv1_m)))) 132 (ncml:component 133 (@ (name comp1) (type pore)) 134 (ncml:const (@ (id gbar_Kv1)) (ncml:expr 0.011)) 135 (ncml:output (@ (id gbar_Kv1)))) 136 (ncml:component 137 (@ (name k) (type permeating-substance)) 138 (ncml:const (@ (id e_CaBK)) (ncml:expr -85.0)) 139 (ncml:output (@ (id e_CaBK))))) 140 (ncml:component 141 (@ (name comp5) (type ion-channel)) 142 (ncml:component 143 (@ (name comp3) (type gate)) 144 (ncml:const (@ (id can)) (ncml:expr 0.15743)) 145 (ncml:const (@ (id ckan)) (ncml:expr -32.19976)) 146 (ncml:const (@ (id cvan)) (ncml:expr 57.0)) 147 (ncml:defun 148 (@ (id Kv4_amf)) 149 (ncml:arg v) 150 (ncml:arg can) 151 (ncml:arg cvan) 152 (ncml:arg ckan) 153 (ncml:arg temp_adj) 154 (ncml:body 155 (ncml:mul 156 (ncml:mul (ncml:id temp_adj) (ncml:id can)) 157 (ncml:exp 158 (ncml:neg 159 (ncml:div 160 (ncml:sum (ncml:id v) (ncml:id cvan)) 161 (ncml:id ckan))))))) 162 (ncml:const (@ (id cbn)) (ncml:expr 0.15743)) 163 (ncml:const (@ (id ckbn)) (ncml:expr 37.51346)) 164 (ncml:const (@ (id cvbn)) (ncml:expr 57.0)) 165 (ncml:defun 166 (@ (id Kv4_bmf)) 167 (ncml:arg v) 168 (ncml:arg cbn) 169 (ncml:arg cvbn) 170 (ncml:arg ckbn) 171 (ncml:arg temp_adj) 172 (ncml:body 173 (ncml:mul 174 (ncml:mul (ncml:id temp_adj) (ncml:id cbn)) 175 (ncml:exp 176 (ncml:neg 177 (ncml:div 178 (ncml:sum (ncml:id v) (ncml:id cvbn)) 179 (ncml:id ckbn))))))) 180 (ncml:const (@ (id cah)) (ncml:expr 0.01342)) 181 (ncml:const (@ (id ckah)) (ncml:expr -7.86476)) 182 (ncml:const (@ (id cvah)) (ncml:expr 60.0)) 183 (ncml:defun 184 (@ (id Kv4_ahf)) 185 (ncml:arg v) 186 (ncml:arg cah) 187 (ncml:arg cvah) 188 (ncml:arg ckah) 189 (ncml:arg temp_adj) 190 (ncml:body 191 (ncml:mul 192 (ncml:id temp_adj) 193 (ncml:div 194 (ncml:id cah) 195 (ncml:sum 196 1.0 197 (ncml:exp 198 (ncml:neg 199 (ncml:div 200 (ncml:sum (ncml:id v) (ncml:id cvah)) 201 (ncml:id ckah))))))))) 202 (ncml:const (@ (id cbh)) (ncml:expr 0.04477)) 203 (ncml:const (@ (id ckbh)) (ncml:expr 11.3615)) 204 (ncml:const (@ (id cvbh)) (ncml:expr 54.0)) 205 (ncml:defun 206 (@ (id Kv4_bhf)) 207 (ncml:arg v) 208 (ncml:arg cbh) 209 (ncml:arg cvbh) 210 (ncml:arg ckbh) 211 (ncml:arg temp_adj) 212 (ncml:body 213 (ncml:mul 214 (ncml:id temp_adj) 215 (ncml:div 216 (ncml:id cbh) 217 (ncml:sum 218 1.0 219 (ncml:exp 220 (ncml:neg 221 (ncml:div 222 (ncml:sum (ncml:id v) (ncml:id cvbh)) 223 (ncml:id ckbh))))))))) 224 (ncml:state_complex 225 (@ (id Kv4_m)) 226 (ncml:open Kv4_mO) 227 (ncml:initial 0.34641264037007) 228 (ncml:transitions 229 (ncml:transition 230 (@ (src Kv4_mC) (dst Kv4_mO)) 231 (ncml:rate 232 (ncml:apply 233 (@ (id Kv4_amf)) 234 (ncml:id v) 235 (ncml:id can) 236 (ncml:id cvan) 237 (ncml:id ckan) 238 (ncml:id temp_adj)))) 239 (ncml:transition 240 (@ (src Kv4_mO) (dst Kv4_mC)) 241 (ncml:rate 242 (ncml:apply 243 (@ (id Kv4_bmf)) 244 (ncml:id v) 245 (ncml:id cbn) 246 (ncml:id cvbn) 247 (ncml:id ckbn) 248 (ncml:id temp_adj))))) 249 (ncml:power 4.0)) 250 (ncml:state_complex 251 (@ (id Kv4_h)) 252 (ncml:open Kv4_hO) 253 (ncml:initial 0.567859615479398) 254 (ncml:transitions 255 (ncml:transition 256 (@ (src Kv4_hC) (dst Kv4_hO)) 257 (ncml:rate 258 (ncml:apply 259 (@ (id Kv4_ahf)) 260 (ncml:id v) 261 (ncml:id cah) 262 (ncml:id cvh) 263 (ncml:id ckah) 264 (ncml:id temp_adj)))) 265 (ncml:transition 266 (@ (src Kv4_hO) (dst Kv4_hC)) 267 (ncml:rate 268 (ncml:apply 269 (@ (id Kv4_bhf)) 270 (ncml:id v) 271 (ncml:id cbh) 272 (ncml:id cvbh) 273 (ncml:id ckbh) 274 (ncml:id temp_adj))))) 275 (ncml:power 1.0)) 276 (ncml:output (@ (id Kv4_m))) 277 (ncml:output (@ (id Kv4_h)))) 278 (ncml:component 279 (@ (name comp4) (type pore)) 280 (ncml:const (@ (id gbar_Kv4)) (ncml:expr 0.0039)) 281 (ncml:output (@ (id gbar_Kv4)))) 282 (ncml:component 283 (@ (name k) (type permeating-substance)) 284 (ncml:const (@ (id e_CaBK)) (ncml:expr -85.0)) 285 (ncml:output (@ (id e_CaBK))))) 286 (ncml:component 287 (@ (name comp8) (type ion-channel)) 288 (ncml:component 289 (@ (name comp6) (type gate)) 290 (ncml:const (@ (id cvn)) (ncml:expr 90.1)) 291 (ncml:const (@ (id ckn)) (ncml:expr -9.9)) 292 (ncml:defun 293 (@ (id Ih_inf)) 294 (ncml:arg v) 295 (ncml:arg cvn) 296 (ncml:arg ckn) 297 (ncml:body 298 (ncml:div 299 1.0 300 (ncml:sum 301 1.0 302 (ncml:exp 303 (ncml:neg 304 (ncml:div 305 (ncml:sum (ncml:id v) (ncml:id cvn)) 306 (ncml:id ckn)))))))) 307 (ncml:const (@ (id cct)) (ncml:expr 190.0)) 308 (ncml:const (@ (id cat)) (ncml:expr 720.0)) 309 (ncml:const (@ (id cvt)) (ncml:expr 81.5)) 310 (ncml:const (@ (id ckt)) (ncml:expr 11.9)) 311 (ncml:defun 312 (@ (id Ih_tau)) 313 (ncml:arg v) 314 (ncml:arg cct) 315 (ncml:arg cat) 316 (ncml:arg cvt) 317 (ncml:arg ckt) 318 (ncml:arg temp_adj) 319 (ncml:body 320 (ncml:div 321 (ncml:sum 322 (ncml:id cct) 323 (ncml:mul 324 (ncml:id cat) 325 (ncml:exp 326 (ncml:neg 327 (ncml:pow 328 (ncml:div 329 (ncml:sum (ncml:id v) (ncml:id cvt)) 330 (ncml:id ckt)) 331 2.0))))) 332 (ncml:id temp_adj)))) 333 (ncml:state_complex 334 (@ (id Ih_m)) 335 (ncml:open Ih_mO) 336 (ncml:initial 0.0968851713304939) 337 (ncml:transitions 338 (ncml:transition 339 (@ (src Ih_mC) (dst Ih_mO)) 340 (ncml:rate 341 (ncml:div 342 (ncml:apply 343 (@ (id Ih_inf)) 344 (ncml:id v) 345 (ncml:id cvn) 346 (ncml:id ckn)) 347 (ncml:apply 348 (@ (id Ih_tau)) 349 (ncml:id v) 350 (ncml:id cct) 351 (ncml:id cat) 352 (ncml:id cvt) 353 (ncml:id ckt) 354 (ncml:id temp_adj))))) 355 (ncml:transition 356 (@ (src Ih_mO) (dst Ih_mC)) 357 (ncml:rate 358 (ncml:div 359 (ncml:sum 360 1.0 361 (ncml:neg 362 (ncml:apply 363 (@ (id Ih_inf)) 364 (ncml:id v) 365 (ncml:id cvn) 366 (ncml:id ckn)))) 367 (ncml:apply 368 (@ (id Ih_tau)) 369 (ncml:id v) 370 (ncml:id cct) 371 (ncml:id cat) 372 (ncml:id cvt) 373 (ncml:id ckt) 374 (ncml:id temp_adj)))))) 375 (ncml:power 1.0)) 376 (ncml:output (@ (id Ih_m)))) 377 (ncml:component 378 (@ (name comp7) (type pore)) 379 (ncml:const (@ (id gbar_Ih)) (ncml:expr 0.2)) 380 (ncml:output (@ (id gbar_Ih)))) 381 (ncml:component 382 (@ (name non-specific) (type permeating-substance)) 383 (ncml:const (@ (id e_Ih)) (ncml:expr -30.0)) 384 (ncml:output (@ (id e_Ih))))) 385 (ncml:component 386 (@ (name comp11) (type ion-channel)) 387 (ncml:component 388 (@ (name comp9) (type gate)) 389 (ncml:const (@ (id cv)) (ncml:expr 19.0)) 390 (ncml:const (@ (id ck)) (ncml:expr 5.5)) 391 (ncml:defun 392 (@ (id CaP_inf)) 393 (ncml:arg v) 394 (ncml:arg cv) 395 (ncml:arg ck) 396 (ncml:body 397 (ncml:div 398 1.0 399 (ncml:sum 400 1.0 401 (ncml:exp 402 (ncml:neg 403 (ncml:div 404 (ncml:sum (ncml:id v) (ncml:id cv)) 405 (ncml:id ck)))))))) 406 (ncml:defun 407 (@ (id CaP_tau)) 408 (ncml:arg v) 409 (ncml:arg temp_adj) 410 (ncml:body 411 (ncml:div 412 (ncml:apply 413 (@ (id if)) 414 (ncml:gt (ncml:id v) -50.0) 415 (ncml:mul 416 1000.0 417 (ncml:sum 418 0.000191 419 (ncml:mul 420 0.00376 421 (ncml:pow 422 (ncml:exp 423 (ncml:neg (ncml:div (ncml:sum (ncml:id v) 41.9) 27.8))) 424 2.0)))) 425 (ncml:mul 426 1000.0 427 (ncml:sum 428 0.00026367 429 (ncml:mul 430 0.1278 431 (ncml:exp (ncml:mul 0.10327 (ncml:id v))))))) 432 (ncml:id temp_adj)))) 433 (ncml:state_complex 434 (@ (id CaP_m)) 435 (ncml:open CaP_mO) 436 (ncml:initial 0.000135136381706817) 437 (ncml:transitions 438 (ncml:transition 439 (@ (src CaP_mC) (dst CaP_mO)) 440 (ncml:rate 441 (ncml:div 442 (ncml:apply 443 (@ (id CaP_inf)) 444 (ncml:id v) 445 (ncml:id cv) 446 (ncml:id ck)) 447 (ncml:apply (@ (id CaP_tau)) (ncml:id v) (ncml:id temp_adj))))) 448 (ncml:transition 449 (@ (src CaP_mO) (dst CaP_mC)) 450 (ncml:rate 451 (ncml:div 452 (ncml:sum 453 1.0 454 (ncml:neg 455 (ncml:apply 456 (@ (id CaP_inf)) 457 (ncml:id v) 458 (ncml:id cv) 459 (ncml:id ck)))) 460 (ncml:apply 461 (@ (id CaP_tau)) 462 (ncml:id v) 463 (ncml:id temp_adj)))))) 464 (ncml:power 1.0)) 465 (ncml:output (@ (id CaP_m)))) 466 (ncml:component 467 (@ (name comp10) (type pore)) 468 (ncml:const (@ (id gmax_CaP)) (ncml:expr 0.01667)) 469 (ncml:asgn 470 (@ (id gbar_CaP)) 471 (ncml:expr 472 (ncml:mul 473 (ncml:id gmax_CaP) 474 (ncml:apply 475 (@ (id ghk)) 476 (ncml:id v) 477 (ncml:id celsius) 478 (ncml:id cai) 479 (ncml:id cao))))) 480 (ncml:output (@ (id gbar_CaP)))) 481 (ncml:component (@ (name ca) (type accumulating-substance)))) 482 (ncml:component 483 (@ (name comp14) (type ion-channel)) 484 (ncml:component 485 (@ (name comp12) (type gate)) 486 (ncml:const (@ (id zhalf)) (ncml:expr 0.001)) 487 (ncml:defun 488 (@ (id CaBK_zinf)) 489 (ncml:arg ca) 490 (ncml:arg zhalf) 491 (ncml:body 492 (ncml:div 493 1.0 494 (ncml:sum 1.0 (ncml:div (ncml:id zhalf) (ncml:id ca)))))) 495 (ncml:const (@ (id CaBK_ztau)) (ncml:expr 0.802741561760231)) 496 (ncml:const (@ (id cvm)) (ncml:expr 28.9)) 497 (ncml:const (@ (id ckm)) (ncml:expr 6.2)) 498 (ncml:defun 499 (@ (id CaBK_minf)) 500 (ncml:arg v) 501 (ncml:arg cvm) 502 (ncml:arg ckm) 503 (ncml:arg temp_adj) 504 (ncml:body 505 (ncml:div 506 (ncml:div 507 1.0 508 (ncml:sum 509 1.0 510 (ncml:exp 511 (ncml:neg 512 (ncml:div 513 (ncml:sum (ncml:sum (ncml:id v) 5.0) (ncml:id cvm)) 514 (ncml:id ckm)))))) 515 (ncml:id temp_adj)))) 516 (ncml:const (@ (id ctm)) (ncml:expr 0.000505)) 517 (ncml:const (@ (id cvtm1)) (ncml:expr 86.4)) 518 (ncml:const (@ (id cktm1)) (ncml:expr -10.1)) 519 (ncml:const (@ (id cvtm2)) (ncml:expr -33.3)) 520 (ncml:const (@ (id cktm2)) (ncml:expr 10.0)) 521 (ncml:defun 522 (@ (id CaBK_mtau)) 523 (ncml:arg v) 524 (ncml:arg ctm) 525 (ncml:arg cvtm1) 526 (ncml:arg cktm1) 527 (ncml:arg cvtm2) 528 (ncml:arg cktm2) 529 (ncml:arg temp_adj) 530 (ncml:body 531 (ncml:div 532 (ncml:sum 533 (ncml:id ctm) 534 (ncml:div 535 1.0 536 (ncml:sum 537 (ncml:exp 538 (ncml:neg 539 (ncml:div 540 (ncml:sum (ncml:sum (ncml:id v) 5.0) (ncml:id cvtm1)) 541 (ncml:id cktm1)))) 542 (ncml:exp 543 (ncml:neg 544 (ncml:div 545 (ncml:sum (ncml:sum (ncml:id v) 5.0) (ncml:id cvtm2)) 546 (ncml:id cktm2))))))) 547 (ncml:id temp_adj)))) 548 (ncml:const (@ (id ch)) (ncml:expr 0.085)) 549 (ncml:const (@ (id cvh)) (ncml:expr 32.0)) 550 (ncml:const (@ (id ckh)) (ncml:expr -5.8)) 551 (ncml:defun 552 (@ (id CaBK_hinf)) 553 (ncml:arg v) 554 (ncml:arg ch) 555 (ncml:arg cvh) 556 (ncml:arg ckh) 557 (ncml:arg temp_adj) 558 (ncml:body 559 (ncml:div 560 (ncml:sum 561 (ncml:id ch) 562 (ncml:div 563 (ncml:sum 1.0 (ncml:neg (ncml:id ch))) 564 (ncml:sum 565 1.0 566 (ncml:exp 567 (ncml:neg 568 (ncml:div 569 (ncml:sum (ncml:sum (ncml:id v) 5.0) (ncml:id cvh)) 570 (ncml:id ckh))))))) 571 (ncml:id temp_adj)))) 572 (ncml:const (@ (id cth)) (ncml:expr 0.0019)) 573 (ncml:const (@ (id cvth1)) (ncml:expr 48.5)) 574 (ncml:const (@ (id ckth1)) (ncml:expr -5.2)) 575 (ncml:const (@ (id cvth2)) (ncml:expr -54.2)) 576 (ncml:const (@ (id ckth2)) (ncml:expr 12.9)) 577 (ncml:defun 578 (@ (id CaBK_htau)) 579 (ncml:arg v) 580 (ncml:arg cth) 581 (ncml:arg ckth1) 582 (ncml:arg ckth2) 583 (ncml:arg cvth1) 584 (ncml:arg cvth2) 585 (ncml:arg temp_adj) 586 (ncml:body 587 (ncml:div 588 (ncml:sum 589 (ncml:id cth) 590 (ncml:div 591 1.0 592 (ncml:sum 593 (ncml:exp 594 (ncml:div 595 (ncml:sum (ncml:id v) (ncml:id cvth1)) 596 (ncml:id ckth1))) 597 (ncml:exp 598 (ncml:div 599 (ncml:sum (ncml:id v) (ncml:id cvth2)) 600 (ncml:id ckth2)))))) 601 (ncml:id temp_adj)))) 602 (ncml:state_complex 603 (@ (id CaBK_z)) 604 (ncml:open zO) 605 (ncml:initial 0.0909090909090909) 606 (ncml:transitions 607 (ncml:transition 608 (@ (src zC) (dst zO)) 609 (ncml:rate 610 (ncml:div 611 (ncml:apply (@ (id CaBK_zinf)) (ncml:id cai) (ncml:id zhalf)) 612 (ncml:id CaBK_ztau)))) 613 (ncml:transition 614 (@ (src zO) (dst zC)) 615 (ncml:rate 616 (ncml:div 617 (ncml:sum 618 1.0 619 (ncml:neg 620 (ncml:apply 621 (@ (id CaBK_zinf)) 622 (ncml:id cai) 623 (ncml:id zhalf)))) 624 (ncml:id CaBK_ztau))))) 625 (ncml:power 2.0)) 626 (ncml:state_complex 627 (@ (id CaBK_m)) 628 (ncml:open CaBK_mO) 629 (ncml:initial 0.00326726870663768) 630 (ncml:transitions 631 (ncml:transition 632 (@ (src CaBK_mC) (dst CaBK_mO)) 633 (ncml:rate 634 (ncml:div 635 (ncml:apply 636 (@ (id CaBK_minf)) 637 (ncml:id v) 638 (ncml:id cvm) 639 (ncml:id ckm) 640 (ncml:id temp_adj)) 641 (ncml:apply 642 (@ (id CaBK_mtau)) 643 (ncml:id v) 644 (ncml:id ctm) 645 (ncml:id cvtm1) 646 (ncml:id cktm1) 647 (ncml:id cvtm2) 648 (ncml:id cktm2) 649 (ncml:id temp_adj))))) 650 (ncml:transition 651 (@ (src CaBK_mO) (dst CaBK_mC)) 652 (ncml:rate 653 (ncml:div 654 (ncml:sum 655 1.0 656 (ncml:neg 657 (ncml:apply 658 (@ (id CaBK_minf)) 659 (ncml:id v) 660 (ncml:id cvm) 661 (ncml:id ckm) 662 (ncml:id temp_adj)))) 663 (ncml:apply 664 (@ (id CaBK_mtau)) 665 (ncml:id v) 666 (ncml:id ctm) 667 (ncml:id cvtm1) 668 (ncml:id cktm1) 669 (ncml:id cvtm2) 670 (ncml:id cktm2) 671 (ncml:id temp_adj)))))) 672 (ncml:power 3.0)) 673 (ncml:state_complex 674 (@ (id CaBK_h)) 675 (ncml:open CaBK_hO) 676 (ncml:initial 0.799252570696669) 677 (ncml:transitions 678 (ncml:transition 679 (@ (src CaBK_hC) (dst CaBK_hO)) 680 (ncml:rate 681 (ncml:div 682 (ncml:apply 683 (@ (id CaBK_hinf)) 684 (ncml:id v) 685 (ncml:id ch) 686 (ncml:id cvh) 687 (ncml:id ckh) 688 (ncml:id temp_adj)) 689 (ncml:apply 690 (@ (id CaBK_htau)) 691 (ncml:id v) 692 (ncml:id cth) 693 (ncml:id cvth1) 694 (ncml:id ckth1) 695 (ncml:id cvth2) 696 (ncml:id cvth2) 697 (ncml:id temp_adj))))) 698 (ncml:transition 699 (@ (src CaBK_hO) (dst CaBK_hC)) 700 (ncml:rate 701 (ncml:div 702 (ncml:sum 703 1.0 704 (ncml:neg 705 (ncml:apply 706 (@ (id CaBK_hinf)) 707 (ncml:id v) 708 (ncml:id ch) 709 (ncml:id cvh) 710 (ncml:id ckh) 711 (ncml:id temp_adj)))) 712 (ncml:apply 713 (@ (id CaBK_htau)) 714 (ncml:id v) 715 (ncml:id cth) 716 (ncml:id cvth1) 717 (ncml:id ckth1) 718 (ncml:id cvth2) 719 (ncml:id cvth2) 720 (ncml:id temp_adj)))))) 721 (ncml:power 1.0)) 722 (ncml:output (@ (id CaBK_z))) 723 (ncml:output (@ (id CaBK_m))) 724 (ncml:output (@ (id CaBK_h)))) 725 (ncml:component 726 (@ (name comp13) (type pore)) 727 (ncml:const (@ (id gbar_CaBK)) (ncml:expr 0.014)) 728 (ncml:output (@ (id gbar_CaBK)))) 729 (ncml:component 730 (@ (name k) (type permeating-substance)) 731 (ncml:const (@ (id e_CaBK)) (ncml:expr -85.0)) 732 (ncml:output (@ (id e_CaBK)))))) -
release/3/nemo/trunk/examples/AKP06/PotIhCa.xml
r11899 r11977 2 2 3 3 <ncml:model xmlns="ncml" name="PotIhCa" xmlns:ncml="ncml"> 4 <ncml:input id="v"></ncml:input> 5 <ncml:input id="cai"></ncml:input> 6 <ncml:input id="cao"></ncml:input> 4 <ncml:input id="v"> 5 <as>v</as></ncml:input> 6 <ncml:input id="cai"> 7 <as>cai</as></ncml:input> 8 <ncml:input id="cao"> 9 <as>cao</as></ncml:input> 7 10 <ncml:const id="Vrest"> 8 <ncml:expr>-68 </ncml:expr></ncml:const>11 <ncml:expr>-68.0</ncml:expr></ncml:const> 9 12 <ncml:const id="diam"> 10 <ncml:expr>20 </ncml:expr></ncml:const>13 <ncml:expr>20.0</ncml:expr></ncml:const> 11 14 <ncml:const id="celsius"> 12 <ncml:expr>24</ncml:expr></ncml:const> 13 <ncml:const id="F"> 14 <ncml:expr>96485.0</ncml:expr></ncml:const> 15 <ncml:const id="R"> 16 <ncml:expr>8.3145</ncml:expr></ncml:const> 15 <ncml:expr>24.0</ncml:expr></ncml:const> 17 16 <ncml:const id="temp_adj"> 18 <ncml:expr> 19 <ncml:pow>3 20 <ncml:div> 21 <ncml:sub> 22 <ncml:id>celsius</ncml:id>22</ncml:sub>10</ncml:div></ncml:pow></ncml:expr></ncml:const> 23 <ncml:component type="ion-channel"> 24 <ncml:component type="pore"> 25 <ncml:const id="gbar_Kv1"> 26 <ncml:expr>0.011</ncml:expr></ncml:const> 27 <ncml:output id="gbar_Kv1"></ncml:output></ncml:component> 28 <ncml:component type="permeating-substance" name="k"> 29 <ncml:const id="e_Kv1"> 30 <ncml:expr>-85</ncml:expr></ncml:const> 31 <ncml:output id="e_Kv1"></ncml:output></ncml:component> 32 <ncml:component type="gate"> 17 <ncml:expr>1.24573093961552</ncml:expr></ncml:const> 18 <ncml:defun id="ghk"> 19 <ncml:arg>v</ncml:arg> 20 <ncml:arg>celsius</ncml:arg> 21 <ncml:arg>ci</ncml:arg> 22 <ncml:arg>co</ncml:arg> 23 <ncml:body> 24 <ncml:let> 25 <ncml:bnds> 26 <ncml:bnd id="F"> 27 <ncml:expr>96485.0</ncml:expr></ncml:bnd> 28 <ncml:bnd id="R"> 29 <ncml:expr>8.3145</ncml:expr></ncml:bnd></ncml:bnds> 30 <ncml:expr> 31 <ncml:let> 32 <ncml:bnds> 33 <ncml:bnd id="zeta"> 34 <ncml:expr> 35 <ncml:div> 36 <ncml:mul> 37 <ncml:mul>0.002 38 <ncml:id>F</ncml:id></ncml:mul> 39 <ncml:id>v</ncml:id></ncml:mul> 40 <ncml:mul> 41 <ncml:id>R</ncml:id> 42 <ncml:sum>273.19 43 <ncml:id>celsius</ncml:id></ncml:sum></ncml:mul></ncml:div></ncml:expr></ncml:bnd></ncml:bnds> 44 <ncml:expr> 45 <ncml:apply id="if"> 46 <ncml:lt> 47 <ncml:abs> 48 <ncml:sum>1.0 49 <ncml:neg> 50 <ncml:exp> 51 <ncml:neg> 52 <ncml:id>zeta</ncml:id></ncml:neg></ncml:exp></ncml:neg></ncml:sum></ncml:abs>1e-06</ncml:lt> 53 <ncml:mul> 54 <ncml:mul>1e-06 55 <ncml:mul>2.0 56 <ncml:id>F</ncml:id></ncml:mul></ncml:mul> 57 <ncml:mul> 58 <ncml:sum> 59 <ncml:id>ci</ncml:id> 60 <ncml:neg> 61 <ncml:mul> 62 <ncml:id>co</ncml:id> 63 <ncml:exp> 64 <ncml:neg> 65 <ncml:id>zeta</ncml:id></ncml:neg></ncml:exp></ncml:mul></ncml:neg></ncml:sum> 66 <ncml:sum>1.0 67 <ncml:div> 68 <ncml:id>zeta</ncml:id>2.0</ncml:div></ncml:sum></ncml:mul></ncml:mul> 69 <ncml:div> 70 <ncml:mul> 71 <ncml:mul>1e-06 72 <ncml:mul> 73 <ncml:mul>2.0 74 <ncml:id>zeta</ncml:id></ncml:mul> 75 <ncml:id>F</ncml:id></ncml:mul></ncml:mul> 76 <ncml:sum> 77 <ncml:id>ci</ncml:id> 78 <ncml:neg> 79 <ncml:mul> 80 <ncml:id>co</ncml:id> 81 <ncml:exp> 82 <ncml:neg> 83 <ncml:id>zeta</ncml:id></ncml:neg></ncml:exp></ncml:mul></ncml:neg></ncml:sum></ncml:mul> 84 <ncml:sum>1.0 85 <ncml:neg> 86 <ncml:exp> 87 <ncml:neg> 88 <ncml:id>zeta</ncml:id></ncml:neg></ncml:exp></ncml:neg></ncml:sum></ncml:div></ncml:apply></ncml:expr></ncml:let></ncml:expr></ncml:let></ncml:body></ncml:defun> 89 <ncml:component name="comp2" type="ion-channel"> 90 <ncml:component name="comp0" type="gate"> 91 <ncml:state_complex id="Kv1_m"> 92 <ncml:open>Kv1_mO</ncml:open> 93 <ncml:initial>0.0737822020422147</ncml:initial> 94 <ncml:transitions> 95 <ncml:transition src="Kv1_mC" dst="Kv1_mO"> 96 <ncml:rate> 97 <ncml:apply id="Kv1_amf"> 98 <ncml:id>v</ncml:id> 99 <ncml:id>cma</ncml:id> 100 <ncml:id>cva</ncml:id> 101 <ncml:id>cka</ncml:id> 102 <ncml:id>temp_adj</ncml:id></ncml:apply></ncml:rate></ncml:transition> 103 <ncml:transition src="Kv1_mO" dst="Kv1_mC"> 104 <ncml:rate> 105 <ncml:apply id="Kv1_bmf"> 106 <ncml:id>v</ncml:id> 107 <ncml:id>cmb</ncml:id> 108 <ncml:id>cvb</ncml:id> 109 <ncml:id>ckb</ncml:id> 110 <ncml:id>temp_adj</ncml:id></ncml:apply></ncml:rate></ncml:transition></ncml:transitions> 111 <ncml:power>4.0</ncml:power></ncml:state_complex> 33 112 <ncml:const id="cma"> 34 113 <ncml:expr>0.12889</ncml:expr></ncml:const> … … 36 115 <ncml:expr>-33.90877</ncml:expr></ncml:const> 37 116 <ncml:const id="cva"> 38 <ncml:expr>45 </ncml:expr></ncml:const>117 <ncml:expr>45.0</ncml:expr></ncml:const> 39 118 <ncml:defun id="Kv1_amf"> 40 119 <ncml:arg>v</ncml:arg> 120 <ncml:arg>cma</ncml:arg> 121 <ncml:arg>cva</ncml:arg> 122 <ncml:arg>cka</ncml:arg> 123 <ncml:arg>temp_adj</ncml:arg> 41 124 <ncml:body> 42 125 <ncml:mul> 43 <ncml:id>temp_adj</ncml:id> 44 <ncml:id>cma</ncml:id> 126 <ncml:mul> 127 <ncml:id>temp_adj</ncml:id> 128 <ncml:id>cma</ncml:id></ncml:mul> 45 129 <ncml:exp> 46 130 <ncml:neg> … … 55 139 <ncml:expr>12.42101</ncml:expr></ncml:const> 56 140 <ncml:const id="cvb"> 57 <ncml:expr>45 </ncml:expr></ncml:const>141 <ncml:expr>45.0</ncml:expr></ncml:const> 58 142 <ncml:defun id="Kv1_bmf"> 59 143 <ncml:arg>v</ncml:arg> 144 <ncml:arg>cmb</ncml:arg> 145 <ncml:arg>cvb</ncml:arg> 146 <ncml:arg>ckb</ncml:arg> 147 <ncml:arg>temp_adj</ncml:arg> 60 148 <ncml:body> 61 149 <ncml:mul> 62 <ncml:id>temp_adj</ncml:id> 63 <ncml:id>cmb</ncml:id> 150 <ncml:mul> 151 <ncml:id>temp_adj</ncml:id> 152 <ncml:id>cmb</ncml:id></ncml:mul> 64 153 <ncml:exp> 65 154 <ncml:neg> … … 69 158 <ncml:id>cvb</ncml:id></ncml:sum> 70 159 <ncml:id>ckb</ncml:id></ncml:div></ncml:neg></ncml:exp></ncml:mul></ncml:body></ncml:defun> 71 <ncml:hh_ionic_conductance id="Kv1"> 72 <ncml:initial_m> 160 <ncml:output id="Kv1_m"></ncml:output></ncml:component> 161 <ncml:component name="comp1" type="pore"> 162 <ncml:const id="gbar_Kv1"> 163 <ncml:expr>0.011</ncml:expr></ncml:const> 164 <ncml:output id="gbar_Kv1"></ncml:output></ncml:component> 165 <ncml:component name="k" type="permeating-substance"> 166 <ncml:const id="e_CaBK"> 167 <ncml:expr>-85.0</ncml:expr></ncml:const> 168 <ncml:output id="e_CaBK"></ncml:output></ncml:component></ncml:component> 169 <ncml:component name="comp5" type="ion-channel"> 170 <ncml:component name="comp3" type="gate"> 171 <ncml:state_complex id="Kv4_h"> 172 <ncml:open>Kv4_hO</ncml:open> 173 <ncml:initial>0.567859615479398</ncml:initial> 174 <ncml:transitions> 175 <ncml:transition src="Kv4_hC" dst="Kv4_hO"> 176 <ncml:rate> 177 <ncml:apply id="Kv4_ahf"> 178 <ncml:id>v</ncml:id> 179 <ncml:id>cah</ncml:id> 180 <ncml:id>cvh</ncml:id> 181 <ncml:id>ckah</ncml:id> 182 <ncml:id>temp_adj</ncml:id></ncml:apply></ncml:rate></ncml:transition> 183 <ncml:transition src="Kv4_hO" dst="Kv4_hC"> 184 <ncml:rate> 185 <ncml:apply id="Kv4_bhf"> 186 <ncml:id>v</ncml:id> 187 <ncml:id>cbh</ncml:id> 188 <ncml:id>cvbh</ncml:id> 189 <ncml:id>ckbh</ncml:id> 190 <ncml:id>temp_adj</ncml:id></ncml:apply></ncml:rate></ncml:transition></ncml:transitions> 191 <ncml:power>1.0</ncml:power></ncml:state_complex> 192 <ncml:state_complex id="Kv4_m"> 193 <ncml:open>Kv4_mO</ncml:open> 194 <ncml:initial> 73 195 <ncml:div> 74 <ncml:apply> 75 <ncml:id>Kv1_amf</ncml:id> 76 <ncml:id>Vrest</ncml:id></ncml:apply> 196 <ncml:apply id="Kv4_amf"> 197 <ncml:id>Vrest</ncml:id> 198 <ncml:id>can</ncml:id> 199 <ncml:id>cvan</ncml:id> 200 <ncml:id>ckan</ncml:id> 201 <ncml:id>temp_adj</ncml:id></ncml:apply> 77 202 <ncml:sum> 78 <ncml:apply> 79 <ncml:id>Kv1_amf</ncml:id> 80 <ncml:id>Vrest</ncml:id></ncml:apply> 81 <ncml:apply> 82 <ncml:id>Kv1_bmf</ncml:id> 83 <ncml:id>Vrest</ncml:id></ncml:apply></ncml:sum></ncml:div></ncml:initial_m> 84 <ncml:m_power>4</ncml:m_power> 85 <ncml:h_power>0</ncml:h_power> 86 <ncml:m_alpha> 87 <ncml:apply> 88 <ncml:id>Kv1_amf</ncml:id> 89 <ncml:id>v</ncml:id></ncml:apply></ncml:m_alpha> 90 <ncml:m_beta> 91 <ncml:apply> 92 <ncml:id>Kv1_bmf</ncml:id> 93 <ncml:id>v</ncml:id></ncml:apply></ncml:m_beta></ncml:hh_ionic_conductance></ncml:component> 94 </ncml:component></ncml:model> 203 <ncml:apply id="Kv4_amf"> 204 <ncml:id>Vrest</ncml:id> 205 <ncml:id>v</ncml:id> 206 <ncml:id>can</ncml:id> 207 <ncml:id>cvan</ncml:id> 208 <ncml:id>ckan</ncml:id> 209 <ncml:id>temp_adj</ncml:id></ncml:apply> 210 <ncml:apply id="Kv4_bmf"> 211 <ncml:id>Vrest</ncml:id> 212 <ncml:id>cbn</ncml:id> 213 <ncml:id>cvbn</ncml:id> 214 <ncml:id>ckbn</ncml:id> 215 <ncml:id>temp_adj</ncml:id></ncml:apply></ncml:sum></ncml:div></ncml:initial> 216 <ncml:transitions> 217 <ncml:transition src="Kv4_mC" dst="Kv4_mO"> 218 <ncml:rate> 219 <ncml:apply id="Kv4_amf"> 220 <ncml:id>v</ncml:id> 221 <ncml:id>can</ncml:id> 222 <ncml:id>cvan</ncml:id> 223 <ncml:id>ckan</ncml:id> 224 <ncml:id>temp_adj</ncml:id></ncml:apply></ncml:rate></ncml:transition> 225 <ncml:transition src="Kv4_mO" dst="Kv4_mC"> 226 <ncml:rate> 227 <ncml:apply id="Kv4_bmf"> 228 <ncml:id>v</ncml:id> 229 <ncml:id>cbn</ncml:id> 230 <ncml:id>cvbn</ncml:id> 231 <ncml:id>ckbn</ncml:id> 232 <ncml:id>temp_adj</ncml:id></ncml:apply></ncml:rate></ncml:transition></ncml:transitions> 233 <ncml:power>4.0</ncml:power></ncml:state_complex> 234 <ncml:const id="can"> 235 <ncml:expr>0.15743</ncml:expr></ncml:const> 236 <ncml:const id="ckan"> 237 <ncml:expr>-32.19976</ncml:expr></ncml:const> 238 <ncml:const id="cvan"> 239 <ncml:expr>57.0</ncml:expr></ncml:const> 240 <ncml:defun id="Kv4_amf"> 241 <ncml:arg>v</ncml:arg> 242 <ncml:arg>can</ncml:arg> 243 <ncml:arg>cvan</ncml:arg> 244 <ncml:arg>ckan</ncml:arg> 245 <ncml:arg>temp_adj</ncml:arg> 246 <ncml:body> 247 <ncml:mul> 248 <ncml:mul> 249 <ncml:id>temp_adj</ncml:id> 250 <ncml:id>can</ncml:id></ncml:mul> 251 <ncml:exp> 252 <ncml:neg> 253 <ncml:div> 254 <ncml:sum> 255 <ncml:id>v</ncml:id> 256 <ncml:id>cvan</ncml:id></ncml:sum> 257 <ncml:id>ckan</ncml:id></ncml:div></ncml:neg></ncml:exp></ncml:mul></ncml:body></ncml:defun> 258 <ncml:const id="cbn"> 259 <ncml:expr>0.15743</ncml:expr></ncml:const> 260 <ncml:const id="ckbn"> 261 <ncml:expr>37.51346</ncml:expr></ncml:const> 262 <ncml:const id="cvbn"> 263 <ncml:expr>57.0</ncml:expr></ncml:const> 264 <ncml:defun id="Kv4_bmf"> 265 <ncml:arg>v</ncml:arg> 266 <ncml:arg>cbn</ncml:arg> 267 <ncml:arg>cvbn</ncml:arg> 268 <ncml:arg>ckbn</ncml:arg> 269 <ncml:arg>temp_adj</ncml:arg> 270 <ncml:body> 271 <ncml:mul> 272 <ncml:mul> 273 <ncml:id>temp_adj</ncml:id> 274 <ncml:id>cbn</ncml:id></ncml:mul> 275 <ncml:exp> 276 <ncml:neg> 277 <ncml:div> 278 <ncml:sum> 279 <ncml:id>v</ncml:id> 280 <ncml:id>cvbn</ncml:id></ncml:sum> 281 <ncml:id>ckbn</ncml:id></ncml:div></ncml:neg></ncml:exp></ncml:mul></ncml:body></ncml:defun> 282 <ncml:const id="cah"> 283 <ncml:expr>0.01342</ncml:expr></ncml:const> 284 <ncml:const id="ckah"> 285 <ncml:expr>-7.86476</ncml:expr></ncml:const> 286 <ncml:const id="cvah"> 287 <ncml:expr>60.0</ncml:expr></ncml:const> 288 <ncml:defun id="Kv4_ahf"> 289 <ncml:arg>v</ncml:arg> 290 <ncml:arg>cah</ncml:arg> 291 <ncml:arg>cvah</ncml:arg> 292 <ncml:arg>ckah</ncml:arg> 293 <ncml:arg>temp_adj</ncml:arg> 294 <ncml:body> 295 <ncml:mul> 296 <ncml:id>temp_adj</ncml:id> 297 <ncml:div> 298 <ncml:id>cah</ncml:id> 299 <ncml:sum>1.0 300 <ncml:exp> 301 <ncml:neg> 302 <ncml:div> 303 <ncml:sum> 304 <ncml:id>v</ncml:id> 305 <ncml:id>cvah</ncml:id></ncml:sum> 306 <ncml:id>ckah</ncml:id></ncml:div></ncml:neg></ncml:exp></ncml:sum></ncml:div></ncml:mul></ncml:body></ncml:defun> 307 <ncml:const id="cbh"> 308 <ncml:expr>0.04477</ncml:expr></ncml:const> 309 <ncml:const id="ckbh"> 310 <ncml:expr>11.3615</ncml:expr></ncml:const> 311 <ncml:const id="cvbh"> 312 <ncml:expr>54.0</ncml:expr></ncml:const> 313 <ncml:defun id="Kv4_bhf"> 314 <ncml:arg>v</ncml:arg> 315 <ncml:arg>cbh</ncml:arg> 316 <ncml:arg>cvbh</ncml:arg> 317 <ncml:arg>ckbh</ncml:arg> 318 <ncml:arg>temp_adj</ncml:arg> 319 <ncml:body> 320 <ncml:mul> 321 <ncml:id>temp_adj</ncml:id> 322 <ncml:div> 323 <ncml:id>cbh</ncml:id> 324 <ncml:sum>1.0 325 <ncml:exp> 326 <ncml:neg> 327 <ncml:div> 328 <ncml:sum> 329 <ncml:id>v</ncml:id> 330 <ncml:id>cvbh</ncml:id></ncml:sum> 331 <ncml:id>ckbh</ncml:id></ncml:div></ncml:neg></ncml:exp></ncml:sum></ncml:div></ncml:mul></ncml:body></ncml:defun> 332 <ncml:output id="Kv4_h"></ncml:output> 333 <ncml:output id="Kv4_m"></ncml:output></ncml:component> 334 <ncml:component name="comp4" type="pore"> 335 <ncml:const id="gbar_Kv4"> 336 <ncml:expr>0.0039</ncml:expr></ncml:const> 337 <ncml:output id="gbar_Kv4"></ncml:output></ncml:component> 338 <ncml:component name="k" type="permeating-substance"> 339 <ncml:const id="e_CaBK"> 340 <ncml:expr>-85.0</ncml:expr></ncml:const> 341 <ncml:output id="e_CaBK"></ncml:output></ncml:component></ncml:component> 342 <ncml:component name="comp8" type="ion-channel"> 343 <ncml:component name="comp6" type="gate"> 344 <ncml:state_complex id="Ih_m"> 345 <ncml:open>Ih_mO</ncml:open> 346 <ncml:initial>0.0968851713304939</ncml:initial> 347 <ncml:transitions> 348 <ncml:transition src="Ih_mC" dst="Ih_mO"> 349 <ncml:rate> 350 <ncml:div> 351 <ncml:apply id="Ih_inf"> 352 <ncml:id>v</ncml:id> 353 <ncml:id>cvn</ncml:id> 354 <ncml:id>ckn</ncml:id></ncml:apply> 355 <ncml:apply id="Ih_tau"> 356 <ncml:id>v</ncml:id> 357 <ncml:id>cct</ncml:id> 358 <ncml:id>cat</ncml:id> 359 <ncml:id>cvt</ncml:id> 360 <ncml:id>ckt</ncml:id> 361 <ncml:id>temp_adj</ncml:id></ncml:apply></ncml:div></ncml:rate></ncml:transition> 362 <ncml:transition src="Ih_mO" dst="Ih_mC"> 363 <ncml:rate> 364 <ncml:div> 365 <ncml:sum>1.0 366 <ncml:neg> 367 <ncml:apply id="Ih_inf"> 368 <ncml:id>v</ncml:id> 369 <ncml:id>cvn</ncml:id> 370 <ncml:id>ckn</ncml:id></ncml:apply></ncml:neg></ncml:sum> 371 <ncml:apply id="Ih_tau"> 372 <ncml:id>v</ncml:id> 373 <ncml:id>cct</ncml:id> 374 <ncml:id>cat</ncml:id> 375 <ncml:id>cvt</ncml:id> 376 <ncml:id>ckt</ncml:id> 377 <ncml:id>temp_adj</ncml:id></ncml:apply></ncml:div></ncml:rate></ncml:transition></ncml:transitions> 378 <ncml:power>1.0</ncml:power></ncml:state_complex> 379 <ncml:const id="cvn"> 380 <ncml:expr>90.1</ncml:expr></ncml:const> 381 <ncml:const id="ckn"> 382 <ncml:expr>-9.9</ncml:expr></ncml:const> 383 <ncml:defun id="Ih_inf"> 384 <ncml:arg>v</ncml:arg> 385 <ncml:arg>cvn</ncml:arg> 386 <ncml:arg>ckn</ncml:arg> 387 <ncml:body> 388 <ncml:div>1.0 389 <ncml:sum>1.0 390 <ncml:exp> 391 <ncml:neg> 392 <ncml:div> 393 <ncml:sum> 394 <ncml:id>v</ncml:id> 395 <ncml:id>cvn</ncml:id></ncml:sum> 396 <ncml:id>ckn</ncml:id></ncml:div></ncml:neg></ncml:exp></ncml:sum></ncml:div></ncml:body></ncml:defun> 397 <ncml:const id="cct"> 398 <ncml:expr>190.0</ncml:expr></ncml:const> 399 <ncml:const id="cat"> 400 <ncml:expr>720.0</ncml:expr></ncml:const> 401 <ncml:const id="cvt"> 402 <ncml:expr>81.5</ncml:expr></ncml:const> 403 <ncml:const id="ckt"> 404 <ncml:expr>11.9</ncml:expr></ncml:const> 405 <ncml:defun id="Ih_tau"> 406 <ncml:arg>v</ncml:arg> 407 <ncml:arg>cct</ncml:arg> 408 <ncml:arg>cat</ncml:arg> 409 <ncml:arg>cvt</ncml:arg> 410 <ncml:arg>ckt</ncml:arg> 411 <ncml:arg>temp_adj</ncml:arg> 412 <ncml:body> 413 <ncml:div> 414 <ncml:sum> 415 <ncml:id>cct</ncml:id> 416 <ncml:mul> 417 <ncml:id>cat</ncml:id> 418 <ncml:exp> 419 <ncml:neg> 420 <ncml:pow> 421 <ncml:div> 422 <ncml:sum> 423 <ncml:id>v</ncml:id> 424 <ncml:id>cvt</ncml:id></ncml:sum> 425 <ncml:id>ckt</ncml:id></ncml:div>2.0</ncml:pow></ncml:neg></ncml:exp></ncml:mul></ncml:sum> 426 <ncml:id>temp_adj</ncml:id></ncml:div></ncml:body></ncml:defun> 427 <ncml:output id="Ih_m"></ncml:output></ncml:component> 428 <ncml:component name="comp7" type="pore"> 429 <ncml:const id="gbar_Ih"> 430 <ncml:expr>0.2</ncml:expr></ncml:const> 431 <ncml:output id="gbar_Ih"></ncml:output></ncml:component> 432 <ncml:component name="non-specific" type="permeating-substance"> 433 <ncml:const id="e_Ih"> 434 <ncml:expr>-30.0</ncml:expr></ncml:const> 435 <ncml:output id="e_Ih"></ncml:output></ncml:component></ncml:component> 436 <ncml:component name="comp11" type="ion-channel"> 437 <ncml:component name="comp9" type="gate"> 438 <ncml:state_complex id="CaP_m"> 439 <ncml:open>CaP_mO</ncml:open> 440 <ncml:initial>0.000135136381706817</ncml:initial> 441 <ncml:transitions> 442 <ncml:transition src="CaP_mC" dst="CaP_mO"> 443 <ncml:rate> 444 <ncml:div> 445 <ncml:apply id="CaP_inf"> 446 <ncml:id>v</ncml:id> 447 <ncml:id>cv</ncml:id> 448 <ncml:id>ck</ncml:id></ncml:apply> 449 <ncml:apply id="CaP_tau"> 450 <ncml:id>v</ncml:id> 451 <ncml:id>temp_adj</ncml:id></ncml:apply></ncml:div></ncml:rate></ncml:transition> 452 <ncml:transition src="CaP_mO" dst="CaP_mC"> 453 <ncml:rate> 454 <ncml:div> 455 <ncml:sum>1.0 456 <ncml:neg> 457 <ncml:apply id="CaP_inf"> 458 <ncml:id>v</ncml:id> 459 <ncml:id>cv</ncml:id> 460 <ncml:id>ck</ncml:id></ncml:apply></ncml:neg></ncml:sum> 461 <ncml:apply id="CaP_tau"> 462 <ncml:id>v</ncml:id> 463 <ncml:id>temp_adj</ncml:id></ncml:apply></ncml:div></ncml:rate></ncml:transition></ncml:transitions> 464 <ncml:power>1.0</ncml:power></ncml:state_complex> 465 <ncml:const id="cv"> 466 <ncml:expr>19.0</ncml:expr></ncml:const> 467 <ncml:const id="ck"> 468 <ncml:expr>5.5</ncml:expr></ncml:const> 469 <ncml:defun id="CaP_inf"> 470 <ncml:arg>v</ncml:arg> 471 <ncml:arg>cv</ncml:arg> 472 <ncml:arg>ck</ncml:arg> 473 <ncml:body> 474 <ncml:div>1.0 475 <ncml:sum>1.0 476 <ncml:exp> 477 <ncml:neg> 478 <ncml:div> 479 <ncml:sum> 480 <ncml:id>v</ncml:id> 481 <ncml:id>cv</ncml:id></ncml:sum> 482 <ncml:id>ck</ncml:id></ncml:div></ncml:neg></ncml:exp></ncml:sum></ncml:div></ncml:body></ncml:defun> 483 <ncml:defun id="CaP_tau"> 484 <ncml:arg>v</ncml:arg> 485 <ncml:arg>temp_adj</ncml:arg> 486 <ncml:body> 487 <ncml:div> 488 <ncml:apply id="if"> 489 <ncml:gt> 490 <ncml:id>v</ncml:id>-50.0</ncml:gt> 491 <ncml:mul>1000.0 492 <ncml:sum>0.000191 493 <ncml:mul>0.00376 494 <ncml:pow> 495 <ncml:exp> 496 <ncml:neg> 497 <ncml:div> 498 <ncml:sum> 499 <ncml:id>v</ncml:id>41.9</ncml:sum>27.8</ncml:div></ncml:neg></ncml:exp>2.0</ncml:pow></ncml:mul></ncml:sum></ncml:mul> 500 <ncml:mul>1000.0 501 <ncml:sum>0.00026367 502 <ncml:mul>0.1278 503 <ncml:exp> 504 <ncml:mul>0.10327 505 <ncml:id>v</ncml:id></ncml:mul></ncml:exp></ncml:mul></ncml:sum></ncml:mul></ncml:apply> 506 <ncml:id>temp_adj</ncml:id></ncml:div></ncml:body></ncml:defun> 507 <ncml:output id="CaP_m"></ncml:output></ncml:component> 508 <ncml:component name="comp10" type="pore"> 509 <ncml:const id="gmax_CaP"> 510 <ncml:expr>0.01667</ncml:expr></ncml:const> 511 <ncml:asgn id="gbar_CaP"> 512 <expr> 513 <ncml:mul> 514 <ncml:id>gmax_CaP</ncml:id> 515 <ncml:apply id="ghk"> 516 <ncml:id>v</ncml:id> 517 <ncml:id>celsius</ncml:id> 518 <ncml:id>cai</ncml:id> 519 <ncml:id>cao</ncml:id></ncml:apply></ncml:mul></expr></ncml:asgn> 520 <ncml:output id="gbar_CaP"></ncml:output></ncml:component> 521 <ncml:component name="ca" type="accumulating-substance"></ncml:component></ncml:component> 522 <ncml:component name="comp14" type="ion-channel"> 523 <ncml:component name="comp12" type="gate"> 524 <ncml:state_complex id="CaBK_h"> 525 <ncml:open>CaBK_hO</ncml:open> 526 <ncml:initial>0.799252570696669</ncml:initial> 527 <ncml:transitions> 528 <ncml:transition src="CaBK_hC" dst="CaBK_hO"> 529 <ncml:rate> 530 <ncml:div> 531 <ncml:apply id="CaBK_hinf"> 532 <ncml:id>v</ncml:id> 533 <ncml:id>ch</ncml:id> 534 <ncml:id>cvh</ncml:id> 535 <ncml:id>ckh</ncml:id> 536 <ncml:id>temp_adj</ncml:id></ncml:apply> 537 <ncml:apply id="CaBK_htau"> 538 <ncml:id>v</ncml:id> 539 <ncml:id>cth</ncml:id> 540 <ncml:id>cvth1</ncml:id> 541 <ncml:id>ckth1</ncml:id> 542 <ncml:id>cvth2</ncml:id> 543 <ncml:id>cvth2</ncml:id> 544 <ncml:id>temp_adj</ncml:id></ncml:apply></ncml:div></ncml:rate></ncml:transition> 545 <ncml:transition src="CaBK_hO" dst="CaBK_hC"> 546 <ncml:rate> 547 <ncml:div> 548 <ncml:sum>1.0 549 <ncml:neg> 550 <ncml:apply id="CaBK_hinf"> 551 <ncml:id>v</ncml:id> 552 <ncml:id>ch</ncml:id> 553 <ncml:id>cvh</ncml:id> 554 <ncml:id>ckh</ncml:id> 555 <ncml:id>temp_adj</ncml:id></ncml:apply></ncml:neg></ncml:sum> 556 <ncml:apply id="CaBK_htau"> 557 <ncml:id>v</ncml:id> 558 <ncml:id>cth</ncml:id> 559 <ncml:id>cvth1</ncml:id> 560 <ncml:id>ckth1</ncml:id> 561 <ncml:id>cvth2</ncml:id> 562 <ncml:id>cvth2</ncml:id> 563 <ncml:id>temp_adj</ncml:id></ncml:apply></ncml:div></ncml:rate></ncml:transition></ncml:transitions> 564 <ncml:power>1.0</ncml:power></ncml:state_complex> 565 <ncml:state_complex id="CaBK_m"> 566 <ncml:open>CaBK_mO</ncml:open> 567 <ncml:initial>0.00326726870663768</ncml:initial> 568 <ncml:transitions> 569 <ncml:transition src="CaBK_mC" dst="CaBK_mO"> 570 <ncml:rate> 571 <ncml:div> 572 <ncml:apply id="CaBK_minf"> 573 <ncml:id>v</ncml:id> 574 <ncml:id>cvm</ncml:id> 575 <ncml:id>ckm</ncml:id> 576 <ncml:id>temp_adj</ncml:id></ncml:apply> 577 <ncml:apply id="CaBK_mtau"> 578 <ncml:id>v</ncml:id> 579 <ncml:id>ctm</ncml:id> 580 <ncml:id>cvtm1</ncml:id> 581 <ncml:id>cktm1</ncml:id> 582 <ncml:id>cvtm2</ncml:id> 583 <ncml:id>cktm2</ncml:id> 584 <ncml:id>temp_adj</ncml:id></ncml:apply></ncml:div></ncml:rate></ncml:transition> 585 <ncml:transition src="CaBK_mO" dst="CaBK_mC"> 586 <ncml:rate> 587 <ncml:div> 588 <ncml:sum>1.0 589 <ncml:neg> 590 <ncml:apply id="CaBK_minf"> 591 <ncml:id>v</ncml:id> 592 <ncml:id>cvm</ncml:id> 593 <ncml:id>ckm</ncml:id> 594 <ncml:id>temp_adj</ncml:id></ncml:apply></ncml:neg></ncml:sum> 595 <ncml:apply id="CaBK_mtau"> 596 <ncml:id>v</ncml:id> 597 <ncml:id>ctm</ncml:id> 598 <ncml:id>cvtm1</ncml:id> 599 <ncml:id>cktm1</ncml:id> 600 <ncml:id>cvtm2</ncml:id> 601 <ncml:id>cktm2</ncml:id> 602 <ncml:id>temp_adj</ncml:id></ncml:apply></ncml:div></ncml:rate></ncml:transition></ncml:transitions> 603 <ncml:power>3.0</ncml:power></ncml:state_complex> 604 <ncml:const id="zhalf"> 605 <ncml:expr>0.001</ncml:expr></ncml:const> 606 <ncml:defun id="CaBK_zinf"> 607 <ncml:arg>ca</ncml:arg> 608 <ncml:arg>zhalf</ncml:arg> 609 <ncml:body> 610 <ncml:div>1.0 611 <ncml:sum>1.0 612 <ncml:div> 613 <ncml:id>zhalf</ncml:id> 614 <ncml:id>ca</ncml:id></ncml:div></ncml:sum></ncml:div></ncml:body></ncml:defun> 615 <ncml:const id="CaBK_ztau"> 616 <ncml:expr>0.802741561760231</ncml:expr></ncml:const> 617 <ncml:const id="cvm"> 618 <ncml:expr>28.9</ncml:expr></ncml:const> 619 <ncml:const id="ckm"> 620 <ncml:expr>6.2</ncml:expr></ncml:const> 621 <ncml:defun id="CaBK_minf"> 622 <ncml:arg>v</ncml:arg> 623 <ncml:arg>cvm</ncml:arg> 624 <ncml:arg>ckm</ncml:arg> 625 <ncml:arg>temp_adj</ncml:arg> 626 <ncml:body> 627 <ncml:div> 628 <ncml:div>1.0 629 <ncml:sum>1.0 630 <ncml:exp> 631 <ncml:neg> 632 <ncml:div> 633 <ncml:sum> 634 <ncml:sum> 635 <ncml:id>v</ncml:id>5.0</ncml:sum> 636 <ncml:id>cvm</ncml:id></ncml:sum> 637 <ncml:id>ckm</ncml:id></ncml:div></ncml:neg></ncml:exp></ncml:sum></ncml:div> 638 <ncml:id>temp_adj</ncml:id></ncml:div></ncml:body></ncml:defun> 639 <ncml:const id="ctm"> 640 <ncml:expr>0.000505</ncml:expr></ncml:const> 641 <ncml:const id="cvtm1"> 642 <ncml:expr>86.4</ncml:expr></ncml:const> 643 <ncml:const id="cktm1"> 644 <ncml:expr>-10.1</ncml:expr></ncml:const> 645 <ncml:const id="cvtm2"> 646 <ncml:expr>-33.3</ncml:expr></ncml:const> 647 <ncml:const id="cktm2"> 648 <ncml:expr>10.0</ncml:expr></ncml:const> 649 <ncml:defun id="CaBK_mtau"> 650 <ncml:arg>v</ncml:arg> 651 <ncml:arg>ctm</ncml:arg> 652 <ncml:arg>cvtm1</ncml:arg> 653 <ncml:arg>cktm1</ncml:arg> 654 <ncml:arg>cvtm2</ncml:arg> 655 <ncml:arg>cktm2</ncml:arg> 656 <ncml:arg>temp_adj</ncml:arg> 657 <ncml:body> 658 <ncml:div> 659 <ncml:sum> 660 <ncml:id>ctm</ncml:id> 661 <ncml:div>1.0 662 <ncml:sum> 663 <ncml:exp> 664 <ncml:neg> 665 <ncml:div> 666 <ncml:sum> 667 <ncml:sum> 668 <ncml:id>v</ncml:id>5.0</ncml:sum> 669 <ncml:id>cvtm1</ncml:id></ncml:sum> 670 <ncml:id>cktm1</ncml:id></ncml:div></ncml:neg></ncml:exp> 671 <ncml:exp> 672 <ncml:neg> 673 <ncml:div> 674 <ncml:sum> 675 <ncml:sum> 676 <ncml:id>v</ncml:id>5.0</ncml:sum> 677 <ncml:id>cvtm2</ncml:id></ncml:sum> 678 <ncml:id>cktm2</ncml:id></ncml:div></ncml:neg></ncml:exp></ncml:sum></ncml:div></ncml:sum> 679 <ncml:id>temp_adj</ncml:id></ncml:div></ncml:body></ncml:defun> 680 <ncml:const id="ch"> 681 <ncml:expr>0.085</ncml:expr></ncml:const> 682 <ncml:const id="cvh"> 683 <ncml:expr>32.0</ncml:expr></ncml:const> 684 <ncml:const id="ckh"> 685 <ncml:expr>-5.8</ncml:expr></ncml:const> 686 <ncml:defun id="CaBK_hinf"> 687 <ncml:arg>v</ncml:arg> 688 <ncml:arg>ch</ncml:arg> 689 <ncml:arg>cvh</ncml:arg> 690 <ncml:arg>ckh</ncml:arg> 691 <ncml:arg>temp_adj</ncml:arg> 692 <ncml:body> 693 <ncml:div> 694 <ncml:sum> 695 <ncml:id>ch</ncml:id> 696 <ncml:div> 697 <ncml:sum>1.0 698 <ncml:neg> 699 <ncml:id>ch</ncml:id></ncml:neg></ncml:sum> 700 <ncml:sum>1.0 701 <ncml:exp> 702 <ncml:neg> 703 <ncml:div> 704 <ncml:sum> 705 <ncml:sum> 706 <ncml:id>v</ncml:id>5.0</ncml:sum> 707 <ncml:id>cvh</ncml:id></ncml:sum> 708 <ncml:id>ckh</ncml:id></ncml:div></ncml:neg></ncml:exp></ncml:sum></ncml:div></ncml:sum> 709 <ncml:id>temp_adj</ncml:id></ncml:div></ncml:body></ncml:defun> 710 <ncml:const id="cth"> 711 <ncml:expr>0.0019</ncml:expr></ncml:const> 712 <ncml:const id="cvth1"> 713 <ncml:expr>48.5</ncml:expr></ncml:const> 714 <ncml:const id="ckth1"> 715 <ncml:expr>-5.2</ncml:expr></ncml:const> 716 <ncml:const id="cvth2"> 717 <ncml:expr>-54.2</ncml:expr></ncml:const> 718 <ncml:const id="ckth2"> 719 <ncml:expr>12.9</ncml:expr></ncml:const> 720 <ncml:defun id="CaBK_htau"> 721 <ncml:arg>v</ncml:arg> 722 <ncml:arg>cth</ncml:arg> 723 <ncml:arg>ckth1</ncml:arg> 724 <ncml:arg>ckth2</ncml:arg> 725 <ncml:arg>cvth1</ncml:arg> 726 <ncml:arg>cvth2</ncml:arg> 727 <ncml:arg>temp_adj</ncml:arg> 728 <ncml:body> 729 <ncml:div> 730 <ncml:sum> 731 <ncml:id>cth</ncml:id> 732 <ncml:div>1.0 733 <ncml:sum> 734 <ncml:exp> 735 <ncml:div> 736 <ncml:sum> 737 <ncml:id>v</ncml:id> 738 <ncml:id>cvth1</ncml:id></ncml:sum> 739 <ncml:id>ckth1</ncml:id></ncml:div></ncml:exp> 740 <ncml:exp> 741 <ncml:div> 742 <ncml:sum> 743 <ncml:id>v</ncml:id> 744 <ncml:id>cvth2</ncml:id></ncml:sum> 745 <ncml:id>ckth2</ncml:id></ncml:div></ncml:exp></ncml:sum></ncml:div></ncml:sum> 746 <ncml:id>temp_adj</ncml:id></ncml:div></ncml:body></ncml:defun> 747 <ncml:state_complex id="CaBK_z"> 748 <ncml:open>zO</ncml:open> 749 <ncml:initial>0.0909090909090909</ncml:initial> 750 <ncml:transitions> 751 <ncml:transition src="zC" dst="zO"> 752 <ncml:rate> 753 <ncml:div> 754 <ncml:apply id="CaBK_zinf"> 755 <ncml:id>cai</ncml:id> 756 <ncml:id>zhalf</ncml:id></ncml:apply> 757 <ncml:id>CaBK_ztau</ncml:id></ncml:div></ncml:rate></ncml:transition> 758 <ncml:transition src="zO" dst="zC"> 759 <ncml:rate> 760 <ncml:div> 761 <ncml:sum>1.0 762 <ncml:neg> 763 <ncml:apply id="CaBK_zinf"> 764 <ncml:id>cai</ncml:id> 765 <ncml:id>zhalf</ncml:id></ncml:apply></ncml:neg></ncml:sum> 766 <ncml:id>CaBK_ztau</ncml:id></ncml:div></ncml:rate></ncml:transition></ncml:transitions> 767 <ncml:power>2.0</ncml:power></ncml:state_complex> 768 <ncml:output id="CaBK_h"></ncml:output> 769 <ncml:output id="CaBK_m"></ncml:output> 770 <ncml:output id="CaBK_z"></ncml:output></ncml:component> 771 <ncml:component name="comp13" type="pore"> 772 <ncml:const id="gbar_CaBK"> 773 <ncml:expr>0.014</ncml:expr></ncml:const> 774 <ncml:output id="gbar_CaBK"></ncml:output></ncml:component> 775 <ncml:component name="k" type="permeating-substance"> 776 <ncml:const id="e_CaBK"> 777 <ncml:expr>-85.0</ncml:expr></ncml:const> 778 <ncml:output id="e_CaBK"></ncml:output></ncml:component></ncml:component></ncml:model> -
release/3/nemo/trunk/extensions/nemo-hh.scm
r11895 r11977 95 95 (m-inf (lookup-field 'm-inf alst)) 96 96 (m-tau (lookup-field 'm-tau alst)) 97 (m-alpha (or (lookup-field 'm-alpha alst) 98 `(/ ,m-inf ,m-tau))) 99 (m-beta (or (lookup-field 'm-beta alst) 100 `(/ (- 1 ,m-inf) ,m-tau))) 97 (m-alpha (or (lookup-field 'm-alpha alst) `(/ ,m-inf ,m-tau))) 98 (m-beta (or (lookup-field 'm-beta alst) `(/ (- 1 ,m-inf) ,m-tau))) 101 99 (open (p$ ion 'mO)) 102 100 (closed (p$ ion 'mC)) 103 (mst `((power ,m-power) 104 (open ,open) 101 (mst `((power ,m-power) (open ,open) 105 102 (transitions (-> ,closed ,open ,m-alpha) 106 103 (-> ,open ,closed ,m-beta))))) … … 139 136 (add-external! ((dis 'add-external!) new-sys)) 140 137 (component-extend! ((dis 'component-extend!) new-sys)) 141 (components ((dis 'components) new-sys))142 138 (indent 0) 143 139 (indent+ (+ 2 indent ))) 144 (for-each 145 (lambda (comp) 146 (let ((comp-name (second comp))) 140 (let recur ((comp-name (nemo-intern 'toplevel))) 141 (let* ((comp-symbols ((dis 'component-symbols) new-sys comp-name)) 142 (subcomps ((dis 'component-subcomps) new-sys comp-name))) 143 (print "comp-name: " comp-name) 144 (print "comp-symbols: " comp-symbols) 147 145 (for-each (lambda (sym) 148 146 (hh-ionic-conductance-transform 149 147 new-sys (dis 'eval-const) env-extend! add-external! component-extend! 150 148 comp-name (environment-ref new-sys sym))) 151 ((dis 'component-symbols) new-sys comp-name))))152 components)149 comp-symbols) 150 (for-each recur (map second subcomps)))) 153 151 new-sys)))) -
release/3/nemo/trunk/nemo.scm
r11944 r11977 56 56 `( 57 57 ,(args:make-option (i) (required: "FORMAT") 58 (s+ "specify input format (xml, sxml )")58 (s+ "specify input format (xml, sxml, s-exp)") 59 59 (string->symbol arg)) 60 60 ,(args:make-option (xml) (optional: "FILE") … … 107 107 (let ((lst ((sxpath query '((ncml . "ncml") )) doc))) 108 108 (and (not (null? lst)) lst))) 109 109 110 (define (ncml-binding->binding node) 111 (match node 112 (('ncml:bnd ('@ ('id id)) ('ncml:expr expr)) 113 `(,($ id) ,(ncml-expr->expr expr))) 114 (else (error 'ncml-binding->binding "invalid binding " node)))) 110 115 111 116 (define (ncml-expr->expr node) … … 114 119 ((? string?) (sxml:number node)) 115 120 (('ncml:id id) (string->symbol (->string id))) 116 (('ncml:apply ('ncml:id id) . args) (cons (string->symbol (->string id)) (map ncml-expr->expr args))) 117 (((and op (? symbol?)) . args) (cons (ncml-op->op op) (map ncml-expr->expr args))))) 121 (('ncml:apply ('@ ('id id)) . args) (cons ($ id) (map ncml-expr->expr args))) 122 (('ncml:let ('ncml:bnds . bnds) ('ncml:expr body)) 123 `(let ,(map ncml-binding->binding bnds) ,(ncml-expr->expr body))) 124 (((and op (? symbol?)) . args) 125 (print "ncml-expr->expr: node = " node) 126 (cons (ncml-op->op op) (map ncml-expr->expr args))) 127 (else (error 'ncml-expr->expr "unknown expression " node)))) 118 128 119 129 … … 132 142 ((pre op) (string->symbol op)) 133 143 (else (error 'ncml-op->op "invalid operator" op)))))) 144 145 146 (define (nemo-constructor name declarations) 147 (let* ((nemo (make-nemo-core)) 148 (sys ((nemo 'system) name))) 149 (eval-nemo-system-decls nemo name sys declarations) 150 (list sys nemo))) 151 152 (define (sexp->model options doc) 153 (match doc 154 (('nemo-model model-name model-decls) 155 (let* ((model+nemo (nemo-constructor model-name model-decls)) 156 (model (first model+nemo)) 157 (nemo (second model+nemo))) 158 (let ((model-1 (nemo:hh-transformer model))) 159 (if (assoc 'depgraph options) (print "dependency graph: " ((nemo 'depgraph*) model-1))) 160 (if (assoc 'exports options) (print "exports: " ((nemo 'exports) model-1))) 161 (if (assoc 'imports options) (print "imports: " ((nemo 'imports) model-1))) 162 (if (assoc 'components options) 163 (for-each (lambda (x) 164 (print "component " x ": " ((nemo 'component-exports) model-1 (second x))) 165 (print "component " x " subcomponents: " ((nemo 'component-subcomps) model-1 (second x)))) 166 ((nemo 'components) model-1))) 167 model-1))) 168 (else (error 'sexp->model "unknown model format")))) 169 170 (define (model->nmodl options model) 171 (nemo:nmodl-translator model (lookup-def 'nmodl-method options) (lookup-def 'table options) -150 150 1)) 172 173 174 (define (transition->ncml-transition x) 175 (match x (('-> src dst rate) 176 `(ncml:transition (@ (src ,src) (dst ,dst)) 177 (ncml:rate ,(expr->ncml-expr rate)))) 178 (else (error 'transition->ncml-transition "invalid transition " x)))) 179 180 (define builtin-fns 181 `(+ - * / pow neg abs atan asin acos sin cos exp ln 182 sqrt tan cosh sinh tanh hypot gamma lgamma log10 log2 log1p ldexp cube 183 > < <= >= = and or round ceiling floor max min)) 184 185 (define (binding->ncml-binding bnd) 186 (match bnd 187 ((id expr) `(ncml:bnd (@ (id ,id)) (ncml:expr ,(expr->ncml-expr expr)))) 188 (else (error 'binding->ncml-binding "invalid binding " bnd)))) 189 190 (define (expr->ncml-expr x) 191 (match x 192 ((? number?) x) 193 ((? symbol?) `(ncml:id ,x)) 194 (('let bnds expr) 195 `(ncml:let (ncml:bnds . ,(map binding->ncml-binding bnds)) 196 (ncml:expr ,(expr->ncml-expr expr)))) 197 (((and op (? symbol?)) . args) 198 (let ((ncml-expr (if (member op builtin-fns) 199 (cons (op->ncml-op op) (map expr->ncml-expr args)) 200 `(ncml:apply (@ (id ,op)) ,@(map expr->ncml-expr args))))) 201 ncml-expr)) 202 (else (error 'expr->ncml-expr "unknown expression " x)))) 203 204 205 206 (define (op->ncml-op op) 207 (case op 208 ((+) 'ncml:sum) 209 ((-) 'ncml:sub) 210 ((*) 'ncml:mul) 211 ((/) 'ncml:div) 212 ((>) 'ncml:gt) 213 ((<) 'ncml:lt) 214 ((<=) 'ncml:lte) 215 ((>=) 'ncml:gte) 216 ((=) 'ncml:eq) 217 (else (string->symbol (string-append "ncml:" (->string op)))))) 218 219 220 (define (make-component->ncml dis model) 221 (lambda (x) 222 (let ((en (environment-ref model x))) 223 (cond ((procedure? en) 224 (let ((fd (procedure-data en))) 225 `(ncml:defun (@ (id ,x)) 226 ,@(map (lambda (v) `(ncml:arg ,v)) (lookup-def 'vars fd)) 227 (ncml:body ,(expr->ncml-expr (lookup-def 'body fd)))))) 228 (else 229 (match en 230 231 (($ nemo:quantity 'EXTERNAL local-name name namespace) 232 (if namespace 233 `(ncml:input (@ (id ,name)) (as ,local-name) (from ,namespace)) 234 `(ncml:input (@ (id ,name)) (as ,local-name)))) 235 (($ nemo:quantity 'CONST name value) 236 `(ncml:const (@ (id ,name)) (ncml:expr ,value))) 237 238 (($ nemo:quantity 'ASGN name value rhs) 239 (let ((expr (expr->ncml-expr rhs))) 240 `(ncml:asgn (@ (id ,name)) (ncml:expr ,expr)))) 241 242 (($ nemo:quantity 'TSCOMP name initial open trs p) 243 (let ((sxml-trs (map transition->ncml-transition trs))) 244 `(ncml:state_complex (@ (id ,name)) 245 (ncml:open ,open) (ncml:initial ,(expr->ncml-expr initial)) 246 (ncml:transitions ,@sxml-trs) 247 (ncml:power ,(expr->ncml-expr p))))) 248 249 (($ nemo:quantity 'COMPONENT type lst) 250 (let ((component->ncml (make-component->ncml dis model)) 251 (component-exports ((dis 'component-exports) model x))) 252 (case type 253 ((toplevel) `(,@(map component->ncml lst) 254 ,@(map (lambda (x) `(ncml:output (@ (id ,x)))) component-exports))) 255 (else `(ncml:component (@ (name ,x) (type ,type)) 256 ,@(filter-map component->ncml lst) 257 ,@(map (lambda (x) `(ncml:output (@ (id ,x)))) component-exports) 258 ))))) 259 260 (else #f))))))) 261 262 263 (define (model->ncml options model) 264 (match-let ((($ nemo:quantity 'DISPATCH dis) (environment-ref model (nemo-intern 'dispatch)))) 265 (let ((sysname ((dis 'sysname) model)) 266 (component->ncml (make-component->ncml dis model))) 267 `(ncml:model (@ (name ,sysname)) ,@(component->ncml (nemo-intern 'toplevel)))))) 268 134 269 135 270 (require-extension stx-engine) … … 182 317 (sxml:match 'ncml:input 183 318 (lambda (node bindings root env) 319 (print "input: node = " node) 184 320 (let ((id (sxml:attr node 'id)) 185 (from (sxml:kidn 'ncml:from node))186 (as (sxml:kidn 'ncml:as node)))321 (from (sxml:kidn* 'ncml:from node)) 322 (as (sxml:kidn* 'ncml:as node))) 187 323 (if (not id) (error 'input-template "input declaration requires id attribute")) 188 324 (cond ((and from as) `(input (,($ id) as ,($ (second as) ) from ,($ (second from)) ))) … … 194 330 (sxml:match 'ncml:output 195 331 (lambda (node bindings root env) 332 (print "output: node = " node) 196 333 (let ((id (sxml:attr node 'id))) 197 334 (if (not id) (error 'output-template "output declaration requires id attribute")) … … 201 338 (sxml:match 'ncml:const 202 339 (lambda (node bindings root env) 340 (print "const: node = " node) 203 341 (let* ((id (sxml:attr node 'id)) 204 342 (expr ((lambda (x) … … 206 344 (error 'const-template "const declaration " id " requires expr element") 207 345 (ncml-expr->expr (second x)))) 208 (sxml:kidn 'ncml:expr node))))346 (sxml:kidn* 'ncml:expr node)))) 209 347 (if (not id) (error 'const-template "const declaration requires id attribute")) 210 348 `(const ,($ id) = ,expr))))) … … 213 351 (sxml:match 'ncml:transition 214 352 (lambda (node bindings root env) 353 (print "transition: node = " node) 215 354 (let ((src (sxml:attr node 'src)) 216 (d est (sxml:attr node 'dest))217 ( expr((lambda (x)218 (if (not x)219 (error 'state-complex-transition-template220 "state complex transition requires rate element")221 (ncml-expr->expr (second x))))222 (sxml:kidn'ncml:rate node))))355 (dst (sxml:attr node 'dst)) 356 (rate ((lambda (x) 357 (if (not x) 358 (error 'state-complex-transition-template 359 "state complex transition requires rate element") 360 (ncml-expr->expr (second x)))) 361 (sxml:kidn* 'ncml:rate node)))) 223 362 (if (not src) (error 'state-complex-transition-template 224 363 "state complex transition requires src attribute")) 225 (if (not dest) (error 'state-complex-transition-template 226 "state complex transition requires dest attribute")) 227 `(-> ,($ src) ,($ dest) ,rate))))) 364 (if (not dst) (error 'state-complex-transition-template 365 "state complex transition requires dst attribute")) 366 367 `(-> ,($ src) ,($ dst) ,rate))))) 228 368 229 369 (asgn-template 230 370 (sxml:match 'ncml:asgn 231 371 (lambda (node bindings root env) 372 (print "asgn: node = " node) 232 373 (let ((id (sxml:attr node 'id)) 233 374 (expr ((lambda (x) … … 235 376 (error 'asgn-template "algebraic assignment requires expr element") 236 377 (ncml-expr->expr (second x)))) 237 (sxml:kidn 'ncml:expr node))))378 (sxml:kidn* 'ncml:expr node)))) 238 379 (if (not id) (error 'asgn-template "algebraic assignment requires id attribute")) 239 380 `(,($ id) = ,expr))))) … … 243 384 (sxml:match 'ncml:state_complex 244 385 (lambda (node bindings root env) 245 (let ((id (sxml:attr node 'id)) 386 (print "state: node = " node) 387 (let ((id (string->symbol (->string (sxml:attr node 'id)))) 246 388 (initial ((lambda (x) 247 389 (if (not x) … … 249 391 "state complex declaration requires initial element") 250 392 (ncml-expr->expr (second x)))) 251 (sxml:kidn 'ncml:initial node)))393 (sxml:kidn* 'ncml:initial node))) 252 394 (open ((lambda (x) 253 395 (if (not x) … … 255 397 "state complex declaration requires open element") 256 398 ($ (second x)))) 257 (sxml:kidn 'ncml:open node)))399 (sxml:kidn* 'ncml:open node))) 258 400 (power ((lambda (x) 259 401 (if (not x) 260 402 (error 'state-complex-template 261 403 "state complex declaration requires open element") 262 (s tring->integer (second x))))263 (sxml:kidn 'ncml:power node)))404 (sxml:number (second x)))) 405 (sxml:kidn* 'ncml:power node))) 264 406 (transitions ((lambda (x) 265 407 (if (not x) … … 267 409 "state complex declaration requires transitions element") 268 410 (let ((tmpl (sxml:make-null-ss state-complex-transition-template))) 269 (stx:apply-templates xtmpl root env))))270 (sxml:kidn 'ncml:transitions node))))411 (stx:apply-templates (cdr x) tmpl root env)))) 412 (sxml:kidn* 'ncml:transitions node)))) 271 413 272 414 (if (not id) (error 'state-complex-template "state complex transition requires id attribute")) 273 415 `(state-complex (,id (initial ,initial) (open ,open) (power ,power) 274 (transitions , transitions)))))))416 (transitions ,@transitions))))))) 275 417 276 418 … … 278 420 (sxml:match 'ncml:defun 279 421 (lambda (node bindings root env) 422 (print "defun: node = " node) 280 423 (let ((id (sxml:attr node 'id)) 281 424 (args ((lambda (x) 425 (print "defun: arg = " x) 282 426 (if (null? x) 283 427 (error 'defun-template … … 286 430 (sxml:kidsn 'ncml:arg node))) 287 431 (body ((lambda (x) 432 (print "defun: body = " x) 288 433 (if (not x) 289 434 (error 'defun-template 290 435 "function definition requires body element") 291 436 (ncml-expr->expr (second x)))) 292 (sxml:kidn 'ncml:body node))))437 (sxml:kidn* 'ncml:body node)))) 293 438 (if (not id) (error 'defun-template "function definition requires id attribute")) 294 439 `(defun ,($ id) ,args ,body))))) … … 297 442 (sxml:match 'ncml:component 298 443 (lambda (node bindings root env) 444 (print "component: node = " node) 299 445 (let ((name (sxml:attr node 'name)) 300 446 (type (sxml:attr node 'type))) … … 309 455 (let* ((or-expr (lambda (x) (and x (ncml-expr->expr (second x))))) 310 456 (id (sxml:attr node 'id)) 311 (initial_m (or-expr (sxml:kidn 'ncml:initial_m node)))312 (initial_h (or-expr (sxml:kidn 'ncml:initial_h node)))313 (m_power (or-expr (sxml:kidn 'ncml:m_power node)))314 (h_power (or-expr (sxml:kidn 'ncml:h_power node)))315 (m_alpha (or-expr (sxml:kidn 'ncml:m_alpha node)))316 (m_beta (or-expr (sxml:kidn 'ncml:m_beta node)))317 (h_alpha (or-expr (sxml:kidn 'ncml:h_alpha node)))318 (h_beta (or-expr (sxml:kidn 'ncml:h_beta node)))319 (m_tau (or-expr (sxml:kidn 'ncml:m_tau node)))320 (m_inf (or-expr (sxml:kidn 'ncml:m_inf node)))321 (h_tau (or-expr (sxml:kidn 'ncml:h_tau node)))322 (h_inf (or-expr (sxml:kidn 'ncml:h_inf node))))457 (initial_m (or-expr (sxml:kidn* 'ncml:initial_m node))) 458 (initial_h (or-expr (sxml:kidn* 'ncml:initial_h node))) 459 (m_power (or-expr (sxml:kidn* 'ncml:m_power node))) 460 (h_power (or-expr (sxml:kidn* 'ncml:h_power node))) 461 (m_alpha (or-expr (sxml:kidn* 'ncml:m_alpha node))) 462 (m_beta (or-expr (sxml:kidn* 'ncml:m_beta node))) 463 (h_alpha (or-expr (sxml:kidn* 'ncml:h_alpha node))) 464 (h_beta (or-expr (sxml:kidn* 'ncml:h_beta node))) 465 (m_tau (or-expr (sxml:kidn* 'ncml:m_tau node))) 466 (m_inf (or-expr (sxml:kidn* 'ncml:m_inf node))) 467 (h_tau (or-expr (sxml:kidn* 'ncml:h_tau node))) 468 (h_inf (or-expr (sxml:kidn* 'ncml:h_inf node)))) 323 469 (if (not id) 324 470 (error 'hh-template "hh ionic conductance definition requires id attribute")) … … 354 500 355 501 (define (ncml->model options doc) 356 (let* ((ncml:model (car (ncml:sxpath '(ncml:model) doc))) 502 (let* ((ncml:model ((lambda (x) 503 (if (null? x) (error 'ncml->model "ncml:model element not found in input document") (car x))) 504 (ncml:sxpath '(ncml:model) `(*TOP* . ,doc)))) 357 505 (model-name (sxml:attr ncml:model 'name)) 358 506 (model-decls (ncml->decls (sxml:kids ncml:model)))) … … 362 510 (let ((model-1 (nemo:hh-transformer model))) 363 511 (if (assoc 'depgraph options) (print "dependency graph: " ((nemo 'depgraph*) model-1))) 364 (if (assoc 'exports options) (print "exports: " ((nemo 'exports) model-1))) 512 (if (assoc 'exports options) (print "exports: " ((nemo 'exports) model-1))) 365 513 (if (assoc 'imports options) (print "imports: " ((nemo 'imports) model-1))) 366 514 (if (assoc 'components options) … … 372 520 373 521 374 (define (nemo-constructor name declarations)375 (let* ((nemo (make-nemo-core))376 (sys ((nemo 'system) name)))377 (eval-nemo-system-decls nemo name sys declarations)378 (list sys nemo)))379 380 381 (define (model->nmodl options model)382 (nemo:nmodl-translator model-1 (lookup-def 'nmodl-method options) (lookup-def 'table options) -150 150 1))383 384 #|385 (define (model->sxml options model)386 (match-let ((($ nemo:quantity 'DISPATCH dis) (environment-ref model (nemo-intern 'dispatch)))387 (($ nemo:quantity 'SYSNAME dis) (environment-ref model (nemo-intern 'sysname))))388 (let* ((defuns ((dis 'defuns) model))389 (sxml-defuns (map (lambda (x) (let* ((ef (environment-ref model x))390 (fd (procedure-data ef)))391 `(ncml:defun (@ (ncml:id ,x))392 ,(map (lambda (v) `(ncml:arg ,v)) (alist-ref 'vars fd))393 (ncml:body ,(alist-ref 'body fd)))394 )) defuns))395 (consts ((dis 'consts) model))396 |#397 398 522 399 523 (define (main options operands) 400 (if (not (null? operands)) 524 (if (null? operands) 525 (usage) 401 526 (for-each 402 527 (lambda (operand) … … 407 532 (lambda (x) 408 533 (case ($ x) 409 ((s exp) 'sexp)534 ((s-exp sexp) 'sexp) 410 535 ((sxml) 'sxml) 411 536 ((xml) 'xml) … … 413 538 (else (case ((lambda (x) (or (not x) ($ x))) 414 539 (pathname-extension operand)) 415 ((s exp) 'sexp)540 ((s-exp sexp) 'sexp) 416 541 ((sxml) 'sxml) 417 542 ((xml) 'xml) 418 543 (else 'xml))))) 419 544 (doc (case in-format 420 ((s exp) (read-sexp operand))545 ((s-exp sexp) (read-sexp operand)) 421 546 ((sxml) (read-sexp operand)) 422 ((xml) (read-sxml operand))547 ((xml) (read-xml operand)) 423 548 (else (error 'nemo "unknown input format" in-format)))) 424 549 (model (case in-format 425 550 ((sxml xml) (ncml->model options doc)) 426 ((s exp) (ncml->model options doc))551 ((s-exp sexp) (sexp->model options doc)) 427 552 (else (error 'nemo "unknown input format" in-format)))) 428 (sxml-fname ((lambda (x) (and x (if (string? (cdr x)) (s+ (pathname-strip-extension (cdr x)) ".sxml") 553 (sxml-fname ((lambda (x) (and x (if (and (cdr x) (string? (cdr x))) 554 (s+ (pathname-strip-extension (cdr x)) ".sxml") 429 555 (s+ (pathname-strip-extension operand) ".sxml")))) 430 556 (assoc 'sxml options))) 431 (xml-fname ((lambda (x) (and x (if (string? (cdr x)) (s+ (pathname-strip-extension (cdr x)) ".xml") 432 (s+ (pathname-strip-extension operand) ".xml")))) 557 (xml-fname ((lambda (x) (and x (if (and (cdr x) (string? (cdr x))) 558 (s+ (pathname-strip-extension (cdr x)) ".xml") 559 (s+ (pathname-strip-extension operand) ".xml")))) 433 560 (assoc 'xml options))) 434 (mod-fname ((lambda (x) (and x (if (string? (cdr x)) (s+ (pathname-strip-extension (cdr x)) ".mod") 561 (mod-fname ((lambda (x) (and x (if (and (cdr x) (string? (cdr x))) 562 (s+ (pathname-strip-extension (cdr x)) ".mod") 435 563 (s+ (pathname-strip-extension operand) ".mod")))) 436 564 (assoc 'nmodl options))) … … 440 568 ((cnexp derivimplicit #f) method) 441 569 (else (error "nmodl-method must be one of cnexp, derivimplicit")))))) 442 (if sxml-fname (with-output-to-file sxml-fname (lambda () (pretty-print doc)))) 443 (if xml-fname (let ((doc1 (ensure-xmlns 570 (if sxml-fname (with-output-to-file sxml-fname (lambda () (pretty-print (model->ncml options model))))) 571 (if xml-fname (let* ((doc (model->ncml options model)) 572 (doc1 (ensure-xmlns 444 573 (cond ((eq? (car doc) '*TOP*) (assoc 'ncml:model (cdr doc))) 445 574 (else doc))))) 446 575 (with-output-to-file xml-fname (lambda () (print-fragments (generate-XML `(begin ,doc1))))))) 447 (with-output-to-file 448 mod-fname (lambda () 449 (model->nmodl `((method . ,nmodl-method) 450 (table . ,(assoc 't options))) model))) 576 (if mod-fname 577 (with-output-to-file 578 mod-fname (lambda () 579 (model->nmodl `((method . ,nmodl-method) 580 (table . ,(assoc 't options))) model)))) 451 581 )) 452 582 operands))) -
release/3/nemo/trunk/nemo.setup
r11944 r11977 88 88 ,@(if has-exports? `((exports "nemo-hh.exports")) (list)) )) 89 89 90 (compile - O2nemo.scm -lchicken)90 (compile -d2 -O nemo.scm -lchicken) 91 91 92 92 (install-program
Note: See TracChangeset
for help on using the changeset viewer.