Changeset 20764 in project


Ignore:
Timestamp:
10/10/10 15:54:17 (11 years ago)
Author:
Ivan Raikov
Message:

9ML-toolkit: example updates

Location:
release/4/9ML-toolkit/trunk
Files:
3 added
1 deleted
4 edited

Legend:

Unmodified
Added
Removed
  • release/4/9ML-toolkit/trunk/9ML-toolkit.setup

    r20680 r20764  
    66(make (
    77       ("9ML-report"
    8         ("NineMLcore.scm" "NineMLsignal.scm" "NineMLdiagram.scm" "NineMLinterval.scm" "NineMLgraph.scm" "report.scm" )
     8        ("NineMLcore.scm" "NineMLsignal.scm" "NineMLdiagram.scm" "NineMLinterval.scm" "NineMLgraph.scm" "NineMLivp.scm" "report.scm" )
    99        (compile -O -d2 -S report.scm -o 9ML-report ))
    1010
  • release/4/9ML-toolkit/trunk/NineMLsignal.scm

    r20679 r20764  
    88  (define path-real   (Pident (ident-create "real")))
    99  (define real-type   (Tcon path-real '()))
     10
     11  (define path-bool   (Pident (ident-create "bool")))
     12  (define bool-type   (Tcon path-bool '()))
    1013
    1114
     
    2629           (Value_sig (ident-create "signal")
    2730                      (make-valtype '() (arrow-type label-type sigfun-type)))
     31           
     32           (Value_sig (ident-create "realconst")
     33                      (make-valtype '() (arrow-type real-type sigfun-type)))
     34           
     35           (Value_sig (ident-create "realinitial")
     36                      (make-valtype '() (arrow-type real-type sigfun-type)))
     37           
     38           (Value_sig (ident-create "boolconst")
     39                      (make-valtype '() (arrow-type bool-type sigfun-type)))
     40           
     41           (Value_sig (ident-create "boolinitial")
     42                      (make-valtype '() (arrow-type bool-type sigfun-type)))
    2843           
    2944           (Value_sig (ident-create "neg")
     
    4863
    4964           (datacon 'sigfun 'signal 1)
     65           (datacon 'sigfun 'realconst 1)
     66           (datacon 'sigfun 'realinitial 1)
     67           (datacon 'sigfun 'boolconst 1)
     68           (datacon 'sigfun 'boolinitial 1)
    5069           (datacon 'sigfun 'neg 1)
    5170           (datacon 'sigfun 'cond 3))
  • release/4/9ML-toolkit/trunk/examples/LeakyIAF.9ML

    r20679 r20764  
    3030val make_diagram V t gL vL Isyn C theta tspike spike Vreset trefractory refractory_end =
    3131
    32   let
    33     subthreshold_eq  = D.ODE `V `t (S.div (S.add (S.mul (S.neg gL) (S.sub V vL)) Isyn) C)
    34   in
    35     let threshold_detect  = D.ASSIGN `spike (S.gte V theta)
    36     in
    37       let tspike_assignment  = D.ASSIGN `tspike (S.cond spike t tspike)
    38       in
    39         let subthreshold_regime  = D.SEQUENCE subthreshold_eq
     32  val subthreshold_eq  = D.ODE `V `t (S.div (S.add (S.mul (S.neg gL) (S.sub V vL)) Isyn) C)
     33  val threshold_detect  = D.ASSIGN `spike (S.gte V theta)
     34  val tspike_assignment  = D.ASSIGN `tspike (S.cond spike t tspike)
     35  val subthreshold_regime  = D.SEQUENCE subthreshold_eq
    4036                                          (D.SEQUENCE threshold_detect
    4137                                                      (D.DUP D.IDENTITY tspike_assignment))
    42         in
    43           let refractory_eq  = D.ASSIGN `V Vreset
    44           in
    45             let check_refractory_time  = D.ASSIGN `refractory_end (S.gte t (S.add tspike trefractory))
    46             in
    47               let refractory_regime  = D.UNION refractory_eq check_refractory_time
    48               in
    49                let LeakyIAF                 = D.RTRANSITION subthreshold_regime refractory_regime spike refractory_end
    50                in
    51                  LeakyIAF
     38  val refractory_eq  = D.ASSIGN `V Vreset
     39  val check_refractory_time  = D.ASSIGN `refractory_end (S.gte t (S.add tspike trefractory))
     40  val refractory_regime  = D.UNION refractory_eq check_refractory_time
     41 
     42  return D.RTRANSITION subthreshold_regime refractory_regime spike refractory_end
    5243
    5344
     
    8172                   I_network I_network `synapticPrototype make_diagram
    8273
     74
    8375end
    8476
     77
  • release/4/9ML-toolkit/trunk/report.scm

    r20679 r20764  
    4141(include "NineMLinterval.scm")
    4242(include "NineMLgraph.scm")
     43(include "NineMLivp.scm")
    4344
    4445(define init-scope      (make-parameter st-empty))
     
    244245           )
    245246
    246       (reset-graph!)
     247      (reset-graph)
    247248      (let recur ((tree tree))
    248249        (if (pair? tree)
     
    250251              (case (car tree)
    251252                ((SEQUENCE) 
    252                  (register-node! (cadr tree))
    253                  (register-node! (caddr tree))
    254                  (register-edge! (cadr tree) (caddr tree)))
    255                 (else (register-node! tree))
     253                 (register-node (cadr tree))
     254                 (register-node (caddr tree))
     255                 (register-edge (cadr tree) (caddr tree)))
     256                (else (register-node tree))
    256257                )
    257258              (case (car tree)
     
    732733
    733734  (let ((find-module (lambda (x) (env-find-module x (init-type-env)))))
    734     (Signal:module-initialize   "Signal" enter-module find-module init-eval-env)
    735     (Diagram:module-initialize  "Diagram" enter-module find-module init-eval-env)
    736     (Interval:module-initialize "Interval" enter-module find-module init-eval-env)
    737     (Graph:module-initialize    "Graph" enter-module find-module init-eval-env)
     735    (for-each (lambda (init name) (init name enter-module find-module init-eval-env))
     736              (list Signal:module-initialize   
     737                    Diagram:module-initialize 
     738                    Interval:module-initialize
     739                    Graph:module-initialize
     740                    IVP:module-initialize)
     741              (list "Signal" "Diagram" "Interval" "Graph" "IVP"))
    738742    )
    739743
Note: See TracChangeset for help on using the changeset viewer.