-
Notifications
You must be signed in to change notification settings - Fork 0
/
MembraneAssignmentProcess.cpp
151 lines (121 loc) · 3.72 KB
/
MembraneAssignmentProcess.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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
#include "libecs.hpp"
#include "Process.hpp"
USE_LIBECS;
LIBECS_DM_CLASS( MembraneAssignmentProcess, Process )
{
public:
LIBECS_DM_OBJECT( MembraneAssignmentProcess, Process )
{
INHERIT_PROPERTIES( Process );
}
MembraneAssignmentProcess()
{
// do nothing
}
virtual void initialize()
{
Process::initialize();
T = getVariableReference( "T" ).getVariable();
Vm = getVariableReference( "Vm" ).getVariable();
R = getVariableReference( "R" ).getVariable();
F = getVariableReference( "F" ).getVariable();
zK = getVariableReference( "zK" ).getVariable();
zNa = getVariableReference( "zNa" ).getVariable();
zCa = getVariableReference( "zCa" ).getVariable();
vrtf = getVariableReference( "vrtf" ).getVariable();
rtf = getVariableReference( "rtf" ).getVariable();
CFK = getVariableReference( "CFK" ).getVariable();
EK = getVariableReference( "EK" ).getVariable();
Ke = getVariableReference( "Ke" ).getVariable();
Ki = getVariableReference( "Ki" ).getVariable();
CFNa = getVariableReference( "CFNa" ).getVariable();
ENa = getVariableReference( "ENa" ).getVariable();
Nae = getVariableReference( "Nae" ).getVariable();
Nai = getVariableReference( "Nai" ).getVariable();
CFCa = getVariableReference( "CFCa" ).getVariable();
ECa = getVariableReference( "ECa" ).getVariable();
Cae = getVariableReference( "Cae" ).getVariable();
Cai = getVariableReference( "Cai" ).getVariable();
///*
current = getVariableReference( "current" ).getVariable();
currentNa = getVariableReference( "currentNa" ).getVariable();
currentK = getVariableReference( "currentK" ).getVariable();
currentCa = getVariableReference( "currentCa" ).getVariable();
//*/
_R_F = R->getValue() / F->getValue();
_R_FzK = _R_F / zK->getValue();
_R_FzNa = _R_F / zNa->getValue();
_R_FzCa = _R_F / zCa->getValue();
}
virtual void fire()
{
_T = T->getValue();
_V_T = Vm->getValue() / _T;
_Ke_MolarConc = Ke->getMolarConc();
_Ki_MolarConc = Ki->getMolarConc();
_Nae_MolarConc = Nae->getMolarConc();
_Nai_MolarConc = Nai->getMolarConc();
_Cae_MolarConc = Cae->getMolarConc();
_Cai_MolarConc = Cai->getMolarConc();
EK->setValue( _R_FzK * _T * log( _Ke_MolarConc / _Ki_MolarConc ) );
ENa->setValue( _R_FzNa * _T * log( _Nae_MolarConc / _Nai_MolarConc ) );
ECa->setValue( _R_FzCa * _T * log( _Cae_MolarConc / _Cai_MolarConc ) );
CFK->setValue( _ConstantField( _Ke_MolarConc, _Ki_MolarConc, ( _V_T / _R_FzK )));
CFNa->setValue( _ConstantField( Nae->getMolarConc(), Nai->getMolarConc(), ( _V_T / _R_FzNa )));
CFCa->setValue( _ConstantField( Cae->getMolarConc(), Cai->getMolarConc(), ( _V_T / _R_FzCa )));
vrtf->setValue( _V_T / _R_F );
rtf->setValue( _R_F * _T );
///*
current->setValue( 0.0 );
currentNa->setValue( 0.0 );
currentK->setValue( 0.0 );
currentCa->setValue( 0.0 );
//*/
}
protected:
Variable* T;
Variable* Vm;
Variable* R;
Variable* F;
Variable* zK;
Variable* zNa;
Variable* zCa;
Variable* vrtf;
Variable* rtf;
Variable* EK;
Variable* Ke;
Variable* Ki;
Variable* ENa;
Variable* CFNa;
Variable* Nae;
Variable* Nai;
Variable* CFK;
Variable* ECa;
Variable* CFCa;
Variable* Cae;
Variable* Cai;
///*
Variable* current;
Variable* currentNa;
Variable* currentK;
Variable* currentCa;
//*/
private:
Real _T;
Real _R_F;
Real _R_FzK;
Real _R_FzNa;
Real _R_FzCa;
Real _V_T;
Real _Ke_MolarConc;
Real _Ki_MolarConc;
Real _Nae_MolarConc;
Real _Nai_MolarConc;
Real _Cae_MolarConc;
Real _Cai_MolarConc;
Real _ConstantField( Real Xe_MolarConc, Real Xi_MolarConc, Real zFV_RT )
{
return ( zFV_RT * ( Xi_MolarConc - Xe_MolarConc * exp( -zFV_RT )) / ( 1.0 - exp( -zFV_RT ) ) * 1000.0 );
}
};
LIBECS_DM_INIT( MembraneAssignmentProcess, Process );