/* There are a total of 79 entries in the algebraic variable array. There are a total of 25 entries in each of the rate and state variable arrays. There are a total of 76 entries in the constant variable array. */ /* * VOI is time in component environment (second). * STATES[0] is V in component membrane (millivolt). * CONSTANTS[0] is R in component membrane (joule_per_kilomole_kelvin). * CONSTANTS[1] is T in component membrane (kelvin). * CONSTANTS[2] is F in component membrane (coulomb_per_mole). * CONSTANTS[3] is Cm in component membrane (microF). * ALGEBRAIC[0] is I_st in component membrane (microA_per_microF). * ALGEBRAIC[2] is i_Na in component fast_sodium_current (microA_per_microF). * ALGEBRAIC[74] is i_Ca_L in component L_type_Ca_channel (microA_per_microF). * ALGEBRAIC[75] is i_Ca_T in component T_type_Ca_channel (microA_per_microF). * ALGEBRAIC[76] is i_Kr in component rapid_delayed_rectifier_potassium_current (microA_per_microF). * ALGEBRAIC[32] is i_Ks in component slow_delayed_rectifier_potassium_current (microA_per_microF). * ALGEBRAIC[43] is i_K_ATP in component ATP_sensitive_potassium_current (microA_per_microF). * ALGEBRAIC[45] is i_to in component transient_outward_current (microA_per_microF). * ALGEBRAIC[77] is i_K1 in component time_independent_potassium_current (microA_per_microF). * ALGEBRAIC[42] is i_Kp in component plateau_potassium_current (microA_per_microF). * ALGEBRAIC[54] is i_p_Ca in component sarcolemmal_calcium_pump (microA_per_microF). * ALGEBRAIC[55] is i_Na_b in component sodium_background_current (microA_per_microF). * ALGEBRAIC[57] is i_Ca_b in component calcium_background_current (microA_per_microF). * ALGEBRAIC[59] is i_NaK in component sodium_potassium_pump (microA_per_microF). * ALGEBRAIC[65] is i_NaCa in component Na_Ca_exchanger (microA_per_microF). * ALGEBRAIC[64] is i_ns_Ca in component non_specific_calcium_activated_current (microA_per_microF). * ALGEBRAIC[78] is dVdt in component membrane (dimensionless). * CONSTANTS[4] is stim_start in component membrane (second). * CONSTANTS[5] is stim_end in component membrane (second). * CONSTANTS[6] is stim_period in component membrane (second). * CONSTANTS[7] is stim_duration in component membrane (second). * CONSTANTS[8] is stim_amplitude in component membrane (microA_per_microF). * ALGEBRAIC[1] is E_Na in component fast_sodium_current (millivolt). * CONSTANTS[9] is g_Na in component fast_sodium_current (milliS_per_microF). * STATES[1] is Nai in component ionic_concentrations (millimolar). * CONSTANTS[10] is Nao in component ionic_concentrations (millimolar). * STATES[2] is m in component fast_sodium_current_m_gate (dimensionless). * STATES[3] is h in component fast_sodium_current_h_gate (dimensionless). * STATES[4] is j in component fast_sodium_current_j_gate (dimensionless). * ALGEBRAIC[4] is alpha_m in component fast_sodium_current_m_gate (per_second). * ALGEBRAIC[5] is beta_m in component fast_sodium_current_m_gate (per_second). * CONSTANTS[11] is delta_m in component fast_sodium_current_m_gate (dimensionless). * ALGEBRAIC[3] is E0_m in component fast_sodium_current_m_gate (millivolt). * ALGEBRAIC[6] is alpha_h in component fast_sodium_current_h_gate (per_second). * ALGEBRAIC[7] is beta_h in component fast_sodium_current_h_gate (per_second). * ALGEBRAIC[8] is alpha_j in component fast_sodium_current_j_gate (per_second). * ALGEBRAIC[9] is beta_j in component fast_sodium_current_j_gate (per_second). * ALGEBRAIC[71] is i_CaCa in component L_type_Ca_channel (microA_per_microF). * ALGEBRAIC[73] is i_CaK in component L_type_Ca_channel (microA_per_microF). * ALGEBRAIC[72] is i_CaNa in component L_type_Ca_channel (microA_per_microF). * CONSTANTS[12] is gamma_Nai in component L_type_Ca_channel (dimensionless). * CONSTANTS[13] is gamma_Nao in component L_type_Ca_channel (dimensionless). * CONSTANTS[14] is gamma_Ki in component L_type_Ca_channel (dimensionless). * CONSTANTS[15] is gamma_Ko in component L_type_Ca_channel (dimensionless). * ALGEBRAIC[10] is I_CaCa in component L_type_Ca_channel (microA_per_microF). * ALGEBRAIC[12] is I_CaK in component L_type_Ca_channel (microA_per_microF). * ALGEBRAIC[11] is I_CaNa in component L_type_Ca_channel (microA_per_microF). * CONSTANTS[16] is P_Ca in component L_type_Ca_channel (cm_per_second). * CONSTANTS[17] is P_Na in component L_type_Ca_channel (cm_per_second). * CONSTANTS[18] is P_K in component L_type_Ca_channel (cm_per_second). * CONSTANTS[19] is gamma_Cai in component L_type_Ca_channel (dimensionless). * CONSTANTS[20] is gamma_Cao in component L_type_Ca_channel (dimensionless). * STATES[5] is Cai in component calcium_dynamics (millimolar). * CONSTANTS[21] is Cao in component calcium_dynamics (millimolar). * CONSTANTS[22] is Ko in component ionic_concentrations (millimolar). * STATES[6] is Ki in component ionic_concentrations (millimolar). * STATES[7] is d in component L_type_Ca_channel_d_gate (dimensionless). * STATES[8] is f in component L_type_Ca_channel_f_gate (dimensionless). * ALGEBRAIC[22] is f_Ca in component L_type_Ca_channel_f_Ca_gate (dimensionless). * ALGEBRAIC[16] is alpha_d in component L_type_Ca_channel_d_gate (per_second). * ALGEBRAIC[17] is beta_d in component L_type_Ca_channel_d_gate (per_second). * ALGEBRAIC[14] is d_infinity in component L_type_Ca_channel_d_gate (dimensionless). * ALGEBRAIC[15] is tau_d in component L_type_Ca_channel_d_gate (second). * ALGEBRAIC[13] is E0_d in component L_type_Ca_channel_d_gate (millivolt). * ALGEBRAIC[20] is alpha_f in component L_type_Ca_channel_f_gate (per_second). * ALGEBRAIC[21] is beta_f in component L_type_Ca_channel_f_gate (per_second). * ALGEBRAIC[18] is f_infinity in component L_type_Ca_channel_f_gate (dimensionless). * ALGEBRAIC[19] is tau_f in component L_type_Ca_channel_f_gate (second). * CONSTANTS[23] is Km_Ca in component L_type_Ca_channel_f_Ca_gate (millimolar). * CONSTANTS[24] is g_CaT in component T_type_Ca_channel (milliS_per_microF). * ALGEBRAIC[56] is E_Ca in component calcium_background_current (millivolt). * STATES[9] is b in component T_type_Ca_channel_b_gate (dimensionless). * STATES[10] is g in component T_type_Ca_channel_g_gate (dimensionless). * ALGEBRAIC[23] is b_inf in component T_type_Ca_channel_b_gate (dimensionless). * ALGEBRAIC[24] is tau_b in component T_type_Ca_channel_b_gate (second). * ALGEBRAIC[25] is g_inf in component T_type_Ca_channel_g_gate (dimensionless). * ALGEBRAIC[26] is tau_g in component T_type_Ca_channel_g_gate (second). * CONSTANTS[63] is g_Kr in component rapid_delayed_rectifier_potassium_current (milliS_per_microF). * ALGEBRAIC[27] is Rect in component rapid_delayed_rectifier_potassium_current (dimensionless). * ALGEBRAIC[37] is E_K in component time_independent_potassium_current (millivolt). * STATES[11] is xr in component rapid_delayed_rectifier_potassium_current_xr_gate (dimensionless). * ALGEBRAIC[28] is xr_infinity in component rapid_delayed_rectifier_potassium_current_xr_gate (dimensionless). * ALGEBRAIC[29] is tau_xr in component rapid_delayed_rectifier_potassium_current_xr_gate (second). * ALGEBRAIC[31] is g_Ks in component slow_delayed_rectifier_potassium_current (milliS_per_microF). * ALGEBRAIC[30] is E_Ks in component slow_delayed_rectifier_potassium_current (millivolt). * CONSTANTS[25] is PNaK in component slow_delayed_rectifier_potassium_current (dimensionless). * STATES[12] is xs1 in component slow_delayed_rectifier_potassium_current_xs1_gate (dimensionless). * STATES[13] is xs2 in component slow_delayed_rectifier_potassium_current_xs2_gate (dimensionless). * ALGEBRAIC[33] is xs1_infinity in component slow_delayed_rectifier_potassium_current_xs1_gate (dimensionless). * ALGEBRAIC[34] is tau_xs1 in component slow_delayed_rectifier_potassium_current_xs1_gate (second). * ALGEBRAIC[35] is xs2_infinity in component slow_delayed_rectifier_potassium_current_xs2_gate (dimensionless). * ALGEBRAIC[36] is tau_xs2 in component slow_delayed_rectifier_potassium_current_xs2_gate (second). * CONSTANTS[64] is g_K1 in component time_independent_potassium_current (milliS_per_cm2). * ALGEBRAIC[40] is K1_infinity in component time_independent_potassium_current_K1_gate (dimensionless). * ALGEBRAIC[38] is alpha_K1 in component time_independent_potassium_current_K1_gate (per_second). * ALGEBRAIC[39] is beta_K1 in component time_independent_potassium_current_K1_gate (per_second). * CONSTANTS[26] is g_Kp in component plateau_potassium_current (milliS_per_microF). * ALGEBRAIC[41] is Kp in component plateau_potassium_current (dimensionless). * CONSTANTS[65] is g_K_ATP in component ATP_sensitive_potassium_current (milliS_per_microF). * CONSTANTS[27] is nATP in component ATP_sensitive_potassium_current (dimensionless). * CONSTANTS[28] is nicholsarea in component ATP_sensitive_potassium_current (dimensionless). * CONSTANTS[29] is ATPi in component ATP_sensitive_potassium_current (millimolar). * CONSTANTS[30] is hATP in component ATP_sensitive_potassium_current (dimensionless). * CONSTANTS[31] is kATP in component ATP_sensitive_potassium_current (millimolar). * CONSTANTS[71] is pATP in component ATP_sensitive_potassium_current (dimensionless). * CONSTANTS[73] is GKbaraATP in component ATP_sensitive_potassium_current (milliS_per_microF). * CONSTANTS[66] is g_to in component transient_outward_current (milliS_per_microF). * ALGEBRAIC[44] is rvdv in component transient_outward_current (dimensionless). * STATES[14] is zdv in component transient_outward_current_zdv_gate (dimensionless). * STATES[15] is ydv in component transient_outward_current_ydv_gate (dimensionless). * ALGEBRAIC[46] is alpha_zdv in component transient_outward_current_zdv_gate (per_second). * ALGEBRAIC[47] is beta_zdv in component transient_outward_current_zdv_gate (per_second). * ALGEBRAIC[48] is tau_zdv in component transient_outward_current_zdv_gate (second). * ALGEBRAIC[49] is zdv_ss in component transient_outward_current_zdv_gate (dimensionless). * ALGEBRAIC[50] is alpha_ydv in component transient_outward_current_ydv_gate (per_second). * ALGEBRAIC[51] is beta_ydv in component transient_outward_current_ydv_gate (per_second). * ALGEBRAIC[52] is tau_ydv in component transient_outward_current_ydv_gate (second). * ALGEBRAIC[53] is ydv_ss in component transient_outward_current_ydv_gate (dimensionless). * CONSTANTS[32] is K_mpCa in component sarcolemmal_calcium_pump (millimolar). * CONSTANTS[33] is I_pCa in component sarcolemmal_calcium_pump (microA_per_microF). * CONSTANTS[34] is g_Nab in component sodium_background_current (milliS_per_microF). * CONSTANTS[35] is g_Cab in component calcium_background_current (milliS_per_microF). * CONSTANTS[36] is I_NaK in component sodium_potassium_pump (microA_per_microF). * ALGEBRAIC[58] is f_NaK in component sodium_potassium_pump (dimensionless). * CONSTANTS[37] is K_mNai in component sodium_potassium_pump (millimolar). * CONSTANTS[38] is K_mKo in component sodium_potassium_pump (millimolar). * CONSTANTS[67] is sigma in component sodium_potassium_pump (dimensionless). * ALGEBRAIC[62] is i_ns_Na in component non_specific_calcium_activated_current (microA_per_microF). * ALGEBRAIC[63] is i_ns_K in component non_specific_calcium_activated_current (microA_per_microF). * CONSTANTS[68] is P_ns_Ca in component non_specific_calcium_activated_current (cm_per_second). * ALGEBRAIC[60] is I_ns_Na in component non_specific_calcium_activated_current (microA_per_microF). * ALGEBRAIC[61] is I_ns_K in component non_specific_calcium_activated_current (microA_per_microF). * CONSTANTS[39] is K_m_ns_Ca in component non_specific_calcium_activated_current (millimolar). * CONSTANTS[40] is n_NaCa in component Na_Ca_exchanger (dimensionless). * CONSTANTS[41] is K_NaCa in component Na_Ca_exchanger (millimolar). * CONSTANTS[42] is d_NaCa in component Na_Ca_exchanger (millimolar). * CONSTANTS[43] is gamma in component Na_Ca_exchanger (dimensionless). * ALGEBRAIC[67] is i_rel in component calcium_dynamics (millimolar_per_second). * ALGEBRAIC[68] is i_up in component calcium_dynamics (millimolar_per_second). * ALGEBRAIC[69] is i_leak in component calcium_dynamics (millimolar_per_second). * ALGEBRAIC[70] is i_tr in component calcium_dynamics (millimolar_per_second). * ALGEBRAIC[66] is G_rel in component calcium_dynamics (per_second). * CONSTANTS[44] is G_rel_max in component calcium_dynamics (per_second). * CONSTANTS[45] is G_rel_overload in component calcium_dynamics (per_second). * CONSTANTS[46] is tau_tr in component calcium_dynamics (second). * CONSTANTS[47] is K_mrel in component calcium_dynamics (millimolar). * CONSTANTS[48] is delta_Ca_ith in component calcium_dynamics (millimolar). * CONSTANTS[49] is CSQN_max in component calcium_dynamics (millimolar). * CONSTANTS[50] is K_mCSQN in component calcium_dynamics (millimolar). * CONSTANTS[51] is K_mup in component calcium_dynamics (millimolar). * CONSTANTS[69] is K_leak in component calcium_dynamics (per_second). * CONSTANTS[52] is I_up in component calcium_dynamics (millimolar_per_second). * CONSTANTS[53] is Ca_NSR_max in component calcium_dynamics (millimolar). * STATES[16] is Ca_JSR in component calcium_dynamics (millimolar). * STATES[17] is Ca_NSR in component calcium_dynamics (millimolar). * CONSTANTS[72] is V_myo in component ionic_concentrations (micro_litre). * CONSTANTS[54] is A_cap in component ionic_concentrations (mm2). * CONSTANTS[74] is V_JSR in component calcium_dynamics (micro_litre). * CONSTANTS[75] is V_NSR in component calcium_dynamics (micro_litre). * CONSTANTS[55] is K_mTn in component calcium_dynamics (millimolar). * CONSTANTS[56] is K_mCMDN in component calcium_dynamics (millimolar). * CONSTANTS[57] is Tn_max in component calcium_dynamics (millimolar). * CONSTANTS[58] is CMDN_max in component calcium_dynamics (millimolar). * STATES[18] is APtrack in component calcium_dynamics (dimensionless). * STATES[19] is APtrack2 in component calcium_dynamics (dimensionless). * STATES[20] is APtrack3 in component calcium_dynamics (dimensionless). * STATES[21] is Cainfluxtrack in component calcium_dynamics (dimensionless). * STATES[22] is OVRLDtrack in component calcium_dynamics (dimensionless). * STATES[23] is OVRLDtrack2 in component calcium_dynamics (dimensionless). * STATES[24] is OVRLDtrack3 in component calcium_dynamics (dimensionless). * CONSTANTS[59] is CSQNthresh in component calcium_dynamics (millimolar). * CONSTANTS[60] is Logicthresh in component calcium_dynamics (dimensionless). * CONSTANTS[61] is preplength in component ionic_concentrations (mm). * CONSTANTS[62] is radius in component ionic_concentrations (mm). * CONSTANTS[70] is volume in component ionic_concentrations (micro_litre). * RATES[0] is d/dt V in component membrane (millivolt). * RATES[2] is d/dt m in component fast_sodium_current_m_gate (dimensionless). * RATES[3] is d/dt h in component fast_sodium_current_h_gate (dimensionless). * RATES[4] is d/dt j in component fast_sodium_current_j_gate (dimensionless). * RATES[7] is d/dt d in component L_type_Ca_channel_d_gate (dimensionless). * RATES[8] is d/dt f in component L_type_Ca_channel_f_gate (dimensionless). * RATES[9] is d/dt b in component T_type_Ca_channel_b_gate (dimensionless). * RATES[10] is d/dt g in component T_type_Ca_channel_g_gate (dimensionless). * RATES[11] is d/dt xr in component rapid_delayed_rectifier_potassium_current_xr_gate (dimensionless). * RATES[12] is d/dt xs1 in component slow_delayed_rectifier_potassium_current_xs1_gate (dimensionless). * RATES[13] is d/dt xs2 in component slow_delayed_rectifier_potassium_current_xs2_gate (dimensionless). * RATES[14] is d/dt zdv in component transient_outward_current_zdv_gate (dimensionless). * RATES[15] is d/dt ydv in component transient_outward_current_ydv_gate (dimensionless). * RATES[18] is d/dt APtrack in component calcium_dynamics (dimensionless). * RATES[19] is d/dt APtrack2 in component calcium_dynamics (dimensionless). * RATES[20] is d/dt APtrack3 in component calcium_dynamics (dimensionless). * RATES[21] is d/dt Cainfluxtrack in component calcium_dynamics (dimensionless). * RATES[22] is d/dt OVRLDtrack in component calcium_dynamics (dimensionless). * RATES[23] is d/dt OVRLDtrack2 in component calcium_dynamics (dimensionless). * RATES[24] is d/dt OVRLDtrack3 in component calcium_dynamics (dimensionless). * RATES[16] is d/dt Ca_JSR in component calcium_dynamics (millimolar). * RATES[17] is d/dt Ca_NSR in component calcium_dynamics (millimolar). * RATES[5] is d/dt Cai in component calcium_dynamics (millimolar). * RATES[1] is d/dt Nai in component ionic_concentrations (millimolar). * RATES[6] is d/dt Ki in component ionic_concentrations (millimolar). * There are a total of 28 condition variables. */ void initConsts(double* CONSTANTS, double* RATES, double *STATES) { STATES[0] = -88.984; CONSTANTS[0] = 8314; CONSTANTS[1] = 310; CONSTANTS[2] = 96485; CONSTANTS[3] = 0.001; CONSTANTS[4] = 0.1; CONSTANTS[5] = 9; CONSTANTS[6] = 1; CONSTANTS[7] = 0.002; CONSTANTS[8] = -25.5; CONSTANTS[9] = 16; STATES[1] = 15.6748357; CONSTANTS[10] = 132; STATES[2] = 0.00079287; STATES[3] = 0.9938; STATES[4] = 0.99573; CONSTANTS[11] = 1e-5; CONSTANTS[12] = 0.75; CONSTANTS[13] = 0.75; CONSTANTS[14] = 0.75; CONSTANTS[15] = 0.75; CONSTANTS[16] = 0.00054; CONSTANTS[17] = 6.75e-7; CONSTANTS[18] = 1.93e-7; CONSTANTS[19] = 1; CONSTANTS[20] = 0.341; STATES[5] = 0.00035237; CONSTANTS[21] = 1.8; CONSTANTS[22] = 4.5; STATES[6] = 137.6244; STATES[7] = 3.18355e-6; STATES[8] = 0.9974388; CONSTANTS[23] = 0.0006; CONSTANTS[24] = 0.05; STATES[9] = 0.000967785; STATES[10] = 0.95331988; STATES[11] = 0.00032151644; CONSTANTS[25] = 0.01833; STATES[12] = 0.0272635; STATES[13] = 0.0631269; CONSTANTS[26] = 0.00552; CONSTANTS[27] = 0.24; CONSTANTS[28] = 5e-5; CONSTANTS[29] = 3; CONSTANTS[30] = 2; CONSTANTS[31] = 0.00025; STATES[14] = 0.011528; STATES[15] = 0.985232; CONSTANTS[32] = 0.0005; CONSTANTS[33] = 1.15; CONSTANTS[34] = 0.004; CONSTANTS[35] = 0.003016; CONSTANTS[36] = 2; CONSTANTS[37] = 10; CONSTANTS[38] = 1.5; CONSTANTS[39] = 0.0012; CONSTANTS[40] = 3; CONSTANTS[41] = 0.002; CONSTANTS[42] = 0.001; CONSTANTS[43] = 0.5; CONSTANTS[44] = 60000; CONSTANTS[45] = 4000; CONSTANTS[46] = 0.18; CONSTANTS[47] = 0.0008; CONSTANTS[48] = 0.00018; CONSTANTS[49] = 10; CONSTANTS[50] = 0.8; CONSTANTS[51] = 0.00092; CONSTANTS[52] = 5; CONSTANTS[53] = 15; STATES[16] = 0.817895; STATES[17] = 2.797668; CONSTANTS[54] = 1.434e-7; CONSTANTS[55] = 0.0005; CONSTANTS[56] = 0.00238; CONSTANTS[57] = 0.07; CONSTANTS[58] = 0.05; STATES[18] = 3.814e-87; STATES[19] = 2.1084e-86; STATES[20] = 0.01925; STATES[21] = 1.784e-87; STATES[22] = 0; STATES[23] = 0; STATES[24] = 0; CONSTANTS[59] = 0.7; CONSTANTS[60] = 0.98; CONSTANTS[61] = 0.001; CONSTANTS[62] = 1.1e-4; CONSTANTS[63] = 0.0261400* pow((CONSTANTS[22]/5.40000), 1.0 / 2); CONSTANTS[64] = 0.750000* pow((CONSTANTS[22]/5.40000), 1.0 / 2); CONSTANTS[65] = 0.000193000/CONSTANTS[28]; CONSTANTS[66] = 0.00000*0.500000; CONSTANTS[67] = (1.00000/7.00000)*(exp(CONSTANTS[10]/67.3000) - 1.00000); CONSTANTS[68] = 0.00000*1.75000e-07; CONSTANTS[69] = CONSTANTS[52]/CONSTANTS[53]; CONSTANTS[70] = 3.14159265358979*CONSTANTS[61]*pow(CONSTANTS[62], 2.00000); CONSTANTS[71] = 1.00000/(1.00000+pow(CONSTANTS[29]/CONSTANTS[31], CONSTANTS[30])); CONSTANTS[72] = 0.680000*CONSTANTS[70]; CONSTANTS[73] = CONSTANTS[65]*CONSTANTS[71]*pow(CONSTANTS[22]/4.00000, CONSTANTS[27]); CONSTANTS[74] = (0.00480000/0.680000)*CONSTANTS[72]; CONSTANTS[75] = (0.0552000/0.680000)*CONSTANTS[72]; RATES[0] = 0.1001; RATES[2] = 0.1001; RATES[3] = 0.1001; RATES[4] = 0.1001; RATES[7] = 0.1001; RATES[8] = 0.1001; RATES[9] = 0.1001; RATES[10] = 0.1001; RATES[11] = 0.1001; RATES[12] = 0.1001; RATES[13] = 0.1001; RATES[14] = 0.1001; RATES[15] = 0.1001; RATES[18] = 0.1001; RATES[19] = 0.1001; RATES[20] = 0.1001; RATES[21] = 0.1001; RATES[22] = 0.1001; RATES[23] = 0.1001; RATES[24] = 0.1001; RATES[16] = 0.1001; RATES[17] = 0.1001; RATES[5] = 0.1001; RATES[1] = 0.1001; RATES[6] = 0.1001; } void computeResiduals(double VOI, double* CONSTANTS, double* RATES, double* OLDRATES, double* STATES, double* OLDSTATES, double* ALGEBRAIC, double* CONDVARS) { resid[0] = RATES[0] - (- 1.00000/CONSTANTS[3])*(ALGEBRAIC[2]+ALGEBRAIC[74]+ALGEBRAIC[75]+ALGEBRAIC[76]+ALGEBRAIC[32]+ALGEBRAIC[43]+ALGEBRAIC[45]+ALGEBRAIC[77]+ALGEBRAIC[42]+ALGEBRAIC[54]+ALGEBRAIC[55]+ALGEBRAIC[57]+ALGEBRAIC[59]+ALGEBRAIC[65]+ALGEBRAIC[64]+ALGEBRAIC[0]); resid[1] = RATES[2] - ALGEBRAIC[4]*(1.00000 - STATES[2]) - ALGEBRAIC[5]*STATES[2]; resid[2] = RATES[3] - ALGEBRAIC[6]*(1.00000 - STATES[3]) - ALGEBRAIC[7]*STATES[3]; resid[3] = RATES[4] - ALGEBRAIC[8]*(1.00000 - STATES[4]) - ALGEBRAIC[9]*STATES[4]; resid[4] = RATES[7] - ALGEBRAIC[16]*(1.00000 - STATES[7]) - ALGEBRAIC[17]*STATES[7]; resid[5] = RATES[8] - ALGEBRAIC[20]*(1.00000 - STATES[8]) - ALGEBRAIC[21]*STATES[8]; resid[6] = RATES[9] - (ALGEBRAIC[23] - STATES[9])/ALGEBRAIC[24]; resid[7] = RATES[10] - (ALGEBRAIC[25] - STATES[10])/ALGEBRAIC[26]; resid[8] = RATES[11] - (ALGEBRAIC[28] - STATES[11])/ALGEBRAIC[29]; resid[9] = RATES[12] - (ALGEBRAIC[33] - STATES[12])/ALGEBRAIC[34]; resid[10] = RATES[13] - (ALGEBRAIC[35] - STATES[13])/ALGEBRAIC[36]; resid[11] = RATES[14] - (ALGEBRAIC[49] - STATES[14])/ALGEBRAIC[48]; resid[12] = RATES[15] - (ALGEBRAIC[53] - STATES[15])/ALGEBRAIC[52]; resid[13] = RATES[18] - (CONDVAR[10]>0.00000 ? 100000.*(1.00000 - STATES[18]) - 500.000*STATES[18] : - 500.000*STATES[18]); resid[14] = RATES[19] - (CONDVAR[11]<0.00000&&CONDVAR[12]>0.00000 ? 100000.*(1.00000 - STATES[19]) - 500.000*STATES[19] : - 500.000*STATES[19]); resid[15] = RATES[20] - (CONDVAR[13]<0.00000&&CONDVAR[14]>0.00000 ? 100000.*(1.00000 - STATES[20]) - 500.000*STATES[20] : - 10.0000*STATES[20]); resid[16] = RATES[21] - (CONDVAR[15]>0.00000 ? ( - CONSTANTS[54]*(((ALGEBRAIC[71]+ALGEBRAIC[75]) - ALGEBRAIC[65])+ALGEBRAIC[54]+ALGEBRAIC[57]))/( 2.00000*CONSTANTS[72]*CONSTANTS[2]) : CONDVAR[16]>0.00000&&CONDVAR[17]<=0.00000 ? 0.00000 : - 500.000*STATES[21]); resid[17] = RATES[22] - (CONDVAR[18]>0.00000&&CONDVAR[19]<0.00000&&CONDVAR[20]<0.00000 ? 50000.0*(1.00000 - STATES[22]) : - 500.000*STATES[22]); resid[18] = RATES[23] - (CONDVAR[21]>0.00000&&CONDVAR[22]<0.00000 ? 50000.0*(1.00000 - STATES[23]) : - 500.000*STATES[23]); resid[19] = RATES[24] - (CONDVAR[23]>0.00000&&CONDVAR[24]<0.00000 ? 50000.0*(1.00000 - STATES[24]) : - 10.0000*STATES[24]); resid[20] = RATES[16] - (1.00000/(1.00000+( CONSTANTS[49]*CONSTANTS[50])/pow(CONSTANTS[50]+STATES[16], 2.00000)))*(ALGEBRAIC[70] - ALGEBRAIC[67]); resid[21] = RATES[17] - (( - ALGEBRAIC[70]*CONSTANTS[74])/CONSTANTS[75] - ALGEBRAIC[69])+ALGEBRAIC[68]; resid[22] = RATES[5] - (1.00000/(1.00000+( CONSTANTS[58]*CONSTANTS[56])/pow(CONSTANTS[56]+STATES[5], 2.00000)+( CONSTANTS[57]*CONSTANTS[55])/pow(CONSTANTS[55]+STATES[5], 2.00000)))*(( - CONSTANTS[54]*(((ALGEBRAIC[71]+ALGEBRAIC[75]) - ALGEBRAIC[65])+ALGEBRAIC[54]+ALGEBRAIC[57]))/( 2.00000*CONSTANTS[72]*CONSTANTS[2])+( ALGEBRAIC[67]*CONSTANTS[74])/CONSTANTS[72]+( (ALGEBRAIC[69] - ALGEBRAIC[68])*CONSTANTS[75])/CONSTANTS[72]); resid[23] = RATES[1] - ( - (ALGEBRAIC[2]+ALGEBRAIC[72]+ALGEBRAIC[55]+ALGEBRAIC[62]+ ALGEBRAIC[65]*3.00000+ ALGEBRAIC[59]*3.00000)*CONSTANTS[54])/( CONSTANTS[72]*CONSTANTS[2]); resid[24] = RATES[6] - ( - (ALGEBRAIC[73]+ALGEBRAIC[76]+ALGEBRAIC[32]+ALGEBRAIC[77]+ALGEBRAIC[42]+ALGEBRAIC[43]+ALGEBRAIC[45]+ALGEBRAIC[63]+ - ALGEBRAIC[59]*2.00000)*CONSTANTS[54])/( CONSTANTS[72]*CONSTANTS[2]); } void computeVariables(double VOI, double* CONSTANTS, double* RATES, double* STATES, double* ALGEBRAIC) { } void computeEssentialVariables(double VOI, double* CONSTANTS, double* RATES, double* STATES, double* ALGEBRAIC) { ALGEBRAIC[0] = (CONDVAR[0]>=0.00000&&CONDVAR[1]<=0.00000&&CONDVAR[2]<=0.00000 ? CONSTANTS[8] : 0.00000); ALGEBRAIC[1] = (( CONSTANTS[0]*CONSTANTS[1])/CONSTANTS[2])*log(CONSTANTS[10]/STATES[1]); ALGEBRAIC[2] = CONSTANTS[9]*pow(STATES[2], 3.00000)*STATES[3]*STATES[4]*(STATES[0] - ALGEBRAIC[1]); ALGEBRAIC[3] = STATES[0]+47.1300; ALGEBRAIC[4] = (CONDVAR[3]>=0.00000 ? ( 320.000*ALGEBRAIC[3])/(1.00000 - exp( - 0.100000*ALGEBRAIC[3])) : 3200.00); ALGEBRAIC[5] = 80.0000*exp(- STATES[0]/11.0000); ALGEBRAIC[6] = (CONDVAR[4]<0.00000 ? 135.000*exp((80.0000+STATES[0])/- 6.80000) : 0.00000); ALGEBRAIC[7] = (CONDVAR[5]<0.00000 ? 3560.00*exp( 0.0790000*STATES[0])+ 3.10000e+08*exp( 0.350000*STATES[0]) : 1.00000/( 0.000130000*(1.00000+exp((STATES[0]+10.6600)/- 11.1000)))); ALGEBRAIC[8] = (CONDVAR[6]<0.00000 ? ( 1000.00*- ( 127140.*exp( 0.244400*STATES[0])+ 3.47400e-05*exp( - 0.0439100*STATES[0]))*(STATES[0]+37.7800))/(1.00000+exp( 0.311000*(STATES[0]+79.2300))) : 0.00000); ALGEBRAIC[9] = (CONDVAR[7]<0.00000 ? ( 121.200*exp( - 0.0105200*STATES[0]))/(1.00000+exp( - 0.137800*(STATES[0]+40.1400))) : ( 300.000*exp( - 2.53500e-07*STATES[0]))/(1.00000+exp( - 0.100000*(STATES[0]+32.0000)))); ALGEBRAIC[13] = STATES[0]+10.0000; ALGEBRAIC[14] = 1.00000/(1.00000+exp(- ALGEBRAIC[13]/6.24000)); ALGEBRAIC[15] = (CONDVAR[8]<0.00000 ? 0.00100000/( 0.0350000*6.24000) : ( 0.00100000*ALGEBRAIC[14]*(1.00000 - exp(- ALGEBRAIC[13]/6.24000)))/( 0.0350000*ALGEBRAIC[13])); ALGEBRAIC[16] = ALGEBRAIC[14]/ALGEBRAIC[15]; ALGEBRAIC[17] = (1.00000 - ALGEBRAIC[14])/ALGEBRAIC[15]; ALGEBRAIC[18] = 1.00000/(1.00000+exp((STATES[0]+32.0000)/8.00000))+0.600000/(1.00000+exp((50.0000 - STATES[0])/20.0000)); ALGEBRAIC[19] = 0.00100000/( 0.0197000*exp(- pow( 0.0337000*(STATES[0]+10.0000), 2.00000))+0.0200000); ALGEBRAIC[20] = ALGEBRAIC[18]/ALGEBRAIC[19]; ALGEBRAIC[21] = (1.00000 - ALGEBRAIC[18])/ALGEBRAIC[19]; ALGEBRAIC[23] = 1.00000/(1.00000+exp(- (STATES[0]+14.0000)/10.8000)); ALGEBRAIC[24] = 0.00370000+0.00610000/(1.00000+exp((STATES[0]+25.0000)/4.50000)); ALGEBRAIC[25] = 1.00000/(1.00000+exp((STATES[0]+60.0000)/5.60000)); ALGEBRAIC[26] = (CONDVAR[9]<=0.00000 ? - 0.000875000*STATES[0]+0.0120000 : 0.0120000); ALGEBRAIC[28] = 1.00000/(1.00000+exp(- (STATES[0]+21.5000)/7.50000)); ALGEBRAIC[29] = 0.00100000/(( 0.00138000*(STATES[0]+14.2000))/(1.00000 - exp( - 0.123000*(STATES[0]+14.2000)))+( 0.000610000*(STATES[0]+38.9000))/(exp( 0.145000*(STATES[0]+38.9000)) - 1.00000)); ALGEBRAIC[31] = 0.433000*(1.00000+0.600000/(1.00000+pow(3.80000e-05/STATES[5], 1.40000))); ALGEBRAIC[30] = (( CONSTANTS[0]*CONSTANTS[1])/CONSTANTS[2])*log((CONSTANTS[22]+ CONSTANTS[25]*CONSTANTS[10])/(STATES[6]+ CONSTANTS[25]*STATES[1])); ALGEBRAIC[32] = ALGEBRAIC[31]*STATES[12]*STATES[13]*(STATES[0] - ALGEBRAIC[30]); ALGEBRAIC[33] = 1.00000/(1.00000+exp(- (STATES[0] - 1.50000)/16.7000)); ALGEBRAIC[34] = 0.00100000/(( 7.19000e-05*(STATES[0]+30.0000))/(1.00000 - exp( - 0.148000*(STATES[0]+30.0000)))+( 0.000131000*(STATES[0]+30.0000))/(exp( 0.0687000*(STATES[0]+30.0000)) - 1.00000)); ALGEBRAIC[35] = 1.00000/(1.00000+exp(- (STATES[0] - 1.50000)/16.7000)); ALGEBRAIC[36] = ( 4.00000*0.00100000)/(( 7.19000e-05*(STATES[0]+30.0000))/(1.00000 - exp( - 0.148000*(STATES[0]+30.0000)))+( 0.000131000*(STATES[0]+30.0000))/(exp( 0.0687000*(STATES[0]+30.0000)) - 1.00000)); ALGEBRAIC[37] = (( CONSTANTS[0]*CONSTANTS[1])/CONSTANTS[2])*log(CONSTANTS[22]/STATES[6]); ALGEBRAIC[41] = 1.00000/(1.00000+exp((7.48800 - STATES[0])/5.98000)); ALGEBRAIC[42] = CONSTANTS[26]*ALGEBRAIC[41]*(STATES[0] - ALGEBRAIC[37]); ALGEBRAIC[43] = CONSTANTS[73]*(STATES[0] - ALGEBRAIC[37]); ALGEBRAIC[44] = exp(STATES[0]/100.000); ALGEBRAIC[45] = CONSTANTS[66]*pow(STATES[14], 3.00000)*STATES[15]*ALGEBRAIC[44]*(STATES[0] - ALGEBRAIC[37]); ALGEBRAIC[46] = ( 10000.0*exp((STATES[0] - 40.0000)/25.0000))/(1.00000+exp((STATES[0] - 40.0000)/25.0000)); ALGEBRAIC[47] = ( 10000.0*exp(- (STATES[0]+90.0000)/25.0000))/(1.00000+exp(- (STATES[0]+90.0000)/25.0000)); ALGEBRAIC[48] = 1.00000/(ALGEBRAIC[46]+ALGEBRAIC[47]); ALGEBRAIC[49] = ALGEBRAIC[46]/(ALGEBRAIC[46]+ALGEBRAIC[47]); ALGEBRAIC[50] = 15.0000/(1.00000+exp((STATES[0]+60.0000)/5.00000)); ALGEBRAIC[51] = ( 100.000*exp((STATES[0]+25.0000)/5.00000))/(1.00000+exp((STATES[0]+25.0000)/5.00000)); ALGEBRAIC[52] = 1.00000/(ALGEBRAIC[50]+ALGEBRAIC[51]); ALGEBRAIC[53] = ALGEBRAIC[50]/(ALGEBRAIC[50]+ALGEBRAIC[51]); ALGEBRAIC[54] = ( CONSTANTS[33]*STATES[5])/(CONSTANTS[32]+STATES[5]); ALGEBRAIC[55] = CONSTANTS[34]*(STATES[0] - ALGEBRAIC[1]); ALGEBRAIC[56] = (( CONSTANTS[0]*CONSTANTS[1])/( 2.00000*CONSTANTS[2]))*log(CONSTANTS[21]/STATES[5]); ALGEBRAIC[57] = CONSTANTS[35]*(STATES[0] - ALGEBRAIC[56]); ALGEBRAIC[58] = 1.00000/(1.00000+ 0.124500*exp(( - 0.100000*STATES[0]*CONSTANTS[2])/( CONSTANTS[0]*CONSTANTS[1]))+ 0.0365000*CONSTANTS[67]*exp(( - STATES[0]*CONSTANTS[2])/( CONSTANTS[0]*CONSTANTS[1]))); ALGEBRAIC[59] = ( (( CONSTANTS[36]*ALGEBRAIC[58]*1.00000)/(1.00000+pow(CONSTANTS[37]/STATES[1], 2.00000)))*CONSTANTS[22])/(CONSTANTS[22]+CONSTANTS[38]); ALGEBRAIC[60] = ( (( CONSTANTS[68]*pow(1.00000, 2.00000)*STATES[0]*pow(CONSTANTS[2], 2.00000))/( CONSTANTS[0]*CONSTANTS[1]))*( CONSTANTS[12]*STATES[1]*exp(( 1.00000*STATES[0]*CONSTANTS[2])/( CONSTANTS[0]*CONSTANTS[1])) - CONSTANTS[13]*CONSTANTS[10]))/(exp(( 1.00000*STATES[0]*CONSTANTS[2])/( CONSTANTS[0]*CONSTANTS[1])) - 1.00000); ALGEBRAIC[62] = ( ALGEBRAIC[60]*1.00000)/(1.00000+pow(CONSTANTS[39]/STATES[5], 3.00000)); ALGEBRAIC[61] = ( (( CONSTANTS[68]*pow(1.00000, 2.00000)*STATES[0]*pow(CONSTANTS[2], 2.00000))/( CONSTANTS[0]*CONSTANTS[1]))*( CONSTANTS[14]*STATES[6]*exp(( 1.00000*STATES[0]*CONSTANTS[2])/( CONSTANTS[0]*CONSTANTS[1])) - CONSTANTS[15]*CONSTANTS[22]))/(exp(( 1.00000*STATES[0]*CONSTANTS[2])/( CONSTANTS[0]*CONSTANTS[1])) - 1.00000); ALGEBRAIC[63] = ( ALGEBRAIC[61]*1.00000)/(1.00000+pow(CONSTANTS[39]/STATES[5], 3.00000)); ALGEBRAIC[64] = ALGEBRAIC[62]+ALGEBRAIC[63]; ALGEBRAIC[65] = ( CONSTANTS[41]*( exp(( CONSTANTS[43]*(CONSTANTS[40] - 2.00000)*STATES[0]*CONSTANTS[2])/( CONSTANTS[0]*CONSTANTS[1]))*pow(STATES[1], CONSTANTS[40])*CONSTANTS[21] - exp(( (CONSTANTS[43] - 1.00000)*(CONSTANTS[40] - 2.00000)*STATES[0]*CONSTANTS[2])/( CONSTANTS[0]*CONSTANTS[1]))*pow(CONSTANTS[10], CONSTANTS[40])*STATES[5]))/( (1.00000+ CONSTANTS[42]*( STATES[5]*pow(CONSTANTS[10], CONSTANTS[40])+ CONSTANTS[21]*pow(STATES[1], CONSTANTS[40])))*(1.00000+STATES[5]/0.00690000)); ALGEBRAIC[66] = (CONDVAR[25]>0.00000 ? (( CONSTANTS[44]*(STATES[21] - CONSTANTS[48]))/((CONSTANTS[47]+STATES[21]) - CONSTANTS[48]))*(1.00000 - STATES[19])*STATES[19] : CONDVAR[26]<=0.00000&&CONDVAR[27]>0.00000 ? CONSTANTS[45]*(1.00000 - STATES[23])*STATES[23] : 0.00000); ALGEBRAIC[67] = ALGEBRAIC[66]*(STATES[16] - STATES[5]); ALGEBRAIC[68] = ( CONSTANTS[52]*STATES[5])/(STATES[5]+CONSTANTS[51]); ALGEBRAIC[69] = CONSTANTS[69]*STATES[17]; ALGEBRAIC[70] = (STATES[17] - STATES[16])/CONSTANTS[46]; ALGEBRAIC[10] = ( (( CONSTANTS[16]*pow(2.00000, 2.00000)*STATES[0]*pow(CONSTANTS[2], 2.00000))/( CONSTANTS[0]*CONSTANTS[1]))*( CONSTANTS[19]*STATES[5]*exp(( 2.00000*STATES[0]*CONSTANTS[2])/( CONSTANTS[0]*CONSTANTS[1])) - CONSTANTS[20]*CONSTANTS[21]))/(exp(( 2.00000*STATES[0]*CONSTANTS[2])/( CONSTANTS[0]*CONSTANTS[1])) - 1.00000); ALGEBRAIC[22] = 1.00000/(1.00000+STATES[5]/CONSTANTS[23]); ALGEBRAIC[71] = STATES[7]*STATES[8]*ALGEBRAIC[22]*ALGEBRAIC[10]; ALGEBRAIC[11] = ( (( CONSTANTS[17]*pow(1.00000, 2.00000)*STATES[0]*pow(CONSTANTS[2], 2.00000))/( CONSTANTS[0]*CONSTANTS[1]))*( CONSTANTS[12]*STATES[1]*exp(( 1.00000*STATES[0]*CONSTANTS[2])/( CONSTANTS[0]*CONSTANTS[1])) - CONSTANTS[13]*CONSTANTS[10]))/(exp(( 1.00000*STATES[0]*CONSTANTS[2])/( CONSTANTS[0]*CONSTANTS[1])) - 1.00000); ALGEBRAIC[72] = STATES[7]*STATES[8]*ALGEBRAIC[22]*ALGEBRAIC[11]; ALGEBRAIC[12] = ( (( CONSTANTS[18]*pow(1.00000, 2.00000)*STATES[0]*pow(CONSTANTS[2], 2.00000))/( CONSTANTS[0]*CONSTANTS[1]))*( CONSTANTS[14]*STATES[6]*exp(( 1.00000*STATES[0]*CONSTANTS[2])/( CONSTANTS[0]*CONSTANTS[1])) - CONSTANTS[15]*CONSTANTS[22]))/(exp(( 1.00000*STATES[0]*CONSTANTS[2])/( CONSTANTS[0]*CONSTANTS[1])) - 1.00000); ALGEBRAIC[73] = STATES[7]*STATES[8]*ALGEBRAIC[22]*ALGEBRAIC[12]; ALGEBRAIC[74] = ALGEBRAIC[71]+ALGEBRAIC[73]+ALGEBRAIC[72]; ALGEBRAIC[75] = CONSTANTS[24]*STATES[9]*STATES[9]*STATES[10]*(STATES[0] - ALGEBRAIC[56]); ALGEBRAIC[27] = 1.00000/(1.00000+exp((STATES[0]+9.00000)/22.4000)); ALGEBRAIC[76] = CONSTANTS[63]*STATES[11]*ALGEBRAIC[27]*(STATES[0] - ALGEBRAIC[37]); ALGEBRAIC[38] = 1020.00/(1.00000+exp( 0.238500*((STATES[0] - ALGEBRAIC[37]) - 59.2150))); ALGEBRAIC[39] = ( 1000.00*( 0.491240*exp( 0.0803200*((STATES[0] - ALGEBRAIC[37])+5.47600))+exp( 0.0617500*((STATES[0] - ALGEBRAIC[37]) - 594.310))))/(1.00000+exp( - 0.514300*((STATES[0] - ALGEBRAIC[37])+4.75300))); ALGEBRAIC[40] = ALGEBRAIC[38]/(ALGEBRAIC[38]+ALGEBRAIC[39]); ALGEBRAIC[77] = CONSTANTS[64]*ALGEBRAIC[40]*(STATES[0] - ALGEBRAIC[37]); ALGEBRAIC[78] = (- 1.00000/CONSTANTS[3])*(ALGEBRAIC[2]+ALGEBRAIC[74]+ALGEBRAIC[75]+ALGEBRAIC[76]+ALGEBRAIC[32]+ALGEBRAIC[43]+ALGEBRAIC[45]+ALGEBRAIC[77]+ALGEBRAIC[42]+ALGEBRAIC[54]+ALGEBRAIC[55]+ALGEBRAIC[57]+ALGEBRAIC[59]+ALGEBRAIC[65]+ALGEBRAIC[64]+ALGEBRAIC[0]); } void getStateInformation(double* SI) { SI[0] = 1.0; SI[1] = 1.0; SI[2] = 1.0; SI[3] = 1.0; SI[4] = 1.0; SI[5] = 1.0; SI[6] = 1.0; SI[7] = 1.0; SI[8] = 1.0; SI[9] = 1.0; SI[10] = 1.0; SI[11] = 1.0; SI[12] = 1.0; SI[13] = 1.0; SI[14] = 1.0; SI[15] = 1.0; SI[16] = 1.0; SI[17] = 1.0; SI[18] = 1.0; SI[19] = 1.0; SI[20] = 1.0; SI[21] = 1.0; SI[22] = 1.0; SI[23] = 1.0; SI[24] = 1.0; } void computeRoots(double VOI, double* CONSTANTS, double* RATES, double* OLDRATES, double* STATES, double* OLDSTATES, double* ALGEBRAIC, double* CONDVARS) { CONDVAR[0] = VOI - CONSTANTS[4]; CONDVAR[1] = VOI - CONSTANTS[5]; CONDVAR[2] = ((VOI - CONSTANTS[4]) - floor((VOI - CONSTANTS[4])/CONSTANTS[6])*CONSTANTS[6]) - CONSTANTS[7]; CONDVAR[3] = fabs(ALGEBRAIC[3]) - CONSTANTS[11]; CONDVAR[4] = STATES[0] - - 40.0000; CONDVAR[5] = STATES[0] - - 40.0000; CONDVAR[6] = STATES[0] - - 40.0000; CONDVAR[7] = STATES[0] - - 40.0000; CONDVAR[8] = fabs(ALGEBRAIC[13]) - 1.00000e-05; CONDVAR[9] = STATES[0] - 0.00000; CONDVAR[10] = ALGEBRAIC[78] - 150000.; CONDVAR[11] = STATES[18] - 0.200000; CONDVAR[12] = STATES[18] - 0.180000; CONDVAR[13] = STATES[18] - 0.200000; CONDVAR[14] = STATES[18] - 0.180000; CONDVAR[15] = STATES[18] - 0.200000; CONDVAR[16] = STATES[19] - 0.0100000; CONDVAR[17] = STATES[18] - 0.200000; CONDVAR[18] = 1.00000/(1.00000+CONSTANTS[50]/STATES[16]) - CONSTANTS[59]; CONDVAR[19] = STATES[24] - 0.370000; CONDVAR[20] = STATES[20] - 0.370000; CONDVAR[21] = STATES[22] - CONSTANTS[60]; CONDVAR[22] = STATES[23] - CONSTANTS[60]; CONDVAR[23] = STATES[22] - CONSTANTS[60]; CONDVAR[24] = STATES[24] - CONSTANTS[60]; CONDVAR[25] = STATES[21] - CONSTANTS[48]; CONDVAR[26] = STATES[21] - CONSTANTS[48]; CONDVAR[27] = STATES[23] - 0.00000; }