00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028 #include "TenTusscher2006OdeSystem.hpp"
00029 #include "OdeSystemInformation.hpp"
00030 #include <cmath>
00031 #include <cstdio>
00032 #include "Exception.hpp"
00033
00034
00035
00036 TenTusscher2006OdeSystem::TenTusscher2006OdeSystem(
00037 AbstractIvpOdeSolver *pSolver,
00038 AbstractStimulusFunction *pIntracellularStimulus)
00039 : AbstractCardiacCell(pSolver, 19, 11, pIntracellularStimulus)
00040 {
00041
00042 mpSystemInfo = OdeSystemInformation<TenTusscher2006OdeSystem>::Instance();
00043
00044 mScaleFactorGks=1.0;
00045 mScaleFactorIto=1.0;
00046 mScaleFactorGkr=1.0;
00047
00048 AbstractCardiacCell::Init();
00049 }
00050
00051
00052 TenTusscher2006OdeSystem::~TenTusscher2006OdeSystem(void)
00053 {
00054 }
00055
00056 void TenTusscher2006OdeSystem::SetScaleFactorGks(double sfgks)
00057 {
00058 mScaleFactorGks=sfgks;
00059 }
00060 void TenTusscher2006OdeSystem::SetScaleFactorIto(double sfito)
00061 {
00062 mScaleFactorIto=sfito;
00063 }
00064 void TenTusscher2006OdeSystem::SetScaleFactorGkr(double sfgkr)
00065 {
00066 mScaleFactorGkr=sfgkr;
00067 }
00077 void TenTusscher2006OdeSystem::EvaluateYDerivatives(double time,
00078 const std::vector<double> &rY,
00079 std::vector<double> &rDY)
00080 {
00081
00082
00083
00084
00085 double Y[19];
00086 double dY[19];
00087
00088 Y[0] = rY[0];
00089 Y[1] = rY[1];
00090 Y[2] = rY[2];
00091 Y[3] = rY[3];
00092 Y[4] = rY[4];
00093 Y[5] = rY[5];
00094 Y[6] = rY[6];
00095 Y[7] = rY[7];
00096 Y[8] = rY[8];
00097 Y[9] = rY[9];
00098 Y[10] = rY[10];
00099 Y[11] = rY[11];
00100 Y[12] = rY[12];
00101 Y[13] = rY[13];
00102 Y[14] = rY[14];
00103 Y[15] = rY[15];
00104 Y[16] = rY[16];
00105 Y[17] = rY[17];
00106 Y[18] = rY[18];
00107
00108 VerifyStateVariables();
00109
00110 L_type_Ca_current_i_CaL = L_type_Ca_current_g_CaL*Y[0]*Y[3]*Y[1]*Y[2]*4.0*(Y[11]-15.0)*pow(membrane_F, 2.0)/(membrane_R*membrane_T)*(0.25*Y[6]*exp(2.0*(Y[11]-15.0)*membrane_F/(membrane_R*membrane_T))-calcium_dynamics_Ca_o)/(exp(2.0*(Y[11]-15.0)*membrane_F/(membrane_R*membrane_T))-1.0);
00111 L_type_Ca_current_d_gate_d_inf = 1.0/(1.0+exp((-8.0-Y[11])/7.5));
00112 L_type_Ca_current_d_gate_alpha_d = 1.4/(1.0+exp((-35.0-Y[11])/13.0))+0.25;
00113 L_type_Ca_current_d_gate_beta_d = 1.4/(1.0+exp((Y[11]+5.0)/5.0));
00114 L_type_Ca_current_d_gate_gamma_d = 1.0/(1.0+exp((50.0-Y[11])/20.0));
00115 L_type_Ca_current_d_gate_tau_d = L_type_Ca_current_d_gate_alpha_d*L_type_Ca_current_d_gate_beta_d+L_type_Ca_current_d_gate_gamma_d;
00116 dY[0] = (L_type_Ca_current_d_gate_d_inf-Y[0])/L_type_Ca_current_d_gate_tau_d;
00117 L_type_Ca_current_f2_gate_f2_inf = 0.67/(1.0+exp((Y[11]+35.0)/7.0))+0.33;
00118 L_type_Ca_current_f2_gate_tau_f2 = 562.0*exp(-pow(Y[11]+27.0, 2.0)/240.0)+31.0/(1.0+exp((25.0-Y[11])/10.0))+80.0/(1.0+exp((Y[11]+30.0)/10.0));
00119 dY[1] = (L_type_Ca_current_f2_gate_f2_inf-Y[1])/L_type_Ca_current_f2_gate_tau_f2;
00120 L_type_Ca_current_fCass_gate_fCass_inf = 0.6/(1.0+pow(Y[6]/0.05, 2.0))+0.4;
00121 L_type_Ca_current_fCass_gate_tau_fCass = 80.0/(1.0+pow(Y[6]/0.05, 2.0))+2.0;
00122 dY[2] = (L_type_Ca_current_fCass_gate_fCass_inf-Y[2])/L_type_Ca_current_fCass_gate_tau_fCass;
00123 L_type_Ca_current_f_gate_f_inf = 1.0/(1.0+exp((Y[11]+20.0)/7.0));
00124 L_type_Ca_current_f_gate_tau_f = 1102.5*exp(-pow(Y[11]+27.0, 2.0)/225.0)+200.0/(1.0+exp((13.0-Y[11])/10.0))+180.0/(1.0+exp((Y[11]+30.0)/10.0))+20.0;
00125 dY[3] = (L_type_Ca_current_f_gate_f_inf-Y[3])/L_type_Ca_current_f_gate_tau_f;
00126 reversal_potentials_E_Ca = 0.5*membrane_R*membrane_T/membrane_F*log(calcium_dynamics_Ca_o/Y[5]);
00127 calcium_background_current_i_b_Ca = calcium_background_current_g_bca*(Y[11]-reversal_potentials_E_Ca);
00128 calcium_dynamics_kcasr = calcium_dynamics_max_sr-(calcium_dynamics_max_sr-calcium_dynamics_min_sr)/(1.0+pow(calcium_dynamics_EC/Y[4], 2.0));
00129 calcium_dynamics_k1 = calcium_dynamics_k1_prime/calcium_dynamics_kcasr;
00130 calcium_dynamics_O = calcium_dynamics_k1*pow(Y[6], 2.0)*Y[7]/(calcium_dynamics_k3+calcium_dynamics_k1*pow(Y[6], 2.0));
00131 calcium_dynamics_i_rel = calcium_dynamics_V_rel*calcium_dynamics_O*(Y[4]-Y[6]);
00132 calcium_dynamics_i_up = calcium_dynamics_Vmax_up/(1.0+pow(calcium_dynamics_K_up, 2.0)/pow(Y[5], 2.0));
00133 calcium_dynamics_i_leak = calcium_dynamics_V_leak*(Y[4]-Y[5]);
00134 calcium_dynamics_i_xfer = calcium_dynamics_V_xfer*(Y[6]-Y[5]);
00135 calcium_dynamics_k2 = calcium_dynamics_k2_prime*calcium_dynamics_kcasr;
00136 dY[7] = -calcium_dynamics_k2*Y[6]*Y[7]+calcium_dynamics_k4*(1.0-Y[7]);
00137 calcium_dynamics_Ca_i_bufc = 1.0/(1.0+calcium_dynamics_Buf_c*calcium_dynamics_K_buf_c/pow(Y[5]+calcium_dynamics_K_buf_c, 2.0));
00138 calcium_dynamics_Ca_sr_bufsr = 1.0/(1.0+calcium_dynamics_Buf_sr*calcium_dynamics_K_buf_sr/pow(Y[4]+calcium_dynamics_K_buf_sr, 2.0));
00139 calcium_dynamics_Ca_ss_bufss = 1.0/(1.0+calcium_dynamics_Buf_ss*calcium_dynamics_K_buf_ss/pow(Y[6]+calcium_dynamics_K_buf_ss, 2.0));
00140 calcium_pump_current_i_p_Ca = calcium_pump_current_g_pCa*Y[5]/(Y[5]+calcium_pump_current_K_pCa);
00141 sodium_calcium_exchanger_current_i_NaCa = sodium_calcium_exchanger_current_K_NaCa*(exp(sodium_calcium_exchanger_current_gamma*Y[11]*membrane_F/(membrane_R*membrane_T))*pow(Y[16], 3.0)*calcium_dynamics_Ca_o-exp((sodium_calcium_exchanger_current_gamma-1.0)*Y[11]*membrane_F/(membrane_R*membrane_T))*pow(sodium_dynamics_Na_o, 3.0)*Y[5]*sodium_calcium_exchanger_current_alpha)/((pow(sodium_calcium_exchanger_current_Km_Nai, 3.0)+pow(sodium_dynamics_Na_o, 3.0))*(sodium_calcium_exchanger_current_Km_Ca+calcium_dynamics_Ca_o)*(1.0+sodium_calcium_exchanger_current_K_sat*exp((sodium_calcium_exchanger_current_gamma-1.0)*Y[11]*membrane_F/(membrane_R*membrane_T))));
00142 dY[5] = calcium_dynamics_Ca_i_bufc*((calcium_dynamics_i_leak-calcium_dynamics_i_up)*calcium_dynamics_V_sr/membrane_V_c+calcium_dynamics_i_xfer-(calcium_background_current_i_b_Ca+calcium_pump_current_i_p_Ca-2.0*sodium_calcium_exchanger_current_i_NaCa)*membrane_Cm/(2.0*membrane_V_c*membrane_F));
00143 dY[4] = calcium_dynamics_Ca_sr_bufsr*(calcium_dynamics_i_up-(calcium_dynamics_i_rel+calcium_dynamics_i_leak));
00144 dY[6] = calcium_dynamics_Ca_ss_bufss*(-L_type_Ca_current_i_CaL*membrane_Cm/(2.0*calcium_dynamics_V_ss*membrane_F)+calcium_dynamics_i_rel*calcium_dynamics_V_sr/calcium_dynamics_V_ss-calcium_dynamics_i_xfer*membrane_V_c/calcium_dynamics_V_ss);
00145 reversal_potentials_E_Na = membrane_R*membrane_T/membrane_F*log(sodium_dynamics_Na_o/Y[16]);
00146 fast_sodium_current_i_Na = fast_sodium_current_g_Na*pow(Y[10], 3.0)*Y[8]*Y[9]*(Y[11]-reversal_potentials_E_Na);
00147 fast_sodium_current_h_gate_h_inf = 1.0/pow(1.0+exp((Y[11]+71.55)/7.43), 2.0);
00148
00149 if (Y[11] < -40.0)
00150 fast_sodium_current_h_gate_alpha_h = 0.057*exp(-(Y[11]+80.0)/6.8);
00151 else
00152 fast_sodium_current_h_gate_alpha_h = 0.0;
00153
00154 if (Y[11] < -40.0)
00155 fast_sodium_current_h_gate_beta_h = 2.7*exp(0.079*Y[11])+310000.0*exp(0.3485*Y[11]);
00156 else
00157 fast_sodium_current_h_gate_beta_h = 0.77/(0.13*(1.0+exp((Y[11]+10.66)/-11.1)));
00158
00159 fast_sodium_current_h_gate_tau_h = 1.0/(fast_sodium_current_h_gate_alpha_h+fast_sodium_current_h_gate_beta_h);
00160 dY[8] = (fast_sodium_current_h_gate_h_inf-Y[8])/fast_sodium_current_h_gate_tau_h;
00161 fast_sodium_current_j_gate_j_inf = 1.0/pow(1.0+exp((Y[11]+71.55)/7.43), 2.0);
00162
00163 if (Y[11] < -40.0)
00164 fast_sodium_current_j_gate_alpha_j = (-25428.0*exp(0.2444*Y[11])-6.948e-6*exp(-0.04391*Y[11]))*(Y[11]+37.78)/(1.0+exp(0.311*(Y[11]+79.23)));
00165 else
00166 fast_sodium_current_j_gate_alpha_j = 0.0;
00167
00168 if (Y[11] < -40.0)
00169 fast_sodium_current_j_gate_beta_j = 0.02424*exp(-0.01052*Y[11])/(1.0+exp(-0.1378*(Y[11]+40.14)));
00170 else
00171 fast_sodium_current_j_gate_beta_j = 0.6*exp(0.057*Y[11])/(1.0+exp(-0.1*(Y[11]+32.0)));
00172
00173 fast_sodium_current_j_gate_tau_j = 1.0/(fast_sodium_current_j_gate_alpha_j+fast_sodium_current_j_gate_beta_j);
00174 dY[9] = (fast_sodium_current_j_gate_j_inf-Y[9])/fast_sodium_current_j_gate_tau_j;
00175 fast_sodium_current_m_gate_m_inf = 1.0/pow(1.0+exp((-56.86-Y[11])/9.03), 2.0);
00176 fast_sodium_current_m_gate_alpha_m = 1.0/(1.0+exp((-60.0-Y[11])/5.0));
00177 fast_sodium_current_m_gate_beta_m = 0.1/(1.0+exp((Y[11]+35.0)/5.0))+0.1/(1.0+exp((Y[11]-50.0)/200.0));
00178 fast_sodium_current_m_gate_tau_m = fast_sodium_current_m_gate_alpha_m*fast_sodium_current_m_gate_beta_m;
00179 dY[10] = (fast_sodium_current_m_gate_m_inf-Y[10])/fast_sodium_current_m_gate_tau_m;
00180 reversal_potentials_E_K = membrane_R*membrane_T/membrane_F*log(potassium_dynamics_K_o/Y[12]);
00181 inward_rectifier_potassium_current_alpha_K1 = 0.1/(1.0+exp(0.06*(Y[11]-reversal_potentials_E_K-200.0)));
00182 inward_rectifier_potassium_current_beta_K1 = (3.0*exp(0.0002*(Y[11]-reversal_potentials_E_K+100.0))+exp(0.1*(Y[11]-reversal_potentials_E_K-10.0)))/(1.0+exp(-0.5*(Y[11]-reversal_potentials_E_K)));
00183 inward_rectifier_potassium_current_xK1_inf = inward_rectifier_potassium_current_alpha_K1/(inward_rectifier_potassium_current_alpha_K1+inward_rectifier_potassium_current_beta_K1);
00184 inward_rectifier_potassium_current_i_K1 = inward_rectifier_potassium_current_g_K1*inward_rectifier_potassium_current_xK1_inf*(Y[11]-reversal_potentials_E_K);
00185
00186
00187 transient_outward_current_i_to = mScaleFactorIto*transient_outward_current_g_to*Y[17]*Y[18]*(Y[11]-reversal_potentials_E_K);
00188 rapid_time_dependent_potassium_current_i_Kr = mScaleFactorGkr*rapid_time_dependent_potassium_current_g_Kr*sqrt(potassium_dynamics_K_o/5.4)*Y[13]*Y[14]*(Y[11]-reversal_potentials_E_K);
00189 reversal_potentials_E_Ks = membrane_R*membrane_T/membrane_F*log((potassium_dynamics_K_o+reversal_potentials_P_kna*sodium_dynamics_Na_o)/(Y[12]+reversal_potentials_P_kna*Y[16]));
00190 slow_time_dependent_potassium_current_i_Ks = mScaleFactorGks*slow_time_dependent_potassium_current_g_Ks*pow(Y[15], 2.0)*(Y[11]-reversal_potentials_E_Ks);
00191 sodium_potassium_pump_current_i_NaK = sodium_potassium_pump_current_P_NaK*potassium_dynamics_K_o/(potassium_dynamics_K_o+sodium_potassium_pump_current_K_mk)*Y[16]/(Y[16]+sodium_potassium_pump_current_K_mNa)/(1.0+0.1245*exp(-0.1*Y[11]*membrane_F/(membrane_R*membrane_T))+0.0353*exp(-Y[11]*membrane_F/(membrane_R*membrane_T)));
00192 sodium_background_current_i_b_Na = sodium_background_current_g_bna*(Y[11]-reversal_potentials_E_Na);
00193 potassium_pump_current_i_p_K = potassium_pump_current_g_pK*(Y[11]-reversal_potentials_E_K)/(1.0+exp((25.0-Y[11])/5.98));
00194
00195
00196 double i_stim = GetStimulus(time);
00197
00198 dY[11] = -1.0/1.0*(inward_rectifier_potassium_current_i_K1+transient_outward_current_i_to+rapid_time_dependent_potassium_current_i_Kr+slow_time_dependent_potassium_current_i_Ks+L_type_Ca_current_i_CaL+sodium_potassium_pump_current_i_NaK+fast_sodium_current_i_Na+sodium_background_current_i_b_Na+sodium_calcium_exchanger_current_i_NaCa+calcium_background_current_i_b_Ca+potassium_pump_current_i_p_K+calcium_pump_current_i_p_Ca+i_stim);
00199 dY[12] = -(inward_rectifier_potassium_current_i_K1+transient_outward_current_i_to+rapid_time_dependent_potassium_current_i_Kr+slow_time_dependent_potassium_current_i_Ks+potassium_pump_current_i_p_K+i_stim-2.0*sodium_potassium_pump_current_i_NaK)/(membrane_V_c*membrane_F)*membrane_Cm;
00200 rapid_time_dependent_potassium_current_Xr1_gate_xr1_inf = 1.0/(1.0+exp((-26.0-Y[11])/7.0));
00201 rapid_time_dependent_potassium_current_Xr1_gate_alpha_xr1 = 450.0/(1.0+exp((-45.0-Y[11])/10.0));
00202 rapid_time_dependent_potassium_current_Xr1_gate_beta_xr1 = 6.0/(1.0+exp((Y[11]+30.0)/11.5));
00203 rapid_time_dependent_potassium_current_Xr1_gate_tau_xr1 = rapid_time_dependent_potassium_current_Xr1_gate_alpha_xr1*rapid_time_dependent_potassium_current_Xr1_gate_beta_xr1;
00204 dY[13] = (rapid_time_dependent_potassium_current_Xr1_gate_xr1_inf-Y[13])/rapid_time_dependent_potassium_current_Xr1_gate_tau_xr1;
00205 rapid_time_dependent_potassium_current_Xr2_gate_xr2_inf = 1.0/(1.0+exp((Y[11]+88.0)/24.0));
00206 rapid_time_dependent_potassium_current_Xr2_gate_alpha_xr2 = 3.0/(1.0+exp((-60.0-Y[11])/20.0));
00207 rapid_time_dependent_potassium_current_Xr2_gate_beta_xr2 = 1.12/(1.0+exp((Y[11]-60.0)/20.0));
00208 rapid_time_dependent_potassium_current_Xr2_gate_tau_xr2 = rapid_time_dependent_potassium_current_Xr2_gate_alpha_xr2*rapid_time_dependent_potassium_current_Xr2_gate_beta_xr2;
00209 dY[14] = (rapid_time_dependent_potassium_current_Xr2_gate_xr2_inf-Y[14])/rapid_time_dependent_potassium_current_Xr2_gate_tau_xr2;
00210 slow_time_dependent_potassium_current_Xs_gate_xs_inf = 1.0/(1.0+exp((-5.0-Y[11])/14.0));
00211 slow_time_dependent_potassium_current_Xs_gate_alpha_xs = 1400.0/sqrt(1.0+exp((5.0-Y[11])/6.0));
00212 slow_time_dependent_potassium_current_Xs_gate_beta_xs = 1.0/(1.0+exp((Y[11]-35.0)/15.0));
00213 slow_time_dependent_potassium_current_Xs_gate_tau_xs = slow_time_dependent_potassium_current_Xs_gate_alpha_xs*slow_time_dependent_potassium_current_Xs_gate_beta_xs+80.0;
00214 dY[15] = (slow_time_dependent_potassium_current_Xs_gate_xs_inf-Y[15])/slow_time_dependent_potassium_current_Xs_gate_tau_xs;
00215 dY[16] = -(fast_sodium_current_i_Na+sodium_background_current_i_b_Na+3.0*sodium_potassium_pump_current_i_NaK+3.0*sodium_calcium_exchanger_current_i_NaCa)/(membrane_V_c*membrane_F)*membrane_Cm;
00216 transient_outward_current_r_gate_r_inf = 1.0/(1.0+exp((20.0-Y[11])/6.0));
00217 transient_outward_current_r_gate_tau_r = 9.5*exp(-pow(Y[11]+40.0, 2.0)/1800.0)+0.8;
00218 dY[17] = (transient_outward_current_r_gate_r_inf-Y[17])/transient_outward_current_r_gate_tau_r;
00219 transient_outward_current_s_gate_s_inf = 1.0/(1.0+exp((Y[11]+20.0)/5.0));
00220 transient_outward_current_s_gate_tau_s = 85.0*exp(-pow(Y[11]+45.0, 2.0)/320.0)+5.0/(1.0+exp((Y[11]-20.0)/5.0))+3.0;
00221 dY[18] = (transient_outward_current_s_gate_s_inf-Y[18])/transient_outward_current_s_gate_tau_s;
00222
00223
00224
00225 if (mSetVoltageDerivativeToZero)
00226 {
00227 dY[11] = 0;
00228 }
00229
00230 rDY[0] = dY[0];
00231 rDY[1] = dY[1];
00232 rDY[2] = dY[2];
00233 rDY[3] = dY[3];
00234 rDY[4] = dY[4];
00235 rDY[5] = dY[5];
00236 rDY[6] = dY[6];
00237 rDY[7] = dY[7];
00238 rDY[8] = dY[8];
00239 rDY[9] = dY[9];
00240 rDY[10]= dY[10];
00241 rDY[11] = dY[11];
00242 rDY[12] = dY[12];
00243 rDY[13] = dY[13];
00244 rDY[14] = dY[14];
00245 rDY[15] = dY[15];
00246 rDY[16] = dY[16];
00247 rDY[17] = dY[17];
00248 rDY[18] = dY[18];
00249 }
00250
00251
00252 double TenTusscher2006OdeSystem::GetIIonic()
00253 {
00254
00255 double Y[19];
00256 double dY[19];
00257
00258 Y[0] = mStateVariables[0];
00259 Y[1] = mStateVariables[1];
00260 Y[2] = mStateVariables[2];
00261 Y[3] = mStateVariables[3];
00262 Y[4] = mStateVariables[4];
00263 Y[5] = mStateVariables[5];
00264 Y[6] = mStateVariables[6];
00265 Y[7] = mStateVariables[7];
00266 Y[8] = mStateVariables[8];
00267 Y[9] = mStateVariables[9];
00268 Y[10] = mStateVariables[10];
00269 Y[11] = mStateVariables[11];
00270 Y[12] = mStateVariables[12];
00271 Y[13] = mStateVariables[13];
00272 Y[14] = mStateVariables[14];
00273 Y[15] = mStateVariables[15];
00274 Y[16] = mStateVariables[16];
00275 Y[17] = mStateVariables[17];
00276 Y[18] = mStateVariables[18];
00277
00278 L_type_Ca_current_i_CaL = L_type_Ca_current_g_CaL*Y[0]*Y[3]*Y[1]*Y[2]*4.0*(Y[11]-15.0)*pow(membrane_F, 2.0)/(membrane_R*membrane_T)*(0.25*Y[6]*exp(2.0*(Y[11]-15.0)*membrane_F/(membrane_R*membrane_T))-calcium_dynamics_Ca_o)/(exp(2.0*(Y[11]-15.0)*membrane_F/(membrane_R*membrane_T))-1.0);
00279 L_type_Ca_current_d_gate_d_inf = 1.0/(1.0+exp((-8.0-Y[11])/7.5));
00280 L_type_Ca_current_d_gate_alpha_d = 1.4/(1.0+exp((-35.0-Y[11])/13.0))+0.25;
00281 L_type_Ca_current_d_gate_beta_d = 1.4/(1.0+exp((Y[11]+5.0)/5.0));
00282 L_type_Ca_current_d_gate_gamma_d = 1.0/(1.0+exp((50.0-Y[11])/20.0));
00283 L_type_Ca_current_d_gate_tau_d = L_type_Ca_current_d_gate_alpha_d*L_type_Ca_current_d_gate_beta_d+L_type_Ca_current_d_gate_gamma_d;
00284 dY[0] = (L_type_Ca_current_d_gate_d_inf-Y[0])/L_type_Ca_current_d_gate_tau_d;
00285 L_type_Ca_current_f2_gate_f2_inf = 0.67/(1.0+exp((Y[11]+35.0)/7.0))+0.33;
00286 L_type_Ca_current_f2_gate_tau_f2 = 562.0*exp(-pow(Y[11]+27.0, 2.0)/240.0)+31.0/(1.0+exp((25.0-Y[11])/10.0))+80.0/(1.0+exp((Y[11]+30.0)/10.0));
00287 dY[1] = (L_type_Ca_current_f2_gate_f2_inf-Y[1])/L_type_Ca_current_f2_gate_tau_f2;
00288 L_type_Ca_current_fCass_gate_fCass_inf = 0.6/(1.0+pow(Y[6]/0.05, 2.0))+0.4;
00289 L_type_Ca_current_fCass_gate_tau_fCass = 80.0/(1.0+pow(Y[6]/0.05, 2.0))+2.0;
00290 dY[2] = (L_type_Ca_current_fCass_gate_fCass_inf-Y[2])/L_type_Ca_current_fCass_gate_tau_fCass;
00291 L_type_Ca_current_f_gate_f_inf = 1.0/(1.0+exp((Y[11]+20.0)/7.0));
00292 L_type_Ca_current_f_gate_tau_f = 1102.5*exp(-pow(Y[11]+27.0, 2.0)/225.0)+200.0/(1.0+exp((13.0-Y[11])/10.0))+180.0/(1.0+exp((Y[11]+30.0)/10.0))+20.0;
00293 dY[3] = (L_type_Ca_current_f_gate_f_inf-Y[3])/L_type_Ca_current_f_gate_tau_f;
00294 reversal_potentials_E_Ca = 0.5*membrane_R*membrane_T/membrane_F*log(calcium_dynamics_Ca_o/Y[5]);
00295 calcium_background_current_i_b_Ca = calcium_background_current_g_bca*(Y[11]-reversal_potentials_E_Ca);
00296 calcium_dynamics_kcasr = calcium_dynamics_max_sr-(calcium_dynamics_max_sr-calcium_dynamics_min_sr)/(1.0+pow(calcium_dynamics_EC/Y[4], 2.0));
00297 calcium_dynamics_k1 = calcium_dynamics_k1_prime/calcium_dynamics_kcasr;
00298 calcium_dynamics_O = calcium_dynamics_k1*pow(Y[6], 2.0)*Y[7]/(calcium_dynamics_k3+calcium_dynamics_k1*pow(Y[6], 2.0));
00299 calcium_dynamics_i_rel = calcium_dynamics_V_rel*calcium_dynamics_O*(Y[4]-Y[6]);
00300 calcium_dynamics_i_up = calcium_dynamics_Vmax_up/(1.0+pow(calcium_dynamics_K_up, 2.0)/pow(Y[5], 2.0));
00301 calcium_dynamics_i_leak = calcium_dynamics_V_leak*(Y[4]-Y[5]);
00302 calcium_dynamics_i_xfer = calcium_dynamics_V_xfer*(Y[6]-Y[5]);
00303 calcium_dynamics_k2 = calcium_dynamics_k2_prime*calcium_dynamics_kcasr;
00304 dY[7] = -calcium_dynamics_k2*Y[6]*Y[7]+calcium_dynamics_k4*(1.0-Y[7]);
00305 calcium_dynamics_Ca_i_bufc = 1.0/(1.0+calcium_dynamics_Buf_c*calcium_dynamics_K_buf_c/pow(Y[5]+calcium_dynamics_K_buf_c, 2.0));
00306 calcium_dynamics_Ca_sr_bufsr = 1.0/(1.0+calcium_dynamics_Buf_sr*calcium_dynamics_K_buf_sr/pow(Y[4]+calcium_dynamics_K_buf_sr, 2.0));
00307 calcium_dynamics_Ca_ss_bufss = 1.0/(1.0+calcium_dynamics_Buf_ss*calcium_dynamics_K_buf_ss/pow(Y[6]+calcium_dynamics_K_buf_ss, 2.0));
00308 calcium_pump_current_i_p_Ca = calcium_pump_current_g_pCa*Y[5]/(Y[5]+calcium_pump_current_K_pCa);
00309 sodium_calcium_exchanger_current_i_NaCa = sodium_calcium_exchanger_current_K_NaCa*(exp(sodium_calcium_exchanger_current_gamma*Y[11]*membrane_F/(membrane_R*membrane_T))*pow(Y[16], 3.0)*calcium_dynamics_Ca_o-exp((sodium_calcium_exchanger_current_gamma-1.0)*Y[11]*membrane_F/(membrane_R*membrane_T))*pow(sodium_dynamics_Na_o, 3.0)*Y[5]*sodium_calcium_exchanger_current_alpha)/((pow(sodium_calcium_exchanger_current_Km_Nai, 3.0)+pow(sodium_dynamics_Na_o, 3.0))*(sodium_calcium_exchanger_current_Km_Ca+calcium_dynamics_Ca_o)*(1.0+sodium_calcium_exchanger_current_K_sat*exp((sodium_calcium_exchanger_current_gamma-1.0)*Y[11]*membrane_F/(membrane_R*membrane_T))));
00310 dY[5] = calcium_dynamics_Ca_i_bufc*((calcium_dynamics_i_leak-calcium_dynamics_i_up)*calcium_dynamics_V_sr/membrane_V_c+calcium_dynamics_i_xfer-(calcium_background_current_i_b_Ca+calcium_pump_current_i_p_Ca-2.0*sodium_calcium_exchanger_current_i_NaCa)*membrane_Cm/(2.0*membrane_V_c*membrane_F));
00311 dY[4] = calcium_dynamics_Ca_sr_bufsr*(calcium_dynamics_i_up-(calcium_dynamics_i_rel+calcium_dynamics_i_leak));
00312 dY[6] = calcium_dynamics_Ca_ss_bufss*(-L_type_Ca_current_i_CaL*membrane_Cm/(2.0*calcium_dynamics_V_ss*membrane_F)+calcium_dynamics_i_rel*calcium_dynamics_V_sr/calcium_dynamics_V_ss-calcium_dynamics_i_xfer*membrane_V_c/calcium_dynamics_V_ss);
00313 reversal_potentials_E_Na = membrane_R*membrane_T/membrane_F*log(sodium_dynamics_Na_o/Y[16]);
00314 fast_sodium_current_i_Na = fast_sodium_current_g_Na*pow(Y[10], 3.0)*Y[8]*Y[9]*(Y[11]-reversal_potentials_E_Na);
00315 fast_sodium_current_h_gate_h_inf = 1.0/pow(1.0+exp((Y[11]+71.55)/7.43), 2.0);
00316
00317 if (Y[11] < -40.0)
00318 fast_sodium_current_h_gate_alpha_h = 0.057*exp(-(Y[11]+80.0)/6.8);
00319 else
00320 fast_sodium_current_h_gate_alpha_h = 0.0;
00321
00322 if (Y[11] < -40.0)
00323 fast_sodium_current_h_gate_beta_h = 2.7*exp(0.079*Y[11])+310000.0*exp(0.3485*Y[11]);
00324 else
00325 fast_sodium_current_h_gate_beta_h = 0.77/(0.13*(1.0+exp((Y[11]+10.66)/-11.1)));
00326
00327 fast_sodium_current_h_gate_tau_h = 1.0/(fast_sodium_current_h_gate_alpha_h+fast_sodium_current_h_gate_beta_h);
00328 dY[8] = (fast_sodium_current_h_gate_h_inf-Y[8])/fast_sodium_current_h_gate_tau_h;
00329 fast_sodium_current_j_gate_j_inf = 1.0/pow(1.0+exp((Y[11]+71.55)/7.43), 2.0);
00330
00331 if (Y[11] < -40.0)
00332 fast_sodium_current_j_gate_alpha_j = (-25428.0*exp(0.2444*Y[11])-6.948e-6*exp(-0.04391*Y[11]))*(Y[11]+37.78)/(1.0+exp(0.311*(Y[11]+79.23)));
00333 else
00334 fast_sodium_current_j_gate_alpha_j = 0.0;
00335
00336 if (Y[11] < -40.0)
00337 fast_sodium_current_j_gate_beta_j = 0.02424*exp(-0.01052*Y[11])/(1.0+exp(-0.1378*(Y[11]+40.14)));
00338 else
00339 fast_sodium_current_j_gate_beta_j = 0.6*exp(0.057*Y[11])/(1.0+exp(-0.1*(Y[11]+32.0)));
00340
00341 fast_sodium_current_j_gate_tau_j = 1.0/(fast_sodium_current_j_gate_alpha_j+fast_sodium_current_j_gate_beta_j);
00342 dY[9] = (fast_sodium_current_j_gate_j_inf-Y[9])/fast_sodium_current_j_gate_tau_j;
00343 fast_sodium_current_m_gate_m_inf = 1.0/pow(1.0+exp((-56.86-Y[11])/9.03), 2.0);
00344 fast_sodium_current_m_gate_alpha_m = 1.0/(1.0+exp((-60.0-Y[11])/5.0));
00345 fast_sodium_current_m_gate_beta_m = 0.1/(1.0+exp((Y[11]+35.0)/5.0))+0.1/(1.0+exp((Y[11]-50.0)/200.0));
00346 fast_sodium_current_m_gate_tau_m = fast_sodium_current_m_gate_alpha_m*fast_sodium_current_m_gate_beta_m;
00347 dY[10] = (fast_sodium_current_m_gate_m_inf-Y[10])/fast_sodium_current_m_gate_tau_m;
00348 reversal_potentials_E_K = membrane_R*membrane_T/membrane_F*log(potassium_dynamics_K_o/Y[12]);
00349 inward_rectifier_potassium_current_alpha_K1 = 0.1/(1.0+exp(0.06*(Y[11]-reversal_potentials_E_K-200.0)));
00350 inward_rectifier_potassium_current_beta_K1 = (3.0*exp(0.0002*(Y[11]-reversal_potentials_E_K+100.0))+exp(0.1*(Y[11]-reversal_potentials_E_K-10.0)))/(1.0+exp(-0.5*(Y[11]-reversal_potentials_E_K)));
00351 inward_rectifier_potassium_current_xK1_inf = inward_rectifier_potassium_current_alpha_K1/(inward_rectifier_potassium_current_alpha_K1+inward_rectifier_potassium_current_beta_K1);
00352 inward_rectifier_potassium_current_i_K1 = inward_rectifier_potassium_current_g_K1*inward_rectifier_potassium_current_xK1_inf*(Y[11]-reversal_potentials_E_K);
00353
00354
00355 transient_outward_current_i_to = mScaleFactorIto*transient_outward_current_g_to*Y[17]*Y[18]*(Y[11]-reversal_potentials_E_K);
00356 rapid_time_dependent_potassium_current_i_Kr = mScaleFactorGkr*rapid_time_dependent_potassium_current_g_Kr*sqrt(potassium_dynamics_K_o/5.4)*Y[13]*Y[14]*(Y[11]-reversal_potentials_E_K);
00357 reversal_potentials_E_Ks = membrane_R*membrane_T/membrane_F*log((potassium_dynamics_K_o+reversal_potentials_P_kna*sodium_dynamics_Na_o)/(Y[12]+reversal_potentials_P_kna*Y[16]));
00358 slow_time_dependent_potassium_current_i_Ks = mScaleFactorGks*slow_time_dependent_potassium_current_g_Ks*pow(Y[15], 2.0)*(Y[11]-reversal_potentials_E_Ks);
00359 sodium_potassium_pump_current_i_NaK = sodium_potassium_pump_current_P_NaK*potassium_dynamics_K_o/(potassium_dynamics_K_o+sodium_potassium_pump_current_K_mk)*Y[16]/(Y[16]+sodium_potassium_pump_current_K_mNa)/(1.0+0.1245*exp(-0.1*Y[11]*membrane_F/(membrane_R*membrane_T))+0.0353*exp(-Y[11]*membrane_F/(membrane_R*membrane_T)));
00360 sodium_background_current_i_b_Na = sodium_background_current_g_bna*(Y[11]-reversal_potentials_E_Na);
00361 potassium_pump_current_i_p_K = potassium_pump_current_g_pK*(Y[11]-reversal_potentials_E_K)/(1.0+exp((25.0-Y[11])/5.98));
00362
00363 dY[11] = -1.0/1.0*(inward_rectifier_potassium_current_i_K1+transient_outward_current_i_to+rapid_time_dependent_potassium_current_i_Kr+slow_time_dependent_potassium_current_i_Ks+L_type_Ca_current_i_CaL+sodium_potassium_pump_current_i_NaK+fast_sodium_current_i_Na+sodium_background_current_i_b_Na+sodium_calcium_exchanger_current_i_NaCa+calcium_background_current_i_b_Ca+potassium_pump_current_i_p_K+calcium_pump_current_i_p_Ca);
00364 dY[12] = -(inward_rectifier_potassium_current_i_K1+transient_outward_current_i_to+rapid_time_dependent_potassium_current_i_Kr+slow_time_dependent_potassium_current_i_Ks+potassium_pump_current_i_p_K-2.0*sodium_potassium_pump_current_i_NaK)/(membrane_V_c*membrane_F)*membrane_Cm;
00365 rapid_time_dependent_potassium_current_Xr1_gate_xr1_inf = 1.0/(1.0+exp((-26.0-Y[11])/7.0));
00366 rapid_time_dependent_potassium_current_Xr1_gate_alpha_xr1 = 450.0/(1.0+exp((-45.0-Y[11])/10.0));
00367 rapid_time_dependent_potassium_current_Xr1_gate_beta_xr1 = 6.0/(1.0+exp((Y[11]+30.0)/11.5));
00368 rapid_time_dependent_potassium_current_Xr1_gate_tau_xr1 = rapid_time_dependent_potassium_current_Xr1_gate_alpha_xr1*rapid_time_dependent_potassium_current_Xr1_gate_beta_xr1;
00369 dY[13] = (rapid_time_dependent_potassium_current_Xr1_gate_xr1_inf-Y[13])/rapid_time_dependent_potassium_current_Xr1_gate_tau_xr1;
00370 rapid_time_dependent_potassium_current_Xr2_gate_xr2_inf = 1.0/(1.0+exp((Y[11]+88.0)/24.0));
00371 rapid_time_dependent_potassium_current_Xr2_gate_alpha_xr2 = 3.0/(1.0+exp((-60.0-Y[11])/20.0));
00372 rapid_time_dependent_potassium_current_Xr2_gate_beta_xr2 = 1.12/(1.0+exp((Y[11]-60.0)/20.0));
00373 rapid_time_dependent_potassium_current_Xr2_gate_tau_xr2 = rapid_time_dependent_potassium_current_Xr2_gate_alpha_xr2*rapid_time_dependent_potassium_current_Xr2_gate_beta_xr2;
00374 dY[14] = (rapid_time_dependent_potassium_current_Xr2_gate_xr2_inf-Y[14])/rapid_time_dependent_potassium_current_Xr2_gate_tau_xr2;
00375 slow_time_dependent_potassium_current_Xs_gate_xs_inf = 1.0/(1.0+exp((-5.0-Y[11])/14.0));
00376 slow_time_dependent_potassium_current_Xs_gate_alpha_xs = 1400.0/sqrt(1.0+exp((5.0-Y[11])/6.0));
00377 slow_time_dependent_potassium_current_Xs_gate_beta_xs = 1.0/(1.0+exp((Y[11]-35.0)/15.0));
00378 slow_time_dependent_potassium_current_Xs_gate_tau_xs = slow_time_dependent_potassium_current_Xs_gate_alpha_xs*slow_time_dependent_potassium_current_Xs_gate_beta_xs+80.0;
00379 dY[15] = (slow_time_dependent_potassium_current_Xs_gate_xs_inf-Y[15])/slow_time_dependent_potassium_current_Xs_gate_tau_xs;
00380 dY[16] = -(fast_sodium_current_i_Na+sodium_background_current_i_b_Na+3.0*sodium_potassium_pump_current_i_NaK+3.0*sodium_calcium_exchanger_current_i_NaCa)/(membrane_V_c*membrane_F)*membrane_Cm;
00381 transient_outward_current_r_gate_r_inf = 1.0/(1.0+exp((20.0-Y[11])/6.0));
00382 transient_outward_current_r_gate_tau_r = 9.5*exp(-pow(Y[11]+40.0, 2.0)/1800.0)+0.8;
00383 dY[17] = (transient_outward_current_r_gate_r_inf-Y[17])/transient_outward_current_r_gate_tau_r;
00384 transient_outward_current_s_gate_s_inf = 1.0/(1.0+exp((Y[11]+20.0)/5.0));
00385 transient_outward_current_s_gate_tau_s = 85.0*exp(-pow(Y[11]+45.0, 2.0)/320.0)+5.0/(1.0+exp((Y[11]-20.0)/5.0))+3.0;
00386 dY[18] = (transient_outward_current_s_gate_s_inf-Y[18])/transient_outward_current_s_gate_tau_s;
00387
00388
00389 double i_ionic = inward_rectifier_potassium_current_i_K1+transient_outward_current_i_to+rapid_time_dependent_potassium_current_i_Kr+slow_time_dependent_potassium_current_i_Ks+L_type_Ca_current_i_CaL+sodium_potassium_pump_current_i_NaK+fast_sodium_current_i_Na+sodium_background_current_i_b_Na+sodium_calcium_exchanger_current_i_NaCa+calcium_background_current_i_b_Ca+potassium_pump_current_i_p_K+calcium_pump_current_i_p_Ca;
00390
00391 assert(!isnan(i_ionic));
00392
00393 double i_ionic_in_microA_per_cm2=i_ionic*membrane_Cm;
00394 return i_ionic_in_microA_per_cm2;
00395
00396
00397
00398
00399
00400
00401
00402
00403
00404 }
00405
00406 void TenTusscher2006OdeSystem::VerifyStateVariables()
00407 {
00408 const std::vector<double>& rY = rGetStateVariables();
00409
00410 double Y[19];
00411
00412 Y[0] = rY[0];
00413 Y[1] = rY[1];
00414 Y[2] = rY[2];
00415 Y[3] = rY[3];
00416 Y[4] = rY[4];
00417 Y[5] = rY[5];
00418 Y[6] = rY[6];
00419 Y[7] = rY[7];
00420 Y[8] = rY[8];
00421 Y[9] = rY[9];
00422 Y[10] = rY[10];
00423 Y[11] = rY[11];
00424 Y[12] = rY[12];
00425 Y[13] = rY[13];
00426 Y[14] = rY[14];
00427 Y[15] = rY[15];
00428 Y[16] = rY[16];
00429 Y[17] = rY[17];
00430 Y[18] = rY[18];
00431
00432 #define COVERAGE_IGNORE
00433 if (!(0<=Y[0] && Y[0]<=1))
00434 {
00435 EXCEPTION(DumpState("d gate of L type calcium channel is out of range!"));
00436 }
00437 if (!(0<=Y[1] && Y[1]<=1))
00438 {
00439 EXCEPTION(DumpState("f2 gate of L type calcium channel is out of range!"));
00440 }
00441 if (!(0<=Y[2] && Y[2]<=1))
00442 {
00443 EXCEPTION(DumpState("fCa gate of L type calcium channel is out of range!"));
00444 }
00445 if (!(0<=Y[3] && Y[3]<=1))
00446 {
00447 EXCEPTION(DumpState("f gate of L type calcium channel is out of range!"));
00448 }
00449 if (!(0<=Y[4]))
00450 {
00451 EXCEPTION(DumpState("CaSR is negative!"));
00452 }
00453 if (!(0<=Y[5]))
00454 {
00455 EXCEPTION(DumpState("Cai is negative!"));
00456 }
00457 if (!(0<=Y[6]))
00458 {
00459 EXCEPTION(DumpState("CaSS is negative!"));
00460 }
00461 if (!(0<=Y[7] && Y[7]<=1))
00462 {
00463 EXCEPTION(DumpState("R gate is out of range!"));
00464 }
00465 if (!(0<=Y[8] && Y[8]<=1))
00466 {
00467 EXCEPTION(DumpState("h gate of Na channel is out of range!"));
00468 }
00469 if (!(0<=Y[9] && Y[9]<=1))
00470 {
00471 EXCEPTION(DumpState("j gate of Na channel is out of range!"));
00472 }
00473 if (!(0<=Y[10] && Y[10]<=1))
00474 {
00475 EXCEPTION(DumpState("m gate of Na channel is out of range!"));
00476 }
00477 if (!(-200<=Y[11] && Y[11]<=200))
00478 {
00479 EXCEPTION(DumpState("Vm is REALLY out of range!"));
00480 }
00481 if (!(0<=Y[12]))
00482 {
00483 EXCEPTION(DumpState("Ki is negative!"));
00484 }
00485 if (!(0<=Y[13] && Y[13]<=1))
00486 {
00487 EXCEPTION(DumpState("xr1 gate of IKR channel is out of range!"));
00488 }
00489 if (!(0<=Y[14] && Y[14]<=1))
00490 {
00491 EXCEPTION(DumpState("xr2 gate of IKR channel is out of range!"));
00492 }
00493 if (!(0<=Y[15] && Y[15]<=1))
00494 {
00495 EXCEPTION(DumpState("xs1 gate of IKS channel is out of range!"));
00496 }
00497 if (!(0<=Y[16]))
00498 {
00499 EXCEPTION(DumpState("Nai is negative!"));
00500 }
00501 if (!(0<=Y[17] && Y[17]<=1))
00502 {
00503 EXCEPTION(DumpState("r gate of Ito channel is out of range!"));
00504 }
00505 if (!(0<=Y[18] && Y[18]<=1))
00506 {
00507 EXCEPTION(DumpState("s gate of Ito channel is out of range!"));
00508 }
00509
00510 #undef COVERAGE_IGNORE
00511 }
00512
00513 template<>
00514 void OdeSystemInformation<TenTusscher2006OdeSystem>::Initialise(void)
00515 {
00516
00517 this->mVariableNames.push_back("d_gate_L");
00518 this->mVariableUnits.push_back("");
00519 this->mInitialConditions.push_back(0.00003373);
00520
00521 this->mVariableNames.push_back("f2_gate_L");
00522 this->mVariableUnits.push_back("");
00523 this->mInitialConditions.push_back(0.9755);
00524
00525 this->mVariableNames.push_back("fca_gate_L");
00526 this->mVariableUnits.push_back("");
00527 this->mInitialConditions.push_back(0.9953);
00528
00529 this->mVariableNames.push_back("f_gate_L");
00530 this->mVariableUnits.push_back("");
00531 this->mInitialConditions.push_back(0.7888);
00532
00533 this->mVariableNames.push_back("CaSR");
00534 this->mVariableUnits.push_back("mM");
00535 this->mInitialConditions.push_back(3.64);
00536
00537 this->mVariableNames.push_back("Cai");
00538 this->mVariableUnits.push_back("mM");
00539 this->mInitialConditions.push_back(0.000126);
00540
00541 this->mVariableNames.push_back("CaSS");
00542 this->mVariableUnits.push_back("mM");
00543 this->mInitialConditions.push_back(0.00036);
00544
00545 this->mVariableNames.push_back("R_gate");
00546 this->mVariableUnits.push_back("");
00547 this->mInitialConditions.push_back(0.9073);
00548
00549 this->mVariableNames.push_back("h_gate_Na");
00550 this->mVariableUnits.push_back("");
00551 this->mInitialConditions.push_back(0.7444);
00552
00553 this->mVariableNames.push_back("j_gate_Na");
00554 this->mVariableUnits.push_back("");
00555 this->mInitialConditions.push_back(0.7045);
00556
00557 this->mVariableNames.push_back("m_gate_Na");
00558 this->mVariableUnits.push_back("");
00559 this->mInitialConditions.push_back(0.00172);
00560
00561 this->mVariableNames.push_back("V");
00562 this->mVariableUnits.push_back("mV");
00563 this->mInitialConditions.push_back(-85.23);
00564
00565 this->mVariableNames.push_back("Ki");
00566 this->mVariableUnits.push_back("mM");
00567 this->mInitialConditions.push_back(136.89);
00568
00569 this->mVariableNames.push_back("xr1_gate");
00570 this->mVariableUnits.push_back("");
00571 this->mInitialConditions.push_back(0.00621);
00572
00573 this->mVariableNames.push_back("xr2_gate");
00574 this->mVariableUnits.push_back("");
00575 this->mInitialConditions.push_back(0.4712);
00576
00577 this->mVariableNames.push_back("xS_gate");
00578 this->mVariableUnits.push_back("");
00579 this->mInitialConditions.push_back(0.0095);
00580
00581 this->mVariableNames.push_back("Nai");
00582 this->mVariableUnits.push_back("mM");
00583 this->mInitialConditions.push_back(8.604);
00584
00585 this->mVariableNames.push_back("r_gate_Ito");
00586 this->mVariableUnits.push_back("");
00587 this->mInitialConditions.push_back(0.0000000242);
00588
00589 this->mVariableNames.push_back("s_gate_Ito");
00590 this->mVariableUnits.push_back("");
00591 this->mInitialConditions.push_back(0.999998);
00592
00593 this->mInitialised = true;
00594 }
00595
00596
00597