source: project/release/4/9ML-toolkit/trunk/examples/TestLeakyIAF.9ML @ 23765

Last change on this file since 23765 was 23765, checked in by Ivan Raikov, 9 years ago

9ML-toolkit: more fixes to the examples

File size: 1.7 KB
Line 
1
2component S = Signal
3
4component LeakyIAF =
5struct
6
7 binding construct V t gL vL Isyn C theta tspike spike Vreset trefractory refractory_end h =
8
9        binding subthreshold_eq       = [ D (V t h) = (((- gL) * (V - vL)) + Isyn) / C ]
10        binding threshold_detect      = [ spike = (V >= theta) ]
11        binding tspike_assignment     = [ tspike = if spike then t else tspike ]
12        binding subthreshold_regime   = Diagram.SEQUENCE subthreshold_eq (Diagram.SEQUENCE threshold_detect tspike_assignment)
13        binding refractory_regime     = [
14                                          [ V = Vreset ]
15                                          [ refractory_end = (t >= (tspike + trefractory)) ]
16                                          [ t = t + h ]
17                                        ]
18        return Diagram.RTRANSITION subthreshold_regime refractory_regime spike refractory_end
19
20
21
22end
23
24component TestLeakyIAF =
25struct
26
27  binding diagram =
28    LeakyIAF.construct
29        ( S.realsig `V       (S.realconst -65.0 ))
30        ( S.realsig `t       (S.realconst 0.0 ))
31        ( S.realsig `gL      (S.realconst 0.2 ))
32        ( S.realsig `vL      (S.realconst -70.0 ))
33        ( S.realsig `Isyn    (S.realconst 20.0 ))
34        ( S.realsig `C       (S.realconst 1.0 ))
35        ( S.realsig `theta   (S.realconst -25.0 ))
36        ( S.realsig `tspike  (S.realconst 0.0 ))
37        ( S.boolsig `spike   (S.boolconst false ))
38        ( S.realsig `Vreset  (S.realconst -65.0 ))
39        ( S.realsig `trefractory (S.realconst 5.0 ))
40        ( S.boolsig `refractory_end (S.boolconst false ))
41        ( S.realsig `h  (S.realconst 0.001 ))
42
43
44  binding ivp = IVP.construct diagram `t `h 0.0 5.0
45
46end
Note: See TracBrowser for help on using the repository browser.