-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathAlphaSynSRk4.cpp
80 lines (60 loc) · 1.8 KB
/
AlphaSynSRk4.cpp
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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
/*************************************************************************/
/********** AlphaSyn.cpp *************/
/*************************************************************************/
/**** ****/
/**** Functions Step (computing method) and Init (intialisation) ****/
/**** for the class Alphasyn ****/
/**** ****/
/*************************************************************************/
#include "AlphaSynS.h"
#include <math.h>
#include <iostream.h>
void AlphaSynS::Init(const real dt){
G=0;
X=0;
t=0;
Gk1=0;
Gk2=0;
Gk3=0;
Gk4=0;
SynEv=0;
Nmem = int(floor(Lat/dt));
gMax=GetgMax(dt);
Pr=Pr0;
}
void AlphaSynS::Step( const real dt )
{
// reset the spike detection variable
SynEv=0;
// check the presynaptic voltage
// but ONLY if we're not already releasing (in the pulse time window)
if(t == 0 || t > pulseTime) {
if (itsComp->Memory[Nmem]>0){ SynEv=1; t=dt;}
}
// if we're not spiking -- i.e., t == 0 -- then return
if (t==0){
G=0;
Gk1=0;
Gk2=0;
Gk3=0;
Gk4=0;
SynEv=0;
Pr=Pr0;
return;
}
// else computes the conductance over a time step : alpha function.
PrInter=dt*(-(1/tau1+1/tau2)*Pr-1/tau1*Y);
Y += dt*(1/tau2*Pr-1/tau2*SynEv*MaxG/gMax);
Pr += PrInter;
t += dt;
// if G has gotten ridiculously small, reset t
if (t > pulseTime && Pr < 0.001E-19) {
Pr = Pr0;
G = 0;
Gk1=0;
Gk2=0;
Gk3=0;
Gk4=0;
t = 0;
}
}