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 72 entries in the algebraic variable array.
   There are a total of 26 entries in each of the rate and state variable arrays.
   There are a total of 48 entries in the constant variable array.
 */
/*
 * VOI is time in component environment (millisecond).
 * STATES[0] is V in component membrane (millivolt).
 * CONSTANTS[0] is R in component membrane (joule_per_mole_kelvin).
 * CONSTANTS[1] is T in component membrane (kelvin).
 * CONSTANTS[2] is F in component membrane (coulomb_per_millimole).
 * CONSTANTS[3] is Cm in component membrane (picoF).
 * ALGEBRAIC[0] is i_st in component membrane (picoA).
 * ALGEBRAIC[67] is i_Na in component fast_sodium_current (picoA).
 * ALGEBRAIC[15] is i_K1 in component time_independent_potassium_current (picoA).
 * ALGEBRAIC[16] is i_to in component transient_outward_K_current (picoA).
 * ALGEBRAIC[23] is i_Kur in component ultrarapid_delayed_rectifier_K_current (picoA).
 * ALGEBRAIC[32] is i_Kr in component rapid_delayed_rectifier_K_current (picoA).
 * ALGEBRAIC[37] is i_Ks in component slow_delayed_rectifier_K_current (picoA).
 * ALGEBRAIC[45] is i_Ca_L in component L_type_Ca_channel (picoA).
 * ALGEBRAIC[57] is i_CaP in component sarcolemmal_calcium_pump_current (picoA).
 * ALGEBRAIC[52] is i_NaK in component sodium_potassium_pump (picoA).
 * ALGEBRAIC[56] is i_NaCa in component Na_Ca_exchanger_current (picoA).
 * ALGEBRAIC[53] is i_B_Na in component background_currents (picoA).
 * ALGEBRAIC[54] is i_B_Ca in component background_currents (picoA).
 * ALGEBRAIC[55] is i_B_Cl in component background_currents (picoA).
 * ALGEBRAIC[42] is i_K_Ach in component i_K_Ach (picoA).
 * CONSTANTS[4] is stim_start in component membrane (millisecond).
 * CONSTANTS[5] is stim_end in component membrane (millisecond).
 * CONSTANTS[6] is stim_period in component membrane (millisecond).
 * CONSTANTS[7] is stim_duration in component membrane (millisecond).
 * CONSTANTS[8] is stim_amplitude in component membrane (picoA).
 * ALGEBRAIC[1] is E_Na in component fast_sodium_current (millivolt).
 * CONSTANTS[9] is g_Na in component fast_sodium_current (nanoS_per_picoF).
 * STATES[1] is Na_i in component intracellular_ion_concentrations (millimolar).
 * CONSTANTS[10] is Na_o in component standard_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[2] is alpha_m in component fast_sodium_current_m_gate (per_millisecond).
 * ALGEBRAIC[3] is beta_m in component fast_sodium_current_m_gate (per_millisecond).
 * ALGEBRAIC[4] is m_inf in component fast_sodium_current_m_gate (dimensionless).
 * ALGEBRAIC[5] is tau_m in component fast_sodium_current_m_gate (millisecond).
 * ALGEBRAIC[6] is alpha_h in component fast_sodium_current_h_gate (per_millisecond).
 * ALGEBRAIC[7] is beta_h in component fast_sodium_current_h_gate (per_millisecond).
 * ALGEBRAIC[8] is h_inf in component fast_sodium_current_h_gate (dimensionless).
 * ALGEBRAIC[9] is tau_h in component fast_sodium_current_h_gate (millisecond).
 * ALGEBRAIC[10] is alpha_j in component fast_sodium_current_j_gate (per_millisecond).
 * ALGEBRAIC[11] is beta_j in component fast_sodium_current_j_gate (per_millisecond).
 * ALGEBRAIC[12] is j_inf in component fast_sodium_current_j_gate (dimensionless).
 * ALGEBRAIC[13] is tau_j in component fast_sodium_current_j_gate (millisecond).
 * ALGEBRAIC[14] is E_K in component time_independent_potassium_current (millivolt).
 * CONSTANTS[11] is g_K1 in component time_independent_potassium_current (nanoS_per_picoF).
 * CONSTANTS[12] is K_o in component standard_ionic_concentrations (millimolar).
 * STATES[5] is K_i in component intracellular_ion_concentrations (millimolar).
 * CONSTANTS[13] is g_to in component transient_outward_K_current (nanoS_per_picoF).
 * STATES[6] is oa in component transient_outward_K_current_oa_gate (dimensionless).
 * STATES[7] is oi in component transient_outward_K_current_oi_gate (dimensionless).
 * ALGEBRAIC[17] is tau_oa in component transient_outward_K_current_oa_gate (millisecond).
 * ALGEBRAIC[18] is oa_infinity in component transient_outward_K_current_oa_gate (dimensionless).
 * ALGEBRAIC[19] is alpha_oi in component transient_outward_K_current_oi_gate (per_millisecond).
 * ALGEBRAIC[20] is beta_oi in component transient_outward_K_current_oi_gate (per_millisecond).
 * ALGEBRAIC[21] is tau_oi in component transient_outward_K_current_oi_gate (millisecond).
 * ALGEBRAIC[22] is oi_infinity in component transient_outward_K_current_oi_gate (dimensionless).
 * CONSTANTS[14] is g_Kur in component ultrarapid_delayed_rectifier_K_current (nanoS_per_picoF).
 * STATES[8] is ua in component ultrarapid_delayed_rectifier_K_current_ua_gate (dimensionless).
 * STATES[9] is ui in component ultrarapid_delayed_rectifier_K_current_ui_gate (dimensionless).
 * ALGEBRAIC[24] is alpha_ua in component ultrarapid_delayed_rectifier_K_current_ua_gate (per_millisecond).
 * ALGEBRAIC[25] is beta_ua in component ultrarapid_delayed_rectifier_K_current_ua_gate (per_millisecond).
 * ALGEBRAIC[26] is tau_ua in component ultrarapid_delayed_rectifier_K_current_ua_gate (millisecond).
 * ALGEBRAIC[27] is ua_infinity in component ultrarapid_delayed_rectifier_K_current_ua_gate (dimensionless).
 * ALGEBRAIC[28] is alpha_ui in component ultrarapid_delayed_rectifier_K_current_ui_gate (per_millisecond).
 * ALGEBRAIC[29] is beta_ui in component ultrarapid_delayed_rectifier_K_current_ui_gate (per_millisecond).
 * ALGEBRAIC[30] is tau_ui in component ultrarapid_delayed_rectifier_K_current_ui_gate (millisecond).
 * ALGEBRAIC[31] is ui_infinity in component ultrarapid_delayed_rectifier_K_current_ui_gate (dimensionless).
 * CONSTANTS[15] is g_Kr in component rapid_delayed_rectifier_K_current (nanoS_per_picoF).
 * STATES[10] is xr in component rapid_delayed_rectifier_K_current_xr_gate (dimensionless).
 * ALGEBRAIC[33] is alpha_xr in component rapid_delayed_rectifier_K_current_xr_gate (per_millisecond).
 * ALGEBRAIC[34] is beta_xr in component rapid_delayed_rectifier_K_current_xr_gate (per_millisecond).
 * ALGEBRAIC[35] is tau_xr in component rapid_delayed_rectifier_K_current_xr_gate (millisecond).
 * ALGEBRAIC[36] is xr_infinity in component rapid_delayed_rectifier_K_current_xr_gate (dimensionless).
 * CONSTANTS[16] is g_Ks in component slow_delayed_rectifier_K_current (nanoS_per_picoF).
 * STATES[11] is xs in component slow_delayed_rectifier_K_current_xs_gate (dimensionless).
 * ALGEBRAIC[38] is alpha_xs in component slow_delayed_rectifier_K_current_xs_gate (per_millisecond).
 * ALGEBRAIC[39] is beta_xs in component slow_delayed_rectifier_K_current_xs_gate (per_millisecond).
 * ALGEBRAIC[40] is tau_xs in component slow_delayed_rectifier_K_current_xs_gate (millisecond).
 * ALGEBRAIC[41] is xs_infinity in component slow_delayed_rectifier_K_current_xs_gate (dimensionless).
 * CONSTANTS[17] is g_K_Ach in component i_K_Ach (nanoS_per_picoF).
 * STATES[12] is xa in component i_K_Ach_xa_gate (dimensionless).
 * ALGEBRAIC[43] is tau_xa in component i_K_Ach_xa_gate (millisecond).
 * ALGEBRAIC[44] is xa_infinity in component i_K_Ach_xa_gate (dimensionless).
 * CONSTANTS[18] is g_Ca_L in component L_type_Ca_channel (nanoS_per_picoF).
 * STATES[13] is Ca_i in component intracellular_ion_concentrations (millimolar).
 * STATES[14] is d in component L_type_Ca_channel_d_gate (dimensionless).
 * STATES[15] is f in component L_type_Ca_channel_f_gate (dimensionless).
 * STATES[16] is f_Ca in component L_type_Ca_channel_f_Ca_gate (dimensionless).
 * ALGEBRAIC[46] is d_infinity in component L_type_Ca_channel_d_gate (dimensionless).
 * ALGEBRAIC[47] is tau_d in component L_type_Ca_channel_d_gate (millisecond).
 * ALGEBRAIC[48] is f_infinity in component L_type_Ca_channel_f_gate (dimensionless).
 * ALGEBRAIC[49] is tau_f in component L_type_Ca_channel_f_gate (millisecond).
 * ALGEBRAIC[50] is f_Ca_infinity in component L_type_Ca_channel_f_Ca_gate (dimensionless).
 * CONSTANTS[43] is tau_f_Ca in component L_type_Ca_channel_f_Ca_gate (millisecond).
 * CONSTANTS[19] is Km_Na_i in component sodium_potassium_pump (millimolar).
 * CONSTANTS[20] is Km_K_o in component sodium_potassium_pump (millimolar).
 * CONSTANTS[21] is i_NaK_max in component sodium_potassium_pump (picoA_per_picoF).
 * ALGEBRAIC[51] is f_NaK in component sodium_potassium_pump (dimensionless).
 * CONSTANTS[44] is sigma in component sodium_potassium_pump (dimensionless).
 * CONSTANTS[22] is g_B_Na in component background_currents (nanoS_per_picoF).
 * CONSTANTS[23] is g_B_Ca in component background_currents (nanoS_per_picoF).
 * CONSTANTS[24] is g_B_Cl in component background_currents (nanoS_per_picoF).
 * CONSTANTS[25] is Ca_o in component standard_ionic_concentrations (millimolar).
 * STATES[17] is Cl_i in component intracellular_ion_concentrations (millimolar).
 * CONSTANTS[26] is Cl_o in component standard_ionic_concentrations (millimolar).
 * CONSTANTS[27] is I_NaCa_max in component Na_Ca_exchanger_current (picoA_per_picoF).
 * CONSTANTS[28] is K_mNa in component Na_Ca_exchanger_current (millimolar).
 * CONSTANTS[29] is K_mCa in component Na_Ca_exchanger_current (millimolar).
 * CONSTANTS[30] is K_sat in component Na_Ca_exchanger_current (dimensionless).
 * CONSTANTS[31] is gamma in component Na_Ca_exchanger_current (dimensionless).
 * CONSTANTS[32] is i_CaP_max in component sarcolemmal_calcium_pump_current (picoA_per_picoF).
 * ALGEBRAIC[58] is i_rel in component Ca_release_current_from_JSR (millimolar_per_millisecond).
 * ALGEBRAIC[68] is Fn in component Ca_release_current_from_JSR (dimensionless).
 * CONSTANTS[33] is K_rel in component Ca_release_current_from_JSR (per_millisecond).
 * CONSTANTS[46] is V_rel in component intracellular_ion_concentrations (micrometre_3).
 * STATES[18] is Ca_rel in component intracellular_ion_concentrations (millimolar).
 * STATES[19] is u in component Ca_release_current_from_JSR_u_gate (dimensionless).
 * STATES[20] is v in component Ca_release_current_from_JSR_v_gate (dimensionless).
 * STATES[21] is w in component Ca_release_current_from_JSR_w_gate (dimensionless).
 * CONSTANTS[45] is tau_u in component Ca_release_current_from_JSR_u_gate (millisecond).
 * ALGEBRAIC[69] is u_infinity in component Ca_release_current_from_JSR_u_gate (dimensionless).
 * ALGEBRAIC[70] is tau_v in component Ca_release_current_from_JSR_v_gate (millisecond).
 * ALGEBRAIC[71] is v_infinity in component Ca_release_current_from_JSR_v_gate (dimensionless).
 * ALGEBRAIC[59] is tau_w in component Ca_release_current_from_JSR_w_gate (millisecond).
 * ALGEBRAIC[60] is w_infinity in component Ca_release_current_from_JSR_w_gate (dimensionless).
 * ALGEBRAIC[61] is i_tr in component transfer_current_from_NSR_to_JSR (millimolar_per_millisecond).
 * CONSTANTS[34] is tau_tr in component transfer_current_from_NSR_to_JSR (millisecond).
 * STATES[22] is Ca_up in component intracellular_ion_concentrations (millimolar).
 * CONSTANTS[35] is I_up_max in component Ca_uptake_current_by_the_NSR (millimolar_per_millisecond).
 * ALGEBRAIC[62] is i_up in component Ca_uptake_current_by_the_NSR (millimolar_per_millisecond).
 * CONSTANTS[36] is K_up in component Ca_uptake_current_by_the_NSR (millimolar).
 * ALGEBRAIC[63] is i_up_leak in component Ca_leak_current_by_the_NSR (millimolar_per_millisecond).
 * CONSTANTS[37] is Ca_up_max in component Ca_leak_current_by_the_NSR (millimolar).
 * CONSTANTS[38] is CMDN_max in component Ca_buffers (millimolar).
 * CONSTANTS[39] is TRPN_max in component Ca_buffers (millimolar).
 * CONSTANTS[40] is CSQN_max in component Ca_buffers (millimolar).
 * STATES[23] is Ca_CMDN in component Ca_buffers (millimolar).
 * STATES[24] is Ca_TRPN in component Ca_buffers (millimolar).
 * STATES[25] is Ca_CSQN in component Ca_buffers (millimolar).
 * ALGEBRAIC[64] is var_CMDN in component Ca_buffers (millimolar).
 * ALGEBRAIC[65] is var_TRPN in component Ca_buffers (millimolar).
 * ALGEBRAIC[66] is var_CSQN in component Ca_buffers (millimolar).
 * CONSTANTS[41] is V_cell in component intracellular_ion_concentrations (micrometre_3).
 * CONSTANTS[42] is V_i in component intracellular_ion_concentrations (micrometre_3).
 * CONSTANTS[47] is V_up in component intracellular_ion_concentrations (micrometre_3).
 * 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[6] is d/dt oa in component transient_outward_K_current_oa_gate (dimensionless).
 * RATES[7] is d/dt oi in component transient_outward_K_current_oi_gate (dimensionless).
 * RATES[8] is d/dt ua in component ultrarapid_delayed_rectifier_K_current_ua_gate (dimensionless).
 * RATES[9] is d/dt ui in component ultrarapid_delayed_rectifier_K_current_ui_gate (dimensionless).
 * RATES[10] is d/dt xr in component rapid_delayed_rectifier_K_current_xr_gate (dimensionless).
 * RATES[11] is d/dt xs in component slow_delayed_rectifier_K_current_xs_gate (dimensionless).
 * RATES[12] is d/dt xa in component i_K_Ach_xa_gate (dimensionless).
 * RATES[14] is d/dt d in component L_type_Ca_channel_d_gate (dimensionless).
 * RATES[15] is d/dt f in component L_type_Ca_channel_f_gate (dimensionless).
 * RATES[16] is d/dt f_Ca in component L_type_Ca_channel_f_Ca_gate (dimensionless).
 * RATES[19] is d/dt u in component Ca_release_current_from_JSR_u_gate (dimensionless).
 * RATES[20] is d/dt v in component Ca_release_current_from_JSR_v_gate (dimensionless).
 * RATES[21] is d/dt w in component Ca_release_current_from_JSR_w_gate (dimensionless).
 * RATES[23] is d/dt Ca_CMDN in component Ca_buffers (millimolar).
 * RATES[24] is d/dt Ca_TRPN in component Ca_buffers (millimolar).
 * RATES[25] is d/dt Ca_CSQN in component Ca_buffers (millimolar).
 * RATES[1] is d/dt Na_i in component intracellular_ion_concentrations (millimolar).
 * RATES[5] is d/dt K_i in component intracellular_ion_concentrations (millimolar).
 * RATES[17] is d/dt Cl_i in component intracellular_ion_concentrations (millimolar).
 * RATES[13] is d/dt Ca_i in component intracellular_ion_concentrations (millimolar).
 * RATES[22] is d/dt Ca_up in component intracellular_ion_concentrations (millimolar).
 * RATES[18] is d/dt Ca_rel in component intracellular_ion_concentrations (millimolar).
 * There are a total of 11 condition variables.
 */
void
initConsts(double* CONSTANTS, double* RATES, double *STATES)
{
STATES[0] = -85.53;
CONSTANTS[0] = 8.3143;
CONSTANTS[1] = 310;
CONSTANTS[2] = 96.4867;
CONSTANTS[3] = 100;
CONSTANTS[4] = 50;
CONSTANTS[5] = 50000;
CONSTANTS[6] = 1000;
CONSTANTS[7] = 2;
CONSTANTS[8] = -2000;
CONSTANTS[9] = 7.8;
STATES[1] = 11.75;
CONSTANTS[10] = 140;
STATES[2] = 1.972e-3;
STATES[3] = 9.791e-1;
STATES[4] = 9.869e-1;
CONSTANTS[11] = 0.1;
CONSTANTS[12] = 5.4;
STATES[5] = 138.4;
CONSTANTS[13] = 0.096;
STATES[6] = 7.164e-2;
STATES[7] = 9.992e-1;
CONSTANTS[14] = 0.0115;
STATES[8] = 0.05869;
STATES[9] = 9.987e-1;
CONSTANTS[15] = 0.0145;
STATES[10] = 7.433e-7;
CONSTANTS[16] = 0.052;
STATES[11] = 0.01791;
CONSTANTS[17] = 0.0045;
STATES[12] = 1e-5;
CONSTANTS[18] = 0.34;
STATES[13] = 1.024e-4;
STATES[14] = 4.757e-6;
STATES[15] = 0.9999;
STATES[16] = 0.7484;
CONSTANTS[19] = 10;
CONSTANTS[20] = 1.5;
CONSTANTS[21] = 0.6;
CONSTANTS[22] = 1e-5;
CONSTANTS[23] = 1e-5;
CONSTANTS[24] = 8e-4;
CONSTANTS[25] = 1.8;
STATES[17] = 29.26;
CONSTANTS[26] = 132;
CONSTANTS[27] = 1600;
CONSTANTS[28] = 87.5;
CONSTANTS[29] = 1.38;
CONSTANTS[30] = 0.1;
CONSTANTS[31] = 0.35;
CONSTANTS[32] = 0.275;
CONSTANTS[33] = 8;
STATES[18] = 1.502;
STATES[19] = 0;
STATES[20] = 1;
STATES[21] = 0.9993;
CONSTANTS[34] = 180;
STATES[22] = 1.502;
CONSTANTS[35] = 0.0035;
CONSTANTS[36] = 6e-4;
CONSTANTS[37] = 27;
CONSTANTS[38] = 0.045;
CONSTANTS[39] = 0.35;
CONSTANTS[40] = 10;
STATES[23] = 1.856e-3;
STATES[24] = 7.022e-3;
STATES[25] = 6.432;
CONSTANTS[41] = 20100;
CONSTANTS[42] =  CONSTANTS[41]*0.680000;
CONSTANTS[43] = 2.00000;
CONSTANTS[44] =  (1.00000/7.00000)*(exp(CONSTANTS[10]/67.3000) - 1.00000);
CONSTANTS[45] = 11.2000;
CONSTANTS[46] =  0.00480000*CONSTANTS[41];
CONSTANTS[47] =  0.0552000*CONSTANTS[41];
RATES[0] = 0.1;
RATES[2] = 0.1;
RATES[3] = 0.1;
RATES[4] = 0.1;
RATES[6] = 0.1;
RATES[7] = 0.1;
RATES[8] = 0.1;
RATES[9] = 0.1;
RATES[10] = 0.1;
RATES[11] = 0.1;
RATES[12] = 0.1;
RATES[14] = 0.1;
RATES[15] = 0.1;
RATES[16] = 0.1;
RATES[19] = 0.1;
RATES[20] = 0.1;
RATES[21] = 0.1;
RATES[23] = 0.1;
RATES[24] = 0.1;
RATES[25] = 0.1;
RATES[1] = 0.1;
RATES[5] = 0.1;
RATES[17] = 0.1;
RATES[13] = 0.1;
RATES[22] = 0.1;
RATES[18] = 0.1;
}
void
computeResiduals(double VOI, double* CONSTANTS, double* RATES, double* OLDRATES, double* STATES,
                 double* OLDSTATES, double* ALGEBRAIC, double* CONDVARS)
{
resid[0] = RATES[0] - - (ALGEBRAIC[67]+ALGEBRAIC[15]+ALGEBRAIC[16]+ALGEBRAIC[23]+ALGEBRAIC[32]+ALGEBRAIC[37]+ALGEBRAIC[53]+ALGEBRAIC[54]+ALGEBRAIC[52]+ALGEBRAIC[57]+ALGEBRAIC[56]+ALGEBRAIC[45]+ALGEBRAIC[0]+ALGEBRAIC[55]+ALGEBRAIC[42])/CONSTANTS[3];
resid[1] = RATES[2] - (ALGEBRAIC[4] - STATES[2])/ALGEBRAIC[5];
resid[2] = RATES[3] - (ALGEBRAIC[8] - STATES[3])/ALGEBRAIC[9];
resid[3] = RATES[4] - (ALGEBRAIC[12] - STATES[4])/ALGEBRAIC[13];
resid[4] = RATES[6] - (ALGEBRAIC[18] - STATES[6])/ALGEBRAIC[17];
resid[5] = RATES[7] - (ALGEBRAIC[22] - STATES[7])/ALGEBRAIC[21];
resid[6] = RATES[8] - (ALGEBRAIC[27] - STATES[8])/ALGEBRAIC[26];
resid[7] = RATES[9] - (ALGEBRAIC[31] - STATES[9])/ALGEBRAIC[30];
resid[8] = RATES[10] - (ALGEBRAIC[36] - STATES[10])/ALGEBRAIC[35];
resid[9] = RATES[11] - (ALGEBRAIC[41] - STATES[11])/ALGEBRAIC[40];
resid[10] = RATES[12] - (ALGEBRAIC[44] - STATES[12])/ALGEBRAIC[43];
resid[11] = RATES[14] - (ALGEBRAIC[46] - STATES[14])/ALGEBRAIC[47];
resid[12] = RATES[15] - (ALGEBRAIC[48] - STATES[15])/ALGEBRAIC[49];
resid[13] = RATES[16] - (ALGEBRAIC[50] - STATES[16])/CONSTANTS[43];
resid[14] = RATES[19] - (ALGEBRAIC[69] - STATES[19])/CONSTANTS[45];
resid[15] = RATES[20] - (ALGEBRAIC[71] - STATES[20])/ALGEBRAIC[70];
resid[16] = RATES[21] - (ALGEBRAIC[60] - STATES[21])/ALGEBRAIC[59];
resid[17] = RATES[23] -  ALGEBRAIC[64]*CONSTANTS[38];
resid[18] = RATES[24] -  ALGEBRAIC[65]*CONSTANTS[39];
resid[19] = RATES[25] -  ALGEBRAIC[66]*CONSTANTS[40];
resid[20] = RATES[1] - ( - 3.00000*ALGEBRAIC[52] - ( 3.00000*ALGEBRAIC[56]+ALGEBRAIC[53]+ALGEBRAIC[67]))/( CONSTANTS[42]*CONSTANTS[2]);
resid[21] = RATES[5] - ( 2.00000*ALGEBRAIC[52] - (ALGEBRAIC[15]+ALGEBRAIC[16]+ALGEBRAIC[23]+ALGEBRAIC[32]+ALGEBRAIC[37]+ALGEBRAIC[42]))/( CONSTANTS[42]*CONSTANTS[2]);
resid[22] = RATES[17] - ALGEBRAIC[55]/( CONSTANTS[42]*CONSTANTS[2]);
resid[23] = RATES[13] - ((( 2.00000*ALGEBRAIC[56] - (ALGEBRAIC[57]+ALGEBRAIC[45]+ALGEBRAIC[54]))/( 2.00000*CONSTANTS[42]*CONSTANTS[2])+( CONSTANTS[47]*(ALGEBRAIC[63] - ALGEBRAIC[62])+ ALGEBRAIC[58]*CONSTANTS[46])/CONSTANTS[42]) -  CONSTANTS[39]*ALGEBRAIC[65]) -  CONSTANTS[38]*ALGEBRAIC[64];
resid[24] = RATES[22] - ALGEBRAIC[62] - (ALGEBRAIC[63]+( ALGEBRAIC[61]*CONSTANTS[46])/CONSTANTS[47]);
resid[25] = RATES[18] - (ALGEBRAIC[61] - ALGEBRAIC[58]) -  31.0000*ALGEBRAIC[66];
}
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[2] = (STATES[0]==- 47.1300 ? 3.20000 : ( 0.320000*(STATES[0]+47.1300))/(1.00000 - exp( - 0.100000*(STATES[0]+47.1300))));
ALGEBRAIC[3] =  0.0800000*exp(- STATES[0]/11.0000);
ALGEBRAIC[4] = ALGEBRAIC[2]/(ALGEBRAIC[2]+ALGEBRAIC[3]);
ALGEBRAIC[5] = 1.00000/(ALGEBRAIC[2]+ALGEBRAIC[3]);
ALGEBRAIC[6] = (CONDVAR[3]<0.00000 ?  0.135000*exp((STATES[0]+80.0000)/- 6.80000) : 0.00000);
ALGEBRAIC[7] = (CONDVAR[4]<0.00000 ?  3.56000*exp( 0.0790000*STATES[0])+ 310000.*exp( 0.350000*STATES[0]) : 1.00000/( 0.130000*(1.00000+exp((STATES[0]+10.6600)/- 11.1000))));
ALGEBRAIC[8] = ALGEBRAIC[6]/(ALGEBRAIC[6]+ALGEBRAIC[7]);
ALGEBRAIC[9] = 1.00000/(ALGEBRAIC[6]+ALGEBRAIC[7]);
ALGEBRAIC[10] = (CONDVAR[5]<0.00000 ? ( ( - 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[11] = (CONDVAR[6]<0.00000 ? ( 0.121200*exp( - 0.0105200*STATES[0]))/(1.00000+exp( - 0.137800*(STATES[0]+40.1400))) : ( 0.300000*exp( - 2.53500e-07*STATES[0]))/(1.00000+exp( - 0.100000*(STATES[0]+32.0000))));
ALGEBRAIC[12] = ALGEBRAIC[10]/(ALGEBRAIC[10]+ALGEBRAIC[11]);
ALGEBRAIC[13] = 1.00000/(ALGEBRAIC[10]+ALGEBRAIC[11]);
ALGEBRAIC[14] =  (( CONSTANTS[0]*CONSTANTS[1])/CONSTANTS[2])*log(CONSTANTS[12]/STATES[5]);
ALGEBRAIC[15] = ( CONSTANTS[3]*CONSTANTS[11]*(STATES[0] - ALGEBRAIC[14]))/(1.00000+exp( 0.0720000*(STATES[0] - ALGEBRAIC[14])));
ALGEBRAIC[16] =  CONSTANTS[3]*CONSTANTS[13]*pow(STATES[6], 3.00000)*STATES[7]*(STATES[0] - ALGEBRAIC[14]);
ALGEBRAIC[17] = 0.400000/exp((STATES[0] - 15.0000)/20.0000);
ALGEBRAIC[18] = pow(1.00000+exp((STATES[0] - 12.0000)/- 11.5000), - 1.00000/3.00000);
ALGEBRAIC[19] = 1.00000/(1.20000+exp((STATES[0]+95.2000)/5.85000));
ALGEBRAIC[20] = 1.00000/(9.54000+exp((STATES[0] - 48.0000)/- 20.0000));
ALGEBRAIC[21] = pow(ALGEBRAIC[19]+ALGEBRAIC[20], - 1.00000);
ALGEBRAIC[22] = pow(1.00000+exp((STATES[0]+31.0000)/6.45000), - 1.00000);
ALGEBRAIC[23] =  CONSTANTS[3]*CONSTANTS[14]*(1.00000+3.00000/(1.00000+exp((STATES[0] - 14.0000)/- 6.00000)))*pow(STATES[8], 3.00000)*STATES[9]*(STATES[0] - ALGEBRAIC[14]);
ALGEBRAIC[24] = 1.47000/(exp((STATES[0]+33.2000)/- 30.6300)+exp((STATES[0] - 27.6000)/- 30.6500));
ALGEBRAIC[25] = 0.420000/(exp((STATES[0]+26.6400)/2.49000)+exp((STATES[0]+44.4100)/20.3600));
ALGEBRAIC[26] = pow(ALGEBRAIC[24]+ALGEBRAIC[25], - 1.00000);
ALGEBRAIC[27] = pow(1.00000+exp((STATES[0]+2.81000)/- 9.49000), - 1.00000/3.00000);
ALGEBRAIC[28] = 1.00000/(21.0000+exp((STATES[0] - 185.000)/- 28.0000));
ALGEBRAIC[29] =  1.00000*exp((STATES[0] - 158.000)/16.0000);
ALGEBRAIC[30] = pow(ALGEBRAIC[28]+ALGEBRAIC[29], - 1.00000);
ALGEBRAIC[31] = pow(1.00000+exp((STATES[0] - 99.4500)/27.4800), - 1.00000);
ALGEBRAIC[32] =  CONSTANTS[3]*CONSTANTS[15]*STATES[10]*(STATES[0] - ALGEBRAIC[14])*(0.600000+1.00000/(0.500000+ 0.500000*exp((STATES[0]+8.00000)/24.4000)));
ALGEBRAIC[33] = ( 0.0400000*(STATES[0] - 248.000))/(1.00000 - exp((STATES[0] - 248.000)/- 28.0000));
ALGEBRAIC[34] = ( 0.0280000*(STATES[0]+163.000))/(exp((STATES[0]+163.000)/21.0000) - 1.00000);
ALGEBRAIC[35] = pow(ALGEBRAIC[33]+ALGEBRAIC[34], - 1.00000);
ALGEBRAIC[36] = pow(1.00000+exp((STATES[0]+7.65400)/- 5.37700), - 1.00000);
ALGEBRAIC[37] =  CONSTANTS[3]*CONSTANTS[16]*pow(STATES[11], 2.00000)*(STATES[0] - ALGEBRAIC[14]);
ALGEBRAIC[38] = (CONDVAR[7]<0.00000 ? 0.00115000 : ( 1.00000e-05*(STATES[0]+28.5000))/(1.00000 - exp((STATES[0]+28.5000)/- 115.000)));
ALGEBRAIC[39] = (CONDVAR[8]<0.00000 ? 0.000759000 : ( 0.000230000*(STATES[0]+28.5000))/(exp((STATES[0]+28.5000)/3.30000) - 1.00000));
ALGEBRAIC[40] = pow(ALGEBRAIC[38]+ALGEBRAIC[39], - 1.00000);
ALGEBRAIC[41] = pow(1.00000+exp((STATES[0] - 13.0000)/- 12.0000), - 0.500000);
ALGEBRAIC[42] = ( CONSTANTS[3]*CONSTANTS[17]*STATES[12]*(STATES[0] - ALGEBRAIC[14]))/(0.100000+exp( 0.0780000*((STATES[0] - ALGEBRAIC[14]) - 65.0000)));
ALGEBRAIC[43] = 360.000+ 130.000*(1.00000 - exp(- (STATES[0]+130.000)/50.0000));
ALGEBRAIC[44] = 1.00000/(1.00000+exp((- 93.0000 - STATES[0])/- 15.2000));
ALGEBRAIC[45] =  CONSTANTS[3]*CONSTANTS[18]*STATES[14]*STATES[15]*STATES[16]*(STATES[0] - 60.0000);
ALGEBRAIC[46] = pow(1.00000+exp((- STATES[0] - 2.00000)/5.00000), - 1.00000);
ALGEBRAIC[47] = (CONDVAR[9]<0.00000 ? 0.763000 : (1.00000 - exp((STATES[0]+10.0000)/- 6.24000))/( 0.0350000*(STATES[0]+10.0000)*(1.00000+exp((STATES[0]+10.0000)/- 6.24000))));
ALGEBRAIC[48] = 1.00000/(1.00000+exp((STATES[0]+34.0000)/6.30000));
ALGEBRAIC[49] = 400.000/(1.00000+ 4.50000*exp(- pow( (STATES[0] - 9.00000)*0.0265000, 2.00000)));
ALGEBRAIC[50] = 0.290000+ 0.800000*pow(1.00000+(STATES[13] - 0.000120000)/6.00000e-05, - 1.00000);
ALGEBRAIC[51] = pow(1.00000+ 0.124500*exp(( - 0.100000*CONSTANTS[2]*STATES[0])/( CONSTANTS[0]*CONSTANTS[1]))+ 0.0365000*CONSTANTS[44]*exp(( - CONSTANTS[2]*STATES[0])/( CONSTANTS[0]*CONSTANTS[1])), - 1.00000);
ALGEBRAIC[52] = ( (( CONSTANTS[3]*CONSTANTS[21]*ALGEBRAIC[51])/(1.00000+pow(CONSTANTS[19]/STATES[1], 1.50000)))*CONSTANTS[12])/(CONSTANTS[12]+CONSTANTS[20]);
ALGEBRAIC[1] =  (( CONSTANTS[0]*CONSTANTS[1])/CONSTANTS[2])*log(CONSTANTS[10]/STATES[1]);
ALGEBRAIC[53] =  CONSTANTS[3]*CONSTANTS[22]*(STATES[0] - ALGEBRAIC[1]);
ALGEBRAIC[54] =  CONSTANTS[3]*CONSTANTS[23]*(STATES[0] -  (( CONSTANTS[0]*CONSTANTS[1])/( 2.00000*CONSTANTS[2]))*log(CONSTANTS[25]/STATES[13]));
ALGEBRAIC[55] =  CONSTANTS[3]*CONSTANTS[24]*(STATES[0] -  (( CONSTANTS[0]*CONSTANTS[1])/CONSTANTS[2])*log(STATES[17]/CONSTANTS[26]));
ALGEBRAIC[56] = ( CONSTANTS[3]*CONSTANTS[27]*( exp(( CONSTANTS[31]*CONSTANTS[2]*STATES[0])/( CONSTANTS[0]*CONSTANTS[1]))*pow(STATES[1], 3.00000)*CONSTANTS[25] -  exp(( (CONSTANTS[31] - 1.00000)*CONSTANTS[2]*STATES[0])/( CONSTANTS[0]*CONSTANTS[1]))*pow(CONSTANTS[10], 3.00000)*STATES[13]))/( (pow(CONSTANTS[28], 3.00000)+pow(CONSTANTS[10], 3.00000))*(CONSTANTS[29]+CONSTANTS[25])*(1.00000+ CONSTANTS[30]*exp(( (CONSTANTS[31] - 1.00000)*STATES[0]*CONSTANTS[2])/( CONSTANTS[0]*CONSTANTS[1]))));
ALGEBRAIC[57] = ( CONSTANTS[3]*CONSTANTS[32]*STATES[13])/(0.000500000+STATES[13]);
ALGEBRAIC[58] =  CONSTANTS[33]*pow(STATES[19], 2.00000)*STATES[20]*STATES[21]*(STATES[18] - STATES[13]);
ALGEBRAIC[59] = (CONDVAR[10]<0.00000 ? ( 6.00000*0.200000)/1.30000 : ( 6.00000*(1.00000 - exp(- (STATES[0] - 7.90000)/5.00000)))/( (1.00000+ 0.300000*exp(- (STATES[0] - 7.90000)/5.00000))*1.00000*(STATES[0] - 7.90000)));
ALGEBRAIC[60] = 1.00000 - pow(1.00000+exp(- (STATES[0] - 40.0000)/17.0000), - 1.00000);
ALGEBRAIC[61] = (STATES[22] - STATES[18])/CONSTANTS[34];
ALGEBRAIC[62] = CONSTANTS[35]/(1.00000+CONSTANTS[36]/STATES[13]);
ALGEBRAIC[63] = ( CONSTANTS[35]*STATES[22])/CONSTANTS[37];
ALGEBRAIC[64] =  200.000*STATES[13]*(1.00000 - STATES[23]/CONSTANTS[38]) - ( 0.476000*STATES[23])/CONSTANTS[38];
ALGEBRAIC[65] =  78.4000*STATES[13]*(1.00000 - STATES[24]/CONSTANTS[39]) - ( 0.392000*STATES[24])/CONSTANTS[39];
ALGEBRAIC[66] =  0.480000*STATES[18]*(1.00000 - STATES[25]/CONSTANTS[40]) - ( 0.400000*STATES[25])/CONSTANTS[40];
ALGEBRAIC[67] =  CONSTANTS[3]*CONSTANTS[9]*pow(STATES[2], 3.00000)*STATES[3]*STATES[4]*(STATES[0] - ALGEBRAIC[1]);
ALGEBRAIC[68] =  1000.00*( 1.00000e-15*CONSTANTS[46]*ALGEBRAIC[58] -  (1.00000e-15/( 2.00000*CONSTANTS[2]))*( 0.500000*ALGEBRAIC[45] -  0.200000*ALGEBRAIC[56]));
ALGEBRAIC[69] = pow(1.00000+exp(- (ALGEBRAIC[68] - 3.41750e-13)/1.36700e-15), - 1.00000);
ALGEBRAIC[70] = 1.91000+ 2.09000*pow(1.00000+exp(- (ALGEBRAIC[68] - 3.41750e-13)/1.36700e-15), - 1.00000);
ALGEBRAIC[71] = 1.00000 - pow(1.00000+exp(- (ALGEBRAIC[68] - 6.83500e-14)/1.36700e-15), - 1.00000);
}
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;
}
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] = STATES[0] - - 40.0000;
CONDVAR[4] = STATES[0] - - 40.0000;
CONDVAR[5] = STATES[0] - - 40.0000;
CONDVAR[6] = STATES[0] - - 40.0000;
CONDVAR[7] = fabs(STATES[0]+28.5000) - 1.00000e-10;
CONDVAR[8] = fabs(STATES[0]+28.5000) - 1.00000e-10;
CONDVAR[9] = fabs(STATES[0]+10.0000) - 1.00000e-10;
CONDVAR[10] = fabs(STATES[0] - 7.90000) - 1.00000e-10;
}