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 78 entries in the algebraic variable array.
   There are a total of 29 entries in each of the rate and state variable arrays.
   There are a total of 49 entries in the constant variable array.
 */
/*
 * VOI is time in component environment (second).
 * CONSTANTS[0] is CT in component environment (dimensionless).
 * CONSTANTS[1] is PM in component environment (dimensionless).
 * STATES[0] is V in component membrane (millivolt).
 * CONSTANTS[2] is R in component membrane (millijoule_per_mole_kelvin).
 * CONSTANTS[3] is T in component membrane (kelvin).
 * CONSTANTS[4] is F in component membrane (coulomb_per_mole).
 * CONSTANTS[5] is Cm in component membrane (nanoF).
 * ALGEBRAIC[2] is i_Na in component sodium_current (picoA).
 * ALGEBRAIC[12] is i_Ca_L in component L_type_Ca_channel (picoA).
 * ALGEBRAIC[25] is i_Ca_T in component T_type_Ca_channel (picoA).
 * ALGEBRAIC[37] is i_to in component Ca_independent_transient_outward_K_current (picoA).
 * ALGEBRAIC[38] is i_sus in component Ca_independent_transient_outward_K_current (picoA).
 * ALGEBRAIC[63] is i_K1 in component inward_rectifier (picoA).
 * ALGEBRAIC[50] is i_Kr in component delayed_rectifier_K_current (picoA).
 * ALGEBRAIC[49] is i_Ks in component delayed_rectifier_K_current (picoA).
 * ALGEBRAIC[65] is i_B_Na in component background_currents (picoA).
 * ALGEBRAIC[66] is i_B_Ca in component background_currents (picoA).
 * ALGEBRAIC[67] is i_p in component sodium_potassium_pump (picoA).
 * ALGEBRAIC[68] is i_CaP in component sarcolemmal_calcium_pump_current (picoA).
 * ALGEBRAIC[69] is i_NaCa in component Na_Ca_ion_exchanger_current (picoA).
 * ALGEBRAIC[0] is i_Stim in component membrane (picoA).
 * CONSTANTS[6] is stim_start in component membrane (second).
 * CONSTANTS[7] is stim_end in component membrane (second).
 * CONSTANTS[8] is stim_period in component membrane (second).
 * CONSTANTS[9] is stim_duration in component membrane (second).
 * CONSTANTS[10] is stim_amplitude in component membrane (picoA).
 * ALGEBRAIC[1] is E_Na in component sodium_current (millivolt).
 * CONSTANTS[11] is P_Na in component sodium_current (nanolitre_per_second).
 * CONSTANTS[12] is Na_c in component cleft_space_ion_concentrations (millimolar).
 * STATES[1] is Na_i in component intracellular_ion_concentrations (millimolar).
 * STATES[2] is m in component sodium_current_m_gate (dimensionless).
 * STATES[3] is h1 in component sodium_current_h1_gate (dimensionless).
 * STATES[4] is h2 in component sodium_current_h2_gate (dimensionless).
 * ALGEBRAIC[3] is E0_m in component sodium_current_m_gate (millivolt).
 * ALGEBRAIC[4] is alpha_m in component sodium_current_m_gate (per_second).
 * ALGEBRAIC[5] is beta_m in component sodium_current_m_gate (per_second).
 * ALGEBRAIC[6] is alpha_h in component sodium_current_h1_gate (per_second).
 * ALGEBRAIC[7] is beta_h in component sodium_current_h1_gate (per_second).
 * ALGEBRAIC[8] is h_infinity in component sodium_current_h1_gate (dimensionless).
 * ALGEBRAIC[9] is tau_h1 in component sodium_current_h1_gate (second).
 * ALGEBRAIC[10] is tau_h2 in component sodium_current_h2_gate (second).
 * CONSTANTS[13] is g_Ca_L in component L_type_Ca_channel (nanoS).
 * CONSTANTS[14] is E_Ca_app in component L_type_Ca_channel (millivolt).
 * ALGEBRAIC[11] is d_prime in component L_type_Ca_channel (dimensionless).
 * STATES[5] is d_L in component L_type_Ca_channel_d_L_gate (dimensionless).
 * STATES[6] is f_L in component L_type_Ca_channel_f_L_gate (dimensionless).
 * ALGEBRAIC[13] is E0_alpha_d_L in component L_type_Ca_channel_d_L_gate (millivolt).
 * ALGEBRAIC[14] is E0_beta_d_L in component L_type_Ca_channel_d_L_gate (millivolt).
 * ALGEBRAIC[15] is E10 in component L_type_Ca_channel_d_L_gate (millivolt).
 * ALGEBRAIC[16] is alpha_d_L in component L_type_Ca_channel_d_L_gate (per_second).
 * ALGEBRAIC[17] is beta_d_L in component L_type_Ca_channel_d_L_gate (per_second).
 * ALGEBRAIC[18] is d_L_infinity in component L_type_Ca_channel_d_L_gate (dimensionless).
 * ALGEBRAIC[19] is tau_d_L in component L_type_Ca_channel_d_L_gate (second).
 * ALGEBRAIC[20] is E0_f_L in component L_type_Ca_channel_f_L_gate (millivolt).
 * ALGEBRAIC[21] is alpha_f_L in component L_type_Ca_channel_f_L_gate (per_second).
 * ALGEBRAIC[22] is beta_f_L in component L_type_Ca_channel_f_L_gate (per_second).
 * ALGEBRAIC[23] is f_L_infinity in component L_type_Ca_channel_f_L_gate (dimensionless).
 * ALGEBRAIC[24] is tau_f_L in component L_type_Ca_channel_f_L_gate (second).
 * CONSTANTS[15] is g_Ca_T in component T_type_Ca_channel (nanoS).
 * CONSTANTS[16] is E_Ca_T in component T_type_Ca_channel (millivolt).
 * STATES[7] is d_T in component T_type_Ca_channel_d_T_gate (dimensionless).
 * STATES[8] is f_T in component T_type_Ca_channel_f_T_gate (dimensionless).
 * ALGEBRAIC[26] is E0_d_T in component T_type_Ca_channel_d_T_gate (millivolt).
 * ALGEBRAIC[27] is alpha_d_T in component T_type_Ca_channel_d_T_gate (per_second).
 * ALGEBRAIC[28] is beta_d_T in component T_type_Ca_channel_d_T_gate (per_second).
 * ALGEBRAIC[29] is d_T_infinity in component T_type_Ca_channel_d_T_gate (dimensionless).
 * ALGEBRAIC[30] is tau_d_T in component T_type_Ca_channel_d_T_gate (second).
 * ALGEBRAIC[31] is E0_f_T in component T_type_Ca_channel_f_T_gate (millivolt).
 * ALGEBRAIC[32] is alpha_f_T in component T_type_Ca_channel_f_T_gate (per_second).
 * ALGEBRAIC[33] is beta_f_T in component T_type_Ca_channel_f_T_gate (per_second).
 * ALGEBRAIC[34] is f_T_infinity in component T_type_Ca_channel_f_T_gate (dimensionless).
 * ALGEBRAIC[35] is tau_f_T in component T_type_Ca_channel_f_T_gate (second).
 * ALGEBRAIC[36] is E_K in component Ca_independent_transient_outward_K_current (millivolt).
 * CONSTANTS[17] is g_to in component Ca_independent_transient_outward_K_current (nanoS).
 * STATES[9] is K_c in component cleft_space_ion_concentrations (millimolar).
 * STATES[10] is K_i in component intracellular_ion_concentrations (millimolar).
 * STATES[11] is r in component Ca_independent_transient_outward_K_current_r_gate (dimensionless).
 * STATES[12] is s1 in component Ca_independent_transient_outward_K_current_s1_gate (dimensionless).
 * STATES[13] is s2 in component Ca_independent_transient_outward_K_current_s2_gate (dimensionless).
 * STATES[14] is s3 in component Ca_independent_transient_outward_K_current_s3_gate (dimensionless).
 * ALGEBRAIC[39] is alpha_r in component Ca_independent_transient_outward_K_current_r_gate (per_second).
 * ALGEBRAIC[40] is beta_r in component Ca_independent_transient_outward_K_current_r_gate (per_second).
 * ALGEBRAIC[42] is tau_r in component Ca_independent_transient_outward_K_current_r_gate (second).
 * ALGEBRAIC[41] is r_infinity in component Ca_independent_transient_outward_K_current_r_gate (dimensionless).
 * ALGEBRAIC[44] is tau_s1 in component Ca_independent_transient_outward_K_current_s1_gate (second).
 * ALGEBRAIC[43] is s1_infinity in component Ca_independent_transient_outward_K_current_s1_gate (dimensionless).
 * ALGEBRAIC[46] is tau_s2 in component Ca_independent_transient_outward_K_current_s2_gate (second).
 * ALGEBRAIC[45] is s2_infinity in component Ca_independent_transient_outward_K_current_s2_gate (dimensionless).
 * ALGEBRAIC[48] is tau_s3 in component Ca_independent_transient_outward_K_current_s3_gate (second).
 * ALGEBRAIC[47] is s3_infinity in component Ca_independent_transient_outward_K_current_s3_gate (dimensionless).
 * CONSTANTS[18] is g_Ks in component delayed_rectifier_K_current (nanoS).
 * CONSTANTS[19] is g_Kr in component delayed_rectifier_K_current (nanoS).
 * STATES[15] is z in component delayed_rectifier_K_current_z_gate (dimensionless).
 * STATES[16] is p_a in component delayed_rectifier_K_current_pa_gate (dimensionless).
 * STATES[17] is p_i in component delayed_rectifier_K_current_pi_gate (dimensionless).
 * ALGEBRAIC[51] is alpha_z in component delayed_rectifier_K_current_z_gate (per_second).
 * ALGEBRAIC[52] is beta_z in component delayed_rectifier_K_current_z_gate (per_second).
 * ALGEBRAIC[54] is tau_z in component delayed_rectifier_K_current_z_gate (second).
 * ALGEBRAIC[53] is z_infinity in component delayed_rectifier_K_current_z_gate (dimensionless).
 * ALGEBRAIC[55] is alpha_p_a in component delayed_rectifier_K_current_pa_gate (per_second).
 * ALGEBRAIC[56] is beta_p_a in component delayed_rectifier_K_current_pa_gate (per_second).
 * ALGEBRAIC[58] is tau_p_a in component delayed_rectifier_K_current_pa_gate (second).
 * ALGEBRAIC[57] is p_a_infinity in component delayed_rectifier_K_current_pa_gate (dimensionless).
 * ALGEBRAIC[59] is alpha_p_i in component delayed_rectifier_K_current_pi_gate (per_second).
 * ALGEBRAIC[60] is beta_p_i in component delayed_rectifier_K_current_pi_gate (per_second).
 * ALGEBRAIC[62] is tau_p_i in component delayed_rectifier_K_current_pi_gate (second).
 * ALGEBRAIC[61] is p_i_infinity in component delayed_rectifier_K_current_pi_gate (dimensionless).
 * CONSTANTS[20] is g_K1 in component inward_rectifier (nanoS).
 * CONSTANTS[21] is KmK1 in component inward_rectifier (millimolar).
 * CONSTANTS[22] is steepK1 in component inward_rectifier (dimensionless).
 * CONSTANTS[23] is shiftK1 in component inward_rectifier (millivolt).
 * CONSTANTS[24] is g_B_Na in component background_currents (nanoS).
 * CONSTANTS[25] is g_B_Ca in component background_currents (nanoS).
 * ALGEBRAIC[64] is E_Ca in component background_currents (millivolt).
 * CONSTANTS[26] is Ca_c in component cleft_space_ion_concentrations (millimolar).
 * STATES[18] is Ca_i in component intracellular_ion_concentrations (millimolar).
 * CONSTANTS[27] is k_NaK_K in component sodium_potassium_pump (millimolar).
 * CONSTANTS[28] is k_NaK_Na in component sodium_potassium_pump (millimolar).
 * CONSTANTS[29] is i_NaK_max in component sodium_potassium_pump (picoA).
 * CONSTANTS[30] is i_CaP_max in component sarcolemmal_calcium_pump_current (picoA).
 * CONSTANTS[31] is k_CaP in component sarcolemmal_calcium_pump_current (millimolar).
 * CONSTANTS[32] is k_NaCa in component Na_Ca_ion_exchanger_current (picoA_per_millimolar_4).
 * CONSTANTS[33] is d_NaCa in component Na_Ca_ion_exchanger_current (per_millimolar_4).
 * CONSTANTS[34] is gamma in component Na_Ca_ion_exchanger_current (dimensionless).
 * CONSTANTS[35] is Vol_i in component intracellular_ion_concentrations (nanolitre).
 * CONSTANTS[36] is Vol_Ca in component intracellular_ion_concentrations (nanolitre).
 * ALGEBRAIC[75] is i_up in component Ca_handling_by_the_SR (picoA).
 * ALGEBRAIC[77] is i_rel in component Ca_handling_by_the_SR (picoA).
 * ALGEBRAIC[70] is dOCdt in component intracellular_Ca_buffering (per_second).
 * ALGEBRAIC[71] is dOTCdt in component intracellular_Ca_buffering (per_second).
 * ALGEBRAIC[72] is dOTMgCdt in component intracellular_Ca_buffering (per_second).
 * STATES[19] is O_C in component intracellular_Ca_buffering (dimensionless).
 * STATES[20] is O_TC in component intracellular_Ca_buffering (dimensionless).
 * STATES[21] is O_TMgC in component intracellular_Ca_buffering (dimensionless).
 * STATES[22] is O_TMgMg in component intracellular_Ca_buffering (dimensionless).
 * CONSTANTS[37] is Mg_i in component intracellular_Ca_buffering (millimolar).
 * CONSTANTS[38] is Vol_c in component cleft_space_ion_concentrations (nanolitre).
 * ALGEBRAIC[76] is i_tr in component Ca_handling_by_the_SR (picoA).
 * CONSTANTS[39] is I_up_max in component Ca_handling_by_the_SR (picoA).
 * CONSTANTS[40] is k_cyca in component Ca_handling_by_the_SR (millimolar).
 * CONSTANTS[41] is k_srca in component Ca_handling_by_the_SR (millimolar).
 * CONSTANTS[42] is k_xcs in component Ca_handling_by_the_SR (dimensionless).
 * CONSTANTS[43] is alpha_rel in component Ca_handling_by_the_SR (picoA_per_millimolar).
 * STATES[23] is Ca_rel in component Ca_handling_by_the_SR (millimolar).
 * STATES[24] is Ca_up in component Ca_handling_by_the_SR (millimolar).
 * CONSTANTS[44] is Vol_up in component Ca_handling_by_the_SR (nanolitre).
 * CONSTANTS[45] is Vol_rel in component Ca_handling_by_the_SR (nanolitre).
 * ALGEBRAIC[73] is r_act in component Ca_handling_by_the_SR (per_second).
 * ALGEBRAIC[74] is r_inact in component Ca_handling_by_the_SR (per_second).
 * STATES[25] is O_Calse in component Ca_handling_by_the_SR (dimensionless).
 * STATES[26] is F1 in component Ca_handling_by_the_SR (dimensionless).
 * STATES[27] is F2 in component Ca_handling_by_the_SR (dimensionless).
 * STATES[28] is F3 in component Ca_handling_by_the_SR (dimensionless).
 * CONSTANTS[46] is tau_tr in component Ca_handling_by_the_SR (second).
 * CONSTANTS[47] is k_rel in component Ca_handling_by_the_SR (millimolar).
 * CONSTANTS[48] is k_F3 in component Ca_handling_by_the_SR (per_second).
 * RATES[0] is d/dt V in component membrane (millivolt).
 * RATES[2] is d/dt m in component sodium_current_m_gate (dimensionless).
 * RATES[3] is d/dt h1 in component sodium_current_h1_gate (dimensionless).
 * RATES[4] is d/dt h2 in component sodium_current_h2_gate (dimensionless).
 * RATES[5] is d/dt d_L in component L_type_Ca_channel_d_L_gate (dimensionless).
 * RATES[6] is d/dt f_L in component L_type_Ca_channel_f_L_gate (dimensionless).
 * RATES[7] is d/dt d_T in component T_type_Ca_channel_d_T_gate (dimensionless).
 * RATES[8] is d/dt f_T in component T_type_Ca_channel_f_T_gate (dimensionless).
 * RATES[11] is d/dt r in component Ca_independent_transient_outward_K_current_r_gate (dimensionless).
 * RATES[12] is d/dt s1 in component Ca_independent_transient_outward_K_current_s1_gate (dimensionless).
 * RATES[13] is d/dt s2 in component Ca_independent_transient_outward_K_current_s2_gate (dimensionless).
 * RATES[14] is d/dt s3 in component Ca_independent_transient_outward_K_current_s3_gate (dimensionless).
 * RATES[15] is d/dt z in component delayed_rectifier_K_current_z_gate (dimensionless).
 * RATES[16] is d/dt p_a in component delayed_rectifier_K_current_pa_gate (dimensionless).
 * RATES[17] is d/dt p_i in component delayed_rectifier_K_current_pi_gate (dimensionless).
 * RATES[1] is d/dt Na_i in component intracellular_ion_concentrations (millimolar).
 * RATES[10] is d/dt K_i in component intracellular_ion_concentrations (millimolar).
 * RATES[18] is d/dt Ca_i in component intracellular_ion_concentrations (millimolar).
 * RATES[19] is d/dt O_C in component intracellular_Ca_buffering (dimensionless).
 * RATES[20] is d/dt O_TC in component intracellular_Ca_buffering (dimensionless).
 * RATES[21] is d/dt O_TMgC in component intracellular_Ca_buffering (dimensionless).
 * RATES[22] is d/dt O_TMgMg in component intracellular_Ca_buffering (dimensionless).
 * RATES[9] is d/dt K_c in component cleft_space_ion_concentrations (millimolar).
 * RATES[25] is d/dt O_Calse in component Ca_handling_by_the_SR (dimensionless).
 * RATES[23] is d/dt Ca_rel in component Ca_handling_by_the_SR (millimolar).
 * RATES[24] is d/dt Ca_up in component Ca_handling_by_the_SR (millimolar).
 * RATES[26] is d/dt F1 in component Ca_handling_by_the_SR (dimensionless).
 * RATES[27] is d/dt F2 in component Ca_handling_by_the_SR (dimensionless).
 * RATES[28] is d/dt F3 in component Ca_handling_by_the_SR (dimensionless).
 * There are a total of 3 condition variables.
 */
void
initConsts(double* CONSTANTS, double* RATES, double *STATES)
{
CONSTANTS[0] = 1;
CONSTANTS[1] = 0;
STATES[0] = -80;
CONSTANTS[2] = 8314;
CONSTANTS[3] = 308;
CONSTANTS[4] = 96487;
CONSTANTS[5] = 0.00005;
CONSTANTS[6] = 0.01;
CONSTANTS[7] = 100;
CONSTANTS[8] = 0.5;
CONSTANTS[9] = 0.0002;
CONSTANTS[10] = -20;
CONSTANTS[11] = 0.0000014;
CONSTANTS[12] = 140;
STATES[1] = 8.4;
STATES[2] = 0.01309;
STATES[3] = 0.706;
STATES[4] = 0.61493;
CONSTANTS[13] = 0.004;
CONSTANTS[14] = 50;
STATES[5] = 0.00003;
STATES[6] = 0.99981;
CONSTANTS[15] = 0.006;
CONSTANTS[16] = 38;
STATES[7] = 0.00046;
STATES[8] = 0.30752;
CONSTANTS[17] = 0.050002;
STATES[9] = 5;
STATES[10] = 100;
STATES[11] = 0.00006;
STATES[12] = 0.5753;
STATES[13] = 0.39871;
STATES[14] = 0.57363;
CONSTANTS[18] = 0.0025;
CONSTANTS[19] = 0.0035;
STATES[15] = 0.02032;
STATES[16] = 0.00016;
STATES[17] = 0.76898;
CONSTANTS[20] = 0.00508;
CONSTANTS[21] = 0.59;
CONSTANTS[22] = 1.393;
CONSTANTS[23] = -3.6;
CONSTANTS[24] = 6.4e-5;
CONSTANTS[25] = 3.1e-5;
CONSTANTS[26] = 2.5;
STATES[18] = 0.000071;
CONSTANTS[27] = 1;
CONSTANTS[28] = 11;
CONSTANTS[29] = 0.06441;
CONSTANTS[30] = 0.009509;
CONSTANTS[31] = 2e-4;
CONSTANTS[32] = 2e-5;
CONSTANTS[33] = 3e-4;
CONSTANTS[34] = 0.45;
CONSTANTS[35] = 1.26e-5;
CONSTANTS[36] = 5.884e-6;
STATES[19] = 0.029108;
STATES[20] = 0.014071;
STATES[21] = 0.214036;
STATES[22] = 0.693565;
CONSTANTS[37] = 2.5;
CONSTANTS[38] = 0.0000025;
CONSTANTS[39] = 2.8;
CONSTANTS[40] = 0.0003;
CONSTANTS[41] = 0.5;
CONSTANTS[42] = 0.4;
CONSTANTS[43] = 200;
STATES[23] = 0.726776;
STATES[24] = 0.730866;
CONSTANTS[44] = 3.969e-7;
CONSTANTS[45] = 4.4e-8;
STATES[25] = 0.465921;
STATES[26] = 0.288039;
STATES[27] = 0.002262;
STATES[28] = 0.612697;
CONSTANTS[46] = 0.01;
CONSTANTS[47] = 0.0003;
CONSTANTS[48] = 0.815;
RATES[0] = 0.1001;
RATES[2] = 0.1001;
RATES[3] = 0.1001;
RATES[4] = 0.1001;
RATES[5] = 0.1001;
RATES[6] = 0.1001;
RATES[7] = 0.1001;
RATES[8] = 0.1001;
RATES[11] = 0.1001;
RATES[12] = 0.1001;
RATES[13] = 0.1001;
RATES[14] = 0.1001;
RATES[15] = 0.1001;
RATES[16] = 0.1001;
RATES[17] = 0.1001;
RATES[1] = 0.1001;
RATES[10] = 0.1001;
RATES[18] = 0.1001;
RATES[19] = 0.1001;
RATES[20] = 0.1001;
RATES[21] = 0.1001;
RATES[22] = 0.1001;
RATES[9] = 0.1001;
RATES[25] = 0.1001;
RATES[23] = 0.1001;
RATES[24] = 0.1001;
RATES[26] = 0.1001;
RATES[27] = 0.1001;
RATES[28] = 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[5])*(ALGEBRAIC[50]+ALGEBRAIC[49]+ALGEBRAIC[2]+ALGEBRAIC[12]+ALGEBRAIC[25]+ALGEBRAIC[37]+ALGEBRAIC[38]+ALGEBRAIC[63]+ALGEBRAIC[65]+ALGEBRAIC[66]+ALGEBRAIC[67]+ALGEBRAIC[68]+ALGEBRAIC[69]+ALGEBRAIC[0]);
resid[1] = RATES[2] -  ALGEBRAIC[4]*(1.00000 - STATES[2]) -  ALGEBRAIC[5]*STATES[2];
resid[2] = RATES[3] - (ALGEBRAIC[8] - STATES[3])/ALGEBRAIC[9];
resid[3] = RATES[4] - (ALGEBRAIC[8] - STATES[4])/ALGEBRAIC[10];
resid[4] = RATES[5] - (ALGEBRAIC[18] - STATES[5])/ALGEBRAIC[19];
resid[5] = RATES[6] - (ALGEBRAIC[23] - STATES[6])/ALGEBRAIC[24];
resid[6] = RATES[7] - (ALGEBRAIC[29] - STATES[7])/ALGEBRAIC[30];
resid[7] = RATES[8] - (ALGEBRAIC[34] - STATES[8])/ALGEBRAIC[35];
resid[8] = RATES[11] - (ALGEBRAIC[41] - STATES[11])/ALGEBRAIC[42];
resid[9] = RATES[12] - (ALGEBRAIC[43] - STATES[12])/ALGEBRAIC[44];
resid[10] = RATES[13] - (ALGEBRAIC[45] - STATES[13])/ALGEBRAIC[46];
resid[11] = RATES[14] - (ALGEBRAIC[47] - STATES[14])/ALGEBRAIC[48];
resid[12] = RATES[15] - (ALGEBRAIC[53] - STATES[15])/ALGEBRAIC[54];
resid[13] = RATES[16] - (ALGEBRAIC[57] - STATES[16])/ALGEBRAIC[58];
resid[14] = RATES[17] - (ALGEBRAIC[61] - STATES[17])/ALGEBRAIC[62];
resid[15] = RATES[1] - - (ALGEBRAIC[2]+ALGEBRAIC[65]+ 3.00000*ALGEBRAIC[67]+ 3.00000*ALGEBRAIC[69])/( CONSTANTS[35]*CONSTANTS[4]);
resid[16] = RATES[10] - - ((ALGEBRAIC[37]+ALGEBRAIC[38]+ALGEBRAIC[63]+ALGEBRAIC[50]+ALGEBRAIC[49]) -  2.00000*ALGEBRAIC[67])/( CONSTANTS[35]*CONSTANTS[4]);
resid[17] = RATES[18] - - ((((ALGEBRAIC[12]+ALGEBRAIC[25]+ALGEBRAIC[66]+ALGEBRAIC[68]) -  2.00000*ALGEBRAIC[69])+ALGEBRAIC[75]) - ALGEBRAIC[77])/( 2.00000*CONSTANTS[36]*CONSTANTS[4]) - ( 0.0800000*ALGEBRAIC[71]+ 0.160000*ALGEBRAIC[72]+ 0.0450000*ALGEBRAIC[70]);
resid[18] = RATES[19] - ALGEBRAIC[70];
resid[19] = RATES[20] - ALGEBRAIC[71];
resid[20] = RATES[21] - ALGEBRAIC[72];
resid[21] = RATES[22] -  2000.00*CONSTANTS[37]*((1.00000 - STATES[21]) - STATES[22]) -  666.000*STATES[22];
resid[22] = RATES[9] - ((ALGEBRAIC[37]+ALGEBRAIC[38]+ALGEBRAIC[63]+ALGEBRAIC[50]+ALGEBRAIC[49]) -  2.00000*ALGEBRAIC[67])/( CONSTANTS[38]*CONSTANTS[4]);
resid[23] = RATES[25] -  480.000*STATES[23]*(1.00000 - STATES[25]) -  400.000*STATES[25];
resid[24] = RATES[23] - (ALGEBRAIC[76] - ALGEBRAIC[77])/( 2.00000*CONSTANTS[45]*CONSTANTS[4]) -  31.0000*RATES[25];
resid[25] = RATES[24] - (ALGEBRAIC[75] - ALGEBRAIC[76])/( 2.00000*CONSTANTS[44]*CONSTANTS[4]);
resid[26] = RATES[26] -  CONSTANTS[48]*STATES[28] -  ALGEBRAIC[73]*STATES[26];
resid[27] = RATES[27] -  ALGEBRAIC[73]*STATES[26] -  ALGEBRAIC[74]*STATES[27];
resid[28] = RATES[28] -  STATES[27]*ALGEBRAIC[74] -  CONSTANTS[48]*STATES[28];
}
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[10] : 0.00000);
ALGEBRAIC[1] =  (( CONSTANTS[2]*CONSTANTS[3])/CONSTANTS[4])*log(CONSTANTS[12]/STATES[1]);
ALGEBRAIC[2] = ( (( CONSTANTS[11]*pow(STATES[2], 3.00000)*( 0.635000*STATES[3]+ 0.365000*STATES[4])*CONSTANTS[12]*STATES[0]*pow(CONSTANTS[4], 2.00000))/( CONSTANTS[2]*CONSTANTS[3]))*(exp(( (STATES[0] - ALGEBRAIC[1])*CONSTANTS[4])/( CONSTANTS[2]*CONSTANTS[3])) - 1.00000))/(exp(( STATES[0]*CONSTANTS[4])/( CONSTANTS[2]*CONSTANTS[3])) - 1.00000);
ALGEBRAIC[3] = STATES[0]+44.4000;
ALGEBRAIC[4] = ( - 460.000*ALGEBRAIC[3])/(exp(ALGEBRAIC[3]/- 12.6730) - 1.00000);
ALGEBRAIC[5] =  18400.0*exp(ALGEBRAIC[3]/- 12.6730);
ALGEBRAIC[6] =  44.9000*exp((STATES[0]+66.9000)/- 5.57000);
ALGEBRAIC[7] = 1491.00/(1.00000+ 323.300*exp((STATES[0]+94.6000)/- 12.9000));
ALGEBRAIC[8] = ALGEBRAIC[6]/(ALGEBRAIC[6]+ALGEBRAIC[7]);
ALGEBRAIC[9] = 0.0300000/(1.00000+exp((STATES[0]+40.0000)/6.00000))+0.000150000;
ALGEBRAIC[10] = 0.120000/(1.00000+exp((STATES[0]+60.0000)/2.00000))+0.000450000;
ALGEBRAIC[11] = 1.00000/(1.00000+exp((STATES[0] - 23.0000)/- 12.0000));
ALGEBRAIC[12] = (CONSTANTS[0]==1.00000&&CONSTANTS[1]==0.00000 ?  1.80000*CONSTANTS[13]*( STATES[5]*STATES[6]+ALGEBRAIC[11])*(STATES[0] - CONSTANTS[14]) : CONSTANTS[0]==0.00000&&CONSTANTS[1]==1.00000 ?  2.10000*CONSTANTS[13]*( STATES[5]*STATES[6]+ALGEBRAIC[11])*(STATES[0] - CONSTANTS[14]) :  CONSTANTS[13]*( STATES[5]*STATES[6]+ALGEBRAIC[11])*(STATES[0] - CONSTANTS[14]));
ALGEBRAIC[15] = STATES[0]+10.0000;
ALGEBRAIC[18] = 1.00000/(1.00000+exp((ALGEBRAIC[15]+0.950000)/- 6.60000));
ALGEBRAIC[13] = STATES[0]+45.0000;
ALGEBRAIC[16] = ( - 16.7200*ALGEBRAIC[13])/(exp(ALGEBRAIC[13]/- 2.50000) - 1.00000)+( - 50.0000*ALGEBRAIC[15])/(exp(ALGEBRAIC[15]/- 4.80800) - 1.00000);
ALGEBRAIC[14] = STATES[0]+5.00000;
ALGEBRAIC[17] = ( 4.48000*ALGEBRAIC[14])/(exp(ALGEBRAIC[14]/2.50000) - 1.00000);
ALGEBRAIC[19] = 1.00000/(ALGEBRAIC[16]+ALGEBRAIC[17]);
ALGEBRAIC[20] = STATES[0]+18.0000;
ALGEBRAIC[21] = ( 8.49000*ALGEBRAIC[20])/(exp(ALGEBRAIC[20]/4.00000) - 1.00000);
ALGEBRAIC[22] = 67.9220/(1.00000+exp(ALGEBRAIC[20]/- 4.00000));
ALGEBRAIC[23] = ALGEBRAIC[21]/(ALGEBRAIC[21]+ALGEBRAIC[22]);
ALGEBRAIC[24] = 1.00000/(ALGEBRAIC[21]+ALGEBRAIC[22]);
ALGEBRAIC[25] =  CONSTANTS[15]*STATES[7]*STATES[8]*(STATES[0] - CONSTANTS[16]);
ALGEBRAIC[26] = STATES[0]+23.3000;
ALGEBRAIC[29] = 1.00000/(1.00000+exp((ALGEBRAIC[26] - 0.300000)/- 6.10000));
ALGEBRAIC[27] =  674.173*exp(ALGEBRAIC[26]/30.0000);
ALGEBRAIC[28] =  674.173*exp(ALGEBRAIC[26]/- 30.0000);
ALGEBRAIC[30] = 1.00000/(ALGEBRAIC[27]+ALGEBRAIC[28]);
ALGEBRAIC[31] = STATES[0]+75.0000;
ALGEBRAIC[32] =  9.63700*exp(ALGEBRAIC[31]/- 83.3000);
ALGEBRAIC[33] =  9.63700*exp(ALGEBRAIC[31]/15.3800);
ALGEBRAIC[34] = ALGEBRAIC[32]/(ALGEBRAIC[32]+ALGEBRAIC[33]);
ALGEBRAIC[35] = 1.00000/(ALGEBRAIC[32]+ALGEBRAIC[33]);
ALGEBRAIC[36] =  (( CONSTANTS[2]*CONSTANTS[3])/CONSTANTS[4])*log(STATES[9]/STATES[10]);
ALGEBRAIC[37] = (CONSTANTS[0]==1.00000&&CONSTANTS[1]==0.00000 ?  0.200000*CONSTANTS[17]*STATES[11]*( 0.590000*pow(STATES[12], 3.00000)+ 0.410000*pow(STATES[13], 3.00000))*( 0.600000*pow(STATES[14], 6.00000)+0.400000)*(STATES[0] - ALGEBRAIC[36]) : CONSTANTS[0]==0.00000&&CONSTANTS[1]==1.00000 ?  0.350000*CONSTANTS[17]*STATES[11]*( 0.590000*pow(STATES[12], 3.00000)+ 0.410000*pow(STATES[13], 3.00000))*( 0.600000*pow(STATES[14], 6.00000)+0.400000)*(STATES[0] - ALGEBRAIC[36]) :  CONSTANTS[17]*STATES[11]*( 0.590000*pow(STATES[12], 3.00000)+ 0.410000*pow(STATES[13], 3.00000))*( 0.600000*pow(STATES[14], 6.00000)+0.400000)*(STATES[0] - ALGEBRAIC[36]));
ALGEBRAIC[38] = (CONSTANTS[0]==1.00000&&CONSTANTS[1]==0.00000 ?  0.00140000*(STATES[0]+70.0000) : CONSTANTS[0]==0.00000&&CONSTANTS[1]==1.00000 ?  0.00240000*(STATES[0]+70.0000) :  0.00100000*(STATES[0]+70.0000));
ALGEBRAIC[41] = 1.00000/(1.00000+exp((STATES[0]+15.0000)/- 5.63300));
ALGEBRAIC[39] =  386.600*exp(STATES[0]/12.0000);
ALGEBRAIC[40] =  8.01100*exp(STATES[0]/- 7.20000);
ALGEBRAIC[42] = 1.00000/(ALGEBRAIC[39]+ALGEBRAIC[40])+0.000400000;
ALGEBRAIC[43] = 1.00000/(1.00000+exp((STATES[0]+28.2900)/7.06000));
ALGEBRAIC[44] = 0.546600/(1.00000+exp((STATES[0]+32.8000)/0.100000))+0.0204000;
ALGEBRAIC[45] = 1.00000/(1.00000+exp((STATES[0]+28.2900)/7.06000));
ALGEBRAIC[46] = 5.75000/(1.00000+exp((STATES[0]+32.8000)/0.100000))+0.450000/(1.00000+exp((STATES[0] - 13.5400)/- 13.9700));
ALGEBRAIC[47] = (1.00000/(1.00000+exp((STATES[0]+50.6700)/27.3800))+0.666000)/1.66600;
ALGEBRAIC[48] = 7.50000/(1.00000+exp((STATES[0]+23.0000)/0.500000))+0.500000;
ALGEBRAIC[49] =  CONSTANTS[18]*STATES[15]*(STATES[0] - ALGEBRAIC[36]);
ALGEBRAIC[50] =  CONSTANTS[19]*STATES[16]*STATES[17]*(STATES[0] - ALGEBRAIC[36]);
ALGEBRAIC[53] = 1.00000/(1.00000+exp((STATES[0] - 0.900000)/- 13.8000));
ALGEBRAIC[51] =  1.66000*exp(STATES[0]/69.4520);
ALGEBRAIC[52] =  0.300000*exp(STATES[0]/- 21.8260);
ALGEBRAIC[54] = 1.00000/(ALGEBRAIC[51]+ALGEBRAIC[52])+0.0600000;
ALGEBRAIC[57] = 1.00000/(1.00000+exp((STATES[0]+5.10000)/- 7.40000));
ALGEBRAIC[55] =  9.00000*exp(STATES[0]/25.3710);
ALGEBRAIC[56] =  1.30000*exp(STATES[0]/- 13.0260);
ALGEBRAIC[58] = 1.00000/(ALGEBRAIC[55]+ALGEBRAIC[56]);
ALGEBRAIC[61] = 1.00000/(1.00000+exp((STATES[0]+47.3921)/18.6603));
ALGEBRAIC[59] =  100.000*exp(STATES[0]/- 54.6450);
ALGEBRAIC[60] =  656.000*exp(STATES[0]/106.157);
ALGEBRAIC[62] = 1.00000/(ALGEBRAIC[59]+ALGEBRAIC[60]);
ALGEBRAIC[63] = (CONSTANTS[0]==1.00000&&CONSTANTS[1]==0.00000 ? ( 2.00000*CONSTANTS[20]*(STATES[0] - ALGEBRAIC[36])*pow(STATES[9]/(STATES[9]+CONSTANTS[21]), 3.00000)*1.00000)/(1.00000+exp(( CONSTANTS[22]*CONSTANTS[4]*((STATES[0] - ALGEBRAIC[36]) - CONSTANTS[23]))/( CONSTANTS[2]*CONSTANTS[3]))) : CONSTANTS[0]==0.00000&&CONSTANTS[1]==1.00000 ? ( 2.50000*CONSTANTS[20]*(STATES[0] - ALGEBRAIC[36])*pow(STATES[9]/(STATES[9]+CONSTANTS[21]), 3.00000)*1.00000)/(1.00000+exp(( CONSTANTS[22]*CONSTANTS[4]*((STATES[0] - ALGEBRAIC[36]) - CONSTANTS[23]))/( CONSTANTS[2]*CONSTANTS[3]))) : ( CONSTANTS[20]*(STATES[0] - ALGEBRAIC[36])*pow(STATES[9]/(STATES[9]+CONSTANTS[21]), 3.00000)*1.00000)/(1.00000+exp(( CONSTANTS[22]*CONSTANTS[4]*((STATES[0] - ALGEBRAIC[36]) - CONSTANTS[23]))/( CONSTANTS[2]*CONSTANTS[3]))));
ALGEBRAIC[65] = (CONSTANTS[0]==1.00000&&CONSTANTS[1]==0.00000 ?  2.00000e-05*(STATES[0] - ALGEBRAIC[1]) : CONSTANTS[0]==0.00000&&CONSTANTS[1]==1.00000 ?  3.00000e-05*(STATES[0] - ALGEBRAIC[1]) :  CONSTANTS[24]*(STATES[0] - ALGEBRAIC[1]));
ALGEBRAIC[64] =  (( CONSTANTS[2]*CONSTANTS[3])/( 2.00000*CONSTANTS[4]))*log(CONSTANTS[26]/STATES[18]);
ALGEBRAIC[66] = (CONSTANTS[0]==1.00000&&CONSTANTS[1]==0.00000 ?  2.00000e-05*(STATES[0] - ALGEBRAIC[64]) : CONSTANTS[0]==0.00000&&CONSTANTS[1]==1.00000 ?  3.00000e-05*(STATES[0] - ALGEBRAIC[64]) :  CONSTANTS[25]*(STATES[0] - ALGEBRAIC[64]));
ALGEBRAIC[67] = ( (( (( CONSTANTS[29]*STATES[9])/(STATES[9]+CONSTANTS[27]))*pow(STATES[1], 1.50000))/(pow(STATES[1], 1.50000)+pow(CONSTANTS[28], 1.50000)))*1.60000)/(1.50000+exp((STATES[0]+60.0000)/- 40.0000));
ALGEBRAIC[68] = ( CONSTANTS[30]*STATES[18])/(STATES[18]+CONSTANTS[31]);
ALGEBRAIC[69] = ( CONSTANTS[32]*( pow(STATES[1], 3.00000)*CONSTANTS[26]*exp(( CONSTANTS[34]*CONSTANTS[4]*STATES[0])/( CONSTANTS[2]*CONSTANTS[3])) -  pow(CONSTANTS[12], 3.00000)*STATES[18]*exp(( (CONSTANTS[34] - 1.00000)*STATES[0]*CONSTANTS[4])/( CONSTANTS[2]*CONSTANTS[3]))))/(1.00000+ CONSTANTS[33]*( pow(CONSTANTS[12], 3.00000)*STATES[18]+ pow(STATES[1], 3.00000)*CONSTANTS[26]));
ALGEBRAIC[70] =  200000.*STATES[18]*(1.00000 - STATES[19]) -  476.000*STATES[19];
ALGEBRAIC[71] =  78400.0*STATES[18]*(1.00000 - STATES[20]) -  392.000*STATES[20];
ALGEBRAIC[72] =  200000.*STATES[18]*((1.00000 - STATES[21]) - STATES[22]) -  6.60000*STATES[21];
ALGEBRAIC[73] =  240.000*exp( 0.0800000*(STATES[0] - 20.0000))+ 203.800*pow(STATES[18]/(STATES[18]+CONSTANTS[47]), 4.00000);
ALGEBRAIC[74] = 33.9600+ 339.600*pow(STATES[18]/(STATES[18]+CONSTANTS[47]), 4.00000);
ALGEBRAIC[75] = ( CONSTANTS[39]*(STATES[18]/CONSTANTS[40] - ( pow(CONSTANTS[42], 2.00000)*STATES[24])/CONSTANTS[41]))/((STATES[18]+CONSTANTS[40])/CONSTANTS[40]+( CONSTANTS[42]*(STATES[24]+CONSTANTS[41]))/CONSTANTS[41]);
ALGEBRAIC[76] = ( (STATES[24] - STATES[23])*2.00000*CONSTANTS[4]*CONSTANTS[45])/CONSTANTS[46];
ALGEBRAIC[77] =  CONSTANTS[43]*pow(STATES[27]/(STATES[27]+0.250000), 2.00000)*(STATES[23] - STATES[18]);
}
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;
SI[25] = 1.0;
SI[26] = 1.0;
SI[27] = 1.0;
SI[28] = 1.0;
}
void
computeRoots(double VOI, double* CONSTANTS, double* RATES, double* OLDRATES, double* STATES,
             double* OLDSTATES, double* ALGEBRAIC, double* CONDVARS)
{
CONDVAR[0] = VOI - CONSTANTS[6];
CONDVAR[1] = VOI - CONSTANTS[7];
CONDVAR[2] = ((VOI - CONSTANTS[6]) -  floor((VOI - CONSTANTS[6])/CONSTANTS[8])*CONSTANTS[8]) - CONSTANTS[9];
}