14
14
15
15
const Cinfo* CaConc::initCinfo ()
16
16
{
17
- static string doc[] =
18
- {
19
- " Name" , " CaConc \n " ,
20
- " Author" , " Upinder S. Bhalla, 2014, NCBS \n " ,
21
- " Description" , " CaConc: Calcium concentration pool. Takes current from a \n "
22
- " channel and keeps track of calcium buildup and depletion by a \n "
23
- " single exponential process. \n " ,
24
- };
25
-
26
- static Dinfo< CaConc > dinfo;
27
-
28
- static Cinfo CaConcCinfo (
29
- " CaConc" ,
30
- CaConcBase::initCinfo (),
31
- 0 ,
32
- 0 ,
33
- &dinfo,
34
- doc,
35
- sizeof (doc)/sizeof (string)
36
- );
37
-
38
- return &CaConcCinfo;
17
+ static string doc[] =
18
+ {
19
+ " Name" , " CaConc \n " ,
20
+ " Author" , " Upinder S. Bhalla, 2014, NCBS \n " ,
21
+ " Description" , " CaConc: Calcium concentration pool. Takes current from a \n "
22
+ " channel and keeps track of calcium buildup and depletion by a \n "
23
+ " single exponential process. \n " ,
24
+ };
25
+
26
+ static Dinfo< CaConc > dinfo;
27
+
28
+ static Cinfo CaConcCinfo (
29
+ " CaConc" ,
30
+ CaConcBase::initCinfo (),
31
+ 0 ,
32
+ 0 ,
33
+ &dinfo,
34
+ doc,
35
+ sizeof (doc)/sizeof (string)
36
+ );
37
+
38
+ return &CaConcCinfo;
39
39
}
40
40
// /////////////////////////////////////////////////
41
41
42
42
static const Cinfo* caConcCinfo = CaConc::initCinfo();
43
43
44
44
CaConc::CaConc ()
45
- : CaConcBase(),
46
- Ca_( 0.0 ),
47
- CaBasal_( 0.0 ),
48
- tau_( 1.0 ),
49
- B_( 1.0 ),
50
- c_( 0.0 ),
51
- activation_( 0.0 ),
52
- ceiling_( 1.0e9 ),
53
- floor_( 0.0 )
45
+ : CaConcBase(),
46
+ Ca_( 0.0 ),
47
+ CaBasal_( 0.0 ),
48
+ tau_( 1.0 ),
49
+ B_( 1.0 ),
50
+ c_( 0.0 ),
51
+ activation_( 0.0 ),
52
+ ceiling_( 1.0e9 ),
53
+ floor_( 0.0 )
54
54
{;}
55
55
56
56
// /////////////////////////////////////////////////
@@ -59,46 +59,46 @@ CaConc::CaConc()
59
59
60
60
void CaConc::vSetCa ( const Eref& e, double Ca )
61
61
{
62
- Ca_ = Ca;
62
+ Ca_ = Ca;
63
63
}
64
64
double CaConc::vGetCa ( const Eref& e ) const
65
65
{
66
- return Ca_;
66
+ return Ca_;
67
67
}
68
68
69
69
void CaConc::vSetCaBasal ( const Eref& e, double CaBasal )
70
70
{
71
- CaBasal_ = CaBasal;
71
+ CaBasal_ = CaBasal;
72
72
}
73
73
double CaConc::vGetCaBasal ( const Eref& e ) const
74
74
{
75
- return CaBasal_;
75
+ return CaBasal_;
76
76
}
77
77
78
78
void CaConc::vSetTau ( const Eref& e, double tau )
79
79
{
80
- tau_ = tau;
80
+ tau_ = tau;
81
81
}
82
82
double CaConc::vGetTau ( const Eref& e ) const
83
83
{
84
- return tau_;
84
+ return tau_;
85
85
}
86
86
87
87
void CaConc::vSetB ( const Eref& e, double B )
88
88
{
89
- B_ = B;
89
+ B_ = B;
90
90
}
91
91
double CaConc::vGetB ( const Eref& e ) const
92
92
{
93
- return B_;
93
+ return B_;
94
94
}
95
95
void CaConc::vSetCeiling ( const Eref& e, double ceiling )
96
96
{
97
97
ceiling_ = ceiling;
98
98
}
99
99
double CaConc::vGetCeiling ( const Eref& e ) const
100
100
{
101
- return ceiling_;
101
+ return ceiling_;
102
102
}
103
103
104
104
void CaConc::vSetFloor ( const Eref& e, double floor )
@@ -107,7 +107,7 @@ void CaConc::vSetFloor( const Eref& e, double floor )
107
107
}
108
108
double CaConc::vGetFloor ( const Eref& e ) const
109
109
{
110
- return floor_;
110
+ return floor_;
111
111
}
112
112
113
113
// /////////////////////////////////////////////////
@@ -116,45 +116,48 @@ double CaConc::vGetFloor( const Eref& e ) const
116
116
117
117
void CaConc::vReinit ( const Eref& e, ProcPtr p )
118
118
{
119
- activation_ = 0.0 ;
120
- c_ = 0.0 ;
121
- Ca_ = CaBasal_;
122
- concOut ()->send ( e, Ca_ );
119
+ activation_ = 0.0 ;
120
+ c_ = 0.0 ;
121
+ Ca_ = CaBasal_;
122
+ concOut ()->send ( e, Ca_ );
123
123
}
124
124
125
125
void CaConc::vProcess ( const Eref& e, ProcPtr p )
126
126
{
127
- double x = exp ( -p->dt / tau_ );
128
- Ca_ = CaBasal_ + c_ * x + ( B_ * activation_ * tau_ ) * (1.0 - x);
129
- if ( ceiling_ > 0.0 && Ca_ > ceiling_ ) {
130
- Ca_ = ceiling_;
131
- } else if ( Ca_ < floor_ ){
132
- Ca_ = floor_;
133
- }
134
- c_ = Ca_ - CaBasal_;
135
- concOut ()->send ( e, Ca_ );
136
- activation_ = 0 ;
127
+ double x = exp ( -p->dt / tau_ );
128
+ Ca_ = CaBasal_ + c_ * x + ( B_ * activation_ * tau_ ) * (1.0 - x);
129
+ if ( ceiling_ > 0.0 && Ca_ > ceiling_ )
130
+ {
131
+ Ca_ = ceiling_;
132
+ }
133
+ else if ( Ca_ < floor_ )
134
+ {
135
+ Ca_ = floor_;
136
+ }
137
+ c_ = Ca_ - CaBasal_;
138
+ concOut ()->send ( e, Ca_ );
139
+ activation_ = 0 ;
137
140
}
138
141
139
142
140
143
void CaConc::vCurrent ( const Eref& e, double I )
141
144
{
142
- activation_ += I;
145
+ activation_ += I;
143
146
}
144
147
145
148
void CaConc::vCurrentFraction ( const Eref& e, double I, double fraction )
146
149
{
147
- activation_ += I * fraction;
150
+ activation_ += I * fraction;
148
151
}
149
152
150
153
void CaConc::vIncrease ( const Eref& e, double I )
151
154
{
152
- activation_ += fabs ( I );
155
+ activation_ += fabs ( I );
153
156
}
154
157
155
158
void CaConc::vDecrease ( const Eref& e, double I )
156
159
{
157
- activation_ -= fabs ( I );
160
+ activation_ -= fabs ( I );
158
161
}
159
162
160
163
// /////////////////////////////////////////////////
@@ -165,52 +168,52 @@ void CaConc::vDecrease( const Eref& e, double I )
165
168
void testCaConc ()
166
169
{
167
170
/*
168
- CaConc cc;
169
- double tau = 0.10;
170
- double basal = 0.0001;
171
-
172
- cc.setCa( basal );
173
- cc.setCaBasal( basal );
174
- cc.setTau( tau );
175
- // Here we use a volume of 1e-15 m^3, i.e., a 10 micron cube.
176
- cc.setB( 5.2e-6 / 1e-15 );
177
- // Faraday constant = 96485.3415 s A / mol
178
- // Use a 1 pA input current. This should give (0.5e-12/F) moles/sec
179
- // influx, because Ca has valence of 2.
180
- // So we get 5.2e-18 moles/sec coming in.
181
- // Our volume is 1e-15 m^3
182
- // So our buildup should be at 5.2e-3 moles/m^3/sec = 5.2 uM/sec
183
- double curr = 1e-12;
184
- // This will settle when efflux = influx
185
- // dC/dt = B*Ik - C/tau = 0.
186
- // so Ca = CaBasal + tau * B * Ik =
187
- // 0.0001 + 0.1 * 5.2e-6 * 1e3 = 0.000626
188
-
189
- ProcInfo p;
190
- p.dt = 0.001;
191
- p.currTime = 0.0;
171
+ CaConc cc;
172
+ double tau = 0.10;
173
+ double basal = 0.0001;
174
+
175
+ cc.setCa( basal );
176
+ cc.setCaBasal( basal );
177
+ cc.setTau( tau );
178
+ // Here we use a volume of 1e-15 m^3, i.e., a 10 micron cube.
179
+ cc.setB( 5.2e-6 / 1e-15 );
180
+ // Faraday constant = 96485.3415 s A / mol
181
+ // Use a 1 pA input current. This should give (0.5e-12/F) moles/sec
182
+ // influx, because Ca has valence of 2.
183
+ // So we get 5.2e-18 moles/sec coming in.
184
+ // Our volume is 1e-15 m^3
185
+ // So our buildup should be at 5.2e-3 moles/m^3/sec = 5.2 uM/sec
186
+ double curr = 1e-12;
187
+ // This will settle when efflux = influx
188
+ // dC/dt = B*Ik - C/tau = 0.
189
+ // so Ca = CaBasal + tau * B * Ik =
190
+ // 0.0001 + 0.1 * 5.2e-6 * 1e3 = 0.000626
191
+
192
+ ProcInfo p;
193
+ p.dt = 0.001;
194
+ p.currTime = 0.0;
192
195
Eref sheller(Id().eref());
193
196
Shell * shell = reinterpret_cast<Shell*> (sheller.data());
194
197
Id temp = shell->doCreate("CaConc", Id(), "caconc", 1);
195
198
assert(temp.element()->getName() == "caconc");
196
- // Id tempId = Id::nextId();
197
- // Element temp( tempId, CaConc::initCinfo(), "temp", 0 );
198
- Eref er( &temp, 0 );
199
- cc.reinit( er, &p );
200
-
201
- double y;
202
- double conc;
203
- double delta = 0.0;
204
- for ( p.currTime = 0.0; p.currTime < 0.5; p.currTime += p.dt )
205
- {
206
- cc.current( curr );
207
- cc.process( er, &p );
208
- y = basal + 526.0e-6 * ( 1.0 - exp( -p.currTime / tau ) );
209
- conc = cc.getCa();
210
- delta += ( y - conc ) * ( y - conc );
211
- }
212
- assert( delta < 1e-6 );
213
- cout << "." << flush;
199
+ // Id tempId = Id::nextId();
200
+ // Element temp( tempId, CaConc::initCinfo(), "temp", 0 );
201
+ Eref er( &temp, 0 );
202
+ cc.reinit( er, &p );
203
+
204
+ double y;
205
+ double conc;
206
+ double delta = 0.0;
207
+ for ( p.currTime = 0.0; p.currTime < 0.5; p.currTime += p.dt )
208
+ {
209
+ cc.current( curr );
210
+ cc.process( er, &p );
211
+ y = basal + 526.0e-6 * ( 1.0 - exp( -p.currTime / tau ) );
212
+ conc = cc.getCa();
213
+ delta += ( y - conc ) * ( y - conc );
214
+ }
215
+ assert( delta < 1e-6 );
216
+ cout << "." << flush;
214
217
*/
215
218
}
216
219
#endif
0 commit comments