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 73 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 55 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[64] is i_Na in component sodium_current (nanoA).
 * ALGEBRAIC[20] is i_Ca_T in component T_type_Ca_channel (nanoA).
 * ALGEBRAIC[65] is i_Ca_L in component L_type_Ca_channel (nanoA).
 * ALGEBRAIC[66] is i_K in component delayed_rectifying_potassium_current (nanoA).
 * ALGEBRAIC[37] is i_f in component hyperpolarisation_activated_current (nanoA).
 * ALGEBRAIC[70] is i_B in component linear_background_current (nanoA).
 * ALGEBRAIC[42] is i_NaK in component sodium_potassium_pump (nanoA).
 * ALGEBRAIC[44] is i_NaCa in component sodium_calcium_pump (nanoA).
 * ALGEBRAIC[43] is i_Ca_P in component calcium_pump_current (nanoA).
 * ALGEBRAIC[72] is i_K_ACh in component muscarinic_potassium_current (nanoA).
 * CONSTANTS[4] is P_Na in component sodium_current (mul_per_second).
 * ALGEBRAIC[61] is E_Na in component reversal_potentials (millivolt).
 * STATES[1] is Na_c in component cleft_space_equations (millimolar).
 * CONSTANTS[45] is F_ACh_Na in component sodium_current (dimensionless).
 * CONSTANTS[5] is ACh in component cAMP_balance (millimolar).
 * STATES[2] is m in component sodium_current_m_gate (dimensionless).
 * STATES[3] is h1 in component sodium_current_h_gate (dimensionless).
 * STATES[4] is h2 in component sodium_current_h_gate (dimensionless).
 * ALGEBRAIC[2] is m_infinity in component sodium_current_m_gate (dimensionless).
 * ALGEBRAIC[3] is tau_m in component sodium_current_m_gate (second).
 * ALGEBRAIC[0] is alpha_m in component sodium_current_m_gate (per_second).
 * ALGEBRAIC[1] is beta_m in component sodium_current_m_gate (per_second).
 * ALGEBRAIC[6] is h1_infinity in component sodium_current_h_gate (dimensionless).
 * ALGEBRAIC[8] is h2_infinity in component sodium_current_h_gate (dimensionless).
 * ALGEBRAIC[7] is tau_h1 in component sodium_current_h_gate (second).
 * ALGEBRAIC[9] is tau_h2 in component sodium_current_h_gate (second).
 * ALGEBRAIC[4] is alpha_h1 in component sodium_current_h_gate (per_second).
 * ALGEBRAIC[5] is beta_h1 in component sodium_current_h_gate (per_second).
 * ALGEBRAIC[11] is g_Ca_L in component L_type_Ca_channel (microS).
 * CONSTANTS[6] is g_Ca_L_cont in component L_type_Ca_channel (microS).
 * ALGEBRAIC[10] is F_cAMP_CaL in component L_type_Ca_channel (dimensionless).
 * STATES[5] is cAMP in component cAMP_balance (millimolar).
 * CONSTANTS[7] is E_Ca_L in component L_type_Ca_channel (millivolt).
 * STATES[6] is d_L in component L_type_Ca_channel_d_gate (dimensionless).
 * ALGEBRAIC[15] is d_L_infinity in component L_type_Ca_channel_d_gate (dimensionless).
 * STATES[7] is f_L in component L_type_Ca_channel_f_gate (dimensionless).
 * ALGEBRAIC[12] is alpha_d_L in component L_type_Ca_channel_d_gate (per_second).
 * ALGEBRAIC[13] is beta_d_L in component L_type_Ca_channel_d_gate (per_second).
 * ALGEBRAIC[14] is tau_d_L in component L_type_Ca_channel_d_gate (second).
 * ALGEBRAIC[16] is alpha_f_L in component L_type_Ca_channel_f_gate (per_second).
 * ALGEBRAIC[17] is beta_f_L in component L_type_Ca_channel_f_gate (per_second).
 * ALGEBRAIC[19] is f_L_infinity in component L_type_Ca_channel_f_gate (dimensionless).
 * ALGEBRAIC[18] is tau_f_L in component L_type_Ca_channel_f_gate (second).
 * CONSTANTS[8] is g_Ca_T in component T_type_Ca_channel (microS).
 * CONSTANTS[9] is E_Ca_T in component T_type_Ca_channel (millivolt).
 * STATES[8] is d_T in component T_type_Ca_channel_d_gate (dimensionless).
 * STATES[9] is f_T in component T_type_Ca_channel_f_gate (dimensionless).
 * ALGEBRAIC[21] is alpha_d_T in component T_type_Ca_channel_d_gate (per_second).
 * ALGEBRAIC[22] is beta_d_T in component T_type_Ca_channel_d_gate (per_second).
 * ALGEBRAIC[24] is d_T_infinity in component T_type_Ca_channel_d_gate (dimensionless).
 * ALGEBRAIC[23] is tau_d_T in component T_type_Ca_channel_d_gate (second).
 * ALGEBRAIC[25] is alpha_f_T in component T_type_Ca_channel_f_gate (per_second).
 * ALGEBRAIC[26] is beta_f_T in component T_type_Ca_channel_f_gate (per_second).
 * ALGEBRAIC[28] is f_T_infinity in component T_type_Ca_channel_f_gate (dimensionless).
 * ALGEBRAIC[27] is tau_f_T in component T_type_Ca_channel_f_gate (second).
 * ALGEBRAIC[30] is g_K in component delayed_rectifying_potassium_current (microS).
 * ALGEBRAIC[29] is F_cAMP_K in component delayed_rectifying_potassium_current (dimensionless).
 * ALGEBRAIC[62] is E_K in component reversal_potentials (millivolt).
 * CONSTANTS[10] is K_b in component cleft_space_equations (millimolar).
 * STATES[10] is P_a in component delayed_rectifying_potassium_current_P_a_gate (dimensionless).
 * STATES[11] is P_i in component delayed_rectifying_potassium_current_P_i_gate (dimensionless).
 * ALGEBRAIC[32] is tau_P_a in component delayed_rectifying_potassium_current_P_a_gate (second).
 * ALGEBRAIC[31] is P_a_infinity in component delayed_rectifying_potassium_current_P_a_gate (dimensionless).
 * ALGEBRAIC[33] is alpha_P_i in component delayed_rectifying_potassium_current_P_i_gate (per_second).
 * ALGEBRAIC[34] is beta_P_i in component delayed_rectifying_potassium_current_P_i_gate (per_second).
 * ALGEBRAIC[67] is i_B_Na in component linear_background_current (nanoA).
 * ALGEBRAIC[68] is i_B_Ca in component linear_background_current (nanoA).
 * ALGEBRAIC[69] is i_B_K in component linear_background_current (nanoA).
 * CONSTANTS[11] is g_B_Na in component linear_background_current (microS).
 * CONSTANTS[12] is g_B_Ca in component linear_background_current (microS).
 * CONSTANTS[13] is g_B_K in component linear_background_current (microS).
 * ALGEBRAIC[63] is E_Ca in component reversal_potentials (millivolt).
 * CONSTANTS[46] is F_ACh_bNa in component linear_background_current (dimensionless).
 * ALGEBRAIC[35] is i_f_Na in component hyperpolarisation_activated_current (nanoA).
 * ALGEBRAIC[36] is i_f_K in component hyperpolarisation_activated_current (nanoA).
 * CONSTANTS[14] is g_f_Na in component hyperpolarisation_activated_current (microS).
 * CONSTANTS[15] is g_f_K in component hyperpolarisation_activated_current (microS).
 * STATES[12] is y in component hyperpolarisation_activated_current_y_gate (dimensionless).
 * ALGEBRAIC[39] is y_infinity in component hyperpolarisation_activated_current_y_gate (dimensionless).
 * ALGEBRAIC[38] is V_half in component hyperpolarisation_activated_current_y_gate (millivolt).
 * ALGEBRAIC[40] is tau_y in component hyperpolarisation_activated_current_y_gate (second).
 * CONSTANTS[16] is K_m_Na in component sodium_potassium_pump (millimolar).
 * CONSTANTS[17] is K_m_K in component sodium_potassium_pump (millimolar).
 * CONSTANTS[18] is i_NaK_max in component sodium_potassium_pump (nanoA).
 * ALGEBRAIC[41] is F_cAMP_NaK in component sodium_potassium_pump (dimensionless).
 * STATES[13] is Na_i in component intracellular_concentrations_and_buffer_equations (millimolar).
 * STATES[14] is K_c in component cleft_space_equations (millimolar).
 * STATES[15] is Ca_i in component intracellular_concentrations_and_buffer_equations (millimolar).
 * CONSTANTS[19] is i_Ca_P_max in component calcium_pump_current (nanoA).
 * CONSTANTS[20] is K_NaCa in component sodium_calcium_pump (nanoA).
 * CONSTANTS[21] is d_NaCa in component sodium_calcium_pump (dimensionless).
 * CONSTANTS[22] is gamma in component sodium_calcium_pump (dimensionless).
 * STATES[16] is Ca_c in component cleft_space_equations (millimolar).
 * ALGEBRAIC[71] is I_K_ACh in component muscarinic_potassium_current (nanoA).
 * CONSTANTS[52] is g_K_ACh in component muscarinic_potassium_current (microS).
 * CONSTANTS[23] is g_K_ACh_base in component muscarinic_potassium_current (microS).
 * CONSTANTS[47] is P_M2_KACh in component muscarinic_potassium_current (dimensionless).
 * STATES[17] is a in component muscarinic_potassium_current (dimensionless).
 * ALGEBRAIC[45] is alpha_a in component muscarinic_potassium_current (per_second).
 * CONSTANTS[48] is beta_a in component muscarinic_potassium_current (per_second).
 * CONSTANTS[24] is f_Vagal in component cAMP_balance (per_second).
 * STATES[18] is K_i in component intracellular_concentrations_and_buffer_equations (millimolar).
 * STATES[19] is Ca_Calmod in component intracellular_concentrations_and_buffer_equations (dimensionless).
 * STATES[20] is Ca_Trop in component intracellular_concentrations_and_buffer_equations (dimensionless).
 * STATES[21] is Ca_Mg_Trop in component intracellular_concentrations_and_buffer_equations (dimensionless).
 * STATES[22] is Mg_Mg_Trop in component intracellular_concentrations_and_buffer_equations (dimensionless).
 * ALGEBRAIC[46] is phi_C in component intracellular_concentrations_and_buffer_equations (per_second).
 * ALGEBRAIC[47] is phi_TC in component intracellular_concentrations_and_buffer_equations (per_second).
 * ALGEBRAIC[48] is phi_TMgC in component intracellular_concentrations_and_buffer_equations (per_second).
 * ALGEBRAIC[49] is phi_TMgM in component intracellular_concentrations_and_buffer_equations (per_second).
 * ALGEBRAIC[53] is phi_B in component intracellular_concentrations_and_buffer_equations (millimolar_per_second).
 * CONSTANTS[25] is Mg_i in component intracellular_concentrations_and_buffer_equations (millimolar).
 * ALGEBRAIC[50] is F_C in component intracellular_concentrations_and_buffer_equations (millimolar_per_second).
 * ALGEBRAIC[51] is F_TC in component intracellular_concentrations_and_buffer_equations (millimolar_per_second).
 * ALGEBRAIC[52] is F_TMgC in component intracellular_concentrations_and_buffer_equations (millimolar_per_second).
 * CONSTANTS[26] is Vol in component cleft_space_equations (mm_cubed).
 * CONSTANTS[49] is V_i in component intracellular_concentrations_and_buffer_equations (mm_cubed).
 * ALGEBRAIC[60] is i_up in component SR_Ca_uptake_and_release (nanoA).
 * ALGEBRAIC[58] is i_rel in component SR_Ca_uptake_and_release (nanoA).
 * CONSTANTS[27] is Na_b in component cleft_space_equations (millimolar).
 * CONSTANTS[28] is Ca_b in component cleft_space_equations (millimolar).
 * CONSTANTS[50] is V_c in component cleft_space_equations (mm_cubed).
 * CONSTANTS[29] is tau_p in component cleft_space_equations (second).
 * STATES[23] is Ca_up in component SR_Ca_uptake_and_release (millimolar).
 * CONSTANTS[30] is alpha_up in component SR_Ca_uptake_and_release (nanoA).
 * CONSTANTS[31] is beta_up in component SR_Ca_uptake_and_release (nanoA).
 * STATES[24] is Ca_rel in component SR_Ca_uptake_and_release (millimolar).
 * CONSTANTS[32] is alpha_rel in component SR_Ca_uptake_and_release (nanoA_per_millimolar).
 * ALGEBRAIC[59] is i_tr in component SR_Ca_uptake_and_release (nanoA).
 * CONSTANTS[51] is K1 in component SR_Ca_uptake_and_release (dimensionless).
 * ALGEBRAIC[54] is K2 in component SR_Ca_uptake_and_release (millimolar).
 * CONSTANTS[33] is k_cyca in component SR_Ca_uptake_and_release (millimolar).
 * CONSTANTS[34] is k_xcs in component SR_Ca_uptake_and_release (dimensionless).
 * CONSTANTS[35] is k_SRCa in component SR_Ca_uptake_and_release (millimolar).
 * CONSTANTS[36] is k_rel in component SR_Ca_uptake_and_release (millimolar).
 * ALGEBRAIC[55] is r_act in component SR_Ca_uptake_and_release (per_second).
 * ALGEBRAIC[56] is r_inact in component SR_Ca_uptake_and_release (per_second).
 * STATES[25] is Ca_Calse in component SR_Ca_uptake_and_release (dimensionless).
 * ALGEBRAIC[57] is phi_Calse in component SR_Ca_uptake_and_release (per_second).
 * STATES[26] is F1 in component SR_Ca_uptake_and_release (dimensionless).
 * STATES[27] is F2 in component SR_Ca_uptake_and_release (dimensionless).
 * STATES[28] is F3 in component SR_Ca_uptake_and_release (dimensionless).
 * CONSTANTS[53] is V_up in component SR_Ca_uptake_and_release (mm_cubed).
 * CONSTANTS[54] is V_rel in component SR_Ca_uptake_and_release (mm_cubed).
 * CONSTANTS[37] is cGMP in component cAMP_balance (millimolar).
 * CONSTANTS[38] is Iso in component cAMP_balance (millimolar).
 * CONSTANTS[39] is Km_Iso in component cAMP_balance (millimolar).
 * CONSTANTS[40] is Km_ACh in component cAMP_balance (millimolar).
 * CONSTANTS[41] is K_PDE in component cAMP_balance (dimensionless).
 * CONSTANTS[42] is K_ADC in component cAMP_balance (millimolar_per_second).
 * CONSTANTS[43] is V_PDE in component cAMP_balance (per_second).
 * CONSTANTS[44] is P_M2_ADC in component cAMP_balance (dimensionless).
 * 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_h_gate (dimensionless).
 * RATES[4] is d/dt h2 in component sodium_current_h_gate (dimensionless).
 * RATES[6] is d/dt d_L in component L_type_Ca_channel_d_gate (dimensionless).
 * RATES[7] is d/dt f_L in component L_type_Ca_channel_f_gate (dimensionless).
 * RATES[8] is d/dt d_T in component T_type_Ca_channel_d_gate (dimensionless).
 * RATES[9] is d/dt f_T in component T_type_Ca_channel_f_gate (dimensionless).
 * RATES[10] is d/dt P_a in component delayed_rectifying_potassium_current_P_a_gate (dimensionless).
 * RATES[11] is d/dt P_i in component delayed_rectifying_potassium_current_P_i_gate (dimensionless).
 * RATES[12] is d/dt y in component hyperpolarisation_activated_current_y_gate (dimensionless).
 * RATES[17] is d/dt a in component muscarinic_potassium_current (dimensionless).
 * RATES[19] is d/dt Ca_Calmod in component intracellular_concentrations_and_buffer_equations (dimensionless).
 * RATES[20] is d/dt Ca_Trop in component intracellular_concentrations_and_buffer_equations (dimensionless).
 * RATES[21] is d/dt Ca_Mg_Trop in component intracellular_concentrations_and_buffer_equations (dimensionless).
 * RATES[22] is d/dt Mg_Mg_Trop in component intracellular_concentrations_and_buffer_equations (dimensionless).
 * RATES[13] is d/dt Na_i in component intracellular_concentrations_and_buffer_equations (millimolar).
 * RATES[18] is d/dt K_i in component intracellular_concentrations_and_buffer_equations (millimolar).
 * RATES[15] is d/dt Ca_i in component intracellular_concentrations_and_buffer_equations (millimolar).
 * RATES[1] is d/dt Na_c in component cleft_space_equations (millimolar).
 * RATES[14] is d/dt K_c in component cleft_space_equations (millimolar).
 * RATES[16] is d/dt Ca_c in component cleft_space_equations (millimolar).
 * RATES[25] is d/dt Ca_Calse in component SR_Ca_uptake_and_release (dimensionless).
 * RATES[26] is d/dt F1 in component SR_Ca_uptake_and_release (dimensionless).
 * RATES[27] is d/dt F2 in component SR_Ca_uptake_and_release (dimensionless).
 * RATES[28] is d/dt F3 in component SR_Ca_uptake_and_release (dimensionless).
 * RATES[23] is d/dt Ca_up in component SR_Ca_uptake_and_release (millimolar).
 * RATES[24] is d/dt Ca_rel in component SR_Ca_uptake_and_release (millimolar).
 * RATES[5] is d/dt cAMP in component cAMP_balance (millimolar).
 * There are a total of 1 condition variables.
 */
void
initConsts(double* CONSTANTS, double* RATES, double *STATES)
{
STATES[0] = -49.54105;
CONSTANTS[0] = 8314.472;
CONSTANTS[1] = 310;
CONSTANTS[2] = 96485.3415;
CONSTANTS[3] = 5.5e-5;
CONSTANTS[4] = 0.00344;
STATES[1] = 139.9988;
CONSTANTS[5] = 0;
STATES[2] = 0.250113;
STATES[3] = 0.001386897;
STATES[4] = 0.002065463;
CONSTANTS[6] = 0.02115;
STATES[5] = 3e-3;
CONSTANTS[7] = 46.4;
STATES[6] = 0.002572773;
STATES[7] = 0.98651;
CONSTANTS[8] = 0.02521;
CONSTANTS[9] = 45;
STATES[8] = 0.02012114;
STATES[9] = 0.1945111;
CONSTANTS[10] = 5.4;
STATES[10] = 0.02302278;
STATES[11] = 0.3777728;
CONSTANTS[11] = 0.00016;
CONSTANTS[12] = 0.0000364;
CONSTANTS[13] = 0.0000694;
CONSTANTS[14] = 0.0067478;
CONSTANTS[15] = 0.0128821;
STATES[12] = 0.09227776;
CONSTANTS[16] = 5.46;
CONSTANTS[17] = 0.621;
CONSTANTS[18] = 0.2192;
STATES[13] = 9.701621;
STATES[14] = 5.389014;
STATES[15] = 3.787018e-4;
CONSTANTS[19] = 0.02869;
CONSTANTS[20] = 0.00001248;
CONSTANTS[21] = 0.0001;
CONSTANTS[22] = 0.5;
STATES[16] = 2.00474;
CONSTANTS[23] = 7.833e-3;
STATES[17] = 0;
CONSTANTS[24] = 200;
STATES[18] = 1.407347e2;
STATES[19] = 0.1411678;
STATES[20] = 0.07331396;
STATES[21] = 0.7618549;
STATES[22] = 0.2097049;
CONSTANTS[25] = 2.5;
CONSTANTS[26] = 3.497e-6;
CONSTANTS[27] = 140;
CONSTANTS[28] = 2;
CONSTANTS[29] = 0.01;
STATES[23] = 16.95311;
CONSTANTS[30] = 0.08;
CONSTANTS[31] = 0.072;
STATES[24] = 16.85024;
CONSTANTS[32] = 0.5;
CONSTANTS[33] = 0.00005;
CONSTANTS[34] = 0.9;
CONSTANTS[35] = 22;
CONSTANTS[36] = 0.004;
STATES[25] = 0.9528726;
STATES[26] = 0.1133251;
STATES[27] = 0.0007594214;
STATES[28] = 0.8859153;
CONSTANTS[37] = 2e-3;
CONSTANTS[38] = 0;
CONSTANTS[39] = 0.14e-3;
CONSTANTS[40] = 0.14e-3;
CONSTANTS[41] = 6;
CONSTANTS[42] = 8e-3;
CONSTANTS[43] = 20;
CONSTANTS[44] = 0.02;
CONSTANTS[45] = 1.00000 - CONSTANTS[5]/(CONSTANTS[5]+0.00100000);
CONSTANTS[46] = 1.00000 - CONSTANTS[5]/(CONSTANTS[5]+0.500000);
CONSTANTS[47] = (CONSTANTS[24]<100.000&&CONSTANTS[24]>25.0000 ? 1.02600/(1.00000+exp((CONSTANTS[24]+11.0500)/- 7.50950)) - 0.990000 : 0.000600000);
CONSTANTS[48] = 12.3200/(1.00000+0.00420000/CONSTANTS[5]);
CONSTANTS[49] =  0.465000*CONSTANTS[26];
CONSTANTS[50] =  0.136000*CONSTANTS[26];
CONSTANTS[51] = ( CONSTANTS[33]*CONSTANTS[34])/CONSTANTS[35];
CONSTANTS[52] =  CONSTANTS[47]*CONSTANTS[23];
CONSTANTS[53] =  0.0116600*CONSTANTS[49];
CONSTANTS[54] =  0.00129600*CONSTANTS[49];
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[12] = 0.1001;
RATES[17] = 0.1001;
RATES[19] = 0.1001;
RATES[20] = 0.1001;
RATES[21] = 0.1001;
RATES[22] = 0.1001;
RATES[13] = 0.1001;
RATES[18] = 0.1001;
RATES[15] = 0.1001;
RATES[1] = 0.1001;
RATES[14] = 0.1001;
RATES[16] = 0.1001;
RATES[25] = 0.1001;
RATES[26] = 0.1001;
RATES[27] = 0.1001;
RATES[28] = 0.1001;
RATES[23] = 0.1001;
RATES[24] = 0.1001;
RATES[5] = 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[64]+ALGEBRAIC[20]+ALGEBRAIC[65]+ALGEBRAIC[66]+ALGEBRAIC[37]+ALGEBRAIC[70]+ALGEBRAIC[42]+ALGEBRAIC[44]+ALGEBRAIC[43]+ALGEBRAIC[72])/CONSTANTS[3];
resid[1] = RATES[2] - (ALGEBRAIC[2] - STATES[2])/ALGEBRAIC[3];
resid[2] = RATES[3] - (ALGEBRAIC[6] - STATES[3])/ALGEBRAIC[7];
resid[3] = RATES[4] - (ALGEBRAIC[8] - STATES[4])/ALGEBRAIC[9];
resid[4] = RATES[6] - (ALGEBRAIC[15] - STATES[6])/ALGEBRAIC[14];
resid[5] = RATES[7] - (ALGEBRAIC[19] - STATES[7])/ALGEBRAIC[18];
resid[6] = RATES[8] - (ALGEBRAIC[24] - STATES[8])/ALGEBRAIC[23];
resid[7] = RATES[9] - (ALGEBRAIC[28] - STATES[9])/ALGEBRAIC[27];
resid[8] = RATES[10] - (ALGEBRAIC[31] - STATES[10])/ALGEBRAIC[32];
resid[9] = RATES[11] -  ALGEBRAIC[33]*(1.00000 - STATES[11]) -  ALGEBRAIC[34]*STATES[11];
resid[10] = RATES[12] - (ALGEBRAIC[39] - STATES[12])/ALGEBRAIC[40];
resid[11] = RATES[17] -  CONSTANTS[48]*(1.00000 - STATES[17]) -  ALGEBRAIC[45]*STATES[17];
resid[12] = RATES[19] - ALGEBRAIC[46];
resid[13] = RATES[20] - ALGEBRAIC[47];
resid[14] = RATES[21] - ALGEBRAIC[48];
resid[15] = RATES[22] - ALGEBRAIC[49];
resid[16] = RATES[13] - - ( 3.00000*ALGEBRAIC[42]+ 3.00000*ALGEBRAIC[44]+ALGEBRAIC[67]+ALGEBRAIC[35]+ALGEBRAIC[64])/( CONSTANTS[2]*CONSTANTS[49]);
resid[17] = RATES[18] - ( 2.00000*ALGEBRAIC[42] - (ALGEBRAIC[66]+ALGEBRAIC[36]+ALGEBRAIC[69]))/( CONSTANTS[2]*CONSTANTS[49]);
resid[18] = RATES[15] - (( 2.00000*ALGEBRAIC[44]+ALGEBRAIC[58]) - (ALGEBRAIC[65]+ALGEBRAIC[20]+ALGEBRAIC[43]+ALGEBRAIC[68]+ALGEBRAIC[60]))/( 2.00000*CONSTANTS[49]*CONSTANTS[2]) - ALGEBRAIC[53];
resid[19] = RATES[1] - (CONSTANTS[27] - STATES[1])/CONSTANTS[29]+(ALGEBRAIC[64]+ 3.00000*ALGEBRAIC[44]+ 3.00000*ALGEBRAIC[42]+ALGEBRAIC[67]+ALGEBRAIC[35])/( CONSTANTS[2]*CONSTANTS[50]);
resid[20] = RATES[14] - (CONSTANTS[10] - STATES[14])/CONSTANTS[29]+( - 2.00000*ALGEBRAIC[42]+ALGEBRAIC[66]+ALGEBRAIC[69]+ALGEBRAIC[36])/( CONSTANTS[2]*CONSTANTS[50]);
resid[21] = RATES[16] - (CONSTANTS[28] - STATES[16])/CONSTANTS[29]+( - 2.00000*ALGEBRAIC[44]+ALGEBRAIC[65]+ALGEBRAIC[20]+ALGEBRAIC[43]+ALGEBRAIC[68])/( 2.00000*CONSTANTS[2]*CONSTANTS[50]);
resid[22] = RATES[25] - ALGEBRAIC[57];
resid[23] = RATES[26] -  0.960000*STATES[28] -  ALGEBRAIC[55]*STATES[26];
resid[24] = RATES[27] -  ALGEBRAIC[55]*STATES[26] -  ALGEBRAIC[56]*STATES[27];
resid[25] = RATES[28] -  ALGEBRAIC[56]*STATES[27] -  0.960000*STATES[28];
resid[26] = RATES[23] - (ALGEBRAIC[60] - ALGEBRAIC[59])/( 2.00000*CONSTANTS[53]*CONSTANTS[2]);
resid[27] = RATES[24] - (ALGEBRAIC[59] - ALGEBRAIC[58])/( 2.00000*CONSTANTS[54]*CONSTANTS[2]) -  11.4800*ALGEBRAIC[57];
resid[28] = RATES[5] -  1.00000*( CONSTANTS[42]*((1.00000+CONSTANTS[38]/(CONSTANTS[38]+CONSTANTS[39])) - ( CONSTANTS[44]*CONSTANTS[5])/( CONSTANTS[44]*CONSTANTS[5]+CONSTANTS[40])) - ( CONSTANTS[43]*CONSTANTS[37]*STATES[5])/(STATES[5]+ CONSTANTS[41]*CONSTANTS[37]));
}
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] = ( - 824.000*(STATES[0]+51.9000))/(exp((STATES[0]+51.9000)/- 8.90000) - 1.00000);
ALGEBRAIC[1] =  32960.0*exp((STATES[0]+51.9000)/- 8.90000);
ALGEBRAIC[2] = ALGEBRAIC[0]/(ALGEBRAIC[0]+ALGEBRAIC[1]);
ALGEBRAIC[3] = 1.00000/(ALGEBRAIC[0]+ALGEBRAIC[1])+1.50000e-05;
ALGEBRAIC[4] =  165.000*exp((STATES[0]+101.300)/- 12.6000);
ALGEBRAIC[5] = 12360.0/( 320.000*exp((STATES[0]+101.300)/- 12.6000)+1.00000);
ALGEBRAIC[6] = ALGEBRAIC[4]/(ALGEBRAIC[4]+ALGEBRAIC[5]);
ALGEBRAIC[7] = 1.00000/(ALGEBRAIC[4]+ALGEBRAIC[5]);
ALGEBRAIC[8] = ALGEBRAIC[6];
ALGEBRAIC[9] =  20.0000*ALGEBRAIC[7];
ALGEBRAIC[12] = ( - 28.3900*(STATES[0]+35.0000))/(exp((STATES[0]+35.0000)/- 2.50000) - 1.00000)+( - 84.9000*STATES[0])/(exp( - 0.208000*STATES[0]) - 1.00000);
ALGEBRAIC[13] = ( 11.4300*(STATES[0] - 5.00000))/(exp( 0.400000*(STATES[0] - 5.00000)) - 1.00000);
ALGEBRAIC[14] = 1.00000/(ALGEBRAIC[12]+ALGEBRAIC[13]);
ALGEBRAIC[15] = 1.00000/(1.00000+exp((STATES[0]+14.1000)/- 6.00000));
ALGEBRAIC[16] = ( 3.75000*(STATES[0]+28.0000))/(exp((STATES[0]+28.0000)/4.00000) - 1.00000);
ALGEBRAIC[17] = 30.0000/(1.00000+exp((STATES[0]+28.0000)/- 4.00000));
ALGEBRAIC[18] = 1.00000/(ALGEBRAIC[16]+ALGEBRAIC[17]);
ALGEBRAIC[19] = 1.00000/(1.00000+exp((STATES[0]+30.0000)/5.00000));
ALGEBRAIC[20] =  CONSTANTS[8]*STATES[8]*STATES[9]*(STATES[0] - CONSTANTS[9]);
ALGEBRAIC[21] =  1068.00*exp((STATES[0]+26.3000)/30.0000);
ALGEBRAIC[22] =  1068.00*exp((STATES[0]+26.3000)/- 30.0000);
ALGEBRAIC[23] = 1.00000/(ALGEBRAIC[21]+ALGEBRAIC[22]);
ALGEBRAIC[24] = 1.00000/(1.00000+exp((STATES[0]+26.3000)/- 6.00000));
ALGEBRAIC[25] =  15.3000*exp((STATES[0]+61.7000)/- 83.3000);
ALGEBRAIC[26] =  15.0000*exp((STATES[0]+61.7000)/15.3800);
ALGEBRAIC[27] = 1.00000/(ALGEBRAIC[25]+ALGEBRAIC[26]);
ALGEBRAIC[28] = 1.00000/(1.00000+exp((STATES[0]+61.7000)/5.60000));
ALGEBRAIC[31] = 1.00000/(1.00000+exp((STATES[0]+5.10000)/- 7.40000));
ALGEBRAIC[32] = 1.00000/( 17.0000*exp( 0.0398000*STATES[0])+ 2.11000*exp( - 0.0510000*STATES[0]));
ALGEBRAIC[33] =  100.000*exp( - 0.0183000*STATES[0]);
ALGEBRAIC[34] =  656.000*exp( 0.00942000*STATES[0]);
ALGEBRAIC[35] =  CONSTANTS[14]*pow(STATES[12], 2.00000)*(STATES[0] - 75.0000);
ALGEBRAIC[36] =  CONSTANTS[15]*pow(STATES[12], 2.00000)*(STATES[0]+85.0000);
ALGEBRAIC[37] = ALGEBRAIC[35]+ALGEBRAIC[36];
ALGEBRAIC[38] = 20.5000/(1.00000+exp((STATES[5] - 0.00340000)/- 0.000500000)) - 78.5600;
ALGEBRAIC[39] = 1.00000/(1.00000+exp((STATES[0] - ALGEBRAIC[38])/9.00000));
ALGEBRAIC[40] = 1.00000/( 1.64830*exp((STATES[0]+54.0600)/- 24.3300)+14.0106/(0.700000+exp((STATES[0]+60.0000)/- 5.50000)));
ALGEBRAIC[41] = 1.60000/(1.00000+exp((STATES[5] - 0.00375000)/- 0.000150000))+0.990000;
ALGEBRAIC[42] = (CONDVAR[0]<0.00000 ? ( (2.00000 - ALGEBRAIC[41])*CONSTANTS[18]*pow(STATES[13]/(CONSTANTS[16]+STATES[13]), 3.00000)*pow(STATES[14]/(CONSTANTS[17]+STATES[14]), 2.00000)*1.60000)/(1.50000+exp((STATES[0]+60.0000)/- 40.0000)) : ( ALGEBRAIC[41]*CONSTANTS[18]*pow(STATES[13]/(CONSTANTS[16]+STATES[13]), 3.00000)*pow(STATES[14]/(CONSTANTS[17]+STATES[14]), 2.00000)*1.60000)/(1.50000+exp((STATES[0]+60.0000)/- 40.0000)));
ALGEBRAIC[43] = ( CONSTANTS[19]*STATES[15])/(STATES[15]+0.000400000);
ALGEBRAIC[44] = ( CONSTANTS[20]*( pow(STATES[13], 3.00000)*STATES[16]*exp( 0.0374300*STATES[0]*CONSTANTS[22]) -  pow(STATES[1], 3.00000)*STATES[15]*exp( 0.0374300*STATES[0]*(CONSTANTS[22] - 1.00000))))/(1.00000+ CONSTANTS[21]*( STATES[15]*pow(STATES[1], 3.00000)+ STATES[16]*pow(STATES[13], 3.00000)));
ALGEBRAIC[45] =  17.0000*exp( 0.0133000*(STATES[0]+40.0000));
ALGEBRAIC[46] =  129000.*STATES[15]*(1.00000 - STATES[19]) -  307.000*STATES[19];
ALGEBRAIC[47] =  50500.0*STATES[15]*(1.00000 - STATES[20]) -  252.000*STATES[20];
ALGEBRAIC[48] =  129000.*STATES[15]*(1.00000 - (STATES[21]+STATES[22])) -  4.25000*STATES[21];
ALGEBRAIC[49] =  1290.00*CONSTANTS[25]*(1.00000 - (STATES[21]+STATES[22])) -  429.000*STATES[22];
ALGEBRAIC[50] =  0.0900000*ALGEBRAIC[46];
ALGEBRAIC[51] =  0.0310000*ALGEBRAIC[47];
ALGEBRAIC[52] =  0.0620000*ALGEBRAIC[48];
ALGEBRAIC[53] = ALGEBRAIC[50]+ALGEBRAIC[51]+ALGEBRAIC[52];
ALGEBRAIC[55] =  240.000*exp( (STATES[0] - 40.0000)*0.0800000)+ 240.000*pow(STATES[15]/(STATES[15]+CONSTANTS[36]), 4.00000);
ALGEBRAIC[56] = 40.0000+ 240.000*pow(STATES[15]/(STATES[15]+CONSTANTS[36]), 4.00000);
ALGEBRAIC[57] =  770.000*STATES[24]*(1.00000 - STATES[25]) -  641.000*STATES[25];
ALGEBRAIC[58] =  CONSTANTS[32]*pow(STATES[27]/(STATES[27]+0.250000), 2.00000)*STATES[24];
ALGEBRAIC[59] = ( (STATES[23] - STATES[24])*2.00000*CONSTANTS[2]*CONSTANTS[53])/0.0641800;
ALGEBRAIC[54] = STATES[15]+ STATES[23]*CONSTANTS[51]+ CONSTANTS[33]*CONSTANTS[34]+CONSTANTS[33];
ALGEBRAIC[60] = ( CONSTANTS[30]*STATES[15] -  CONSTANTS[31]*STATES[23]*CONSTANTS[51])/ALGEBRAIC[54];
ALGEBRAIC[61] =  (( CONSTANTS[0]*CONSTANTS[1])/CONSTANTS[2])*log(STATES[1]/STATES[13]);
ALGEBRAIC[64] = ( (( CONSTANTS[45]*CONSTANTS[4]*pow(STATES[2], 3.00000)*STATES[3]*STATES[4]*STATES[1]*STATES[0]*pow(CONSTANTS[2], 2.00000))/( CONSTANTS[0]*CONSTANTS[1]))*(exp(( (STATES[0] - ALGEBRAIC[61])*CONSTANTS[2])/( CONSTANTS[0]*CONSTANTS[1])) - 1.00000))/(exp(( STATES[0]*CONSTANTS[2])/( CONSTANTS[0]*CONSTANTS[1])) - 1.00000);
ALGEBRAIC[10] =  0.400000*(1.00000+( 4.50000*STATES[5])/(STATES[5]+0.00650000))+0.0315700;
ALGEBRAIC[11] =  CONSTANTS[6]*ALGEBRAIC[10];
ALGEBRAIC[65] =  ALGEBRAIC[11]*( STATES[7]*STATES[6]+ 0.0950000*ALGEBRAIC[15])*(STATES[0] - CONSTANTS[7]);
ALGEBRAIC[29] =  0.620000*(1.00000+( 2.61290*STATES[5])/(STATES[5]+0.00900000)) - 0.0250000;
ALGEBRAIC[30] =  ALGEBRAIC[29]*0.00693000*pow(CONSTANTS[10]/1.00000, 0.590000);
ALGEBRAIC[62] =  (( CONSTANTS[0]*CONSTANTS[1])/CONSTANTS[2])*log(STATES[14]/STATES[18]);
ALGEBRAIC[66] =  ALGEBRAIC[30]*STATES[10]*STATES[11]*(STATES[0] - ALGEBRAIC[62]);
ALGEBRAIC[67] =  CONSTANTS[46]*CONSTANTS[11]*(STATES[0] - ALGEBRAIC[61]);
ALGEBRAIC[63] =  (( 0.500000*CONSTANTS[0]*CONSTANTS[1])/CONSTANTS[2])*log(STATES[16]/STATES[15]);
ALGEBRAIC[68] =  CONSTANTS[12]*(STATES[0] - ALGEBRAIC[63]);
ALGEBRAIC[69] =  CONSTANTS[13]*(STATES[0] - ALGEBRAIC[62]);
ALGEBRAIC[70] = ALGEBRAIC[67]+ALGEBRAIC[68]+ALGEBRAIC[69];
ALGEBRAIC[71] =  CONSTANTS[52]*(STATES[0] - ALGEBRAIC[62]);
ALGEBRAIC[72] =  STATES[17]*ALGEBRAIC[71];
}
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] = STATES[15] - 0.000150000;
}