Generated Code

The following is c_ida code generated by the CellML API from this CellML file. (Back to language selection)

The raw code is available.

/*
   There are a total of 85 entries in the algebraic variable array.
   There are a total of 18 entries in each of the rate and state variable arrays.
   There are a total of 71 entries in the constant variable array.
 */
/*
 * VOI is time in component environment (ms).
 * STATES[0] is V in component membrane (mV).
 * CONSTANTS[0] is R in component membrane (millijoule_per_mole_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 (uF).
 * ALGEBRAIC[4] is i_Na in component sodium_current (uA).
 * ALGEBRAIC[12] is i_t in component Ca_independent_transient_outward_K_current (uA).
 * ALGEBRAIC[19] is i_ss in component steady_state_outward_K_current (uA).
 * ALGEBRAIC[23] is i_K1 in component inward_rectifier (uA).
 * ALGEBRAIC[26] is i_f in component hyperpolarisation_activated_current (uA).
 * ALGEBRAIC[29] is i_B_Na in component background_currents (uA).
 * ALGEBRAIC[30] is i_B_K in component background_currents (uA).
 * ALGEBRAIC[33] is i_NaK in component sodium_potassium_pump (uA).
 * ALGEBRAIC[57] is i_Ncx2 in component Na_Ca_Exchanger (uA).
 * ALGEBRAIC[60] is i_pCa2 in component SarcolemMal_Ca_pump (uA).
 * ALGEBRAIC[84] is i_LCC2 in component LCC_current (uA).
 * ALGEBRAIC[63] is i_CaB2 in component Background_Ca_current (uA).
 * ALGEBRAIC[2] is i_Stim in component membrane (uA).
 * CONSTANTS[4] is stim_period in component membrane (ms).
 * CONSTANTS[5] is stim_duration in component membrane (ms).
 * CONSTANTS[6] is stim_amplitude in component membrane (uA).
 * ALGEBRAIC[0] is FVRT in component membrane (dimensionless).
 * ALGEBRAIC[1] is FVRT_Ca in component membrane (dimensionless).
 * CONSTANTS[7] is Vmyo in component cell_geometry (um3).
 * CONSTANTS[8] is Vmyo_uL in component cell_geometry (uL).
 * CONSTANTS[9] is VSR_uL in component cell_geometry (uL).
 * ALGEBRAIC[3] is E_Na in component sodium_current (mV).
 * CONSTANTS[10] is g_Na in component sodium_current (mSi).
 * STATES[1] is Na_i in component intracellular_ion_concentrations (mM).
 * CONSTANTS[11] is Na_o in component extracellular_ion_concentrations (mM).
 * STATES[2] is m in component sodium_current_m_gate (dimensionless).
 * STATES[3] is h in component sodium_current_h_gate (dimensionless).
 * STATES[4] is j in component sodium_current_j_gate (dimensionless).
 * ALGEBRAIC[5] is m_infinity in component sodium_current_m_gate (dimensionless).
 * ALGEBRAIC[6] is tau_m in component sodium_current_m_gate (ms).
 * ALGEBRAIC[7] is h_infinity in component sodium_current_h_gate (dimensionless).
 * ALGEBRAIC[8] is tau_h in component sodium_current_h_gate (ms).
 * ALGEBRAIC[9] is j_infinity in component sodium_current_j_gate (dimensionless).
 * ALGEBRAIC[10] is tau_j in component sodium_current_j_gate (ms).
 * ALGEBRAIC[11] is E_K in component Ca_independent_transient_outward_K_current (mV).
 * CONSTANTS[12] is g_t in component Ca_independent_transient_outward_K_current (mSi).
 * CONSTANTS[13] is a in component Ca_independent_transient_outward_K_current (dimensionless).
 * CONSTANTS[14] is b in component Ca_independent_transient_outward_K_current (dimensionless).
 * CONSTANTS[15] is K_o in component extracellular_ion_concentrations (mM).
 * STATES[5] is K_i in component intracellular_ion_concentrations (mM).
 * STATES[6] is r in component Ca_independent_transient_outward_K_current_r_gate (dimensionless).
 * STATES[7] is s in component Ca_independent_transient_outward_K_current_s_gate (dimensionless).
 * STATES[8] is s_slow in component Ca_independent_transient_outward_K_current_s_slow_gate (dimensionless).
 * ALGEBRAIC[14] is tau_r in component Ca_independent_transient_outward_K_current_r_gate (ms).
 * ALGEBRAIC[13] is r_infinity in component Ca_independent_transient_outward_K_current_r_gate (dimensionless).
 * ALGEBRAIC[16] is tau_s in component Ca_independent_transient_outward_K_current_s_gate (ms).
 * ALGEBRAIC[15] is s_infinity in component Ca_independent_transient_outward_K_current_s_gate (dimensionless).
 * ALGEBRAIC[18] is tau_s_slow in component Ca_independent_transient_outward_K_current_s_slow_gate (ms).
 * ALGEBRAIC[17] is s_slow_infinity in component Ca_independent_transient_outward_K_current_s_slow_gate (dimensionless).
 * CONSTANTS[16] is g_ss in component steady_state_outward_K_current (mSi).
 * STATES[9] is r_ss in component steady_state_outward_K_current_r_ss_gate (dimensionless).
 * STATES[10] is s_ss in component steady_state_outward_K_current_s_ss_gate (dimensionless).
 * ALGEBRAIC[21] is tau_r_ss in component steady_state_outward_K_current_r_ss_gate (ms).
 * ALGEBRAIC[20] is r_ss_infinity in component steady_state_outward_K_current_r_ss_gate (dimensionless).
 * CONSTANTS[67] is tau_s_ss in component steady_state_outward_K_current_s_ss_gate (ms).
 * ALGEBRAIC[22] is s_ss_infinity in component steady_state_outward_K_current_s_ss_gate (dimensionless).
 * CONSTANTS[17] is g_K1 in component inward_rectifier (mSi).
 * ALGEBRAIC[24] is i_f_Na in component hyperpolarisation_activated_current (uA).
 * ALGEBRAIC[25] is i_f_K in component hyperpolarisation_activated_current (uA).
 * CONSTANTS[18] is g_f in component hyperpolarisation_activated_current (mSi).
 * CONSTANTS[19] is f_Na in component hyperpolarisation_activated_current (dimensionless).
 * CONSTANTS[68] is f_K in component hyperpolarisation_activated_current (dimensionless).
 * STATES[11] is y in component hyperpolarisation_activated_current_y_gate (dimensionless).
 * ALGEBRAIC[28] is tau_y in component hyperpolarisation_activated_current_y_gate (ms).
 * ALGEBRAIC[27] is y_infinity in component hyperpolarisation_activated_current_y_gate (dimensionless).
 * ALGEBRAIC[31] is i_B in component background_currents (uA).
 * CONSTANTS[20] is g_B_Na in component background_currents (mSi).
 * CONSTANTS[21] is g_B_K in component background_currents (mSi).
 * CONSTANTS[22] is i_NaK_max in component sodium_potassium_pump (uA).
 * ALGEBRAIC[32] is nu_1 in component sodium_potassium_pump (dimensionless).
 * CONSTANTS[23] is gamma1 in component sodium_potassium_pump (dimensionless).
 * CONSTANTS[24] is KdNaio in component sodium_potassium_pump (mM).
 * CONSTANTS[25] is KdNais in component sodium_potassium_pump (mM).
 * CONSTANTS[26] is KdNaes in component sodium_potassium_pump (mM).
 * CONSTANTS[27] is Delta in component sodium_potassium_pump (dimensionless).
 * CONSTANTS[28] is alpha in component sodium_potassium_pump (mM).
 * CONSTANTS[29] is Ca_o in component extracellular_ion_concentrations (mM).
 * CONSTANTS[30] is g_D in component CaRU (um3_per_ms).
 * CONSTANTS[31] is J_R in component CaRU (um3_per_ms).
 * CONSTANTS[32] is J_L in component CaRU (um3_per_ms).
 * CONSTANTS[33] is N in component CaRU (dimensionless).
 * STATES[12] is Ca_i in component intracellular_ion_concentrations (mM).
 * STATES[13] is Ca_SR in component intracellular_ion_concentrations (mM).
 * ALGEBRAIC[81] is i_RyR2 in component RyR_current (mM_per_ms).
 * ALGEBRAIC[43] is C_oc in component DS_Calcium_Concentrations (mM).
 * ALGEBRAIC[42] is C_co in component DS_Calcium_Concentrations (mM).
 * CONSTANTS[34] is V_L in component CaRU_Transitions (mV).
 * CONSTANTS[35] is del_VL in component CaRU_Transitions (mV).
 * CONSTANTS[36] is phi_L in component CaRU_Transitions (dimensionless).
 * CONSTANTS[37] is t_L in component CaRU_Transitions (ms).
 * CONSTANTS[38] is tau_L in component CaRU_Transitions (ms).
 * CONSTANTS[39] is t_R in component CaRU_Transitions (ms).
 * CONSTANTS[40] is tau_R in component CaRU_Transitions (ms).
 * CONSTANTS[41] is phi_R in component CaRU_Transitions (dimensionless).
 * CONSTANTS[42] is theta_R in component CaRU_Transitions (dimensionless).
 * CONSTANTS[43] is K_RyR in component CaRU_Transitions (mM).
 * CONSTANTS[44] is K_L in component CaRU_Transitions (mM).
 * CONSTANTS[45] is a1 in component CaRU_Transitions (dimensionless).
 * CONSTANTS[46] is b1 in component CaRU_Transitions (dimensionless).
 * CONSTANTS[47] is c in component CaRU_Transitions (dimensionless).
 * CONSTANTS[48] is d in component CaRU_Transitions (dimensionless).
 * ALGEBRAIC[34] is expVL in component CaRU_Transitions (dimensionless).
 * ALGEBRAIC[35] is alpha_p in component CaRU_Transitions (per_ms).
 * CONSTANTS[69] is alpha_m in component CaRU_Transitions (per_ms).
 * ALGEBRAIC[67] is beta_poc in component CaRU_Transitions (per_ms).
 * ALGEBRAIC[36] is beta_pcc in component CaRU_Transitions (per_ms).
 * CONSTANTS[70] is beta_m in component CaRU_Transitions (per_ms).
 * ALGEBRAIC[68] is epsilon_pco in component CaRU_Transitions (per_ms).
 * ALGEBRAIC[37] is epsilon_pcc in component CaRU_Transitions (per_ms).
 * ALGEBRAIC[38] is epsilon_m in component CaRU_Transitions (per_ms).
 * ALGEBRAIC[69] is mu_poc in component CaRU_Transitions (per_ms).
 * ALGEBRAIC[39] is mu_pcc in component CaRU_Transitions (per_ms).
 * ALGEBRAIC[70] is mu_moc in component CaRU_Transitions (per_ms).
 * ALGEBRAIC[40] is mu_mcc in component CaRU_Transitions (per_ms).
 * ALGEBRAIC[41] is C_cc in component DS_Calcium_Concentrations (mM).
 * ALGEBRAIC[47] is J_Loo in component LCC_and_RyR_fluxes (um3_mM_per_ms).
 * ALGEBRAIC[46] is J_Loc in component LCC_and_RyR_fluxes (um3_mM_per_ms).
 * ALGEBRAIC[44] is J_Rco in component LCC_and_RyR_fluxes (um3_mM_per_ms).
 * ALGEBRAIC[45] is J_Roo in component LCC_and_RyR_fluxes (um3_mM_per_ms).
 * ALGEBRAIC[71] is denom in component CaRU_states (per_ms3).
 * ALGEBRAIC[72] is P1 in component CaRU_states (dimensionless).
 * ALGEBRAIC[73] is P2 in component CaRU_states (dimensionless).
 * ALGEBRAIC[74] is P3 in component CaRU_states (dimensionless).
 * ALGEBRAIC[75] is P4 in component CaRU_states (dimensionless).
 * ALGEBRAIC[76] is r_1 in component CaRU_reduced_states (per_ms).
 * ALGEBRAIC[77] is r_2 in component CaRU_reduced_states (per_ms).
 * ALGEBRAIC[48] is r_3 in component CaRU_reduced_states (per_ms).
 * ALGEBRAIC[49] is r_4 in component CaRU_reduced_states (per_ms).
 * ALGEBRAIC[78] is r_5 in component CaRU_reduced_states (per_ms).
 * ALGEBRAIC[50] is r_6 in component CaRU_reduced_states (per_ms).
 * ALGEBRAIC[51] is r_7 in component CaRU_reduced_states (per_ms).
 * ALGEBRAIC[52] is r_8 in component CaRU_reduced_states (per_ms).
 * STATES[14] is z_1 in component CaRU_reduced_states (dimensionless).
 * STATES[15] is z_2 in component CaRU_reduced_states (dimensionless).
 * STATES[16] is z_3 in component CaRU_reduced_states (dimensionless).
 * ALGEBRAIC[53] is z_4 in component CaRU_reduced_states (dimensionless).
 * ALGEBRAIC[79] is J_R1 in component RyR_current (um3_mM_per_ms).
 * ALGEBRAIC[54] is J_R3 in component RyR_current (um3_mM_per_ms).
 * ALGEBRAIC[80] is i_RyR1 in component RyR_current (mM_per_ms).
 * ALGEBRAIC[82] is J_L1 in component LCC_current (um3_mM_per_ms).
 * ALGEBRAIC[55] is J_L2 in component LCC_current (um3_mM_per_ms).
 * ALGEBRAIC[83] is i_LCC1 in component LCC_current (mM_per_ms).
 * CONSTANTS[49] is K_mNa in component Na_Ca_Exchanger (mM).
 * CONSTANTS[50] is K_mCa in component Na_Ca_Exchanger (mM).
 * CONSTANTS[51] is eta in component Na_Ca_Exchanger (dimensionless).
 * CONSTANTS[52] is k_sat in component Na_Ca_Exchanger (dimensionless).
 * CONSTANTS[53] is g_NCX in component Na_Ca_Exchanger (mM_per_ms).
 * ALGEBRAIC[56] is i_Ncx1 in component Na_Ca_Exchanger (mM_per_ms).
 * CONSTANTS[54] is g_SERCA in component SERCA (mM_per_ms).
 * CONSTANTS[55] is K_SERCA in component SERCA (mM).
 * ALGEBRAIC[58] is i_SERCA in component SERCA (mM_per_ms).
 * CONSTANTS[56] is g_pCa in component SarcolemMal_Ca_pump (mM_per_ms).
 * CONSTANTS[57] is K_mpCa in component SarcolemMal_Ca_pump (mM).
 * ALGEBRAIC[59] is i_pCa1 in component SarcolemMal_Ca_pump (mM_per_ms).
 * ALGEBRAIC[61] is E_Ca in component Background_Ca_current (mV).
 * CONSTANTS[58] is g_CaB in component Background_Ca_current (mM_per_mV_ms).
 * ALGEBRAIC[62] is i_CaB1 in component Background_Ca_current (mM_per_ms).
 * CONSTANTS[59] is g_SRl in component SR_Ca_leak_current (per_ms).
 * ALGEBRAIC[64] is i_SR in component SR_Ca_leak_current (mM_per_ms).
 * CONSTANTS[60] is k_m_TRPN in component troponin_Ca_buffer (per_ms).
 * CONSTANTS[61] is k_p_TRPN in component troponin_Ca_buffer (per_mM_ms).
 * CONSTANTS[62] is B_TRPN in component troponin_Ca_buffer (mM).
 * STATES[17] is TRPN in component intracellular_ion_concentrations (mM).
 * ALGEBRAIC[65] is i_TRPN in component troponin_Ca_buffer (mM_per_ms).
 * CONSTANTS[63] is k_CMDN in component calmodulin_Ca_buffer (mM).
 * CONSTANTS[64] is B_CMDN in component calmodulin_Ca_buffer (mM).
 * ALGEBRAIC[66] is beta_CMDN in component calmodulin_Ca_buffer (dimensionless).
 * CONSTANTS[65] is EGTA_tot in component calmodulin_Ca_buffer (mM).
 * CONSTANTS[66] is KmEGTA in component calmodulin_Ca_buffer (mM).
 * RATES[0] is d/dt V in component membrane (mV).
 * RATES[2] is d/dt m in component sodium_current_m_gate (dimensionless).
 * RATES[3] is d/dt h in component sodium_current_h_gate (dimensionless).
 * RATES[4] is d/dt j in component sodium_current_j_gate (dimensionless).
 * RATES[6] is d/dt r in component Ca_independent_transient_outward_K_current_r_gate (dimensionless).
 * RATES[7] is d/dt s in component Ca_independent_transient_outward_K_current_s_gate (dimensionless).
 * RATES[8] is d/dt s_slow in component Ca_independent_transient_outward_K_current_s_slow_gate (dimensionless).
 * RATES[9] is d/dt r_ss in component steady_state_outward_K_current_r_ss_gate (dimensionless).
 * RATES[10] is d/dt s_ss in component steady_state_outward_K_current_s_ss_gate (dimensionless).
 * RATES[11] is d/dt y in component hyperpolarisation_activated_current_y_gate (dimensionless).
 * RATES[14] is d/dt z_1 in component CaRU_reduced_states (dimensionless).
 * RATES[15] is d/dt z_2 in component CaRU_reduced_states (dimensionless).
 * RATES[16] is d/dt z_3 in component CaRU_reduced_states (dimensionless).
 * RATES[1] is d/dt Na_i in component intracellular_ion_concentrations (mM).
 * RATES[5] is d/dt K_i in component intracellular_ion_concentrations (mM).
 * RATES[17] is d/dt TRPN in component intracellular_ion_concentrations (mM).
 * RATES[12] is d/dt Ca_i in component intracellular_ion_concentrations (mM).
 * RATES[13] is d/dt Ca_SR in component intracellular_ion_concentrations (mM).
 * There are a total of 8 condition variables.
 */
void
initConsts(double* CONSTANTS, double* RATES, double *STATES)
{
STATES[0] = -85.1221681609219;
CONSTANTS[0] = 8314;
CONSTANTS[1] = 310;
CONSTANTS[2] = 96487;
CONSTANTS[3] = 0.0001;
CONSTANTS[4] = 1000;
CONSTANTS[5] = 3;
CONSTANTS[6] = -0.0012;
CONSTANTS[7] = 25850;
CONSTANTS[8] = 2.585e-5;
CONSTANTS[9] = 2.098e-6;
CONSTANTS[10] = 0.0007;
STATES[1] = 8.46899983583716;
CONSTANTS[11] = 140;
STATES[2] = 0.00208137744708665;
STATES[3] = 0.815520320018128;
STATES[4] = 0.815471795073686;
CONSTANTS[12] = 2e-5;
CONSTANTS[13] = 0.883;
CONSTANTS[14] = 0.117;
CONSTANTS[15] = 5.4;
STATES[5] = 142.919492013701;
STATES[6] = 0.00146331830465093;
STATES[7] = 0.996934138278418;
STATES[8] = 0.78841193673441;
CONSTANTS[16] = 1.3e-5;
STATES[9] = 0.0019683140031203;
STATES[10] = 0.416987850222633;
CONSTANTS[17] = 4e-5;
CONSTANTS[18] = 1.45e-6;
CONSTANTS[19] = 0.2;
STATES[11] = 0.00566123148325894;
CONSTANTS[20] = 8.015e-8;
CONSTANTS[21] = 1.38e-7;
CONSTANTS[22] = 0.00138;
CONSTANTS[23] = 3.6;
CONSTANTS[24] = 19;
CONSTANTS[25] = 22;
CONSTANTS[26] = 880;
CONSTANTS[27] = 0.3;
CONSTANTS[28] = 1.8;
CONSTANTS[29] = 1.8;
CONSTANTS[30] = 0.1;
CONSTANTS[31] = 0.02;
CONSTANTS[32] = 0.0008;
CONSTANTS[33] = 50000;
STATES[12] = 0.000103020385969363;
STATES[13] = 0.96268028201207;
CONSTANTS[34] = -9;
CONSTANTS[35] = 7;
CONSTANTS[36] = 11.5;
CONSTANTS[37] = 1;
CONSTANTS[38] = 1550;
CONSTANTS[39] = 1.17;
CONSTANTS[40] = 2.4;
CONSTANTS[41] = 0.05;
CONSTANTS[42] = 0.012;
CONSTANTS[43] = 0.065;
CONSTANTS[44] = 0.00038;
CONSTANTS[45] = 0.0625;
CONSTANTS[46] = 14;
CONSTANTS[47] = 0.01;
CONSTANTS[48] = 100;
STATES[14] = 0.990016532916529;
STATES[15] = 0.00845823628523856;
STATES[16] = 0.00151233172289407;
CONSTANTS[49] = 87.5;
CONSTANTS[50] = 1.38;
CONSTANTS[51] = 0.35;
CONSTANTS[52] = 0.1;
CONSTANTS[53] = 0.0234;
CONSTANTS[54] = 0.000235;
CONSTANTS[55] = 0.0004968;
CONSTANTS[56] = 5e-6;
CONSTANTS[57] = 0.00035;
CONSTANTS[58] = 2e-8;
CONSTANTS[59] = 1e-6;
CONSTANTS[60] = 0.04;
CONSTANTS[61] = 40;
CONSTANTS[62] = 0.07;
STATES[17] = 0.0633670056927004;
CONSTANTS[63] = 0.002382;
CONSTANTS[64] = 0.05;
CONSTANTS[65] = 0;
CONSTANTS[66] = 0.00015;
CONSTANTS[67] = 2100.00;
CONSTANTS[68] = 1.00000 - CONSTANTS[19];
CONSTANTS[69] = CONSTANTS[36]/CONSTANTS[37];
CONSTANTS[70] = CONSTANTS[41]/CONSTANTS[39];
RATES[0] = 0.1001;
RATES[2] = 0.1001;
RATES[3] = 0.1001;
RATES[4] = 0.1001;
RATES[6] = 0.1001;
RATES[7] = 0.1001;
RATES[8] = 0.1001;
RATES[9] = 0.1001;
RATES[10] = 0.1001;
RATES[11] = 0.1001;
RATES[14] = 0.1001;
RATES[15] = 0.1001;
RATES[16] = 0.1001;
RATES[1] = 0.1001;
RATES[5] = 0.1001;
RATES[17] = 0.1001;
RATES[12] = 0.1001;
RATES[13] = 0.1001;
}
void
computeResiduals(double VOI, double* CONSTANTS, double* RATES, double* OLDRATES, double* STATES,
                 double* OLDSTATES, double* ALGEBRAIC, double* CONDVARS)
{
resid[0] = RATES[0] - - (ALGEBRAIC[4]+ALGEBRAIC[12]+ALGEBRAIC[19]+ALGEBRAIC[26]+ALGEBRAIC[23]+ALGEBRAIC[29]+ALGEBRAIC[30]+ALGEBRAIC[33]+ALGEBRAIC[63]+ALGEBRAIC[57]+ALGEBRAIC[60]+ALGEBRAIC[84]+ALGEBRAIC[2])/CONSTANTS[3];
resid[1] = RATES[2] - (ALGEBRAIC[5] - STATES[2])/ALGEBRAIC[6];
resid[2] = RATES[3] - (ALGEBRAIC[7] - STATES[3])/ALGEBRAIC[8];
resid[3] = RATES[4] - (ALGEBRAIC[9] - STATES[4])/ALGEBRAIC[10];
resid[4] = RATES[6] - (ALGEBRAIC[13] - STATES[6])/ALGEBRAIC[14];
resid[5] = RATES[7] - (ALGEBRAIC[15] - STATES[7])/ALGEBRAIC[16];
resid[6] = RATES[8] - (ALGEBRAIC[17] - STATES[8])/ALGEBRAIC[18];
resid[7] = RATES[9] - (ALGEBRAIC[20] - STATES[9])/ALGEBRAIC[21];
resid[8] = RATES[10] - (ALGEBRAIC[22] - STATES[10])/CONSTANTS[67];
resid[9] = RATES[11] - (ALGEBRAIC[27] - STATES[11])/ALGEBRAIC[28];
resid[10] = RATES[14] -  - (ALGEBRAIC[76]+ALGEBRAIC[78])*STATES[14]+ ALGEBRAIC[77]*STATES[15]+ ALGEBRAIC[50]*STATES[16];
resid[11] = RATES[15] - ( ALGEBRAIC[76]*STATES[14] -  (ALGEBRAIC[77]+ALGEBRAIC[51])*STATES[15])+ ALGEBRAIC[52]*ALGEBRAIC[53];
resid[12] = RATES[16] - ( ALGEBRAIC[78]*STATES[14] -  (ALGEBRAIC[50]+ALGEBRAIC[48])*STATES[16])+ ALGEBRAIC[49]*ALGEBRAIC[53];
resid[13] = RATES[1] - ( - (ALGEBRAIC[4]+ALGEBRAIC[29]+ ALGEBRAIC[57]*3.00000+ ALGEBRAIC[33]*3.00000+ALGEBRAIC[24])*1.00000)/( CONSTANTS[8]*CONSTANTS[2]);
resid[14] = RATES[5] - ( - (ALGEBRAIC[2]+ALGEBRAIC[19]+ALGEBRAIC[30]+ALGEBRAIC[12]+ALGEBRAIC[23]+ALGEBRAIC[25]+ - 2.00000*ALGEBRAIC[33])*1.00000)/( CONSTANTS[8]*CONSTANTS[2]);
resid[15] = RATES[17] - ALGEBRAIC[65];
resid[16] = RATES[12] -  ALGEBRAIC[66]*(((ALGEBRAIC[81] - ALGEBRAIC[58])+ALGEBRAIC[64]+ALGEBRAIC[65]) - ( - 2.00000*ALGEBRAIC[57]+ALGEBRAIC[84]+ALGEBRAIC[60]+ALGEBRAIC[63])/( 2.00000*CONSTANTS[8]*CONSTANTS[2]));
resid[17] = RATES[13] -  (CONSTANTS[8]/CONSTANTS[9])*((- ALGEBRAIC[81]+ALGEBRAIC[58]) - ALGEBRAIC[64]);
}
void
computeVariables(double VOI, double* CONSTANTS, double* RATES, double* STATES, double* ALGEBRAIC)
{
ALGEBRAIC[31] = ALGEBRAIC[29]+ALGEBRAIC[30];
ALGEBRAIC[41] = STATES[12];
}
void
computeEssentialVariables(double VOI, double* CONSTANTS, double* RATES, double* STATES, double* ALGEBRAIC)
{
ALGEBRAIC[2] = (CONDVAR[0]>=0.00000&&CONDVAR[1]<=0.00000 ? CONSTANTS[6] : 0.00000);
ALGEBRAIC[3] =  (( CONSTANTS[0]*CONSTANTS[1])/CONSTANTS[2])*log(CONSTANTS[11]/STATES[1]);
ALGEBRAIC[4] =  CONSTANTS[10]*pow(STATES[2], 3.00000)*STATES[3]*STATES[4]*(STATES[0] - ALGEBRAIC[3]);
ALGEBRAIC[5] = 1.00000/(1.00000+exp((STATES[0]+45.0000)/- 6.50000));
ALGEBRAIC[6] = 1.36000/(( 0.320000*(STATES[0]+47.1300))/(1.00000 - exp( - 0.100000*(STATES[0]+47.1300)))+ 0.0800000*exp(- STATES[0]/11.0000));
ALGEBRAIC[7] = 1.00000/(1.00000+exp((STATES[0]+76.1000)/6.07000));
ALGEBRAIC[8] = (CONDVAR[2]>=0.00000 ?  0.453700*(1.00000+exp(- (STATES[0]+10.6600)/11.1000)) : 3.49000/( 0.135000*exp(- (STATES[0]+80.0000)/6.80000)+ 3.56000*exp( 0.0790000*STATES[0])+ 310000.*exp( 0.350000*STATES[0])));
ALGEBRAIC[9] = 1.00000/(1.00000+exp((STATES[0]+76.1000)/6.07000));
ALGEBRAIC[10] = (CONDVAR[3]>=0.00000 ? ( 11.6300*(1.00000+exp( - 0.100000*(STATES[0]+32.0000))))/exp( - 2.53500e-07*STATES[0]) : 3.49000/( ((STATES[0]+37.7800)/(1.00000+exp( 0.311000*(STATES[0]+79.2300))))*( - 127140.*exp( 0.244400*STATES[0]) -  3.47400e-05*exp( - 0.0439100*STATES[0]))+( 0.121200*exp( - 0.0105200*STATES[0]))/(1.00000+exp( - 0.137800*(STATES[0]+40.1400)))));
ALGEBRAIC[11] =  (( CONSTANTS[0]*CONSTANTS[1])/CONSTANTS[2])*log(CONSTANTS[15]/STATES[5]);
ALGEBRAIC[12] =  CONSTANTS[12]*STATES[6]*( CONSTANTS[13]*STATES[7]+ CONSTANTS[14]*STATES[8])*(STATES[0] - ALGEBRAIC[11]);
ALGEBRAIC[13] = 1.00000/(1.00000+exp((STATES[0]+10.6000)/- 11.4200));
ALGEBRAIC[14] = 100.000/( 45.1600*exp( 0.0357700*(STATES[0]+50.0000))+ 98.9000*exp( - 0.100000*(STATES[0]+38.0000)));
ALGEBRAIC[15] = 1.00000/(1.00000+exp((STATES[0]+45.3000)/6.88410));
ALGEBRAIC[16] =  20.0000*exp(- pow((STATES[0]+70.0000)/25.0000, 2.00000))+35.0000;
ALGEBRAIC[17] = 1.00000/(1.00000+exp((STATES[0]+45.3000)/6.88410));
ALGEBRAIC[18] =  1300.00*exp(- pow((STATES[0]+70.0000)/30.0000, 2.00000))+35.0000;
ALGEBRAIC[19] =  CONSTANTS[16]*STATES[9]*STATES[10]*(STATES[0] - ALGEBRAIC[11]);
ALGEBRAIC[20] = 1.00000/(1.00000+exp((STATES[0]+11.5000)/- 11.8200));
ALGEBRAIC[21] = 10000.0/( 45.1600*exp( 0.0357700*(STATES[0]+50.0000))+ 98.9000*exp( - 0.100000*(STATES[0]+38.0000)));
ALGEBRAIC[22] = 1.00000/(1.00000+exp((STATES[0]+87.5000)/10.3000));
ALGEBRAIC[23] = ( (0.0480000/(exp((STATES[0]+37.0000)/25.0000)+exp((STATES[0]+37.0000)/- 25.0000))+0.0100000)*0.00100000)/(1.00000+exp((STATES[0] - (ALGEBRAIC[11]+76.7700))/- 17.0000))+( CONSTANTS[17]*(STATES[0] - (ALGEBRAIC[11]+1.73000)))/( (1.00000+exp(( 1.61300*CONSTANTS[2]*(STATES[0] - (ALGEBRAIC[11]+1.73000)))/( CONSTANTS[0]*CONSTANTS[1])))*(1.00000+exp((CONSTANTS[15] - 0.998800)/- 0.124000)));
ALGEBRAIC[24] =  CONSTANTS[18]*STATES[11]*CONSTANTS[19]*(STATES[0] - ALGEBRAIC[3]);
ALGEBRAIC[25] =  CONSTANTS[18]*STATES[11]*CONSTANTS[68]*(STATES[0] - ALGEBRAIC[11]);
ALGEBRAIC[26] = ALGEBRAIC[24]+ALGEBRAIC[25];
ALGEBRAIC[27] = 1.00000/(1.00000+exp((STATES[0]+138.600)/10.4800));
ALGEBRAIC[28] = 1000.00/( 0.118850*exp((STATES[0]+80.0000)/28.3700)+ 0.562300*exp((STATES[0]+80.0000)/- 14.1900));
ALGEBRAIC[29] =  CONSTANTS[20]*(STATES[0] - ALGEBRAIC[3]);
ALGEBRAIC[30] =  CONSTANTS[21]*(STATES[0] - ALGEBRAIC[11]);
ALGEBRAIC[32] =  CONSTANTS[23]*pow(1.00000+CONSTANTS[24]/STATES[1], 2.00000)*(1.00000+ (CONSTANTS[25]/STATES[1])*exp((( - CONSTANTS[27]*CONSTANTS[2]*STATES[0])/CONSTANTS[0])/CONSTANTS[1]))+ pow(1.00000+CONSTANTS[28]/CONSTANTS[15], 2.00000)*(1.00000+ (CONSTANTS[11]/CONSTANTS[26])*exp((( - (1.00000 - CONSTANTS[27])*CONSTANTS[2]*STATES[0])/CONSTANTS[0])/CONSTANTS[1]));
ALGEBRAIC[33] = ( CONSTANTS[22]*(CONSTANTS[23]+1.00000))/ALGEBRAIC[32];
ALGEBRAIC[36] = pow(STATES[12], 2.00000)/( CONSTANTS[39]*(pow(STATES[12], 2.00000)+pow(CONSTANTS[43], 2.00000)));
ALGEBRAIC[39] = (pow(STATES[12], 2.00000)+ CONSTANTS[47]*pow(CONSTANTS[43], 2.00000))/( CONSTANTS[40]*(pow(STATES[12], 2.00000)+pow(CONSTANTS[43], 2.00000)));
ALGEBRAIC[48] = ( CONSTANTS[70]*ALGEBRAIC[39])/(CONSTANTS[70]+ALGEBRAIC[36]);
ALGEBRAIC[40] = ( CONSTANTS[42]*CONSTANTS[48]*(pow(STATES[12], 2.00000)+ CONSTANTS[47]*pow(CONSTANTS[43], 2.00000)))/( CONSTANTS[40]*( CONSTANTS[48]*pow(STATES[12], 2.00000)+ CONSTANTS[47]*pow(CONSTANTS[43], 2.00000)));
ALGEBRAIC[49] = ALGEBRAIC[40];
ALGEBRAIC[34] = exp((STATES[0] - CONSTANTS[34])/CONSTANTS[35]);
ALGEBRAIC[38] = ( CONSTANTS[46]*(ALGEBRAIC[34]+CONSTANTS[45]))/( CONSTANTS[38]*( CONSTANTS[46]*ALGEBRAIC[34]+CONSTANTS[45]));
ALGEBRAIC[50] = ALGEBRAIC[38];
ALGEBRAIC[35] = ALGEBRAIC[34]/( CONSTANTS[37]*(ALGEBRAIC[34]+1.00000));
ALGEBRAIC[37] = ( STATES[12]*(ALGEBRAIC[34]+CONSTANTS[45]))/( CONSTANTS[38]*CONSTANTS[44]*(ALGEBRAIC[34]+1.00000));
ALGEBRAIC[51] = ( CONSTANTS[69]*ALGEBRAIC[37])/(ALGEBRAIC[35]+CONSTANTS[69]);
ALGEBRAIC[52] = ALGEBRAIC[38];
ALGEBRAIC[53] = ((1.00000 - STATES[14]) - STATES[15]) - STATES[16];
ALGEBRAIC[0] = ( CONSTANTS[2]*STATES[0])/( CONSTANTS[0]*CONSTANTS[1]);
ALGEBRAIC[56] = ( CONSTANTS[53]*( exp( CONSTANTS[51]*ALGEBRAIC[0])*pow(STATES[1], 3.00000)*CONSTANTS[29] -  exp( (CONSTANTS[51] - 1.00000)*ALGEBRAIC[0])*pow(CONSTANTS[11], 3.00000)*STATES[12]))/( (pow(CONSTANTS[11], 3.00000)+pow(CONSTANTS[49], 3.00000))*(CONSTANTS[29]+CONSTANTS[50])*(1.00000+ CONSTANTS[52]*exp( (CONSTANTS[51] - 1.00000)*ALGEBRAIC[0])));
ALGEBRAIC[57] =  ALGEBRAIC[56]*CONSTANTS[2]*CONSTANTS[8];
ALGEBRAIC[58] = ( CONSTANTS[54]*pow(STATES[12], 2.00000))/(pow(CONSTANTS[55], 2.00000)+pow(STATES[12], 2.00000));
ALGEBRAIC[59] = ( CONSTANTS[56]*STATES[12])/(CONSTANTS[57]+STATES[12]);
ALGEBRAIC[60] =  ALGEBRAIC[59]*2.00000*CONSTANTS[2]*CONSTANTS[8];
ALGEBRAIC[61] =  (( CONSTANTS[0]*CONSTANTS[1])/( 2.00000*CONSTANTS[2]))*log(CONSTANTS[29]/STATES[12]);
ALGEBRAIC[62] =  CONSTANTS[58]*(ALGEBRAIC[61] - STATES[0]);
ALGEBRAIC[63] =  - ALGEBRAIC[62]*2.00000*CONSTANTS[2]*CONSTANTS[8];
ALGEBRAIC[64] =  CONSTANTS[59]*(STATES[13] - STATES[12]);
ALGEBRAIC[65] =  CONSTANTS[60]*(CONSTANTS[62] - STATES[17]) -  CONSTANTS[61]*STATES[17]*STATES[12];
ALGEBRAIC[66] = pow(1.00000+( CONSTANTS[63]*CONSTANTS[64])/pow(CONSTANTS[63]+STATES[12], 2.00000)+( CONSTANTS[65]*CONSTANTS[66])/pow(CONSTANTS[66]+STATES[12], 2.00000), - 1.00000);
ALGEBRAIC[1] =  2.00000*ALGEBRAIC[0];
ALGEBRAIC[43] = (CONDVAR[4]>0.00000 ? (STATES[12]+( (CONSTANTS[32]/CONSTANTS[30])*CONSTANTS[29]*ALGEBRAIC[1]*exp(- ALGEBRAIC[1]))/(1.00000 - exp(- ALGEBRAIC[1])))/(1.00000+( (CONSTANTS[32]/CONSTANTS[30])*ALGEBRAIC[1])/(1.00000 - exp(- ALGEBRAIC[1]))) : (STATES[12]+ (CONSTANTS[32]/CONSTANTS[30])*CONSTANTS[29])/(1.00000+CONSTANTS[32]/CONSTANTS[30]));
ALGEBRAIC[69] = (pow(ALGEBRAIC[43], 2.00000)+ CONSTANTS[47]*pow(CONSTANTS[43], 2.00000))/( CONSTANTS[40]*(pow(ALGEBRAIC[43], 2.00000)+pow(CONSTANTS[43], 2.00000)));
ALGEBRAIC[67] = pow(ALGEBRAIC[43], 2.00000)/( CONSTANTS[39]*(pow(ALGEBRAIC[43], 2.00000)+pow(CONSTANTS[43], 2.00000)));
ALGEBRAIC[71] =  (ALGEBRAIC[35]+CONSTANTS[69])*( (CONSTANTS[69]+CONSTANTS[70]+ALGEBRAIC[67])*(CONSTANTS[70]+ALGEBRAIC[36])+ ALGEBRAIC[35]*(CONSTANTS[70]+ALGEBRAIC[67]));
ALGEBRAIC[72] = ( ALGEBRAIC[35]*CONSTANTS[70]*(ALGEBRAIC[35]+CONSTANTS[69]+CONSTANTS[70]+ALGEBRAIC[36]))/ALGEBRAIC[71];
ALGEBRAIC[75] = ( CONSTANTS[69]*CONSTANTS[70]*(CONSTANTS[69]+ALGEBRAIC[35]+CONSTANTS[70]+ALGEBRAIC[67]))/ALGEBRAIC[71];
ALGEBRAIC[76] =  ALGEBRAIC[72]*ALGEBRAIC[69]+ ALGEBRAIC[75]*ALGEBRAIC[39];
ALGEBRAIC[70] = ( CONSTANTS[42]*CONSTANTS[48]*(pow(ALGEBRAIC[43], 2.00000)+ CONSTANTS[47]*pow(CONSTANTS[43], 2.00000)))/( CONSTANTS[40]*( CONSTANTS[48]*pow(ALGEBRAIC[43], 2.00000)+ CONSTANTS[47]*pow(CONSTANTS[43], 2.00000)));
ALGEBRAIC[77] = ( ALGEBRAIC[35]*ALGEBRAIC[70]+ CONSTANTS[69]*ALGEBRAIC[40])/(ALGEBRAIC[35]+CONSTANTS[69]);
ALGEBRAIC[42] = (STATES[12]+ (CONSTANTS[31]/CONSTANTS[30])*STATES[13])/(1.00000+CONSTANTS[31]/CONSTANTS[30]);
ALGEBRAIC[68] = ( ALGEBRAIC[42]*(ALGEBRAIC[34]+CONSTANTS[45]))/( CONSTANTS[38]*CONSTANTS[44]*(ALGEBRAIC[34]+1.00000));
ALGEBRAIC[73] = ( CONSTANTS[69]*( ALGEBRAIC[36]*(CONSTANTS[69]+CONSTANTS[70]+ALGEBRAIC[67])+ ALGEBRAIC[67]*ALGEBRAIC[35]))/ALGEBRAIC[71];
ALGEBRAIC[78] =  ALGEBRAIC[73]*ALGEBRAIC[68]+ ALGEBRAIC[75]*ALGEBRAIC[37];
ALGEBRAIC[44] = ( CONSTANTS[31]*(STATES[13] - STATES[12]))/(1.00000+CONSTANTS[31]/CONSTANTS[30]);
ALGEBRAIC[45] = (CONDVAR[5]>0.00000 ? ( CONSTANTS[31]*((STATES[13] - STATES[12])+ (( (CONSTANTS[32]/CONSTANTS[30])*ALGEBRAIC[1])/(1.00000 - exp(- ALGEBRAIC[1])))*(STATES[13] -  CONSTANTS[29]*exp(- ALGEBRAIC[1]))))/(1.00000+CONSTANTS[31]/CONSTANTS[30]+( (CONSTANTS[32]/CONSTANTS[30])*ALGEBRAIC[1])/(1.00000 - exp(- ALGEBRAIC[1]))) : ( CONSTANTS[31]*((STATES[13] - STATES[12])+ (( (CONSTANTS[32]/CONSTANTS[30])*1.00000e-05)/(1.00000 - exp(- 1.00000e-05)))*(STATES[13] -  CONSTANTS[29]*exp(- 1.00000e-05))))/(1.00000+CONSTANTS[31]/CONSTANTS[30]+( (CONSTANTS[32]/CONSTANTS[30])*1.00000e-05)/(1.00000 - exp(- 1.00000e-05))));
ALGEBRAIC[74] = ( ALGEBRAIC[35]*( ALGEBRAIC[67]*(ALGEBRAIC[35]+CONSTANTS[70]+ALGEBRAIC[36])+ ALGEBRAIC[36]*CONSTANTS[69]))/ALGEBRAIC[71];
ALGEBRAIC[79] =  ALGEBRAIC[74]*ALGEBRAIC[45]+ ALGEBRAIC[44]*ALGEBRAIC[73];
ALGEBRAIC[54] = ( ALGEBRAIC[44]*ALGEBRAIC[36])/(CONSTANTS[70]+ALGEBRAIC[36]);
ALGEBRAIC[80] = ( ( STATES[14]*ALGEBRAIC[79]+ STATES[16]*ALGEBRAIC[54])*CONSTANTS[33])/CONSTANTS[7];
ALGEBRAIC[81] = ALGEBRAIC[80];
ALGEBRAIC[47] = (CONDVAR[7]>0.00000 ? ( (( CONSTANTS[32]*ALGEBRAIC[1])/(1.00000 - exp(- ALGEBRAIC[1])))*(( CONSTANTS[29]*exp(- ALGEBRAIC[1]) - STATES[12])+ (CONSTANTS[31]/CONSTANTS[30])*( CONSTANTS[29]*exp(- ALGEBRAIC[1]) - STATES[13])))/(1.00000+CONSTANTS[31]/CONSTANTS[30]+( (CONSTANTS[32]/CONSTANTS[30])*ALGEBRAIC[1])/(1.00000 - exp(ALGEBRAIC[1]))) : ( (( CONSTANTS[32]*1.00000e-05)/(1.00000 - exp(- 1.00000e-05)))*(( CONSTANTS[29]*exp(- 1.00000e-05) - STATES[12])+ (CONSTANTS[31]/CONSTANTS[30])*( CONSTANTS[29]*exp(- 1.00000e-05) - STATES[13])))/(1.00000+CONSTANTS[31]/CONSTANTS[30]+( (CONSTANTS[32]/CONSTANTS[30])*1.00000e-05)/(1.00000 - exp(- 1.00000e-05))));
ALGEBRAIC[46] = (CONDVAR[6]>0.00000 ? ( (( CONSTANTS[32]*ALGEBRAIC[1])/(1.00000 - exp(- ALGEBRAIC[1])))*( CONSTANTS[29]*exp(- ALGEBRAIC[1]) - STATES[12]))/(1.00000+( (CONSTANTS[32]/CONSTANTS[30])*ALGEBRAIC[1])/(1.00000 - exp(- ALGEBRAIC[1]))) : ( (( CONSTANTS[32]*1.00000e-05)/(1.00000 - exp(- 1.00000e-05)))*( CONSTANTS[29]*exp(- 1.00000e-05) - STATES[12]))/(1.00000+( (CONSTANTS[32]/CONSTANTS[30])*1.00000e-05)/(1.00000 - exp(- 1.00000e-05))));
ALGEBRAIC[82] =  ALGEBRAIC[47]*ALGEBRAIC[74]+ ALGEBRAIC[46]*ALGEBRAIC[72];
ALGEBRAIC[55] = ( ALGEBRAIC[46]*ALGEBRAIC[35])/(ALGEBRAIC[35]+CONSTANTS[69]);
ALGEBRAIC[83] = ( ( STATES[14]*ALGEBRAIC[82]+ STATES[15]*ALGEBRAIC[55])*CONSTANTS[33])/CONSTANTS[7];
ALGEBRAIC[84] =  - ALGEBRAIC[83]*2.00000*CONSTANTS[2]*CONSTANTS[8];
}
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;
}
void
computeRoots(double VOI, double* CONSTANTS, double* RATES, double* OLDRATES, double* STATES,
             double* OLDSTATES, double* ALGEBRAIC, double* CONDVARS)
{
CONDVAR[0] = (VOI -  floor(VOI/CONSTANTS[4])*CONSTANTS[4]) - 0.00000;
CONDVAR[1] = (VOI -  floor(VOI/CONSTANTS[4])*CONSTANTS[4]) - CONSTANTS[5];
CONDVAR[2] = STATES[0] - - 40.0000;
CONDVAR[3] = STATES[0] - - 40.0000;
CONDVAR[4] = fabs(ALGEBRAIC[1]) - 1.00000e-09;
CONDVAR[5] = fabs(ALGEBRAIC[1]) - 1.00000e-05;
CONDVAR[6] = fabs(ALGEBRAIC[1]) - 1.00000e-05;
CONDVAR[7] = fabs(ALGEBRAIC[1]) - 1.00000e-05;
}