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 138 entries in the algebraic variable array.
   There are a total of 40 entries in each of the rate and state variable arrays.
   There are a total of 101 entries in the constant variable array.
 */
/*
 * VOI is time in component environment (millisecond).
 * STATES[0] is Vm in component membrane (millivolt).
 * CONSTANTS[0] is R in component membrane (coulomb_millivolt_per_kelvin_millimole).
 * 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_ext in component membrane (picoA).
 * ALGEBRAIC[137] is i_tot in component membrane (picoA).
 * ALGEBRAIC[134] is i_I in component membrane (picoA).
 * ALGEBRAIC[104] is i_Na in component sodium_current (picoA).
 * ALGEBRAIC[130] is i_Ca_L in component L_type_Ca_channel (picoA).
 * ALGEBRAIC[37] is i_Ca_T in component T_type_Ca_channel (picoA).
 * ALGEBRAIC[131] is i_K1 in component time_independent_potassium_current (picoA).
 * ALGEBRAIC[46] is i_Kr in component rapid_time_dependent_potassium_current (picoA).
 * ALGEBRAIC[114] is i_Ks in component slow_time_dependent_potassium_current (picoA).
 * ALGEBRAIC[115] is i_to in component transient_outward_current (picoA).
 * ALGEBRAIC[133] is i_NaK in component sodium_potassium_pump (picoA).
 * ALGEBRAIC[120] is i_NaCa in component sodium_calcium_exchanger (picoA).
 * ALGEBRAIC[116] is i_bNSC in component background_NSC_current (picoA).
 * ALGEBRAIC[69] is i_Cab in component background_Cab_current (picoA).
 * ALGEBRAIC[66] is i_Kpl in component background_Kpl_current (picoA).
 * ALGEBRAIC[132] is i_lCa in component background_lCa_current (picoA).
 * ALGEBRAIC[119] is i_KATP in component background_KATP_current (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).
 * CONSTANTS[9] is Nao in component external_ion_concentrations (millimolar).
 * CONSTANTS[10] is Cao in component external_ion_concentrations (millimolar).
 * CONSTANTS[11] is Ko in component external_ion_concentrations (millimolar).
 * STATES[1] is Nai in component internal_ion_concentrations (millimolar).
 * ALGEBRAIC[3] is Cai in component internal_ion_concentrations (millimolar).
 * STATES[2] is Ki in component internal_ion_concentrations (millimolar).
 * CONSTANTS[12] is Vi in component internal_ion_concentrations (micrometre3).
 * ALGEBRAIC[135] is i_net_Na in component internal_ion_concentrations (picoA).
 * ALGEBRAIC[136] is i_net_K in component internal_ion_concentrations (picoA).
 * ALGEBRAIC[129] is i_net_Ca in component internal_ion_concentrations (picoA).
 * ALGEBRAIC[7] is i_Na_Na in component sodium_current (picoA).
 * ALGEBRAIC[106] is i_CaL_Na in component L_type_Ca_channel (picoA).
 * ALGEBRAIC[65] is i_bNSC_Na in component background_NSC_current (picoA).
 * ALGEBRAIC[118] is i_lCa_Na in component background_lCa_current (picoA).
 * ALGEBRAIC[58] is i_to_K in component transient_outward_current (picoA).
 * ALGEBRAIC[59] is i_to_Na in component transient_outward_current (picoA).
 * ALGEBRAIC[53] is i_Ks_K in component slow_time_dependent_potassium_current (picoA).
 * ALGEBRAIC[54] is i_Ks_Na in component slow_time_dependent_potassium_current (picoA).
 * ALGEBRAIC[8] is i_Na_K in component sodium_current (picoA).
 * ALGEBRAIC[107] is i_CaL_K in component L_type_Ca_channel (picoA).
 * ALGEBRAIC[64] is i_bNSC_K in component background_NSC_current (picoA).
 * ALGEBRAIC[117] is i_lCa_K in component background_lCa_current (picoA).
 * ALGEBRAIC[105] is i_CaL_Ca in component L_type_Ca_channel (picoA).
 * ALGEBRAIC[125] is i_RyR in component RyR_channel (picoA).
 * ALGEBRAIC[124] is i_SR_U in component SR_calcium_pump (picoA).
 * ALGEBRAIC[89] is i_SR_L in component SR_L_current (picoA).
 * STATES[37] is dCaidt in component NL_model (millimolar_per_millisecond).
 * CONSTANTS[13] is CMDN_max in component internal_ion_concentrations (millimolar).
 * CONSTANTS[14] is K_mCMDN in component internal_ion_concentrations (millimolar).
 * STATES[3] is Ca_Total in component internal_ion_concentrations (millimolar).
 * ALGEBRAIC[1] is b1 in component internal_ion_concentrations (millimolar).
 * ALGEBRAIC[2] is c1 in component internal_ion_concentrations (millimolar2).
 * ALGEBRAIC[4] is CF_Na in component constant_field_equations (millimolar).
 * ALGEBRAIC[5] is CF_Ca in component constant_field_equations (millimolar).
 * ALGEBRAIC[6] is CF_K in component constant_field_equations (millimolar).
 * STATES[4] is ATPi in component ATP_production (millimolar).
 * ALGEBRAIC[99] is dATPdt in component NL_model (millimolar_per_millisecond).
 * CONSTANTS[15] is ProducingRate_Max in component ATP_production (per_millisecond).
 * CONSTANTS[16] is Adenosine_Total in component ATP_production (millimolar).
 * CONSTANTS[17] is P_Na in component sodium_current (picoA_per_millimolar).
 * STATES[5] is p_AP_Na in component sodium_current_voltage_dependent_gate (dimensionless).
 * STATES[6] is y in component sodium_current_ultra_slow_gate (dimensionless).
 * ALGEBRAIC[9] is p_RI_Na in component sodium_current_voltage_dependent_gate (dimensionless).
 * STATES[7] is p_RP_Na in component sodium_current_voltage_dependent_gate (dimensionless).
 * STATES[8] is p_AI_Na in component sodium_current_voltage_dependent_gate (dimensionless).
 * ALGEBRAIC[10] is k_RP_AP in component sodium_current_voltage_dependent_gate (per_millisecond).
 * ALGEBRAIC[11] is k_AP_RP in component sodium_current_voltage_dependent_gate (per_millisecond).
 * ALGEBRAIC[14] is k_RI_AI in component sodium_current_voltage_dependent_gate (per_millisecond).
 * ALGEBRAIC[13] is k_AI_RI in component sodium_current_voltage_dependent_gate (per_millisecond).
 * ALGEBRAIC[12] is k_AP_AI in component sodium_current_voltage_dependent_gate (per_millisecond).
 * CONSTANTS[18] is k_AI_AP in component sodium_current_voltage_dependent_gate (per_millisecond).
 * ALGEBRAIC[15] is k_RP_RI in component sodium_current_voltage_dependent_gate (per_millisecond).
 * ALGEBRAIC[16] is k_RI_RP in component sodium_current_voltage_dependent_gate (per_millisecond).
 * ALGEBRAIC[17] is alpha_y in component sodium_current_ultra_slow_gate (per_millisecond).
 * ALGEBRAIC[18] is beta_y in component sodium_current_ultra_slow_gate (per_millisecond).
 * ALGEBRAIC[19] is p_open_CaL in component L_type_Ca_channel (dimensionless).
 * ALGEBRAIC[28] is CaDiadic in component L_type_Ca_channel_Ca_dependent_gate (picoA).
 * CONSTANTS[19] is P_CaL in component L_type_Ca_channel (picoA_per_millimolar).
 * STATES[9] is p_AP_CaL in component L_type_Ca_channel_voltage_dependent_gate (dimensionless).
 * STATES[10] is p_U in component L_type_Ca_channel_Ca_dependent_gate (dimensionless).
 * STATES[11] is p_UCa in component L_type_Ca_channel_Ca_dependent_gate (dimensionless).
 * STATES[12] is y in component L_type_Ca_channel_ultra_slow_gate (dimensionless).
 * ALGEBRAIC[20] is p_RI_CaL in component L_type_Ca_channel_voltage_dependent_gate (dimensionless).
 * STATES[13] is p_RP_CaL in component L_type_Ca_channel_voltage_dependent_gate (dimensionless).
 * STATES[14] is p_AI_CaL in component L_type_Ca_channel_voltage_dependent_gate (dimensionless).
 * ALGEBRAIC[21] is k_RP_AP in component L_type_Ca_channel_voltage_dependent_gate (per_millisecond).
 * ALGEBRAIC[22] is k_AP_RP in component L_type_Ca_channel_voltage_dependent_gate (per_millisecond).
 * ALGEBRAIC[23] is k_RI_AI in component L_type_Ca_channel_voltage_dependent_gate (per_millisecond).
 * ALGEBRAIC[24] is k_AI_RI in component L_type_Ca_channel_voltage_dependent_gate (per_millisecond).
 * CONSTANTS[20] is k_AP_AI in component L_type_Ca_channel_voltage_dependent_gate (per_millisecond).
 * CONSTANTS[21] is k_AI_AP in component L_type_Ca_channel_voltage_dependent_gate (per_millisecond).
 * ALGEBRAIC[25] is k_RP_RI in component L_type_Ca_channel_voltage_dependent_gate (per_millisecond).
 * ALGEBRAIC[26] is k_RI_RP in component L_type_Ca_channel_voltage_dependent_gate (per_millisecond).
 * ALGEBRAIC[27] is iCaL in component L_type_Ca_channel_Ca_dependent_gate (picoA).
 * ALGEBRAIC[29] is Cacm in component L_type_Ca_channel_Ca_dependent_gate (millimolar).
 * ALGEBRAIC[34] is p_CCa in component L_type_Ca_channel_Ca_dependent_gate (dimensionless).
 * STATES[15] is p_C in component L_type_Ca_channel_Ca_dependent_gate (dimensionless).
 * CONSTANTS[22] is k_CCa_UCa in component L_type_Ca_channel_Ca_dependent_gate (per_millisecond).
 * CONSTANTS[23] is k_UCa_CCa in component L_type_Ca_channel_Ca_dependent_gate (per_millisecond).
 * CONSTANTS[24] is k_C_U in component L_type_Ca_channel_Ca_dependent_gate (per_millisecond).
 * CONSTANTS[25] is k_U_C in component L_type_Ca_channel_Ca_dependent_gate (per_millisecond).
 * CONSTANTS[92] is k_UCa_U in component L_type_Ca_channel_Ca_dependent_gate (per_millisecond).
 * CONSTANTS[26] is k_U_UCa in component L_type_Ca_channel_Ca_dependent_gate (per_millimolar_millisecond).
 * CONSTANTS[27] is k_CCa_C in component L_type_Ca_channel_Ca_dependent_gate (per_millisecond).
 * CONSTANTS[28] is k_C_CCa in component L_type_Ca_channel_Ca_dependent_gate (per_millimolar_millisecond).
 * ALGEBRAIC[30] is CaEffC in component L_type_Ca_channel_Ca_dependent_gate (millimolar).
 * ALGEBRAIC[31] is CaEffU in component L_type_Ca_channel_Ca_dependent_gate (millimolar).
 * ALGEBRAIC[32] is k_UUCa_Ca in component L_type_Ca_channel_Ca_dependent_gate (per_millisecond).
 * ALGEBRAIC[33] is k_CCCa_Ca in component L_type_Ca_channel_Ca_dependent_gate (per_millisecond).
 * ALGEBRAIC[35] is alpha_y in component L_type_Ca_channel_ultra_slow_gate (per_millisecond).
 * ALGEBRAIC[36] is beta_y in component L_type_Ca_channel_ultra_slow_gate (per_millisecond).
 * CONSTANTS[29] is P_CaT in component T_type_Ca_channel (picoA_per_millimolar).
 * STATES[16] is y1 in component T_type_Ca_channel_y1_gate (dimensionless).
 * STATES[17] is y2 in component T_type_Ca_channel_y2_gate (dimensionless).
 * ALGEBRAIC[38] is alpha_y1 in component T_type_Ca_channel_y1_gate (per_millisecond).
 * ALGEBRAIC[39] is beta_y1 in component T_type_Ca_channel_y1_gate (per_millisecond).
 * ALGEBRAIC[40] is alpha_y2 in component T_type_Ca_channel_y2_gate (per_millisecond).
 * ALGEBRAIC[41] is beta_y2 in component T_type_Ca_channel_y2_gate (per_millisecond).
 * ALGEBRAIC[42] is E_K in component time_independent_potassium_current (millivolt).
 * CONSTANTS[93] is g_K1 in component time_independent_potassium_current (nanoS).
 * CONSTANTS[30] is P_K1_0 in component time_independent_potassium_current (nanoS_per_picoF).
 * ALGEBRAIC[109] is fO in component time_independent_potassium_current (dimensionless).
 * ALGEBRAIC[110] is fO2 in component time_independent_potassium_current (dimensionless).
 * ALGEBRAIC[111] is fO3 in component time_independent_potassium_current (dimensionless).
 * ALGEBRAIC[112] is fO4 in component time_independent_potassium_current (dimensionless).
 * ALGEBRAIC[108] is fB in component time_independent_potassium_current (dimensionless).
 * ALGEBRAIC[43] is mu in component time_independent_potassium_current (per_millisecond).
 * ALGEBRAIC[44] is lambda in component time_independent_potassium_current (per_millisecond).
 * STATES[18] is y in component time_independent_potassium_current_y_gate (dimensionless).
 * ALGEBRAIC[45] is alpha_y in component time_independent_potassium_current_y_gate (per_millisecond).
 * ALGEBRAIC[113] is beta_y in component time_independent_potassium_current_y_gate (per_millisecond).
 * CONSTANTS[94] is g_Kr in component rapid_time_dependent_potassium_current (nanoS).
 * CONSTANTS[31] is P_Kr in component rapid_time_dependent_potassium_current (nanoS_per_picoF).
 * STATES[19] is y1 in component rapid_time_dependent_potassium_current_y1_gate (dimensionless).
 * STATES[20] is y2 in component rapid_time_dependent_potassium_current_y2_gate (dimensionless).
 * STATES[21] is y3 in component rapid_time_dependent_potassium_current_y3_gate (dimensionless).
 * ALGEBRAIC[47] is alpha_y1 in component rapid_time_dependent_potassium_current_y1_gate (per_millisecond).
 * ALGEBRAIC[48] is beta_y1 in component rapid_time_dependent_potassium_current_y1_gate (per_millisecond).
 * ALGEBRAIC[49] is alpha_y2 in component rapid_time_dependent_potassium_current_y2_gate (per_millisecond).
 * ALGEBRAIC[50] is beta_y2 in component rapid_time_dependent_potassium_current_y2_gate (per_millisecond).
 * ALGEBRAIC[51] is alpha_y3 in component rapid_time_dependent_potassium_current_y3_gate (per_millisecond).
 * ALGEBRAIC[52] is beta_y3 in component rapid_time_dependent_potassium_current_y3_gate (per_millisecond).
 * STATES[22] is y1 in component slow_time_dependent_potassium_current_y1_gate (dimensionless).
 * STATES[23] is y2 in component slow_time_dependent_potassium_current_y2_gate (dimensionless).
 * CONSTANTS[32] is P_Ks_K in component slow_time_dependent_potassium_current (picoA_per_millimolar).
 * CONSTANTS[33] is P_Ks_Na in component slow_time_dependent_potassium_current (picoA_per_millimolar).
 * ALGEBRAIC[55] is alpha_y1 in component slow_time_dependent_potassium_current_y1_gate (per_millisecond).
 * ALGEBRAIC[56] is beta_y1 in component slow_time_dependent_potassium_current_y1_gate (per_millisecond).
 * ALGEBRAIC[57] is alpha_y2 in component slow_time_dependent_potassium_current_y2_gate (per_millisecond).
 * CONSTANTS[34] is beta_y2 in component slow_time_dependent_potassium_current_y2_gate (per_millisecond).
 * STATES[24] is y1 in component transient_outward_current_y1_gate (dimensionless).
 * STATES[25] is y2 in component transient_outward_current_y2_gate (dimensionless).
 * CONSTANTS[35] is P_to_K in component transient_outward_current (picoA_per_millimolar).
 * CONSTANTS[36] is P_to_Na in component transient_outward_current (picoA_per_millimolar).
 * ALGEBRAIC[60] is alpha_y1 in component transient_outward_current_y1_gate (per_millisecond).
 * ALGEBRAIC[61] is beta_y1 in component transient_outward_current_y1_gate (per_millisecond).
 * ALGEBRAIC[62] is alpha_y2 in component transient_outward_current_y2_gate (per_millisecond).
 * ALGEBRAIC[63] is beta_y2 in component transient_outward_current_y2_gate (per_millisecond).
 * CONSTANTS[37] is P_bNSC in component background_NSC_current (picoA_per_millimolar).
 * CONSTANTS[95] is P_Kpl in component background_Kpl_current (nanoS_per_millimolar).
 * CONSTANTS[38] is P_lCa in component background_lCa_current (picoA_per_millimolar).
 * ALGEBRAIC[67] is p_open in component background_lCa_current (dimensionless).
 * ALGEBRAIC[68] is p_open in component background_KATP_current (dimensionless).
 * CONSTANTS[96] is gamma in component background_KATP_current (nanoS).
 * CONSTANTS[39] is P_KATP in component background_KATP_current (nanoS_per_picoF).
 * CONSTANTS[40] is N in component background_KATP_current (picoF).
 * CONSTANTS[41] is P_Cab in component background_Cab_current (picoA_per_millimolar).
 * CONSTANTS[97] is p_E2Na in component sodium_calcium_exchanger (dimensionless).
 * ALGEBRAIC[70] is p_E1Na in component sodium_calcium_exchanger (dimensionless).
 * ALGEBRAIC[71] is p_E1Ca in component sodium_calcium_exchanger (dimensionless).
 * CONSTANTS[100] is p_E2Ca in component sodium_calcium_exchanger (dimensionless).
 * ALGEBRAIC[72] is k1 in component sodium_calcium_exchanger (per_millisecond).
 * ALGEBRAIC[73] is k2 in component sodium_calcium_exchanger (per_millisecond).
 * CONSTANTS[42] is k3 in component sodium_calcium_exchanger (per_millisecond).
 * CONSTANTS[43] is k4 in component sodium_calcium_exchanger (per_millisecond).
 * CONSTANTS[44] is Km_Nai in component sodium_calcium_exchanger (millimolar).
 * CONSTANTS[45] is Km_Nao in component sodium_calcium_exchanger (millimolar).
 * CONSTANTS[46] is Km_Cai in component sodium_calcium_exchanger (millimolar).
 * CONSTANTS[47] is Km_Cao in component sodium_calcium_exchanger (millimolar).
 * STATES[26] is y in component sodium_calcium_exchanger_y_gate (dimensionless).
 * CONSTANTS[48] is P_NaCa in component sodium_calcium_exchanger (picoA_per_picoF).
 * CONSTANTS[49] is Partition in component sodium_calcium_exchanger (dimensionless).
 * ALGEBRAIC[74] is alpha_y in component sodium_calcium_exchanger_y_gate (per_millisecond).
 * ALGEBRAIC[75] is beta_y in component sodium_calcium_exchanger_y_gate (per_millisecond).
 * ALGEBRAIC[121] is p_E2Na in component sodium_potassium_pump (dimensionless).
 * ALGEBRAIC[76] is p_E1Na in component sodium_potassium_pump (dimensionless).
 * ALGEBRAIC[77] is p_E1K in component sodium_potassium_pump (dimensionless).
 * ALGEBRAIC[122] is p_E2K in component sodium_potassium_pump (dimensionless).
 * ALGEBRAIC[78] is k1 in component sodium_potassium_pump (per_millisecond).
 * CONSTANTS[50] is k2 in component sodium_potassium_pump (per_millisecond).
 * CONSTANTS[51] is k3 in component sodium_potassium_pump (per_millisecond).
 * CONSTANTS[52] is k4 in component sodium_potassium_pump (per_millisecond).
 * CONSTANTS[53] is Km_Nai in component sodium_potassium_pump (millimolar).
 * CONSTANTS[54] is Km_Nao in component sodium_potassium_pump (millimolar).
 * CONSTANTS[55] is Km_Ki in component sodium_potassium_pump (millimolar).
 * CONSTANTS[56] is Km_Ko in component sodium_potassium_pump (millimolar).
 * CONSTANTS[57] is Km_ATP in component sodium_potassium_pump (millimolar).
 * ALGEBRAIC[79] is Nao_Eff in component sodium_potassium_pump (millimolar).
 * STATES[27] is y in component sodium_potassium_pump_y_gate (dimensionless).
 * CONSTANTS[58] is P_NaK in component sodium_potassium_pump (picoA_per_picoF).
 * ALGEBRAIC[123] is alpha_y in component sodium_potassium_pump_y_gate (per_millisecond).
 * ALGEBRAIC[80] is beta_y in component sodium_potassium_pump_y_gate (per_millisecond).
 * ALGEBRAIC[82] is p_E2Ca in component SR_calcium_pump (dimensionless).
 * ALGEBRAIC[81] is p_E1Ca in component SR_calcium_pump (dimensionless).
 * ALGEBRAIC[83] is p_E1 in component SR_calcium_pump (dimensionless).
 * ALGEBRAIC[84] is p_E2 in component SR_calcium_pump (dimensionless).
 * CONSTANTS[59] is k1 in component SR_calcium_pump (per_millisecond).
 * ALGEBRAIC[85] is k2 in component SR_calcium_pump (per_millisecond).
 * CONSTANTS[60] is k3 in component SR_calcium_pump (per_millisecond).
 * CONSTANTS[61] is k4 in component SR_calcium_pump (per_millisecond).
 * CONSTANTS[62] is Km_CaSR in component SR_calcium_pump (millimolar).
 * CONSTANTS[63] is Km_CaCyto in component SR_calcium_pump (millimolar).
 * CONSTANTS[64] is Km_ATP in component SR_calcium_pump (millimolar).
 * CONSTANTS[65] is i_max in component SR_calcium_pump (picoA).
 * STATES[28] is Caup in component Ca_concentrations_in_SR (millimolar).
 * STATES[29] is y in component SR_calcium_pump_y_gate (dimensionless).
 * ALGEBRAIC[86] is alpha_y in component SR_calcium_pump_y_gate (per_millisecond).
 * ALGEBRAIC[87] is beta_y in component SR_calcium_pump_y_gate (per_millisecond).
 * CONSTANTS[66] is P_RyR in component RyR_channel (picoA_per_millimolar).
 * ALGEBRAIC[88] is k1 in component RyR_channel (per_millisecond).
 * ALGEBRAIC[126] is k2 in component RyR_channel (per_millisecond).
 * ALGEBRAIC[127] is k3 in component RyR_channel (per_millisecond).
 * CONSTANTS[67] is k4 in component RyR_channel (per_millisecond).
 * STATES[30] is p_open_RyR in component RyR_channel (dimensionless).
 * STATES[31] is p_close_RyR in component RyR_channel (dimensionless).
 * ALGEBRAIC[92] is Carel in component Ca_concentrations_in_SR (millimolar).
 * CONSTANTS[68] is Diadid_Factor in component RyR_channel (per_picoA_millisecond).
 * ALGEBRAIC[128] is i_SR_T in component SR_T_current (picoA).
 * CONSTANTS[69] is P_SR_T in component SR_T_current (picoA_per_millimolar).
 * CONSTANTS[70] is P_SR_L in component SR_L_current (picoA_per_millimolar).
 * STATES[32] is Ca_Total in component Ca_concentrations_in_SR (millimolar).
 * CONSTANTS[71] is V_rel in component Ca_concentrations_in_SR (micrometre3).
 * CONSTANTS[72] is V_up in component Ca_concentrations_in_SR (micrometre3).
 * CONSTANTS[73] is CSQN_max in component Ca_concentrations_in_SR (millimolar).
 * CONSTANTS[74] is K_mCSQN in component Ca_concentrations_in_SR (millimolar).
 * ALGEBRAIC[90] is b1 in component Ca_concentrations_in_SR (millimolar).
 * ALGEBRAIC[91] is c1 in component Ca_concentrations_in_SR (millimolar2).
 * CONSTANTS[98] is EffFraction in component NL_model (dimensionless).
 * STATES[33] is pCa in component NL_model (dimensionless).
 * STATES[34] is pCaCB in component NL_model (dimensionless).
 * STATES[35] is pCB in component NL_model (dimensionless).
 * ALGEBRAIC[94] is p in component NL_model (dimensionless).
 * CONSTANTS[75] is T_t in component NL_model (millimolar).
 * ALGEBRAIC[96] is Q_a in component NL_model (per_millisecond).
 * ALGEBRAIC[95] is Q_b in component NL_model (per_millisecond).
 * ALGEBRAIC[97] is Q_r in component NL_model (per_millisecond).
 * ALGEBRAIC[98] is Q_d in component NL_model (per_millisecond).
 * STATES[38] is Q_d1 in component NL_model (per_millisecond).
 * STATES[39] is Q_d2 in component NL_model (per_millisecond).
 * CONSTANTS[76] is Y_1 in component NL_model (per_millimolar_millisecond).
 * CONSTANTS[77] is Y_2 in component NL_model (per_millisecond).
 * CONSTANTS[78] is Y_3 in component NL_model (per_millisecond).
 * CONSTANTS[79] is Y_4 in component NL_model (per_millisecond).
 * CONSTANTS[80] is Y_d in component NL_model (millisecond_per_micrometre2).
 * CONSTANTS[81] is Z_1 in component NL_model (per_millisecond).
 * CONSTANTS[82] is Z_2 in component NL_model (per_millisecond).
 * CONSTANTS[83] is Z_3 in component NL_model (per_millimolar_millisecond).
 * ALGEBRAIC[93] is h in component NL_model (micrometre).
 * CONSTANTS[84] is L_a in component NL_model (micrometre).
 * CONSTANTS[85] is L in component NL_model (micrometre).
 * ALGEBRAIC[102] is ForceCB in component NL_model (mN_per_mm2).
 * STATES[36] is X in component NL_model (micrometre).
 * ALGEBRAIC[101] is NewCBF in component NL_model (mN_per_mm2_micrometre).
 * ALGEBRAIC[100] is CBBound in component NL_model (millimolar).
 * CONSTANTS[86] is KForceEC in component NL_model (mN_per_mm2_micrometre5).
 * CONSTANTS[87] is ZeroForceEL in component NL_model (micrometre).
 * CONSTANTS[88] is KForceLinearEc in component NL_model (mN_per_mm2_micrometre).
 * CONSTANTS[89] is ForceFactor in component NL_model (mN_per_mm2_micrometre_millimolar).
 * CONSTANTS[99] is ForceEcomp in component NL_model (mN_per_mm2).
 * CONSTANTS[90] is B in component NL_model (per_millisecond).
 * CONSTANTS[91] is h_c in component NL_model (micrometre).
 * ALGEBRAIC[103] is ForceExt in component NL_model (mN_per_mm2).
 * RATES[0] is d/dt Vm in component membrane (millivolt).
 * RATES[1] is d/dt Nai in component internal_ion_concentrations (millimolar).
 * RATES[2] is d/dt Ki in component internal_ion_concentrations (millimolar).
 * RATES[3] is d/dt Ca_Total in component internal_ion_concentrations (millimolar).
 * RATES[4] is d/dt ATPi in component ATP_production (millimolar).
 * RATES[7] is d/dt p_RP_Na in component sodium_current_voltage_dependent_gate (dimensionless).
 * RATES[5] is d/dt p_AP_Na in component sodium_current_voltage_dependent_gate (dimensionless).
 * RATES[8] is d/dt p_AI_Na in component sodium_current_voltage_dependent_gate (dimensionless).
 * RATES[6] is d/dt y in component sodium_current_ultra_slow_gate (dimensionless).
 * RATES[13] is d/dt p_RP_CaL in component L_type_Ca_channel_voltage_dependent_gate (dimensionless).
 * RATES[9] is d/dt p_AP_CaL in component L_type_Ca_channel_voltage_dependent_gate (dimensionless).
 * RATES[14] is d/dt p_AI_CaL in component L_type_Ca_channel_voltage_dependent_gate (dimensionless).
 * RATES[10] is d/dt p_U in component L_type_Ca_channel_Ca_dependent_gate (dimensionless).
 * RATES[11] is d/dt p_UCa in component L_type_Ca_channel_Ca_dependent_gate (dimensionless).
 * RATES[15] is d/dt p_C in component L_type_Ca_channel_Ca_dependent_gate (dimensionless).
 * RATES[12] is d/dt y in component L_type_Ca_channel_ultra_slow_gate (dimensionless).
 * RATES[16] is d/dt y1 in component T_type_Ca_channel_y1_gate (dimensionless).
 * RATES[17] is d/dt y2 in component T_type_Ca_channel_y2_gate (dimensionless).
 * RATES[18] is d/dt y in component time_independent_potassium_current_y_gate (dimensionless).
 * RATES[19] is d/dt y1 in component rapid_time_dependent_potassium_current_y1_gate (dimensionless).
 * RATES[20] is d/dt y2 in component rapid_time_dependent_potassium_current_y2_gate (dimensionless).
 * RATES[21] is d/dt y3 in component rapid_time_dependent_potassium_current_y3_gate (dimensionless).
 * RATES[22] is d/dt y1 in component slow_time_dependent_potassium_current_y1_gate (dimensionless).
 * RATES[23] is d/dt y2 in component slow_time_dependent_potassium_current_y2_gate (dimensionless).
 * RATES[24] is d/dt y1 in component transient_outward_current_y1_gate (dimensionless).
 * RATES[25] is d/dt y2 in component transient_outward_current_y2_gate (dimensionless).
 * RATES[26] is d/dt y in component sodium_calcium_exchanger_y_gate (dimensionless).
 * RATES[27] is d/dt y in component sodium_potassium_pump_y_gate (dimensionless).
 * RATES[29] is d/dt y in component SR_calcium_pump_y_gate (dimensionless).
 * RATES[30] is d/dt p_open_RyR in component RyR_channel (dimensionless).
 * RATES[31] is d/dt p_close_RyR in component RyR_channel (dimensionless).
 * RATES[32] is d/dt Ca_Total in component Ca_concentrations_in_SR (millimolar).
 * RATES[28] is d/dt Caup in component Ca_concentrations_in_SR (millimolar).
 * RATES[36] is d/dt X in component NL_model (micrometre).
 * RATES[33] is d/dt pCa in component NL_model (dimensionless).
 * RATES[34] is d/dt pCaCB in component NL_model (dimensionless).
 * RATES[35] is d/dt pCB in component NL_model (dimensionless).
 * There are a total of 3 condition variables.
 */
void
initConsts(double* CONSTANTS, double* RATES, double *STATES)
{
STATES[0] = -85.95752434460744;
CONSTANTS[0] = 8.3143;
CONSTANTS[1] = 310;
CONSTANTS[2] = 96.4867;
CONSTANTS[3] = 132;
CONSTANTS[4] = 50;
CONSTANTS[5] = 1000000;
CONSTANTS[6] = 400;
CONSTANTS[7] = 2;
CONSTANTS[8] = -4000;
CONSTANTS[9] = 140;
CONSTANTS[10] = 1.8;
CONSTANTS[11] = 5.4;
STATES[1] = 4.925761439682025;
STATES[2] = 143.1837333000449;
CONSTANTS[12] = 8000;
CONSTANTS[13] = 0.05;
CONSTANTS[14] = 0.00238;
STATES[3] = 4.0180173572968586e-4;
STATES[4] = 4.657102729020499;
CONSTANTS[15] = 0.003;
CONSTANTS[16] = 5;
CONSTANTS[17] = 2860;
STATES[5] = 1.779648367445368e-5;
STATES[6] = 0.5861887862983165;
STATES[7] = 0.3556412697995689;
STATES[8] = 0.40285968661346977;
CONSTANTS[18] = 0.0000875;
CONSTANTS[19] = 8712;
STATES[9] = 1.5445004166497696e-6;
STATES[10] = 0.17246483915629204;
STATES[11] = 6.098246017787626e-5;
STATES[12] = 0.9985266538252986;
STATES[13] = 0.9968480629364956;
STATES[14] = 8.77325391245903e-4;
CONSTANTS[20] = 0.004;
CONSTANTS[21] = 0.001;
STATES[15] = 0.4250747299372254;
CONSTANTS[22] = 0.0003;
CONSTANTS[23] = 0.35;
CONSTANTS[24] = 0.143;
CONSTANTS[25] = 0.35;
CONSTANTS[26] = 6.954;
CONSTANTS[27] = 0.0042;
CONSTANTS[28] = 6.954;
CONSTANTS[29] = 612;
STATES[16] = 1.6882718240109127e-5;
STATES[17] = 0.8585352091865849;
CONSTANTS[30] = 1.146;
STATES[18] = 0.6080573900752752;
CONSTANTS[31] = 0.00864;
STATES[19] = 0.0018339931180983765;
STATES[20] = 0.20443083454225305;
STATES[21] = 0.967887666264921;
STATES[22] = 0.09738789658609195;
STATES[23] = 0.09745345578743213;
CONSTANTS[32] = 5.04;
CONSTANTS[33] = 0.2016;
CONSTANTS[34] = 0.004444;
STATES[24] = 7.956883250874798e-4;
STATES[25] = 0.9999125083105881;
CONSTANTS[35] = 0.033;
CONSTANTS[36] = 0.00297;
CONSTANTS[37] = 0.385;
CONSTANTS[38] = 0.11;
CONSTANTS[39] = 0.0236;
CONSTANTS[40] = 2333;
CONSTANTS[41] = 0.04;
CONSTANTS[42] = 1;
CONSTANTS[43] = 1;
CONSTANTS[44] = 8.75;
CONSTANTS[45] = 87.5;
CONSTANTS[46] = 0.00138;
CONSTANTS[47] = 1.38;
STATES[26] = 0.9891789193465331;
CONSTANTS[48] = 6.81;
CONSTANTS[49] = 0.32;
CONSTANTS[50] = 0.04;
CONSTANTS[51] = 0.01;
CONSTANTS[52] = 0.165;
CONSTANTS[53] = 4.05;
CONSTANTS[54] = 69.8;
CONSTANTS[55] = 32.88;
CONSTANTS[56] = 0.258;
CONSTANTS[57] = 0.094;
STATES[27] = 0.5910747147428818;
CONSTANTS[58] = 21;
CONSTANTS[59] = 0.01;
CONSTANTS[60] = 1;
CONSTANTS[61] = 0.01;
CONSTANTS[62] = 0.08;
CONSTANTS[63] = 0.0008;
CONSTANTS[64] = 0.1;
CONSTANTS[65] = 162500;
STATES[28] = 2.611712901567567;
STATES[29] = 0.46108441538480216;
CONSTANTS[66] = 62000;
CONSTANTS[67] = 0.000849;
STATES[30] = 3.4314360001543243e-4;
STATES[31] = 0.19135178123107768;
CONSTANTS[68] = -150;
CONSTANTS[69] = 386;
CONSTANTS[70] = 459;
STATES[32] = 9.455741736977666;
CONSTANTS[71] = 160;
CONSTANTS[72] = 400;
CONSTANTS[73] = 10;
CONSTANTS[74] = 0.8;
STATES[33] = 0.02490898775497523;
STATES[34] = 0.001990153835322864;
STATES[35] = 4.2941813853474524e-4;
CONSTANTS[75] = 0.07;
CONSTANTS[76] = 39;
CONSTANTS[77] = 0.0039;
CONSTANTS[78] = 0.03;
CONSTANTS[79] = 0.12;
CONSTANTS[80] = 0.027;
CONSTANTS[81] = 0.03;
CONSTANTS[82] = 0.0039;
CONSTANTS[83] = 1560;
CONSTANTS[84] = 1.17;
CONSTANTS[85] = 0.9623799975411884;
STATES[36] = 0.9573749975411884;
CONSTANTS[86] = 140000;
CONSTANTS[87] = 0.97;
CONSTANTS[88] = 200;
CONSTANTS[89] = 1800000;
CONSTANTS[90] = 1.2;
CONSTANTS[91] = 0.005;
CONSTANTS[92] = ( CONSTANTS[27]*CONSTANTS[24]*CONSTANTS[26]*CONSTANTS[23])/( CONSTANTS[25]*CONSTANTS[28]*CONSTANTS[22]);
CONSTANTS[93] =  CONSTANTS[30]*CONSTANTS[3]*pow(CONSTANTS[11]/5.40000, 0.400000);
CONSTANTS[94] =  CONSTANTS[31]*CONSTANTS[3]*pow(CONSTANTS[11]/5.40000, 0.200000);
CONSTANTS[95] =  0.000110000*pow(CONSTANTS[11]/5.40000, 0.160000);
CONSTANTS[96] =  CONSTANTS[39]*CONSTANTS[40]*pow(CONSTANTS[11]/1.00000, 0.240000);
CONSTANTS[97] = 1.00000/(1.00000+ pow(CONSTANTS[45]/CONSTANTS[9], 3.00000)*(1.00000+CONSTANTS[10]/CONSTANTS[47]));
CONSTANTS[98] = exp( - 20.0000*pow(CONSTANTS[85] - CONSTANTS[84], 2.00000));
CONSTANTS[99] =  CONSTANTS[86]*pow(CONSTANTS[87] - CONSTANTS[85], 5.00000)+ CONSTANTS[88]*(CONSTANTS[87] - CONSTANTS[85]);
CONSTANTS[100] = 1.00000/(1.00000+ (CONSTANTS[47]/CONSTANTS[10])*(1.00000+pow(CONSTANTS[9]/CONSTANTS[45], 3.00000)));
STATES[37] = 0.1001;
STATES[38] = 0.1001;
STATES[39] = 0.1001;
RATES[0] = 0.1001;
RATES[1] = 0.1001;
RATES[2] = 0.1001;
RATES[3] = 0.1001;
RATES[4] = 0.1001;
RATES[7] = 0.1001;
RATES[5] = 0.1001;
RATES[8] = 0.1001;
RATES[6] = 0.1001;
RATES[13] = 0.1001;
RATES[9] = 0.1001;
RATES[14] = 0.1001;
RATES[10] = 0.1001;
RATES[11] = 0.1001;
RATES[15] = 0.1001;
RATES[12] = 0.1001;
RATES[16] = 0.1001;
RATES[17] = 0.1001;
RATES[18] = 0.1001;
RATES[19] = 0.1001;
RATES[20] = 0.1001;
RATES[21] = 0.1001;
RATES[22] = 0.1001;
RATES[23] = 0.1001;
RATES[24] = 0.1001;
RATES[25] = 0.1001;
RATES[26] = 0.1001;
RATES[27] = 0.1001;
RATES[29] = 0.1001;
RATES[30] = 0.1001;
RATES[31] = 0.1001;
RATES[32] = 0.1001;
RATES[28] = 0.1001;
RATES[36] = 0.1001;
RATES[33] = 0.1001;
RATES[34] = 0.1001;
RATES[35] = 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[137]+ALGEBRAIC[0])/CONSTANTS[3];
resid[1] = RATES[1] - - ALGEBRAIC[135]/( CONSTANTS[2]*CONSTANTS[12]);
resid[2] = RATES[2] - - (ALGEBRAIC[136]+ALGEBRAIC[0])/( CONSTANTS[2]*CONSTANTS[12]);
resid[3] = RATES[3] - - (((ALGEBRAIC[129] - ALGEBRAIC[124]) - ALGEBRAIC[125]) - ALGEBRAIC[89])/( 2.00000*CONSTANTS[2]*CONSTANTS[12])+STATES[37];
resid[4] = RATES[4] - (( CONSTANTS[15]*(CONSTANTS[16] - STATES[4])+ALGEBRAIC[99]) - ALGEBRAIC[133]/( CONSTANTS[2]*CONSTANTS[12]))+ALGEBRAIC[124]/( 4.00000*CONSTANTS[2]*CONSTANTS[12]);
resid[5] = RATES[7] - ( STATES[5]*ALGEBRAIC[11]+ ALGEBRAIC[9]*ALGEBRAIC[16]) -  STATES[7]*(ALGEBRAIC[15]+ALGEBRAIC[10]);
resid[6] = RATES[5] - ( STATES[7]*ALGEBRAIC[10]+ STATES[8]*CONSTANTS[18]) -  STATES[5]*(ALGEBRAIC[11]+ALGEBRAIC[12]);
resid[7] = RATES[8] - ( ALGEBRAIC[9]*ALGEBRAIC[14]+ STATES[5]*ALGEBRAIC[12]) -  STATES[8]*(ALGEBRAIC[13]+CONSTANTS[18]);
resid[8] = RATES[6] -  ALGEBRAIC[17]*(1.00000 - STATES[6]) -  ALGEBRAIC[18]*STATES[6];
resid[9] = RATES[13] - ( STATES[9]*ALGEBRAIC[22]+ ALGEBRAIC[20]*ALGEBRAIC[26]) -  STATES[13]*(ALGEBRAIC[25]+ALGEBRAIC[21]);
resid[10] = RATES[9] - ( STATES[13]*ALGEBRAIC[21]+ STATES[14]*CONSTANTS[21]) -  STATES[9]*(ALGEBRAIC[22]+CONSTANTS[20]);
resid[11] = RATES[14] - ( ALGEBRAIC[20]*ALGEBRAIC[23]+ STATES[9]*CONSTANTS[20]) -  STATES[14]*(ALGEBRAIC[24]+CONSTANTS[21]);
resid[12] = RATES[10] - ( STATES[15]*CONSTANTS[24]+ STATES[11]*CONSTANTS[92]) -  STATES[10]*(ALGEBRAIC[32]+CONSTANTS[25]);
resid[13] = RATES[11] - ( STATES[10]*ALGEBRAIC[32]+ ALGEBRAIC[34]*CONSTANTS[22]) -  STATES[11]*(CONSTANTS[23]+CONSTANTS[92]);
resid[14] = RATES[15] - ( ALGEBRAIC[34]*CONSTANTS[27]+ STATES[10]*CONSTANTS[25]) -  STATES[15]*(CONSTANTS[24]+ CONSTANTS[28]*ALGEBRAIC[29]*STATES[9]);
resid[15] = RATES[12] -  ALGEBRAIC[35]*(1.00000 - STATES[12]) -  ALGEBRAIC[36]*STATES[12];
resid[16] = RATES[16] -  ALGEBRAIC[38]*(1.00000 - STATES[16]) -  ALGEBRAIC[39]*STATES[16];
resid[17] = RATES[17] -  ALGEBRAIC[40]*(1.00000 - STATES[17]) -  ALGEBRAIC[41]*STATES[17];
resid[18] = RATES[18] -  ALGEBRAIC[45]*(1.00000 - STATES[18]) -  ALGEBRAIC[113]*STATES[18];
resid[19] = RATES[19] -  ALGEBRAIC[47]*(1.00000 - STATES[19]) -  ALGEBRAIC[48]*STATES[19];
resid[20] = RATES[20] -  ALGEBRAIC[49]*(1.00000 - STATES[20]) -  ALGEBRAIC[50]*STATES[20];
resid[21] = RATES[21] -  ALGEBRAIC[51]*(1.00000 - STATES[21]) -  ALGEBRAIC[52]*STATES[21];
resid[22] = RATES[22] -  ALGEBRAIC[55]*(1.00000 - STATES[22]) -  ALGEBRAIC[56]*STATES[22];
resid[23] = RATES[23] -  ALGEBRAIC[57]*(1.00000 - STATES[23]) -  CONSTANTS[34]*STATES[23];
resid[24] = RATES[24] -  ALGEBRAIC[60]*(1.00000 - STATES[24]) -  ALGEBRAIC[61]*STATES[24];
resid[25] = RATES[25] -  ALGEBRAIC[62]*(1.00000 - STATES[25]) -  ALGEBRAIC[63]*STATES[25];
resid[26] = RATES[26] -  ALGEBRAIC[74]*(1.00000 - STATES[26]) -  ALGEBRAIC[75]*STATES[26];
resid[27] = RATES[27] -  ALGEBRAIC[123]*(1.00000 - STATES[27]) -  ALGEBRAIC[80]*STATES[27];
resid[28] = RATES[29] -  ALGEBRAIC[86]*(1.00000 - STATES[29]) -  ALGEBRAIC[87]*STATES[29];
resid[29] = RATES[30] -  STATES[31]*ALGEBRAIC[88] -  STATES[30]*ALGEBRAIC[126];
resid[30] = RATES[31] -  ALGEBRAIC[127]*(1.00000 - (STATES[30]+STATES[31])) -  (ALGEBRAIC[88]+CONSTANTS[67])*STATES[31];
resid[31] = RATES[32] - (ALGEBRAIC[128] - ALGEBRAIC[125])/( 2.00000*CONSTANTS[2]*CONSTANTS[71]);
resid[32] = RATES[28] - ((- ALGEBRAIC[124] - ALGEBRAIC[128]) - ALGEBRAIC[89])/( 2.00000*CONSTANTS[2]*CONSTANTS[72]);
resid[33] = STATES[38] -  CONSTANTS[80]*pow(RATES[36], 2.00000)*STATES[35];
resid[34] = STATES[39] -  CONSTANTS[80]*pow(RATES[36], 2.00000)*STATES[34];
resid[35] = RATES[33] - ALGEBRAIC[95] - ALGEBRAIC[96];
resid[36] = RATES[34] - (ALGEBRAIC[96] - ALGEBRAIC[97]) - STATES[39];
resid[37] = RATES[35] - (ALGEBRAIC[97] - ALGEBRAIC[98]) - STATES[38];
resid[38] = STATES[37] -  CONSTANTS[75]*((STATES[39]+ALGEBRAIC[97]) - ALGEBRAIC[95]);
resid[39] = RATES[36] -  CONSTANTS[90]*(ALGEBRAIC[93] - CONSTANTS[91]);
}
void
computeVariables(double VOI, double* CONSTANTS, double* RATES, double* STATES, double* ALGEBRAIC)
{
ALGEBRAIC[33] =  CONSTANTS[28]*ALGEBRAIC[30];
ALGEBRAIC[100] =  CONSTANTS[75]*(STATES[34]+STATES[35]);
ALGEBRAIC[101] =  CONSTANTS[89]*ALGEBRAIC[100];
ALGEBRAIC[102] =  ALGEBRAIC[101]*ALGEBRAIC[93];
ALGEBRAIC[103] = - CONSTANTS[99]+ALGEBRAIC[102];
}
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[9] = ((1.00000 - STATES[7]) - STATES[5]) - STATES[8];
ALGEBRAIC[10] = 1.00000/( 0.102700*exp(- STATES[0]/8.00000)+ 0.250000*exp(- STATES[0]/50.0000));
ALGEBRAIC[11] = 1.00000/( 26.0000*exp(STATES[0]/17.0000)+ 0.0200000*exp(STATES[0]/800.000));
ALGEBRAIC[12] = 1.00000/( 0.800000*exp(- STATES[0]/400.000));
ALGEBRAIC[13] = 1.00000/( 1300.00*exp(STATES[0]/20.0000)+ 0.0400000*exp(STATES[0]/800.000));
ALGEBRAIC[14] = 1.00000/( 0.000102700*exp(- STATES[0]/8.00000)+ 5.00000*exp(- STATES[0]/400.000));
ALGEBRAIC[15] = 0.0100000/(1.00000+( CONSTANTS[18]*ALGEBRAIC[11]*ALGEBRAIC[14])/( ALGEBRAIC[12]*ALGEBRAIC[10]*ALGEBRAIC[13]));
ALGEBRAIC[16] = 0.0100000 - ALGEBRAIC[15];
ALGEBRAIC[17] = 1.00000/( 9.00000e+09*exp(STATES[0]/5.00000)+ 8000.00*exp(STATES[0]/100.000));
ALGEBRAIC[18] = 1.00000/( 0.0140000*exp(- STATES[0]/5.00000)+ 4000.00*exp(- STATES[0]/100.000));
ALGEBRAIC[20] = ((1.00000 - STATES[9]) - STATES[13]) - STATES[14];
ALGEBRAIC[21] = 1.00000/( 0.270000*exp(- STATES[0]/5.90000)+ 1.50000*exp(- STATES[0]/65.0000));
ALGEBRAIC[22] = 1.00000/( 480.000*exp(STATES[0]/7.00000)+ 2.20000*exp(STATES[0]/65.0000));
ALGEBRAIC[23] = 1.00000/( 0.00180000*exp(- STATES[0]/7.40000)+ 2.00000*exp(- STATES[0]/100.000));
ALGEBRAIC[24] = 1.00000/( 2.20000e+06*exp(STATES[0]/7.40000)+ 11.0000*exp(STATES[0]/100.000));
ALGEBRAIC[25] = 0.0400000/(1.00000+( CONSTANTS[21]*ALGEBRAIC[22]*ALGEBRAIC[23])/( CONSTANTS[20]*ALGEBRAIC[21]*ALGEBRAIC[24]));
ALGEBRAIC[26] = 0.0400000 - ALGEBRAIC[25];
ALGEBRAIC[1] = (CONSTANTS[13] - STATES[3])+CONSTANTS[14];
ALGEBRAIC[2] =  CONSTANTS[14]*STATES[3];
ALGEBRAIC[3] = ( pow((pow(ALGEBRAIC[1], 2.00000)+ 4.00000*ALGEBRAIC[2]), 1.0 / 2) - ALGEBRAIC[1])/2.00000;
ALGEBRAIC[5] = (STATES[0]==0.00000 ? - CONSTANTS[10] : ( (( 2.00000*CONSTANTS[2]*STATES[0])/( CONSTANTS[0]*CONSTANTS[1]))*(ALGEBRAIC[3] -  CONSTANTS[10]*exp(( - 2.00000*CONSTANTS[2]*STATES[0])/( CONSTANTS[0]*CONSTANTS[1]))))/(1.00000 - exp(( - 2.00000*CONSTANTS[2]*STATES[0])/( CONSTANTS[0]*CONSTANTS[1]))));
ALGEBRAIC[27] =  0.0676000*ALGEBRAIC[5];
ALGEBRAIC[29] = ALGEBRAIC[3] -  0.300000*ALGEBRAIC[27];
ALGEBRAIC[30] =  ALGEBRAIC[29]*STATES[9];
ALGEBRAIC[31] = ALGEBRAIC[30]+ ALGEBRAIC[3]*(1.00000 - STATES[9]);
ALGEBRAIC[32] =  CONSTANTS[26]*ALGEBRAIC[31];
ALGEBRAIC[34] = ((1.00000 - STATES[15]) - STATES[10]) - STATES[11];
ALGEBRAIC[35] = 1.00000/( 250000.*exp(STATES[0]/9.00000)+ 58.0000*exp(STATES[0]/65.0000));
ALGEBRAIC[36] = 1.00000/( 1800.00*exp(- STATES[0]/14.0000)+ 66.0000*exp(- STATES[0]/65.0000));
ALGEBRAIC[38] = 1.00000/( 0.0190000*exp(- STATES[0]/5.60000)+ 0.820000*exp(- STATES[0]/250.000));
ALGEBRAIC[39] = 1.00000/( 40.0000*exp(STATES[0]/6.30000)+ 1.50000*exp(STATES[0]/10000.0));
ALGEBRAIC[40] = 1.00000/( 62000.0*exp(STATES[0]/10.1000)+ 30.0000*exp(STATES[0]/3000.00));
ALGEBRAIC[41] = 1.00000/( 0.000600000*exp(- STATES[0]/6.70000)+ 1.20000*exp(- STATES[0]/25.0000));
ALGEBRAIC[42] =  (( CONSTANTS[0]*CONSTANTS[1])/CONSTANTS[2])*log(CONSTANTS[11]/STATES[2]);
ALGEBRAIC[45] = 1.00000/( 8000.00*exp(((STATES[0] - ALGEBRAIC[42]) - 97.0000)/8.50000)+ 7.00000*exp(((STATES[0] - ALGEBRAIC[42]) - 97.0000)/300.000));
ALGEBRAIC[47] = 1.00000/( 20.0000*exp(- STATES[0]/11.5000)+ 5.00000*exp(- STATES[0]/300.000));
ALGEBRAIC[48] = 1.00000/( 160.000*exp(STATES[0]/28.0000)+ 200.000*exp(STATES[0]/1000.00))+1.00000/( 2500.00*exp(STATES[0]/20.0000));
ALGEBRAIC[49] = 1.00000/( 200.000*exp(- STATES[0]/13.0000)+ 20.0000*exp(- STATES[0]/300.000));
ALGEBRAIC[50] = 1.00000/( 1600.00*exp(STATES[0]/28.0000)+ 2000.00*exp(STATES[0]/1000.00))+1.00000/( 10000.0*exp(STATES[0]/20.0000));
ALGEBRAIC[51] = 1.00000/( 10.0000*exp(STATES[0]/17.0000)+ 2.50000*exp(STATES[0]/300.000));
ALGEBRAIC[52] = 1.00000/( 0.350000*exp(- STATES[0]/17.0000)+ 2.00000*exp(- STATES[0]/150.000));
ALGEBRAIC[55] = 1.00000/( 85.0000*exp(- STATES[0]/10.5000)+ 370.000*exp(- STATES[0]/62.0000));
ALGEBRAIC[56] = 1.00000/( 1450.00*exp(STATES[0]/20.0000)+ 260.000*exp(STATES[0]/100.000));
ALGEBRAIC[57] =  3.70000*ALGEBRAIC[3];
ALGEBRAIC[60] = 1.00000/( 11.0000*exp(- STATES[0]/28.0000)+ 0.200000*exp(- STATES[0]/400.000));
ALGEBRAIC[61] = 1.00000/( 4.40000*exp(STATES[0]/16.0000)+ 0.200000*exp(STATES[0]/500.000));
ALGEBRAIC[62] = ( 0.00380000*exp(- (STATES[0]+13.5000)/11.3000))/(1.00000+ 0.0513350*exp(- (STATES[0]+13.5000)/11.3000));
ALGEBRAIC[63] = ( 0.00380000*exp((STATES[0]+13.5000)/11.3000))/(1.00000+ 0.0670830*exp((STATES[0]+13.5000)/11.3000));
ALGEBRAIC[73] =  1.00000*exp(( (CONSTANTS[49] - 1.00000)*CONSTANTS[2]*STATES[0])/( CONSTANTS[0]*CONSTANTS[1]));
ALGEBRAIC[74] =  ALGEBRAIC[73]*CONSTANTS[97]+ CONSTANTS[43]*CONSTANTS[100];
ALGEBRAIC[70] = 1.00000/(1.00000+ pow(CONSTANTS[44]/STATES[1], 3.00000)*(1.00000+ALGEBRAIC[3]/CONSTANTS[46]));
ALGEBRAIC[71] = 1.00000/(1.00000+ (CONSTANTS[46]/ALGEBRAIC[3])*(1.00000+pow(STATES[1]/CONSTANTS[44], 3.00000)));
ALGEBRAIC[72] =  1.00000*exp(( CONSTANTS[49]*CONSTANTS[2]*STATES[0])/( CONSTANTS[0]*CONSTANTS[1]));
ALGEBRAIC[75] =  ALGEBRAIC[72]*ALGEBRAIC[70]+ CONSTANTS[42]*ALGEBRAIC[71];
ALGEBRAIC[76] = 1.00000/(1.00000+ pow(CONSTANTS[53]/STATES[1], 1.06000)*(1.00000+pow(STATES[2]/CONSTANTS[55], 1.12000)));
ALGEBRAIC[77] = 1.00000/(1.00000+ pow(CONSTANTS[55]/STATES[2], 1.12000)*(1.00000+pow(STATES[1]/CONSTANTS[53], 1.06000)));
ALGEBRAIC[78] = 0.370000/(1.00000+CONSTANTS[57]/STATES[4]);
ALGEBRAIC[80] =  ALGEBRAIC[78]*ALGEBRAIC[76]+ CONSTANTS[51]*ALGEBRAIC[77];
ALGEBRAIC[82] = 1.00000/(1.00000+CONSTANTS[63]/ALGEBRAIC[3]);
ALGEBRAIC[84] = 1.00000 - ALGEBRAIC[82];
ALGEBRAIC[85] = 1.00000/(1.00000+CONSTANTS[64]/STATES[4]);
ALGEBRAIC[86] =  ALGEBRAIC[85]*ALGEBRAIC[82]+ CONSTANTS[61]*ALGEBRAIC[84];
ALGEBRAIC[81] = 1.00000/(1.00000+CONSTANTS[62]/STATES[28]);
ALGEBRAIC[83] = 1.00000 - ALGEBRAIC[81];
ALGEBRAIC[87] =  CONSTANTS[59]*ALGEBRAIC[81]+ CONSTANTS[60]*ALGEBRAIC[83];
ALGEBRAIC[19] = ( STATES[9]*(STATES[10]+STATES[11])*STATES[12])/(1.00000+pow(1.40000/STATES[4], 3.00000));
ALGEBRAIC[28] =  ALGEBRAIC[27]*ALGEBRAIC[19];
ALGEBRAIC[88] =  280000.*pow(ALGEBRAIC[3]/1.00000, 2.00000)+ CONSTANTS[68]*ALGEBRAIC[28];
ALGEBRAIC[89] =  CONSTANTS[70]*(STATES[28] - ALGEBRAIC[3]);
ALGEBRAIC[93] = CONSTANTS[85] - STATES[36];
ALGEBRAIC[94] = ((1.00000 - STATES[33]) - STATES[34]) - STATES[35];
ALGEBRAIC[95] =  CONSTANTS[76]*ALGEBRAIC[3]*ALGEBRAIC[94] -  CONSTANTS[81]*STATES[33];
ALGEBRAIC[96] =  CONSTANTS[77]*STATES[33]*CONSTANTS[98] -  CONSTANTS[82]*STATES[34];
ALGEBRAIC[97] =  CONSTANTS[78]*STATES[34] -  CONSTANTS[83]*STATES[35]*ALGEBRAIC[3];
ALGEBRAIC[98] =  CONSTANTS[79]*STATES[35];
ALGEBRAIC[99] =  - 0.400000*STATES[34]*CONSTANTS[75];
ALGEBRAIC[43] = ( 0.750000*exp( 0.0350000*((STATES[0] - ALGEBRAIC[42]) - 10.0000)))/(1.00000+exp( 0.0150000*((STATES[0] - ALGEBRAIC[42]) - 140.000)));
ALGEBRAIC[44] = ( 3.00000*exp( - 0.0480000*((STATES[0] - ALGEBRAIC[42]) - 10.0000))*(1.00000+exp( 0.0640000*((STATES[0] - ALGEBRAIC[42]) - 38.0000))))/(1.00000+exp( 0.0300000*((STATES[0] - ALGEBRAIC[42]) - 70.0000)));
ALGEBRAIC[109] = ALGEBRAIC[44]/(ALGEBRAIC[43]+ALGEBRAIC[44]);
ALGEBRAIC[113] = ( pow(ALGEBRAIC[109], 4.00000)*1.00000)/( 0.000140000*exp(- ((STATES[0] - ALGEBRAIC[42]) - 97.0000)/9.10000)+ 0.200000*exp(- ((STATES[0] - ALGEBRAIC[42]) - 97.0000)/500.000));
ALGEBRAIC[79] =  CONSTANTS[9]*exp(( - 0.820000*CONSTANTS[2]*STATES[0])/( CONSTANTS[0]*CONSTANTS[1]));
ALGEBRAIC[121] = 1.00000/(1.00000+ pow(CONSTANTS[54]/ALGEBRAIC[79], 1.06000)*(1.00000+pow(CONSTANTS[11]/CONSTANTS[56], 1.12000)));
ALGEBRAIC[122] = 1.00000/(1.00000+ pow(CONSTANTS[56]/CONSTANTS[11], 1.12000)*(1.00000+pow(ALGEBRAIC[79]/CONSTANTS[54], 1.06000)));
ALGEBRAIC[123] =  CONSTANTS[50]*ALGEBRAIC[121]+ CONSTANTS[52]*ALGEBRAIC[122];
ALGEBRAIC[124] =  CONSTANTS[65]*1.00000*( CONSTANTS[59]*ALGEBRAIC[81]*STATES[29] -  ALGEBRAIC[85]*ALGEBRAIC[82]*(1.00000 - STATES[29]));
ALGEBRAIC[90] = (CONSTANTS[73] - STATES[32])+CONSTANTS[74];
ALGEBRAIC[91] =  CONSTANTS[74]*STATES[32];
ALGEBRAIC[92] = ( pow((pow(ALGEBRAIC[90], 2.00000)+ 4.00000*ALGEBRAIC[91]), 1.0 / 2) - ALGEBRAIC[90])/2.00000;
ALGEBRAIC[125] =  CONSTANTS[66]*(ALGEBRAIC[92] - ALGEBRAIC[3])*STATES[30];
ALGEBRAIC[126] = 0.0800000/(1.00000+0.360000/ALGEBRAIC[92]);
ALGEBRAIC[127] =  0.000377000*pow(ALGEBRAIC[92]/1.00000, 2.00000);
ALGEBRAIC[128] =  CONSTANTS[69]*(STATES[28] - ALGEBRAIC[92]);
ALGEBRAIC[37] =  CONSTANTS[29]*ALGEBRAIC[5]*STATES[16]*STATES[17];
ALGEBRAIC[120] =  CONSTANTS[48]*CONSTANTS[3]*1.00000*( ALGEBRAIC[72]*ALGEBRAIC[70]*STATES[26] -  ALGEBRAIC[73]*CONSTANTS[97]*(1.00000 - STATES[26]));
ALGEBRAIC[69] =  CONSTANTS[41]*ALGEBRAIC[5];
ALGEBRAIC[105] =  CONSTANTS[19]*ALGEBRAIC[5]*ALGEBRAIC[19];
ALGEBRAIC[129] = (ALGEBRAIC[105]+ALGEBRAIC[37]+ALGEBRAIC[69]) -  2.00000*ALGEBRAIC[120];
ALGEBRAIC[133] =  CONSTANTS[58]*CONSTANTS[3]*1.00000*( ALGEBRAIC[78]*ALGEBRAIC[76]*STATES[27] -  CONSTANTS[50]*ALGEBRAIC[121]*(1.00000 - STATES[27]));
ALGEBRAIC[4] = (STATES[0]==0.00000 ? - CONSTANTS[9] : ( (( CONSTANTS[2]*STATES[0])/( CONSTANTS[0]*CONSTANTS[1]))*(STATES[1] -  CONSTANTS[9]*exp(( - CONSTANTS[2]*STATES[0])/( CONSTANTS[0]*CONSTANTS[1]))))/(1.00000 - exp(( - CONSTANTS[2]*STATES[0])/( CONSTANTS[0]*CONSTANTS[1]))));
ALGEBRAIC[7] =  CONSTANTS[17]*ALGEBRAIC[4]*STATES[5]*STATES[6];
ALGEBRAIC[106] =  1.85000e-05*CONSTANTS[19]*ALGEBRAIC[4]*ALGEBRAIC[19];
ALGEBRAIC[65] =  CONSTANTS[37]*ALGEBRAIC[4];
ALGEBRAIC[67] = 1.00000/(1.00000+pow(0.00120000/ALGEBRAIC[3], 3.00000));
ALGEBRAIC[118] =  CONSTANTS[38]*ALGEBRAIC[4]*ALGEBRAIC[67];
ALGEBRAIC[59] =  CONSTANTS[36]*ALGEBRAIC[4]*pow(STATES[24], 3.00000)*STATES[25];
ALGEBRAIC[54] =  CONSTANTS[33]*ALGEBRAIC[4]*pow(STATES[22], 2.00000)*( 0.900000*STATES[23]+0.100000);
ALGEBRAIC[135] = ALGEBRAIC[7]+ALGEBRAIC[54]+ALGEBRAIC[59]+ALGEBRAIC[106]+ALGEBRAIC[65]+ALGEBRAIC[118]+ 3.00000*ALGEBRAIC[133]+ 3.00000*ALGEBRAIC[120];
ALGEBRAIC[108] = ALGEBRAIC[43]/(ALGEBRAIC[43]+ALGEBRAIC[44]);
ALGEBRAIC[110] =  2.00000*pow(ALGEBRAIC[109], 2.00000)*pow(ALGEBRAIC[108], 2.00000);
ALGEBRAIC[111] =  (8.00000/3.00000)*pow(ALGEBRAIC[109], 3.00000)*ALGEBRAIC[108];
ALGEBRAIC[112] = pow(ALGEBRAIC[109], 4.00000);
ALGEBRAIC[131] =  CONSTANTS[93]*(STATES[0] - ALGEBRAIC[42])*(ALGEBRAIC[112]+ALGEBRAIC[111]+ALGEBRAIC[110])*STATES[18];
ALGEBRAIC[46] =  CONSTANTS[94]*(STATES[0] - ALGEBRAIC[42])*( 0.600000*STATES[19]+ 0.400000*STATES[20])*STATES[21];
ALGEBRAIC[6] = (STATES[0]==0.00000 ? STATES[2] : ( (( CONSTANTS[2]*STATES[0])/( CONSTANTS[0]*CONSTANTS[1]))*(STATES[2] -  CONSTANTS[11]*exp(( - CONSTANTS[2]*STATES[0])/( CONSTANTS[0]*CONSTANTS[1]))))/(1.00000 - exp(( - CONSTANTS[2]*STATES[0])/( CONSTANTS[0]*CONSTANTS[1]))));
ALGEBRAIC[66] = (STATES[0]==- 3.00000 ?  CONSTANTS[95]*ALGEBRAIC[6]*13.0077 : ( CONSTANTS[95]*ALGEBRAIC[6]*(STATES[0]+3.00000))/(1.00000 - exp(- (STATES[0]+3.00000)/13.0000)));
ALGEBRAIC[68] = 0.800000/(1.00000+pow(STATES[4]/0.100000, 2.00000));
ALGEBRAIC[119] =  CONSTANTS[96]*(STATES[0] - ALGEBRAIC[42])*ALGEBRAIC[68];
ALGEBRAIC[58] =  CONSTANTS[35]*ALGEBRAIC[6]*pow(STATES[24], 3.00000)*STATES[25];
ALGEBRAIC[53] =  CONSTANTS[32]*ALGEBRAIC[6]*pow(STATES[22], 2.00000)*( 0.900000*STATES[23]+0.100000);
ALGEBRAIC[8] =  0.100000*CONSTANTS[17]*ALGEBRAIC[6]*STATES[5]*STATES[6];
ALGEBRAIC[107] =  0.000365000*CONSTANTS[19]*ALGEBRAIC[6]*ALGEBRAIC[19];
ALGEBRAIC[64] =  0.400000*CONSTANTS[37]*ALGEBRAIC[6];
ALGEBRAIC[117] =  CONSTANTS[38]*ALGEBRAIC[6]*ALGEBRAIC[67];
ALGEBRAIC[136] = (ALGEBRAIC[131]+ALGEBRAIC[46]+ALGEBRAIC[58]+ALGEBRAIC[119]+ALGEBRAIC[53]+ALGEBRAIC[8]+ALGEBRAIC[107]+ALGEBRAIC[64]+ALGEBRAIC[117]+ALGEBRAIC[66]) -  2.00000*ALGEBRAIC[133];
ALGEBRAIC[116] = ALGEBRAIC[64]+ALGEBRAIC[65];
ALGEBRAIC[132] = ALGEBRAIC[117]+ALGEBRAIC[118];
ALGEBRAIC[134] = ALGEBRAIC[116]+ALGEBRAIC[69]+ALGEBRAIC[66]+ALGEBRAIC[132]+ALGEBRAIC[119];
ALGEBRAIC[104] = ALGEBRAIC[7]+ALGEBRAIC[8];
ALGEBRAIC[130] = ALGEBRAIC[106]+ALGEBRAIC[105]+ALGEBRAIC[107];
ALGEBRAIC[114] = ALGEBRAIC[54]+ALGEBRAIC[53];
ALGEBRAIC[115] = ALGEBRAIC[59]+ALGEBRAIC[58];
ALGEBRAIC[137] = ALGEBRAIC[104]+ALGEBRAIC[130]+ALGEBRAIC[37]+ALGEBRAIC[131]+ALGEBRAIC[46]+ALGEBRAIC[114]+ALGEBRAIC[115]+ALGEBRAIC[134]+ALGEBRAIC[133]+ALGEBRAIC[120];
}
void
getStateInformation(double* SI)
{
SI[0] = 1.0;
SI[1] = 1.0;
SI[2] = 1.0;
SI[37] = 0.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;
SI[29] = 1.0;
SI[30] = 1.0;
SI[31] = 1.0;
SI[32] = 1.0;
SI[33] = 1.0;
SI[34] = 1.0;
SI[35] = 1.0;
SI[38] = 0.0;
SI[39] = 0.0;
SI[36] = 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];
}