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 105 entries in the algebraic variable array.
   There are a total of 22 entries in each of the rate and state variable arrays.
   There are a total of 90 entries in the constant variable array.
 */
/*
 * VOI is time in component environment (ms).
 * STATES[0] is V in component membrane (mV).
 * CONSTANTS[0] is R in component membrane (mJ_per_mole_K).
 * CONSTANTS[1] is T in component membrane (kelvin).
 * CONSTANTS[2] is F in component membrane (C_per_mole).
 * CONSTANTS[3] is Cm in component membrane (uF).
 * ALGEBRAIC[1] is I_Stim in component membrane (uA).
 * ALGEBRAIC[0] is stim_period in component membrane (ms).
 * CONSTANTS[4] is stim_duration in component membrane (ms).
 * CONSTANTS[5] is stim_amplitude in component membrane (uA).
 * ALGEBRAIC[5] is i_Na in component pandit_sodium_current (uA).
 * ALGEBRAIC[13] is i_t in component pandit_Ca_independent_transient_outward_K_current (uA).
 * ALGEBRAIC[20] is i_ss in component pandit_steady_state_outward_K_current (uA).
 * ALGEBRAIC[27] is i_f in component pandit_hyperpolarisation_activated_current (uA).
 * ALGEBRAIC[24] is i_K1 in component pandit_inward_rectifier (uA).
 * ALGEBRAIC[30] is i_B_Na in component pandit_background_currents (uA).
 * ALGEBRAIC[31] is i_B_K in component pandit_background_currents (uA).
 * ALGEBRAIC[32] is i_NaK in component pandit_sodium_potassium_pump (uA).
 * ALGEBRAIC[94] is I_LCC in component convert_hinch (uA).
 * ALGEBRAIC[67] is I_NaCa in component convert_hinch (uA).
 * ALGEBRAIC[68] is I_pCa in component convert_hinch (uA).
 * ALGEBRAIC[69] is I_CaB in component convert_hinch (uA).
 * ALGEBRAIC[2] is FVRT in component membrane (dimensionless).
 * ALGEBRAIC[3] is FVRT_Ca in component membrane (dimensionless).
 * CONSTANTS[6] is V_myo in component cell_geometry (um3).
 * CONSTANTS[7] is V_SR in component cell_geometry (um3).
 * CONSTANTS[8] is V_myo_uL in component cell_geometry (uL).
 * CONSTANTS[9] is V_SR_uL in component cell_geometry (uL).
 * ALGEBRAIC[4] is E_Na in component pandit_sodium_current (mV).
 * CONSTANTS[10] is g_Na in component pandit_sodium_current (mSi).
 * CONSTANTS[79] is g_Na_endo in component pandit_sodium_current (mSi).
 * STATES[1] is Na_i in component intracellular_ion_concentrations (mM).
 * CONSTANTS[11] is Na_o in component pandit_standard_ionic_concentrations (mM).
 * STATES[2] is m in component sodium_current_m_gate (dimensionless).
 * STATES[3] is h in component sodium_current_h_gate (dimensionless).
 * STATES[4] is j in component sodium_current_j_gate (dimensionless).
 * ALGEBRAIC[6] is m_infinity in component sodium_current_m_gate (dimensionless).
 * ALGEBRAIC[7] is tau_m in component sodium_current_m_gate (ms).
 * ALGEBRAIC[8] is h_infinity in component sodium_current_h_gate (dimensionless).
 * ALGEBRAIC[9] is tau_h in component sodium_current_h_gate (ms).
 * ALGEBRAIC[10] is j_infinity in component sodium_current_j_gate (dimensionless).
 * ALGEBRAIC[11] is tau_j in component sodium_current_j_gate (ms).
 * ALGEBRAIC[12] is E_K in component pandit_Ca_independent_transient_outward_K_current (mV).
 * CONSTANTS[12] is g_t in component pandit_Ca_independent_transient_outward_K_current (mSi).
 * CONSTANTS[80] is g_t_endo in component pandit_Ca_independent_transient_outward_K_current (mSi).
 * CONSTANTS[13] is a_endo in component pandit_Ca_independent_transient_outward_K_current (dimensionless).
 * CONSTANTS[14] is b_endo in component pandit_Ca_independent_transient_outward_K_current (dimensionless).
 * CONSTANTS[15] is K_o in component pandit_standard_ionic_concentrations (mM).
 * STATES[5] is K_i in component intracellular_ion_concentrations (mM).
 * STATES[6] is r in component Ca_independent_transient_outward_K_current_r_gate (dimensionless).
 * STATES[7] is s in component Ca_independent_transient_outward_K_current_s_gate (dimensionless).
 * STATES[8] is s_slow in component Ca_independent_transient_outward_K_current_s_slow_gate (dimensionless).
 * ALGEBRAIC[15] is tau_r in component Ca_independent_transient_outward_K_current_r_gate (ms).
 * ALGEBRAIC[14] is r_infinity in component Ca_independent_transient_outward_K_current_r_gate (dimensionless).
 * ALGEBRAIC[17] is tau_s_endo in component Ca_independent_transient_outward_K_current_s_gate (ms).
 * ALGEBRAIC[16] is s_infinity in component Ca_independent_transient_outward_K_current_s_gate (dimensionless).
 * ALGEBRAIC[19] is tau_s_slow_endo in component Ca_independent_transient_outward_K_current_s_slow_gate (ms).
 * ALGEBRAIC[18] is s_slow_infinity in component Ca_independent_transient_outward_K_current_s_slow_gate (dimensionless).
 * CONSTANTS[16] is g_ss in component pandit_steady_state_outward_K_current (mSi).
 * STATES[9] is r_ss in component steady_state_outward_K_current_r_ss_gate (dimensionless).
 * STATES[10] is s_ss in component steady_state_outward_K_current_s_ss_gate (dimensionless).
 * ALGEBRAIC[22] is tau_r_ss in component steady_state_outward_K_current_r_ss_gate (ms).
 * ALGEBRAIC[21] is r_ss_infinity in component steady_state_outward_K_current_r_ss_gate (dimensionless).
 * CONSTANTS[81] is tau_s_ss in component steady_state_outward_K_current_s_ss_gate (ms).
 * ALGEBRAIC[23] is s_ss_infinity in component steady_state_outward_K_current_s_ss_gate (dimensionless).
 * CONSTANTS[17] is g_K1 in component pandit_inward_rectifier (mSi).
 * ALGEBRAIC[25] is i_f_Na in component pandit_hyperpolarisation_activated_current (uA).
 * ALGEBRAIC[26] is i_f_K in component pandit_hyperpolarisation_activated_current (uA).
 * CONSTANTS[18] is g_f in component pandit_hyperpolarisation_activated_current (mSi).
 * CONSTANTS[19] is f_Na in component pandit_hyperpolarisation_activated_current (dimensionless).
 * CONSTANTS[82] is f_K in component pandit_hyperpolarisation_activated_current (dimensionless).
 * STATES[11] is y in component hyperpolarisation_activated_current_y_gate (dimensionless).
 * ALGEBRAIC[29] is tau_y in component hyperpolarisation_activated_current_y_gate (ms).
 * ALGEBRAIC[28] is y_infinity in component hyperpolarisation_activated_current_y_gate (dimensionless).
 * CONSTANTS[20] is g_B_Na in component pandit_background_currents (mSi).
 * CONSTANTS[21] is g_B_K in component pandit_background_currents (mSi).
 * CONSTANTS[22] is i_NaK_max in component pandit_sodium_potassium_pump (uA).
 * CONSTANTS[23] is K_m_K in component pandit_sodium_potassium_pump (mM).
 * CONSTANTS[24] is K_m_Na in component pandit_sodium_potassium_pump (mM).
 * CONSTANTS[83] is sigma in component pandit_sodium_potassium_pump (dimensionless).
 * CONSTANTS[25] is Ca_o in component pandit_standard_ionic_concentrations (mM).
 * CONSTANTS[26] is g_D in component hinch_CaRU (um3_per_ms).
 * CONSTANTS[27] is J_R in component hinch_CaRU (um3_per_ms).
 * CONSTANTS[28] is J_L in component hinch_CaRU (um3_per_ms).
 * CONSTANTS[29] is N in component hinch_CaRU (dimensionless).
 * STATES[12] is Ca_i in component intracellular_ion_concentrations (mM).
 * STATES[13] is Ca_SR in component intracellular_ion_concentrations (mM).
 * ALGEBRAIC[91] is I_RyR in component RyR_current (mM_per_ms).
 * ALGEBRAIC[93] is I_LCC in component LCC_current (mM_per_ms).
 * ALGEBRAIC[42] is C_oc in component DS_Calcium_Concentrations (mM).
 * ALGEBRAIC[41] is C_co in component DS_Calcium_Concentrations (mM).
 * CONSTANTS[30] is V_L in component CaRU_Transitions (mV).
 * CONSTANTS[31] is del_VL in component CaRU_Transitions (mV).
 * CONSTANTS[32] is phi_L in component CaRU_Transitions (dimensionless).
 * CONSTANTS[33] is t_L in component CaRU_Transitions (ms).
 * CONSTANTS[34] is tau_L in component CaRU_Transitions (ms).
 * CONSTANTS[84] is t_R in component CaRU_Transitions (ms).
 * CONSTANTS[35] is tau_R in component CaRU_Transitions (ms).
 * CONSTANTS[36] is phi_R in component CaRU_Transitions (dimensionless).
 * CONSTANTS[37] is theta_R in component CaRU_Transitions (dimensionless).
 * CONSTANTS[38] is K_RyR in component CaRU_Transitions (mM).
 * CONSTANTS[39] is K_L in component CaRU_Transitions (mM).
 * CONSTANTS[40] is a in component CaRU_Transitions (dimensionless).
 * CONSTANTS[41] is b in component CaRU_Transitions (dimensionless).
 * CONSTANTS[42] is c in component CaRU_Transitions (dimensionless).
 * CONSTANTS[43] is d in component CaRU_Transitions (dimensionless).
 * ALGEBRAIC[33] is expVL in component CaRU_Transitions (dimensionless).
 * ALGEBRAIC[34] is alpha_p in component CaRU_Transitions (per_ms).
 * CONSTANTS[87] is alpha_m in component CaRU_Transitions (per_ms).
 * ALGEBRAIC[77] is beta_poc in component CaRU_Transitions (per_ms).
 * ALGEBRAIC[35] is beta_pcc in component CaRU_Transitions (per_ms).
 * CONSTANTS[89] is beta_m in component CaRU_Transitions (per_ms).
 * ALGEBRAIC[78] is epsilon_pco in component CaRU_Transitions (per_ms).
 * ALGEBRAIC[36] is epsilon_pcc in component CaRU_Transitions (per_ms).
 * ALGEBRAIC[37] is epsilon_m in component CaRU_Transitions (per_ms).
 * ALGEBRAIC[79] is mu_poc in component CaRU_Transitions (per_ms).
 * ALGEBRAIC[38] is mu_pcc in component CaRU_Transitions (per_ms).
 * ALGEBRAIC[80] is mu_moc in component CaRU_Transitions (per_ms).
 * ALGEBRAIC[39] is mu_mcc in component CaRU_Transitions (per_ms).
 * ALGEBRAIC[40] is C_cc in component DS_Calcium_Concentrations (mM).
 * ALGEBRAIC[43] is C_oo in component DS_Calcium_Concentrations (mM).
 * ALGEBRAIC[47] is J_Loo in component LCC_and_RyR_fluxes (um3_mM_per_ms).
 * ALGEBRAIC[46] is J_Loc in component LCC_and_RyR_fluxes (um3_mM_per_ms).
 * ALGEBRAIC[44] is J_Rco in component LCC_and_RyR_fluxes (um3_mM_per_ms).
 * ALGEBRAIC[45] is J_Roo in component LCC_and_RyR_fluxes (um3_mM_per_ms).
 * ALGEBRAIC[81] is denom in component CaRU_states (per_ms3).
 * ALGEBRAIC[82] is y_oc in component CaRU_states (dimensionless).
 * ALGEBRAIC[83] is y_co in component CaRU_states (dimensionless).
 * ALGEBRAIC[84] is y_oo in component CaRU_states (dimensionless).
 * ALGEBRAIC[85] is y_cc in component CaRU_states (dimensionless).
 * ALGEBRAIC[48] is y_ci in component CaRU_states (dimensionless).
 * ALGEBRAIC[49] is y_oi in component CaRU_states (dimensionless).
 * ALGEBRAIC[50] is y_ic in component CaRU_states (dimensionless).
 * ALGEBRAIC[51] is y_io in component CaRU_states (dimensionless).
 * ALGEBRAIC[86] is y_ii in component CaRU_states (dimensionless).
 * ALGEBRAIC[87] is r_1 in component CaRU_reduced_states (per_ms).
 * ALGEBRAIC[88] is r_2 in component CaRU_reduced_states (per_ms).
 * ALGEBRAIC[52] is r_3 in component CaRU_reduced_states (per_ms).
 * ALGEBRAIC[53] is r_4 in component CaRU_reduced_states (per_ms).
 * ALGEBRAIC[89] is r_5 in component CaRU_reduced_states (per_ms).
 * ALGEBRAIC[54] is r_6 in component CaRU_reduced_states (per_ms).
 * ALGEBRAIC[55] is r_7 in component CaRU_reduced_states (per_ms).
 * ALGEBRAIC[56] is r_8 in component CaRU_reduced_states (per_ms).
 * STATES[14] is z_1 in component CaRU_reduced_states (dimensionless).
 * STATES[15] is z_2 in component CaRU_reduced_states (dimensionless).
 * STATES[16] is z_3 in component CaRU_reduced_states (dimensionless).
 * ALGEBRAIC[57] is z_4 in component CaRU_reduced_states (dimensionless).
 * ALGEBRAIC[90] is J_R1 in component RyR_current (um3_mM_per_ms).
 * ALGEBRAIC[58] is J_R3 in component RyR_current (um3_mM_per_ms).
 * ALGEBRAIC[92] is J_L1 in component LCC_current (um3_mM_per_ms).
 * ALGEBRAIC[59] is J_L2 in component LCC_current (um3_mM_per_ms).
 * CONSTANTS[44] is K_mNa in component hinch_Na_Ca_Exchanger (mM).
 * CONSTANTS[45] is K_mCa in component hinch_Na_Ca_Exchanger (mM).
 * CONSTANTS[46] is eta in component hinch_Na_Ca_Exchanger (dimensionless).
 * CONSTANTS[47] is k_sat in component hinch_Na_Ca_Exchanger (dimensionless).
 * CONSTANTS[48] is g_NCX in component hinch_Na_Ca_Exchanger (mM_per_ms).
 * ALGEBRAIC[60] is I_NaCa in component hinch_Na_Ca_Exchanger (mM_per_ms).
 * CONSTANTS[49] is g_SERCA in component hinch_SERCA (mM_per_ms).
 * CONSTANTS[50] is K_SERCA in component hinch_SERCA (mM).
 * ALGEBRAIC[61] is I_SERCA in component hinch_SERCA (mM_per_ms).
 * CONSTANTS[51] is g_pCa in component hinch_Sarcolemmal_Ca_pump (mM_per_ms).
 * CONSTANTS[52] is K_mpCa in component hinch_Sarcolemmal_Ca_pump (mM).
 * ALGEBRAIC[62] is I_pCa in component hinch_Sarcolemmal_Ca_pump (mM_per_ms).
 * ALGEBRAIC[63] is E_Ca in component hinch_Background_Ca_current (mV).
 * CONSTANTS[53] is g_CaB in component hinch_Background_Ca_current (mM_per_mV_ms).
 * ALGEBRAIC[64] is I_CaB in component hinch_Background_Ca_current (mM_per_ms).
 * CONSTANTS[54] is g_SRl in component hinch_SR_Ca_leak_current (per_ms).
 * ALGEBRAIC[65] is I_SR in component hinch_SR_Ca_leak_current (mM_per_ms).
 * CONSTANTS[55] is k_CMDN in component hinch_calmodulin_Ca_buffer (mM).
 * CONSTANTS[56] is B_CMDN in component hinch_calmodulin_Ca_buffer (mM).
 * ALGEBRAIC[66] is beta_CMDN in component hinch_calmodulin_Ca_buffer (dimensionless).
 * ALGEBRAIC[95] is I_RyR in component convert_hinch (mM_per_ms).
 * STATES[17] is z in component niederer_tropomyosin (dimensionless).
 * ALGEBRAIC[99] is z_max in component niederer_tropomyosin (dimensionless).
 * CONSTANTS[57] is k_on in component niederer_troponin (per_mM_ms).
 * CONSTANTS[58] is k_Ref_off in component niederer_troponin (per_ms).
 * CONSTANTS[59] is gamma_trpn in component niederer_troponin (dimensionless).
 * CONSTANTS[60] is Ca_TRPN_Max in component niederer_troponin (mM).
 * CONSTANTS[61] is alpha_0 in component niederer_tropomyosin (per_ms).
 * CONSTANTS[62] is alpha_r1 in component niederer_tropomyosin (per_ms).
 * CONSTANTS[63] is alpha_r2 in component niederer_tropomyosin (per_ms).
 * CONSTANTS[64] is n_Rel in component niederer_tropomyosin (dimensionless).
 * CONSTANTS[65] is K_z in component niederer_tropomyosin (dimensionless).
 * CONSTANTS[66] is n_Hill in component niederer_tropomyosin (dimensionless).
 * CONSTANTS[67] is Ca_50ref in component niederer_tropomyosin (mM).
 * CONSTANTS[68] is z_p in component niederer_tropomyosin (dimensionless).
 * CONSTANTS[69] is beta_1 in component niederer_tropomyosin (dimensionless).
 * ALGEBRAIC[96] is Ca_50 in component niederer_tropomyosin (mM).
 * ALGEBRAIC[97] is Ca_TRPN_50 in component niederer_tropomyosin (mM).
 * CONSTANTS[85] is K_2 in component niederer_tropomyosin (per_ms).
 * CONSTANTS[88] is K_1 in component niederer_tropomyosin (per_ms).
 * ALGEBRAIC[98] is alpha_Tm in component niederer_tropomyosin (per_ms).
 * ALGEBRAIC[70] is beta_Tm in component niederer_tropomyosin (per_ms).
 * CONSTANTS[70] is beta_0 in component niederer_filament_overlap (dimensionless).
 * ALGEBRAIC[76] is Ca_b in component intracellular_ion_concentrations (mM).
 * ALGEBRAIC[73] is lambda in component niederer_Myofilaments (dimensionless).
 * ALGEBRAIC[104] is I_TRPN in component niederer_troponin (mM_per_ms).
 * STATES[18] is TRPN in component intracellular_ion_concentrations (mM).
 * ALGEBRAIC[103] is k_off in component niederer_troponin (per_ms).
 * ALGEBRAIC[102] is Tension in component niederer_Cross_Bridges (N_per_mm2).
 * CONSTANTS[71] is T_ref in component niederer_length_independent_tension (N_per_mm2).
 * ALGEBRAIC[71] is ExtensionRatio in component niederer_Myofilaments (dimensionless).
 * CONSTANTS[86] is dExtensionRatiodt in component niederer_Myofilaments (per_ms).
 * ALGEBRAIC[72] is lambda_prev in component niederer_Myofilaments (dimensionless).
 * ALGEBRAIC[74] is overlap in component niederer_filament_overlap (dimensionless).
 * ALGEBRAIC[100] is T_Base in component niederer_length_independent_tension (N_per_mm2).
 * ALGEBRAIC[101] is T_0 in component niederer_isometric_tension (N_per_mm2).
 * ALGEBRAIC[75] is Q in component niederer_Cross_Bridges (dimensionless).
 * CONSTANTS[72] is a in component niederer_Cross_Bridges (dimensionless).
 * STATES[19] is Q_1 in component niederer_Cross_Bridges (dimensionless).
 * STATES[20] is Q_2 in component niederer_Cross_Bridges (dimensionless).
 * STATES[21] is Q_3 in component niederer_Cross_Bridges (dimensionless).
 * CONSTANTS[73] is A_1 in component niederer_Cross_Bridges (dimensionless).
 * CONSTANTS[74] is A_2 in component niederer_Cross_Bridges (dimensionless).
 * CONSTANTS[75] is A_3 in component niederer_Cross_Bridges (dimensionless).
 * CONSTANTS[76] is alpha_1 in component niederer_Cross_Bridges (per_ms).
 * CONSTANTS[77] is alpha_2 in component niederer_Cross_Bridges (per_ms).
 * CONSTANTS[78] is alpha_3 in component niederer_Cross_Bridges (per_ms).
 * RATES[0] is d/dt V in component membrane (mV).
 * RATES[2] is d/dt m in component sodium_current_m_gate (dimensionless).
 * RATES[3] is d/dt h in component sodium_current_h_gate (dimensionless).
 * RATES[4] is d/dt j in component sodium_current_j_gate (dimensionless).
 * RATES[6] is d/dt r in component Ca_independent_transient_outward_K_current_r_gate (dimensionless).
 * RATES[7] is d/dt s in component Ca_independent_transient_outward_K_current_s_gate (dimensionless).
 * RATES[8] is d/dt s_slow in component Ca_independent_transient_outward_K_current_s_slow_gate (dimensionless).
 * RATES[9] is d/dt r_ss in component steady_state_outward_K_current_r_ss_gate (dimensionless).
 * RATES[10] is d/dt s_ss in component steady_state_outward_K_current_s_ss_gate (dimensionless).
 * RATES[11] is d/dt y in component hyperpolarisation_activated_current_y_gate (dimensionless).
 * RATES[14] is d/dt z_1 in component CaRU_reduced_states (dimensionless).
 * RATES[15] is d/dt z_2 in component CaRU_reduced_states (dimensionless).
 * RATES[16] is d/dt z_3 in component CaRU_reduced_states (dimensionless).
 * RATES[17] is d/dt z in component niederer_tropomyosin (dimensionless).
 * RATES[19] is d/dt Q_1 in component niederer_Cross_Bridges (dimensionless).
 * RATES[20] is d/dt Q_2 in component niederer_Cross_Bridges (dimensionless).
 * RATES[21] is d/dt Q_3 in component niederer_Cross_Bridges (dimensionless).
 * RATES[1] is d/dt Na_i in component intracellular_ion_concentrations (mM).
 * RATES[5] is d/dt K_i in component intracellular_ion_concentrations (mM).
 * RATES[18] is d/dt TRPN in component intracellular_ion_concentrations (mM).
 * RATES[12] is d/dt Ca_i in component intracellular_ion_concentrations (mM).
 * RATES[13] is d/dt Ca_SR in component intracellular_ion_concentrations (mM).
 * There are a total of 17 condition variables.
 */
void
initConsts(double* CONSTANTS, double* RATES, double *STATES)
{
STATES[0] = -78.8;
CONSTANTS[0] = 8314.5;
CONSTANTS[1] = 295;
CONSTANTS[2] = 96487;
CONSTANTS[3] = 0.0001;
CONSTANTS[4] = 10;
CONSTANTS[5] = -0.6e-3;
CONSTANTS[6] = 25.85e3;
CONSTANTS[7] = 2.098e3;
CONSTANTS[8] = 25.85e-6;
CONSTANTS[9] = 2.098e-6;
CONSTANTS[10] = 0.8e-3;
STATES[1] = 11.28;
CONSTANTS[11] = 140;
STATES[2] = 0.0054828;
STATES[3] = 0.6095126;
STATES[4] = 0.60876276;
CONSTANTS[12] = 0.035e-3;
CONSTANTS[13] = 0.583;
CONSTANTS[14] = 0.417;
CONSTANTS[15] = 5.4;
STATES[5] = 138.7225;
STATES[6] = 0.002542;
STATES[7] = 0.8823;
STATES[8] = 0.42756;
CONSTANTS[16] = 0.007e-3;
STATES[9] = 0.0033545;
STATES[10] = 0.266596;
CONSTANTS[17] = 0.024e-3;
CONSTANTS[18] = 0.00145e-3;
CONSTANTS[19] = 0.2;
STATES[11] = 0.0026369;
CONSTANTS[20] = 0.00008015e-3;
CONSTANTS[21] = 0.000138e-3;
CONSTANTS[22] = 0.95e-4;
CONSTANTS[23] = 1.5;
CONSTANTS[24] = 10;
CONSTANTS[25] = 1.2;
CONSTANTS[26] = 0.065;
CONSTANTS[27] = 0.02;
CONSTANTS[28] = 9.13e-4;
CONSTANTS[29] = 50000;
STATES[12] = 0.00011423;
STATES[13] = 721.96e-3;
CONSTANTS[30] = -2;
CONSTANTS[31] = 7;
CONSTANTS[32] = 2.35;
CONSTANTS[33] = 1;
CONSTANTS[34] = 650;
CONSTANTS[35] = 2.43;
CONSTANTS[36] = 0.05;
CONSTANTS[37] = 0.012;
CONSTANTS[38] = 41e-3;
CONSTANTS[39] = 0.22e-3;
CONSTANTS[40] = 0.0625;
CONSTANTS[41] = 14;
CONSTANTS[42] = 0.01;
CONSTANTS[43] = 100;
STATES[14] = 0.98794;
STATES[15] = 0.00887;
STATES[16] = 0.003156;
CONSTANTS[44] = 87.5;
CONSTANTS[45] = 1380e-3;
CONSTANTS[46] = 0.35;
CONSTANTS[47] = 0.1;
CONSTANTS[48] = 38.5e-3;
CONSTANTS[49] = 0.45e-3;
CONSTANTS[50] = 0.5e-3;
CONSTANTS[51] = 0.0035e-3;
CONSTANTS[52] = 0.5e-3;
CONSTANTS[53] = 2.6875e-8;
CONSTANTS[54] = 1.8951e-5;
CONSTANTS[55] = 2.382e-3;
CONSTANTS[56] = 50e-3;
STATES[17] = 0.020023;
CONSTANTS[57] = 100;
CONSTANTS[58] = 0.2;
CONSTANTS[59] = 2;
CONSTANTS[60] = 70e-3;
CONSTANTS[61] = 8e-3;
CONSTANTS[62] = 2e-3;
CONSTANTS[63] = 1.75e-3;
CONSTANTS[64] = 3;
CONSTANTS[65] = 0.15;
CONSTANTS[66] = 3;
CONSTANTS[67] = 1.05e-3;
CONSTANTS[68] = 0.85;
CONSTANTS[69] = -4;
CONSTANTS[70] = 4.9;
STATES[18] = 0.0661796;
CONSTANTS[71] = 56.2;
CONSTANTS[72] = 0.35;
STATES[19] = 0;
STATES[20] = 0;
STATES[21] = 0;
CONSTANTS[73] = -29;
CONSTANTS[74] = 138;
CONSTANTS[75] = 129;
CONSTANTS[76] = 0.03;
CONSTANTS[77] = 0.13;
CONSTANTS[78] = 0.625;
CONSTANTS[79] =  1.33000*CONSTANTS[10];
CONSTANTS[80] =  0.464700*CONSTANTS[12];
CONSTANTS[81] = 2100.00;
CONSTANTS[82] = 1.00000 - CONSTANTS[19];
CONSTANTS[83] = (exp(CONSTANTS[11]/67.3000) - 1.00000)/7.00000;
CONSTANTS[84] =  1.17000*CONSTANTS[33];
CONSTANTS[85] =  (( CONSTANTS[63]*pow(CONSTANTS[68], CONSTANTS[64]))/(pow(CONSTANTS[68], CONSTANTS[64])+pow(CONSTANTS[65], CONSTANTS[64])))*(1.00000 - ( CONSTANTS[64]*pow(CONSTANTS[65], CONSTANTS[64]))/(pow(CONSTANTS[68], CONSTANTS[64])+pow(CONSTANTS[65], CONSTANTS[64])));
CONSTANTS[86] = 0.00000;
CONSTANTS[87] = CONSTANTS[32]/CONSTANTS[33];
CONSTANTS[88] = ( CONSTANTS[63]*pow(CONSTANTS[68], CONSTANTS[64] - 1.00000)*CONSTANTS[64]*pow(CONSTANTS[65], CONSTANTS[64]))/pow(pow(CONSTANTS[68], CONSTANTS[64])+pow(CONSTANTS[65], CONSTANTS[64]), 2.00000);
CONSTANTS[89] = CONSTANTS[36]/CONSTANTS[84];
RATES[0] = 0.1001;
RATES[2] = 0.1001;
RATES[3] = 0.1001;
RATES[4] = 0.1001;
RATES[6] = 0.1001;
RATES[7] = 0.1001;
RATES[8] = 0.1001;
RATES[9] = 0.1001;
RATES[10] = 0.1001;
RATES[11] = 0.1001;
RATES[14] = 0.1001;
RATES[15] = 0.1001;
RATES[16] = 0.1001;
RATES[17] = 0.1001;
RATES[19] = 0.1001;
RATES[20] = 0.1001;
RATES[21] = 0.1001;
RATES[1] = 0.1001;
RATES[5] = 0.1001;
RATES[18] = 0.1001;
RATES[12] = 0.1001;
RATES[13] = 0.1001;
}
void
computeResiduals(double VOI, double* CONSTANTS, double* RATES, double* OLDRATES, double* STATES,
                 double* OLDSTATES, double* ALGEBRAIC, double* CONDVARS)
{
resid[0] = RATES[0] - - (ALGEBRAIC[5]+ALGEBRAIC[13]+ALGEBRAIC[20]+ALGEBRAIC[27]+ALGEBRAIC[24]+ALGEBRAIC[30]+ALGEBRAIC[31]+ALGEBRAIC[32]+ALGEBRAIC[1]+ALGEBRAIC[69]+ALGEBRAIC[67]+ALGEBRAIC[68]+ALGEBRAIC[94])/CONSTANTS[3];
resid[1] = RATES[2] - (ALGEBRAIC[6] - STATES[2])/ALGEBRAIC[7];
resid[2] = RATES[3] - (ALGEBRAIC[8] - STATES[3])/ALGEBRAIC[9];
resid[3] = RATES[4] - (ALGEBRAIC[10] - STATES[4])/ALGEBRAIC[11];
resid[4] = RATES[6] - (ALGEBRAIC[14] - STATES[6])/ALGEBRAIC[15];
resid[5] = RATES[7] - (ALGEBRAIC[16] - STATES[7])/ALGEBRAIC[17];
resid[6] = RATES[8] - (ALGEBRAIC[18] - STATES[8])/ALGEBRAIC[19];
resid[7] = RATES[9] - (ALGEBRAIC[21] - STATES[9])/ALGEBRAIC[22];
resid[8] = RATES[10] - (ALGEBRAIC[23] - STATES[10])/CONSTANTS[81];
resid[9] = RATES[11] - (ALGEBRAIC[28] - STATES[11])/ALGEBRAIC[29];
resid[10] = RATES[14] -  - (ALGEBRAIC[87]+ALGEBRAIC[89])*STATES[14]+ ALGEBRAIC[88]*STATES[15]+ ALGEBRAIC[54]*STATES[16];
resid[11] = RATES[15] - ( ALGEBRAIC[87]*STATES[14] -  (ALGEBRAIC[88]+ALGEBRAIC[55])*STATES[15])+ ALGEBRAIC[56]*ALGEBRAIC[57];
resid[12] = RATES[16] - ( ALGEBRAIC[89]*STATES[14] -  (ALGEBRAIC[54]+ALGEBRAIC[52])*STATES[16])+ ALGEBRAIC[53]*ALGEBRAIC[57];
resid[13] = RATES[17] -  ALGEBRAIC[98]*(1.00000 - STATES[17]) -  ALGEBRAIC[70]*STATES[17];
resid[14] = RATES[19] -  CONSTANTS[73]*CONSTANTS[86] -  CONSTANTS[76]*STATES[19];
resid[15] = RATES[20] -  CONSTANTS[74]*CONSTANTS[86] -  CONSTANTS[77]*STATES[20];
resid[16] = RATES[21] -  CONSTANTS[75]*CONSTANTS[86] -  CONSTANTS[78]*STATES[21];
resid[17] = RATES[1] - ( - (ALGEBRAIC[5]+ALGEBRAIC[30]+ ALGEBRAIC[67]*3.00000+ ALGEBRAIC[32]*3.00000+ALGEBRAIC[25])*1.00000)/( CONSTANTS[8]*CONSTANTS[2]);
resid[18] = RATES[5] - ( - (ALGEBRAIC[1]+ALGEBRAIC[20]+ALGEBRAIC[31]+ALGEBRAIC[13]+ALGEBRAIC[24]+ALGEBRAIC[26]+ - 2.00000*ALGEBRAIC[32])*1.00000)/( CONSTANTS[8]*CONSTANTS[2]);
resid[19] = RATES[18] - ALGEBRAIC[104];
resid[20] = RATES[12] -  ALGEBRAIC[66]*(((ALGEBRAIC[95] - ALGEBRAIC[61])+ALGEBRAIC[65]+ALGEBRAIC[104]) - ( - 2.00000*ALGEBRAIC[67]+ALGEBRAIC[68]+ALGEBRAIC[69]+ALGEBRAIC[94])/( 2.00000*CONSTANTS[8]*CONSTANTS[2]));
resid[21] = RATES[13] -  (CONSTANTS[8]/CONSTANTS[9])*((- ALGEBRAIC[95]+ALGEBRAIC[61]) - ALGEBRAIC[65]);
}
void
computeVariables(double VOI, double* CONSTANTS, double* RATES, double* STATES, double* ALGEBRAIC)
{
ALGEBRAIC[40] = STATES[12];
ALGEBRAIC[43] = (CONDVAR[7]>0.00000 ? (STATES[12]+ (CONSTANTS[27]/CONSTANTS[26])*STATES[13]+( (CONSTANTS[28]/CONSTANTS[26])*CONSTANTS[25]*ALGEBRAIC[3]*exp(- ALGEBRAIC[3]))/(1.00000 - exp(- ALGEBRAIC[3])))/(1.00000+CONSTANTS[27]/CONSTANTS[26]+( (CONSTANTS[28]/CONSTANTS[26])*ALGEBRAIC[3])/(1.00000 - exp(- ALGEBRAIC[3]))) : (STATES[12]+ (CONSTANTS[27]/CONSTANTS[26])*STATES[13]+ (CONSTANTS[28]/CONSTANTS[26])*CONSTANTS[25])/(1.00000+CONSTANTS[27]/CONSTANTS[26]+CONSTANTS[28]/CONSTANTS[26]));
ALGEBRAIC[48] = CONSTANTS[87]/(ALGEBRAIC[34]+CONSTANTS[87]);
ALGEBRAIC[49] = ALGEBRAIC[34]/(ALGEBRAIC[34]+CONSTANTS[87]);
ALGEBRAIC[50] = CONSTANTS[89]/(ALGEBRAIC[35]+CONSTANTS[89]);
ALGEBRAIC[51] = ALGEBRAIC[35]/(ALGEBRAIC[35]+CONSTANTS[89]);
ALGEBRAIC[72] = ALGEBRAIC[71];
ALGEBRAIC[86] = (((((((1.00000 - ALGEBRAIC[82]) - ALGEBRAIC[83]) - ALGEBRAIC[84]) - ALGEBRAIC[85]) - ALGEBRAIC[48]) - ALGEBRAIC[50]) - ALGEBRAIC[49]) - ALGEBRAIC[51];
}
void
computeEssentialVariables(double VOI, double* CONSTANTS, double* RATES, double* STATES, double* ALGEBRAIC)
{
ALGEBRAIC[0] = (CONDVAR[0]>=0.00000&&CONDVAR[1]<=0.00000 ? 500.000 : 1000.00);
ALGEBRAIC[1] = (CONDVAR[2]>=0.00000&&CONDVAR[3]<=0.00000 ? CONSTANTS[5] : 0.00000);
ALGEBRAIC[4] =  (( CONSTANTS[0]*CONSTANTS[1])/CONSTANTS[2])*log(CONSTANTS[11]/STATES[1]);
ALGEBRAIC[5] =  CONSTANTS[79]*pow(STATES[2], 3.00000)*STATES[3]*STATES[4]*(STATES[0] - ALGEBRAIC[4]);
ALGEBRAIC[6] = 1.00000/(1.00000+exp((STATES[0]+45.0000)/- 6.50000));
ALGEBRAIC[7] = 1.36000/(( 0.320000*(STATES[0]+47.1300))/(1.00000 - exp( - 0.100000*(STATES[0]+47.1300)))+ 0.0800000*exp(- STATES[0]/11.0000));
ALGEBRAIC[8] = 1.00000/(1.00000+exp((STATES[0]+76.1000)/6.07000));
ALGEBRAIC[9] = (CONDVAR[4]>=0.00000 ?  0.453700*(1.00000+exp(- (STATES[0]+10.6600)/11.1000)) : 3.49000/( 0.135000*exp(- (STATES[0]+80.0000)/6.80000)+ 3.56000*exp( 0.0790000*STATES[0])+ 310000.*exp( 0.350000*STATES[0])));
ALGEBRAIC[10] = 1.00000/(1.00000+exp((STATES[0]+76.1000)/6.07000));
ALGEBRAIC[11] = (CONDVAR[5]>=0.00000 ? ( 11.6300*(1.00000+exp( - 0.100000*(STATES[0]+32.0000))))/exp( - 2.53500e-07*STATES[0]) : 3.49000/( ((STATES[0]+37.7800)/(1.00000+exp( 0.311000*(STATES[0]+79.2300))))*( - 127140.*exp( 0.244400*STATES[0]) -  3.47400e-05*exp( - 0.0439100*STATES[0]))+( 0.121200*exp( - 0.0105200*STATES[0]))/(1.00000+exp( - 0.137800*(STATES[0]+40.1400)))));
ALGEBRAIC[12] =  (( CONSTANTS[0]*CONSTANTS[1])/CONSTANTS[2])*log(CONSTANTS[15]/STATES[5]);
ALGEBRAIC[13] =  CONSTANTS[80]*STATES[6]*( CONSTANTS[13]*STATES[7]+ CONSTANTS[14]*STATES[8])*(STATES[0] - ALGEBRAIC[12]);
ALGEBRAIC[14] = 1.00000/(1.00000+exp((STATES[0]+10.6000)/- 11.4200));
ALGEBRAIC[15] = 1000.00/( 45.1600*exp( 0.0357700*(STATES[0]+50.0000))+ 98.9000*exp( - 0.100000*(STATES[0]+38.0000)));
ALGEBRAIC[16] = 1.00000/(1.00000+exp((STATES[0]+45.3000)/6.88410));
ALGEBRAIC[17] =  550.000*exp(- pow((STATES[0]+70.0000)/25.0000, 2.00000))+49.0000;
ALGEBRAIC[18] = 1.00000/(1.00000+exp((STATES[0]+45.3000)/6.88410));
ALGEBRAIC[19] =  3300.00*exp(- pow((STATES[0]+70.0000)/30.0000, 2.00000))+49.0000;
ALGEBRAIC[20] =  CONSTANTS[16]*STATES[9]*STATES[10]*(STATES[0] - ALGEBRAIC[12]);
ALGEBRAIC[21] = 1.00000/(1.00000+exp((STATES[0]+11.5000)/- 11.8200));
ALGEBRAIC[22] = 10000.0/( 45.1600*exp( 0.0357700*(STATES[0]+50.0000))+ 98.9000*exp( - 0.100000*(STATES[0]+38.0000)));
ALGEBRAIC[23] = 1.00000/(1.00000+exp((STATES[0]+87.5000)/10.3000));
ALGEBRAIC[24] =  (0.0480000/(exp((STATES[0]+37.0000)/25.0000)+exp((STATES[0]+37.0000)/- 25.0000))+0.0100000)*(0.00100000/(1.00000+exp((STATES[0] - (ALGEBRAIC[12]+76.7700))/- 17.0000)))+( CONSTANTS[17]*(STATES[0] - (ALGEBRAIC[12]+1.73000)))/( (1.00000+exp(( 1.61300*CONSTANTS[2]*(STATES[0] - (ALGEBRAIC[12]+1.73000)))/( CONSTANTS[0]*CONSTANTS[1])))*(1.00000+exp((CONSTANTS[15] - 0.998800)/- 0.124000)));
ALGEBRAIC[25] =  CONSTANTS[18]*STATES[11]*CONSTANTS[19]*(STATES[0] - ALGEBRAIC[4]);
ALGEBRAIC[26] =  CONSTANTS[18]*STATES[11]*CONSTANTS[82]*(STATES[0] - ALGEBRAIC[12]);
ALGEBRAIC[27] = ALGEBRAIC[25]+ALGEBRAIC[26];
ALGEBRAIC[28] = 1.00000/(1.00000+exp((STATES[0]+138.600)/10.4800));
ALGEBRAIC[29] = 1000.00/( 0.118850*exp((STATES[0]+80.0000)/28.3700)+ 0.562300*exp((STATES[0]+80.0000)/- 14.1900));
ALGEBRAIC[30] =  CONSTANTS[20]*(STATES[0] - ALGEBRAIC[4]);
ALGEBRAIC[31] =  CONSTANTS[21]*(STATES[0] - ALGEBRAIC[12]);
ALGEBRAIC[32] = ( (( (( CONSTANTS[22]*1.00000)/(1.00000+ 0.124500*exp(( - 0.100000*STATES[0]*CONSTANTS[2])/( CONSTANTS[0]*CONSTANTS[1]))+ 0.0365000*CONSTANTS[83]*exp(( - STATES[0]*CONSTANTS[2])/( CONSTANTS[0]*CONSTANTS[1]))))*CONSTANTS[15])/(CONSTANTS[15]+CONSTANTS[23]))*1.00000)/(1.00000+pow(CONSTANTS[24]/STATES[1], 4.00000));
ALGEBRAIC[35] = pow(STATES[12], 2.00000)/( CONSTANTS[84]*(pow(STATES[12], 2.00000)+pow(CONSTANTS[38], 2.00000)));
ALGEBRAIC[38] = (pow(STATES[12], 2.00000)+ CONSTANTS[42]*pow(CONSTANTS[38], 2.00000))/( CONSTANTS[35]*(pow(STATES[12], 2.00000)+pow(CONSTANTS[38], 2.00000)));
ALGEBRAIC[52] = ( CONSTANTS[89]*ALGEBRAIC[38])/(CONSTANTS[89]+ALGEBRAIC[35]);
ALGEBRAIC[39] = ( CONSTANTS[37]*CONSTANTS[43]*(pow(STATES[12], 2.00000)+ CONSTANTS[42]*pow(CONSTANTS[38], 2.00000)))/( CONSTANTS[35]*( CONSTANTS[43]*pow(STATES[12], 2.00000)+ CONSTANTS[42]*pow(CONSTANTS[38], 2.00000)));
ALGEBRAIC[53] = ALGEBRAIC[39];
ALGEBRAIC[33] = exp((STATES[0] - CONSTANTS[30])/CONSTANTS[31]);
ALGEBRAIC[37] = ( CONSTANTS[41]*(ALGEBRAIC[33]+CONSTANTS[40]))/( CONSTANTS[34]*( CONSTANTS[41]*ALGEBRAIC[33]+CONSTANTS[40]));
ALGEBRAIC[54] = ALGEBRAIC[37];
ALGEBRAIC[34] = ALGEBRAIC[33]/( CONSTANTS[33]*(ALGEBRAIC[33]+1.00000));
ALGEBRAIC[36] = ( STATES[12]*(ALGEBRAIC[33]+CONSTANTS[40]))/( CONSTANTS[34]*CONSTANTS[39]*(ALGEBRAIC[33]+1.00000));
ALGEBRAIC[55] = ( CONSTANTS[87]*ALGEBRAIC[36])/(ALGEBRAIC[34]+CONSTANTS[87]);
ALGEBRAIC[56] = ALGEBRAIC[37];
ALGEBRAIC[57] = ((1.00000 - STATES[14]) - STATES[15]) - STATES[16];
ALGEBRAIC[61] = ( CONSTANTS[49]*pow(STATES[12], 2.00000))/(pow(CONSTANTS[50], 2.00000)+pow(STATES[12], 2.00000));
ALGEBRAIC[65] =  CONSTANTS[54]*(STATES[13] - STATES[12]);
ALGEBRAIC[66] = pow(1.00000+( CONSTANTS[55]*CONSTANTS[56])/pow(CONSTANTS[55]+STATES[12], 2.00000), - 1.00000);
ALGEBRAIC[2] = ( CONSTANTS[2]*STATES[0])/( CONSTANTS[0]*CONSTANTS[1]);
ALGEBRAIC[60] = ( CONSTANTS[48]*( exp( CONSTANTS[46]*ALGEBRAIC[2])*pow(STATES[1], 3.00000)*CONSTANTS[25] -  exp( (CONSTANTS[46] - 1.00000)*ALGEBRAIC[2])*pow(CONSTANTS[11], 3.00000)*STATES[12]))/( (pow(CONSTANTS[11], 3.00000)+pow(CONSTANTS[44], 3.00000))*(CONSTANTS[25]+CONSTANTS[45])*(1.00000+ CONSTANTS[47]*exp( (CONSTANTS[46] - 1.00000)*ALGEBRAIC[2])));
ALGEBRAIC[67] =  ALGEBRAIC[60]*CONSTANTS[8]*CONSTANTS[2];
ALGEBRAIC[62] = ( CONSTANTS[51]*STATES[12])/(CONSTANTS[52]+STATES[12]);
ALGEBRAIC[68] =  ALGEBRAIC[62]*2.00000*CONSTANTS[8]*CONSTANTS[2];
ALGEBRAIC[63] =  (( CONSTANTS[0]*CONSTANTS[1])/( 2.00000*CONSTANTS[2]))*log(CONSTANTS[25]/STATES[12]);
ALGEBRAIC[64] =  CONSTANTS[53]*(ALGEBRAIC[63] - STATES[0]);
ALGEBRAIC[69] =  - ALGEBRAIC[64]*2.00000*CONSTANTS[8]*CONSTANTS[2];
ALGEBRAIC[70] = CONSTANTS[62]+( CONSTANTS[63]*pow(STATES[17], CONSTANTS[64] - 1.00000))/(pow(STATES[17], CONSTANTS[64])+pow(CONSTANTS[65], CONSTANTS[64]));
ALGEBRAIC[3] =  2.00000*ALGEBRAIC[2];
ALGEBRAIC[42] = (CONDVAR[6]>0.00000 ? (STATES[12]+( (CONSTANTS[28]/CONSTANTS[26])*CONSTANTS[25]*ALGEBRAIC[3]*exp(- ALGEBRAIC[3]))/(1.00000 - exp(- ALGEBRAIC[3])))/(1.00000+( (CONSTANTS[28]/CONSTANTS[26])*ALGEBRAIC[3])/(1.00000 - exp(- ALGEBRAIC[3]))) : (STATES[12]+ (CONSTANTS[28]/CONSTANTS[26])*CONSTANTS[25])/(1.00000+CONSTANTS[28]/CONSTANTS[26]));
ALGEBRAIC[79] = (pow(ALGEBRAIC[42], 2.00000)+ CONSTANTS[42]*pow(CONSTANTS[38], 2.00000))/( CONSTANTS[35]*(pow(ALGEBRAIC[42], 2.00000)+pow(CONSTANTS[38], 2.00000)));
ALGEBRAIC[77] = pow(ALGEBRAIC[42], 2.00000)/( CONSTANTS[84]*(pow(ALGEBRAIC[42], 2.00000)+pow(CONSTANTS[38], 2.00000)));
ALGEBRAIC[81] =  (ALGEBRAIC[34]+CONSTANTS[87])*( (CONSTANTS[87]+CONSTANTS[89]+ALGEBRAIC[77])*(CONSTANTS[89]+ALGEBRAIC[35])+ ALGEBRAIC[34]*(CONSTANTS[89]+ALGEBRAIC[77]));
ALGEBRAIC[82] = ( ALGEBRAIC[34]*CONSTANTS[89]*(ALGEBRAIC[34]+CONSTANTS[87]+CONSTANTS[89]+ALGEBRAIC[35]))/ALGEBRAIC[81];
ALGEBRAIC[85] = ( CONSTANTS[87]*CONSTANTS[89]*(CONSTANTS[87]+ALGEBRAIC[34]+CONSTANTS[89]+ALGEBRAIC[77]))/ALGEBRAIC[81];
ALGEBRAIC[87] =  ALGEBRAIC[82]*ALGEBRAIC[79]+ ALGEBRAIC[85]*ALGEBRAIC[38];
ALGEBRAIC[80] = ( CONSTANTS[37]*CONSTANTS[43]*(pow(ALGEBRAIC[42], 2.00000)+ CONSTANTS[42]*pow(CONSTANTS[38], 2.00000)))/( CONSTANTS[35]*( CONSTANTS[43]*pow(ALGEBRAIC[42], 2.00000)+ CONSTANTS[42]*pow(CONSTANTS[38], 2.00000)));
ALGEBRAIC[88] = ( ALGEBRAIC[34]*ALGEBRAIC[80]+ CONSTANTS[87]*ALGEBRAIC[39])/(ALGEBRAIC[34]+CONSTANTS[87]);
ALGEBRAIC[41] = (STATES[12]+ (CONSTANTS[27]/CONSTANTS[26])*STATES[13])/(1.00000+CONSTANTS[27]/CONSTANTS[26]);
ALGEBRAIC[78] = ( ALGEBRAIC[41]*(ALGEBRAIC[33]+CONSTANTS[40]))/( CONSTANTS[34]*CONSTANTS[39]*(ALGEBRAIC[33]+1.00000));
ALGEBRAIC[83] = ( CONSTANTS[87]*( ALGEBRAIC[35]*(CONSTANTS[87]+CONSTANTS[89]+ALGEBRAIC[77])+ ALGEBRAIC[77]*ALGEBRAIC[34]))/ALGEBRAIC[81];
ALGEBRAIC[89] =  ALGEBRAIC[83]*ALGEBRAIC[78]+ ALGEBRAIC[85]*ALGEBRAIC[36];
ALGEBRAIC[47] = (CONDVAR[10]>0.00000 ? ( (( CONSTANTS[28]*ALGEBRAIC[3])/(1.00000 - exp(- ALGEBRAIC[3])))*(( CONSTANTS[25]*exp(- ALGEBRAIC[3]) - STATES[12])+ (CONSTANTS[27]/CONSTANTS[26])*( CONSTANTS[25]*exp(- ALGEBRAIC[3]) - STATES[13])))/(1.00000+CONSTANTS[27]/CONSTANTS[26]+( (CONSTANTS[28]/CONSTANTS[26])*ALGEBRAIC[3])/(1.00000 - exp(ALGEBRAIC[3]))) : ( (( CONSTANTS[28]*1.00000e-05)/(1.00000 - exp(- 1.00000e-05)))*(( CONSTANTS[25]*exp(- 1.00000e-05) - STATES[12])+ (CONSTANTS[27]/CONSTANTS[26])*( CONSTANTS[25]*exp(- 1.00000e-05) - STATES[13])))/(1.00000+CONSTANTS[27]/CONSTANTS[26]+( (CONSTANTS[28]/CONSTANTS[26])*1.00000e-05)/(1.00000 - exp(- 1.00000e-05))));
ALGEBRAIC[46] = (CONDVAR[9]>0.00000 ? ( (( CONSTANTS[28]*ALGEBRAIC[3])/(1.00000 - exp(- ALGEBRAIC[3])))*( CONSTANTS[25]*exp(- ALGEBRAIC[3]) - STATES[12]))/(1.00000+( (CONSTANTS[28]/CONSTANTS[26])*ALGEBRAIC[3])/(1.00000 - exp(- ALGEBRAIC[3]))) : ( (( CONSTANTS[28]*1.00000e-05)/(1.00000 - exp(- 1.00000e-05)))*( CONSTANTS[25]*exp(- 1.00000e-05) - STATES[12]))/(1.00000+( (CONSTANTS[28]/CONSTANTS[26])*1.00000e-05)/(1.00000 - exp(- 1.00000e-05))));
ALGEBRAIC[84] = ( ALGEBRAIC[34]*( ALGEBRAIC[77]*(ALGEBRAIC[34]+CONSTANTS[89]+ALGEBRAIC[35])+ ALGEBRAIC[35]*CONSTANTS[87]))/ALGEBRAIC[81];
ALGEBRAIC[92] =  ALGEBRAIC[47]*ALGEBRAIC[84]+ ALGEBRAIC[46]*ALGEBRAIC[82];
ALGEBRAIC[59] = ( ALGEBRAIC[46]*ALGEBRAIC[34])/(ALGEBRAIC[34]+CONSTANTS[87]);
ALGEBRAIC[93] = ( ( STATES[14]*ALGEBRAIC[92]+ STATES[15]*ALGEBRAIC[59])*CONSTANTS[29])/CONSTANTS[6];
ALGEBRAIC[94] =  - 1.50000*ALGEBRAIC[93]*2.00000*CONSTANTS[8]*CONSTANTS[2];
ALGEBRAIC[44] = ( CONSTANTS[27]*(STATES[13] - STATES[12]))/(1.00000+CONSTANTS[27]/CONSTANTS[26]);
ALGEBRAIC[45] = (CONDVAR[8]>0.00000 ? ( CONSTANTS[27]*((STATES[13] - STATES[12])+ (( (CONSTANTS[28]/CONSTANTS[26])*ALGEBRAIC[3])/(1.00000 - exp(- ALGEBRAIC[3])))*(STATES[13] -  CONSTANTS[25]*exp(- ALGEBRAIC[3]))))/(1.00000+CONSTANTS[27]/CONSTANTS[26]+( (CONSTANTS[28]/CONSTANTS[26])*ALGEBRAIC[3])/(1.00000 - exp(- ALGEBRAIC[3]))) : ( CONSTANTS[27]*((STATES[13] - STATES[12])+ (( (CONSTANTS[28]/CONSTANTS[26])*1.00000e-05)/(1.00000 - exp(- 1.00000e-05)))*(STATES[13] -  CONSTANTS[25]*exp(- 1.00000e-05))))/(1.00000+CONSTANTS[27]/CONSTANTS[26]+( (CONSTANTS[28]/CONSTANTS[26])*1.00000e-05)/(1.00000 - exp(- 1.00000e-05))));
ALGEBRAIC[90] =  ALGEBRAIC[84]*ALGEBRAIC[45]+ ALGEBRAIC[44]*ALGEBRAIC[83];
ALGEBRAIC[58] = ( ALGEBRAIC[44]*ALGEBRAIC[35])/(CONSTANTS[89]+ALGEBRAIC[35]);
ALGEBRAIC[91] = ( ( STATES[14]*ALGEBRAIC[90]+ STATES[16]*ALGEBRAIC[58])*CONSTANTS[29])/CONSTANTS[6];
ALGEBRAIC[95] =  1.50000*ALGEBRAIC[91];
ALGEBRAIC[71] = (CONDVAR[12]>0.00000 ? 1.00000 : 1.00000);
ALGEBRAIC[73] = (CONDVAR[13]>0.00000&&CONDVAR[14]<=0.00000 ? ALGEBRAIC[71] : CONDVAR[15]>0.00000 ? 1.15000 : 0.800000);
ALGEBRAIC[96] =  CONSTANTS[67]*(1.00000+ CONSTANTS[69]*(ALGEBRAIC[73] - 1.00000));
ALGEBRAIC[97] = ( ALGEBRAIC[96]*CONSTANTS[60])/(ALGEBRAIC[96]+ (CONSTANTS[58]/CONSTANTS[57])*(1.00000 - ( (1.00000+ CONSTANTS[70]*(ALGEBRAIC[73] - 1.00000))*0.500000)/CONSTANTS[59]));
ALGEBRAIC[76] = CONSTANTS[60] - STATES[18];
ALGEBRAIC[98] =  CONSTANTS[61]*pow(ALGEBRAIC[76]/ALGEBRAIC[97], CONSTANTS[66]);
ALGEBRAIC[74] = 1.00000+ CONSTANTS[70]*(ALGEBRAIC[73] - 1.00000);
ALGEBRAIC[99] = (CONSTANTS[61]/pow(ALGEBRAIC[97]/CONSTANTS[60], CONSTANTS[66]) - CONSTANTS[85])/(CONSTANTS[62]+CONSTANTS[88]+CONSTANTS[61]/pow(ALGEBRAIC[97]/CONSTANTS[60], CONSTANTS[66]));
ALGEBRAIC[100] = ( CONSTANTS[71]*STATES[17])/ALGEBRAIC[99];
ALGEBRAIC[101] =  ALGEBRAIC[100]*ALGEBRAIC[74];
ALGEBRAIC[75] = STATES[19]+STATES[20]+STATES[21];
ALGEBRAIC[102] = (CONDVAR[16]<0.00000 ? ( ALGEBRAIC[101]*( CONSTANTS[72]*ALGEBRAIC[75]+1.00000))/(1.00000 - ALGEBRAIC[75]) : ( ALGEBRAIC[101]*(1.00000+ (CONSTANTS[72]+2.00000)*ALGEBRAIC[75]))/(1.00000+ALGEBRAIC[75]));
ALGEBRAIC[103] = (CONDVAR[11]>0.00000 ?  CONSTANTS[58]*(1.00000 - ALGEBRAIC[102]/( CONSTANTS[59]*CONSTANTS[71])) :  CONSTANTS[58]*0.100000);
ALGEBRAIC[104] =  (CONSTANTS[60] - STATES[18])*ALGEBRAIC[103] -  STATES[12]*STATES[18]*CONSTANTS[57];
}
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;
}
void
computeRoots(double VOI, double* CONSTANTS, double* RATES, double* OLDRATES, double* STATES,
             double* OLDSTATES, double* ALGEBRAIC, double* CONDVARS)
{
CONDVAR[0] = VOI - 5000.00;
CONDVAR[1] = VOI - 10000.0;
CONDVAR[2] = (VOI -  floor(VOI/ALGEBRAIC[0])*ALGEBRAIC[0]) - 0.00000;
CONDVAR[3] = (VOI -  floor(VOI/ALGEBRAIC[0])*ALGEBRAIC[0]) - CONSTANTS[4];
CONDVAR[4] = STATES[0] - - 40.0000;
CONDVAR[5] = STATES[0] - - 40.0000;
CONDVAR[6] = fabs(ALGEBRAIC[3]) - 1.00000e-09;
CONDVAR[7] = fabs(ALGEBRAIC[3]) - 1.00000e-09;
CONDVAR[8] = fabs(ALGEBRAIC[3]) - 1.00000e-05;
CONDVAR[9] = fabs(ALGEBRAIC[3]) - 1.00000e-05;
CONDVAR[10] = fabs(ALGEBRAIC[3]) - 1.00000e-05;
CONDVAR[11] = (1.00000 - ALGEBRAIC[102]/( CONSTANTS[59]*CONSTANTS[71])) - 0.100000;
CONDVAR[12] = VOI - 300000.;
CONDVAR[13] = ALGEBRAIC[71] - 0.800000;
CONDVAR[14] = ALGEBRAIC[71] - 1.15000;
CONDVAR[15] = ALGEBRAIC[71] - 1.15000;
CONDVAR[16] = ALGEBRAIC[75] - 0.00000;
}