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 54 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 71 entries in the constant variable array.
 */
/*
 * VOI is time in component environment (second).
 * STATES[0] is V in component membrane (millivolt).
 * CONSTANTS[0] is R in component membrane (millijoule_per_mole_kelvin).
 * CONSTANTS[1] is T in component membrane (kelvin).
 * CONSTANTS[2] is F in component membrane (coulomb_per_mole).
 * CONSTANTS[3] is Cm in component membrane (microF).
 * ALGEBRAIC[2] is i_Na in component sodium_current (nanoA).
 * ALGEBRAIC[9] is i_Ca_L in component L_type_Ca_channel (nanoA).
 * ALGEBRAIC[18] is i_t in component Ca_independent_transient_outward_K_current (nanoA).
 * ALGEBRAIC[25] is i_ss in component steady_state_outward_K_current (nanoA).
 * ALGEBRAIC[32] is i_f in component hyperpolarisation_activated_current (nanoA).
 * ALGEBRAIC[29] is i_K1 in component inward_rectifier (nanoA).
 * ALGEBRAIC[38] is i_B in component background_currents (nanoA).
 * ALGEBRAIC[39] is i_NaK in component sodium_potassium_pump (nanoA).
 * ALGEBRAIC[41] is i_NaCa in component Na_Ca_ion_exchanger_current (nanoA).
 * ALGEBRAIC[40] is i_Ca_P in component sarcolemmal_calcium_pump_current (nanoA).
 * ALGEBRAIC[0] is i_Stim in component membrane (nanoA).
 * CONSTANTS[4] is stim_period in component membrane (second).
 * CONSTANTS[5] is stim_duration in component membrane (second).
 * CONSTANTS[6] is stim_amplitude in component membrane (nanoA).
 * ALGEBRAIC[1] is E_Na in component sodium_current (millivolt).
 * CONSTANTS[7] is g_Na in component sodium_current (microS).
 * CONSTANTS[66] is g_Na_endo in component sodium_current (microS).
 * STATES[1] is Na_i in component intracellular_ion_concentrations (millimolar).
 * CONSTANTS[8] is Na_o in component standard_ionic_concentrations (millimolar).
 * 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[3] is m_infinity in component sodium_current_m_gate (dimensionless).
 * ALGEBRAIC[4] is tau_m in component sodium_current_m_gate (second).
 * ALGEBRAIC[5] is h_infinity in component sodium_current_h_gate (dimensionless).
 * ALGEBRAIC[6] is tau_h in component sodium_current_h_gate (second).
 * ALGEBRAIC[7] is j_infinity in component sodium_current_j_gate (dimensionless).
 * ALGEBRAIC[8] is tau_j in component sodium_current_j_gate (second).
 * CONSTANTS[9] is g_Ca_L in component L_type_Ca_channel (microS).
 * CONSTANTS[10] is E_Ca_L in component L_type_Ca_channel (millivolt).
 * STATES[5] is Ca_ss in component intracellular_ion_concentrations (millimolar).
 * STATES[6] is d in component L_type_Ca_channel_d_gate (dimensionless).
 * STATES[7] is f_11 in component L_type_Ca_channel_f_11_gate (dimensionless).
 * STATES[8] is f_12 in component L_type_Ca_channel_f_12_gate (dimensionless).
 * STATES[9] is Ca_inact in component L_type_Ca_channel_Ca_inact_gate (dimensionless).
 * ALGEBRAIC[10] is d_infinity in component L_type_Ca_channel_d_gate (dimensionless).
 * ALGEBRAIC[11] is tau_d in component L_type_Ca_channel_d_gate (second).
 * ALGEBRAIC[12] is f_11_infinity in component L_type_Ca_channel_f_11_gate (dimensionless).
 * ALGEBRAIC[13] is tau_f_11 in component L_type_Ca_channel_f_11_gate (second).
 * ALGEBRAIC[14] is f_12_infinity in component L_type_Ca_channel_f_12_gate (dimensionless).
 * ALGEBRAIC[15] is tau_f_12 in component L_type_Ca_channel_f_12_gate (second).
 * CONSTANTS[11] is tau_Ca_inact in component L_type_Ca_channel_Ca_inact_gate (second).
 * ALGEBRAIC[16] is Ca_inact_infinity in component L_type_Ca_channel_Ca_inact_gate (dimensionless).
 * ALGEBRAIC[17] is E_K in component Ca_independent_transient_outward_K_current (millivolt).
 * CONSTANTS[12] is g_t in component Ca_independent_transient_outward_K_current (microS).
 * CONSTANTS[67] is g_t_endo in component Ca_independent_transient_outward_K_current (microS).
 * CONSTANTS[13] is a in component Ca_independent_transient_outward_K_current (dimensionless).
 * CONSTANTS[14] is b in component Ca_independent_transient_outward_K_current (dimensionless).
 * CONSTANTS[15] is K_o in component standard_ionic_concentrations (millimolar).
 * STATES[10] is K_i in component intracellular_ion_concentrations (millimolar).
 * STATES[11] is r in component Ca_independent_transient_outward_K_current_r_gate (dimensionless).
 * STATES[12] is s in component Ca_independent_transient_outward_K_current_s_gate (dimensionless).
 * STATES[13] is s_slow in component Ca_independent_transient_outward_K_current_s_slow_gate (dimensionless).
 * ALGEBRAIC[20] is tau_r in component Ca_independent_transient_outward_K_current_r_gate (second).
 * ALGEBRAIC[19] is r_infinity in component Ca_independent_transient_outward_K_current_r_gate (dimensionless).
 * ALGEBRAIC[22] is tau_s in component Ca_independent_transient_outward_K_current_s_gate (second).
 * ALGEBRAIC[21] is s_infinity in component Ca_independent_transient_outward_K_current_s_gate (dimensionless).
 * ALGEBRAIC[24] is tau_s_slow in component Ca_independent_transient_outward_K_current_s_slow_gate (second).
 * ALGEBRAIC[23] is s_slow_infinity in component Ca_independent_transient_outward_K_current_s_slow_gate (dimensionless).
 * CONSTANTS[16] is g_ss in component steady_state_outward_K_current (microS).
 * STATES[14] is r_ss in component steady_state_outward_K_current_r_ss_gate (dimensionless).
 * STATES[15] is s_ss in component steady_state_outward_K_current_s_ss_gate (dimensionless).
 * ALGEBRAIC[27] is tau_r_ss in component steady_state_outward_K_current_r_ss_gate (second).
 * ALGEBRAIC[26] is r_ss_infinity in component steady_state_outward_K_current_r_ss_gate (dimensionless).
 * CONSTANTS[68] is tau_s_ss in component steady_state_outward_K_current_s_ss_gate (second).
 * ALGEBRAIC[28] is s_ss_infinity in component steady_state_outward_K_current_s_ss_gate (dimensionless).
 * CONSTANTS[17] is g_K1 in component inward_rectifier (microS).
 * ALGEBRAIC[30] is i_f_Na in component hyperpolarisation_activated_current (nanoA).
 * ALGEBRAIC[31] is i_f_K in component hyperpolarisation_activated_current (nanoA).
 * CONSTANTS[18] is g_f in component hyperpolarisation_activated_current (microS).
 * CONSTANTS[19] is f_Na in component hyperpolarisation_activated_current (dimensionless).
 * CONSTANTS[69] is f_K in component hyperpolarisation_activated_current (dimensionless).
 * STATES[16] is y in component hyperpolarisation_activated_current_y_gate (dimensionless).
 * ALGEBRAIC[34] is tau_y in component hyperpolarisation_activated_current_y_gate (second).
 * ALGEBRAIC[33] is y_infinity in component hyperpolarisation_activated_current_y_gate (dimensionless).
 * ALGEBRAIC[35] is i_B_Na in component background_currents (nanoA).
 * ALGEBRAIC[36] is i_B_Ca in component background_currents (nanoA).
 * ALGEBRAIC[37] is i_B_K in component background_currents (nanoA).
 * CONSTANTS[20] is g_B_Na in component background_currents (microS).
 * CONSTANTS[21] is g_B_Ca in component background_currents (microS).
 * CONSTANTS[22] is g_B_K in component background_currents (microS).
 * CONSTANTS[23] is E_Ca in component background_currents (millivolt).
 * CONSTANTS[24] is Ca_o in component standard_ionic_concentrations (millimolar).
 * STATES[17] is Ca_i in component intracellular_ion_concentrations (millimolar).
 * CONSTANTS[25] is i_NaK_max in component sodium_potassium_pump (nanoA).
 * CONSTANTS[26] is K_m_K in component sodium_potassium_pump (millimolar).
 * CONSTANTS[27] is K_m_Na in component sodium_potassium_pump (millimolar).
 * CONSTANTS[70] is sigma in component sodium_potassium_pump (dimensionless).
 * CONSTANTS[28] is i_Ca_P_max in component sarcolemmal_calcium_pump_current (nanoA).
 * CONSTANTS[29] is K_NaCa in component Na_Ca_ion_exchanger_current (millimolar_4).
 * CONSTANTS[30] is d_NaCa in component Na_Ca_ion_exchanger_current (millimolar_4).
 * CONSTANTS[31] is gamma_NaCa in component Na_Ca_ion_exchanger_current (dimensionless).
 * ALGEBRAIC[42] is J_rel in component SR_Ca_release_channel (millimolar_per_second).
 * CONSTANTS[32] is v1 in component SR_Ca_release_channel (per_second).
 * CONSTANTS[33] is k_a_plus in component SR_Ca_release_channel (millimolar4_per_second).
 * CONSTANTS[34] is k_a_minus in component SR_Ca_release_channel (per_second).
 * CONSTANTS[35] is k_b_plus in component SR_Ca_release_channel (millimolar3_per_second).
 * CONSTANTS[36] is k_b_minus in component SR_Ca_release_channel (per_second).
 * CONSTANTS[37] is k_c_plus in component SR_Ca_release_channel (per_second).
 * CONSTANTS[38] is k_c_minus in component SR_Ca_release_channel (per_second).
 * STATES[18] is P_O1 in component SR_Ca_release_channel (dimensionless).
 * STATES[19] is P_O2 in component SR_Ca_release_channel (dimensionless).
 * STATES[20] is P_C1 in component SR_Ca_release_channel (dimensionless).
 * STATES[21] is P_C2 in component SR_Ca_release_channel (dimensionless).
 * CONSTANTS[39] is n in component SR_Ca_release_channel (dimensionless).
 * CONSTANTS[40] is m in component SR_Ca_release_channel (dimensionless).
 * STATES[22] is Ca_JSR in component intracellular_ion_concentrations (millimolar).
 * ALGEBRAIC[45] is J_up in component SERCA2a_pump (millimolar_per_second).
 * CONSTANTS[41] is K_fb in component SERCA2a_pump (millimolar).
 * CONSTANTS[42] is K_rb in component SERCA2a_pump (millimolar).
 * ALGEBRAIC[43] is fb in component SERCA2a_pump (dimensionless).
 * ALGEBRAIC[44] is rb in component SERCA2a_pump (dimensionless).
 * CONSTANTS[43] is Vmaxf in component SERCA2a_pump (millimolar_per_second).
 * CONSTANTS[44] is Vmaxr in component SERCA2a_pump (millimolar_per_second).
 * CONSTANTS[45] is K_SR in component SERCA2a_pump (dimensionless).
 * CONSTANTS[46] is N_fb in component SERCA2a_pump (dimensionless).
 * CONSTANTS[47] is N_rb in component SERCA2a_pump (dimensionless).
 * STATES[23] is Ca_NSR in component intracellular_ion_concentrations (millimolar).
 * ALGEBRAIC[46] is J_tr in component intracellular_and_SR_Ca_fluxes (millimolar_per_second).
 * ALGEBRAIC[47] is J_xfer in component intracellular_and_SR_Ca_fluxes (millimolar_per_second).
 * ALGEBRAIC[50] is J_trpn in component intracellular_and_SR_Ca_fluxes (millimolar_per_second).
 * CONSTANTS[48] is tau_tr in component intracellular_and_SR_Ca_fluxes (second).
 * CONSTANTS[49] is tau_xfer in component intracellular_and_SR_Ca_fluxes (second).
 * STATES[24] is HTRPNCa in component intracellular_and_SR_Ca_fluxes (millimolar).
 * STATES[25] is LTRPNCa in component intracellular_and_SR_Ca_fluxes (millimolar).
 * ALGEBRAIC[48] is J_HTRPNCa in component intracellular_and_SR_Ca_fluxes (millimolar_per_second).
 * ALGEBRAIC[49] is J_LTRPNCa in component intracellular_and_SR_Ca_fluxes (millimolar_per_second).
 * CONSTANTS[50] is HTRPN_tot in component intracellular_and_SR_Ca_fluxes (millimolar).
 * CONSTANTS[51] is LTRPN_tot in component intracellular_and_SR_Ca_fluxes (millimolar).
 * CONSTANTS[52] is k_htrpn_plus in component intracellular_and_SR_Ca_fluxes (millimolar_per_second).
 * CONSTANTS[53] is k_htrpn_minus in component intracellular_and_SR_Ca_fluxes (per_second).
 * CONSTANTS[54] is k_ltrpn_plus in component intracellular_and_SR_Ca_fluxes (millimolar_per_second).
 * CONSTANTS[55] is k_ltrpn_minus in component intracellular_and_SR_Ca_fluxes (per_second).
 * CONSTANTS[56] is V_myo in component intracellular_ion_concentrations (micro_litre).
 * CONSTANTS[57] is V_JSR in component intracellular_ion_concentrations (micro_litre).
 * CONSTANTS[58] is V_NSR in component intracellular_ion_concentrations (micro_litre).
 * CONSTANTS[59] is V_SS in component intracellular_ion_concentrations (micro_litre).
 * CONSTANTS[60] is K_mCMDN in component intracellular_ion_concentrations (millimolar).
 * CONSTANTS[61] is K_mCSQN in component intracellular_ion_concentrations (millimolar).
 * CONSTANTS[62] is K_mEGTA in component intracellular_ion_concentrations (millimolar).
 * CONSTANTS[63] is CMDN_tot in component intracellular_ion_concentrations (millimolar).
 * CONSTANTS[64] is CSQN_tot in component intracellular_ion_concentrations (millimolar).
 * CONSTANTS[65] is EGTA_tot in component intracellular_ion_concentrations (millimolar).
 * ALGEBRAIC[51] is beta_i in component intracellular_ion_concentrations (millimolar).
 * ALGEBRAIC[52] is beta_SS in component intracellular_ion_concentrations (millimolar).
 * ALGEBRAIC[53] is beta_JSR in component intracellular_ion_concentrations (millimolar).
 * RATES[0] is d/dt V in component membrane (millivolt).
 * RATES[2] is d/dt m in component sodium_current_m_gate (dimensionless).
 * RATES[3] is d/dt 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 d in component L_type_Ca_channel_d_gate (dimensionless).
 * RATES[7] is d/dt f_11 in component L_type_Ca_channel_f_11_gate (dimensionless).
 * RATES[8] is d/dt f_12 in component L_type_Ca_channel_f_12_gate (dimensionless).
 * RATES[9] is d/dt Ca_inact in component L_type_Ca_channel_Ca_inact_gate (dimensionless).
 * RATES[11] is d/dt r in component Ca_independent_transient_outward_K_current_r_gate (dimensionless).
 * RATES[12] is d/dt s in component Ca_independent_transient_outward_K_current_s_gate (dimensionless).
 * RATES[13] is d/dt s_slow in component Ca_independent_transient_outward_K_current_s_slow_gate (dimensionless).
 * RATES[14] is d/dt r_ss in component steady_state_outward_K_current_r_ss_gate (dimensionless).
 * RATES[15] is d/dt s_ss in component steady_state_outward_K_current_s_ss_gate (dimensionless).
 * RATES[16] is d/dt y in component hyperpolarisation_activated_current_y_gate (dimensionless).
 * RATES[20] is d/dt P_C1 in component SR_Ca_release_channel (dimensionless).
 * RATES[18] is d/dt P_O1 in component SR_Ca_release_channel (dimensionless).
 * RATES[19] is d/dt P_O2 in component SR_Ca_release_channel (dimensionless).
 * RATES[21] is d/dt P_C2 in component SR_Ca_release_channel (dimensionless).
 * RATES[24] is d/dt HTRPNCa in component intracellular_and_SR_Ca_fluxes (millimolar).
 * RATES[25] is d/dt LTRPNCa in component intracellular_and_SR_Ca_fluxes (millimolar).
 * RATES[17] is d/dt Ca_i in component intracellular_ion_concentrations (millimolar).
 * RATES[1] is d/dt Na_i in component intracellular_ion_concentrations (millimolar).
 * RATES[10] is d/dt K_i in component intracellular_ion_concentrations (millimolar).
 * RATES[5] is d/dt Ca_ss in component intracellular_ion_concentrations (millimolar).
 * RATES[22] is d/dt Ca_JSR in component intracellular_ion_concentrations (millimolar).
 * RATES[23] is d/dt Ca_NSR in component intracellular_ion_concentrations (millimolar).
 * There are a total of 4 condition variables.
 */
void
initConsts(double* CONSTANTS, double* RATES, double *STATES)
{
STATES[0] = -80.50146;
CONSTANTS[0] = 8314.5;
CONSTANTS[1] = 295;
CONSTANTS[2] = 96487;
CONSTANTS[3] = 0.0001;
CONSTANTS[4] = 1;
CONSTANTS[5] = 5e-3;
CONSTANTS[6] = -0.6;
CONSTANTS[7] = 1.064;
STATES[1] = 10.73519;
CONSTANTS[8] = 140;
STATES[2] = 0.004164108;
STATES[3] = 0.6735613;
STATES[4] = 0.6729362;
CONSTANTS[9] = 0.025916;
CONSTANTS[10] = 65;
STATES[5] = 0.00008737212;
STATES[6] = 0.000002171081;
STATES[7] = 0.9999529;
STATES[8] = 0.9999529;
STATES[9] = 0.9913102;
CONSTANTS[11] = 0.009;
CONSTANTS[12] = 0.02975;
CONSTANTS[13] = 0.69;
CONSTANTS[14] = 0.31;
CONSTANTS[15] = 5.4;
STATES[10] = 139.2751;
STATES[11] = 0.002191519;
STATES[12] = 0.9842542;
STATES[13] = 0.6421196;
CONSTANTS[16] = 0.005929;
STATES[14] = 0.002907171;
STATES[15] = 0.3142767;
CONSTANTS[17] = 0.024;
CONSTANTS[18] = 0.00145;
CONSTANTS[19] = 0.2;
STATES[16] = 0.003578708;
CONSTANTS[20] = 0.000100188;
CONSTANTS[21] = 0.0000162;
CONSTANTS[22] = 0.000138;
CONSTANTS[23] = 65;
CONSTANTS[24] = 1.2;
STATES[17] = 0.00007901351;
CONSTANTS[25] = 0.0504;
CONSTANTS[26] = 1.5;
CONSTANTS[27] = 10;
CONSTANTS[28] = 0.004;
CONSTANTS[29] = 0.000009984;
CONSTANTS[30] = 0.0001;
CONSTANTS[31] = 0.5;
CONSTANTS[32] = 1.8e3;
CONSTANTS[33] = 12.15e12;
CONSTANTS[34] = 576;
CONSTANTS[35] = 4.05e9;
CONSTANTS[36] = 1930;
CONSTANTS[37] = 100;
CONSTANTS[38] = 0.8;
STATES[18] = 0.0004327548;
STATES[19] = 0.000000000606254;
STATES[20] = 0.6348229;
STATES[21] = 0.3647471;
CONSTANTS[39] = 4;
CONSTANTS[40] = 3;
STATES[22] = 0.06607948;
CONSTANTS[41] = 0.000168;
CONSTANTS[42] = 3.29;
CONSTANTS[43] = 0.032;
CONSTANTS[44] = 0.9;
CONSTANTS[45] = 0.55;
CONSTANTS[46] = 1.2;
CONSTANTS[47] = 1;
STATES[23] = 0.06600742;
CONSTANTS[48] = 0.0005747;
CONSTANTS[49] = 0.0267;
STATES[24] = 1.394301e-1;
STATES[25] = 5.1619e-3;
CONSTANTS[50] = 0.14;
CONSTANTS[51] = 0.07;
CONSTANTS[52] = 200000;
CONSTANTS[53] = 0.066;
CONSTANTS[54] = 40000;
CONSTANTS[55] = 40;
CONSTANTS[56] = 9.36e-6;
CONSTANTS[57] = 0.056e-6;
CONSTANTS[58] = 0.504e-6;
CONSTANTS[59] = 1.2e-9;
CONSTANTS[60] = 0.00238;
CONSTANTS[61] = 0.8;
CONSTANTS[62] = 0.00015;
CONSTANTS[63] = 0.05;
CONSTANTS[64] = 15;
CONSTANTS[65] = 0;
CONSTANTS[66] =  1.33000*CONSTANTS[7];
CONSTANTS[67] =  0.464700*CONSTANTS[12];
CONSTANTS[68] = 2.10000;
CONSTANTS[69] = 1.00000 - CONSTANTS[19];
CONSTANTS[70] = (exp(CONSTANTS[8]/67.3000) - 1.00000)/7.00000;
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[11] = 0.1001;
RATES[12] = 0.1001;
RATES[13] = 0.1001;
RATES[14] = 0.1001;
RATES[15] = 0.1001;
RATES[16] = 0.1001;
RATES[20] = 0.1001;
RATES[18] = 0.1001;
RATES[19] = 0.1001;
RATES[21] = 0.1001;
RATES[24] = 0.1001;
RATES[25] = 0.1001;
RATES[17] = 0.1001;
RATES[1] = 0.1001;
RATES[10] = 0.1001;
RATES[5] = 0.1001;
RATES[22] = 0.1001;
RATES[23] = 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[2]+ALGEBRAIC[9]+ALGEBRAIC[18]+ALGEBRAIC[25]+ALGEBRAIC[32]+ALGEBRAIC[29]+ALGEBRAIC[38]+ALGEBRAIC[39]+ALGEBRAIC[41]+ALGEBRAIC[40]+ALGEBRAIC[0])/CONSTANTS[3];
resid[1] = RATES[2] - (ALGEBRAIC[3] - STATES[2])/ALGEBRAIC[4];
resid[2] = RATES[3] - (ALGEBRAIC[5] - STATES[3])/ALGEBRAIC[6];
resid[3] = RATES[4] - (ALGEBRAIC[7] - STATES[4])/ALGEBRAIC[8];
resid[4] = RATES[6] - (ALGEBRAIC[10] - STATES[6])/ALGEBRAIC[11];
resid[5] = RATES[7] - (ALGEBRAIC[12] - STATES[7])/ALGEBRAIC[13];
resid[6] = RATES[8] - (ALGEBRAIC[14] - STATES[8])/ALGEBRAIC[15];
resid[7] = RATES[9] - (ALGEBRAIC[16] - STATES[9])/CONSTANTS[11];
resid[8] = RATES[11] - (ALGEBRAIC[19] - STATES[11])/ALGEBRAIC[20];
resid[9] = RATES[12] - (ALGEBRAIC[21] - STATES[12])/ALGEBRAIC[22];
resid[10] = RATES[13] - (ALGEBRAIC[23] - STATES[13])/ALGEBRAIC[24];
resid[11] = RATES[14] - (ALGEBRAIC[26] - STATES[14])/ALGEBRAIC[27];
resid[12] = RATES[15] - (ALGEBRAIC[28] - STATES[15])/CONSTANTS[68];
resid[13] = RATES[16] - (ALGEBRAIC[33] - STATES[16])/ALGEBRAIC[34];
resid[14] = RATES[20] -  - CONSTANTS[33]*pow(STATES[5], CONSTANTS[39])*STATES[20]+ CONSTANTS[34]*STATES[18];
resid[15] = RATES[18] - ( CONSTANTS[33]*pow(STATES[5], CONSTANTS[39])*STATES[20] - ( CONSTANTS[34]*STATES[18]+ CONSTANTS[35]*pow(STATES[5], CONSTANTS[40])*STATES[18]+ CONSTANTS[37]*STATES[18]))+ CONSTANTS[36]*STATES[19]+ CONSTANTS[38]*STATES[21];
resid[16] = RATES[19] -  CONSTANTS[35]*pow(STATES[5], CONSTANTS[40])*STATES[18] -  CONSTANTS[36]*STATES[19];
resid[17] = RATES[21] -  CONSTANTS[37]*STATES[18] -  CONSTANTS[38]*STATES[21];
resid[18] = RATES[24] - ALGEBRAIC[48];
resid[19] = RATES[25] - ALGEBRAIC[49];
resid[20] = RATES[17] -  ALGEBRAIC[51]*(ALGEBRAIC[47] - (ALGEBRAIC[45]+ALGEBRAIC[50]+( ((ALGEBRAIC[36] -  2.00000*ALGEBRAIC[41])+ALGEBRAIC[40])*1.00000)/( 2.00000*CONSTANTS[56]*CONSTANTS[2])));
resid[21] = RATES[1] - ( - (ALGEBRAIC[2]+ALGEBRAIC[35]+ ALGEBRAIC[41]*3.00000+ ALGEBRAIC[39]*3.00000+ALGEBRAIC[30])*1.00000)/( CONSTANTS[56]*CONSTANTS[2]);
resid[22] = RATES[10] - ( - (ALGEBRAIC[25]+ALGEBRAIC[37]+ALGEBRAIC[18]+ALGEBRAIC[29]+ALGEBRAIC[31]+ ALGEBRAIC[39]*- 2.00000)*1.00000)/( CONSTANTS[56]*CONSTANTS[2]);
resid[23] = RATES[5] -  ALGEBRAIC[52]*((( ALGEBRAIC[42]*CONSTANTS[57])/CONSTANTS[59] - ( ALGEBRAIC[47]*CONSTANTS[56])/CONSTANTS[59]) - ( ALGEBRAIC[9]*1.00000)/( 2.00000*CONSTANTS[59]*CONSTANTS[2]));
resid[24] = RATES[22] -  ALGEBRAIC[53]*(ALGEBRAIC[46] - ALGEBRAIC[42]);
resid[25] = RATES[23] - ( ALGEBRAIC[45]*CONSTANTS[56])/CONSTANTS[58] - ( ALGEBRAIC[46]*CONSTANTS[57])/CONSTANTS[58];
}
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 ? CONSTANTS[6] : 0.00000);
ALGEBRAIC[1] =  (( CONSTANTS[0]*CONSTANTS[1])/CONSTANTS[2])*log(CONSTANTS[8]/STATES[1]);
ALGEBRAIC[2] =  CONSTANTS[7]*pow(STATES[2], 3.00000)*STATES[3]*STATES[4]*(STATES[0] - ALGEBRAIC[1]);
ALGEBRAIC[3] = 1.00000/(1.00000+exp((STATES[0]+45.0000)/- 6.50000));
ALGEBRAIC[4] = 0.00136000/(( 0.320000*(STATES[0]+47.1300))/(1.00000 - exp( - 0.100000*(STATES[0]+47.1300)))+ 0.0800000*exp(- STATES[0]/11.0000));
ALGEBRAIC[5] = 1.00000/(1.00000+exp((STATES[0]+76.1000)/6.07000));
ALGEBRAIC[6] = (CONDVAR[2]>=0.00000 ?  0.000453700*(1.00000+exp(- (STATES[0]+10.6600)/11.1000)) : 0.00349000/( 0.135000*exp(- (STATES[0]+80.0000)/6.80000)+ 3.56000*exp( 0.0790000*STATES[0])+ 310000.*exp( 0.350000*STATES[0])));
ALGEBRAIC[7] = 1.00000/(1.00000+exp((STATES[0]+76.1000)/6.07000));
ALGEBRAIC[8] = (CONDVAR[3]>=0.00000 ? ( 0.0116300*(1.00000+exp( - 0.100000*(STATES[0]+32.0000))))/exp( - 2.53500e-07*STATES[0]) : 0.00349000/( ((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[9] =  CONSTANTS[9]*STATES[6]*( (0.900000+STATES[9]/10.0000)*STATES[7]+ (0.100000 - STATES[9]/10.0000)*STATES[8])*(STATES[0] - CONSTANTS[10]);
ALGEBRAIC[10] = 1.00000/(1.00000+exp((STATES[0]+15.3000)/- 5.00000));
ALGEBRAIC[11] =  0.00305000*exp( - 0.00450000*pow(STATES[0]+7.00000, 2.00000))+ 0.00105000*exp( - 0.00200000*pow(STATES[0] - 18.0000, 2.00000))+0.000250000;
ALGEBRAIC[12] = 1.00000/(1.00000+exp((STATES[0]+26.7000)/5.40000));
ALGEBRAIC[13] =  0.900000*( 0.105000*exp(- pow((STATES[0]+45.0000)/12.0000, 2.00000))+0.0400000/(1.00000+exp((- STATES[0]+25.0000)/25.0000))+0.0150000/(1.00000+exp((STATES[0]+75.0000)/25.0000))+0.00170000);
ALGEBRAIC[14] = 1.00000/(1.00000+exp((STATES[0]+26.7000)/5.40000));
ALGEBRAIC[15] =  0.0410000*exp(- pow((STATES[0]+47.0000)/12.0000, 2.00000))+0.0800000/(1.00000+exp((STATES[0]+55.0000)/- 5.00000))+0.0150000/(1.00000+exp((STATES[0]+75.0000)/25.0000))+0.00170000;
ALGEBRAIC[16] = 1.00000/(1.00000+STATES[5]/0.0100000);
ALGEBRAIC[17] =  (( CONSTANTS[0]*CONSTANTS[1])/CONSTANTS[2])*log(CONSTANTS[15]/STATES[10]);
ALGEBRAIC[18] =  CONSTANTS[12]*STATES[11]*( CONSTANTS[13]*STATES[12]+ CONSTANTS[14]*STATES[13])*(STATES[0] - ALGEBRAIC[17]);
ALGEBRAIC[19] = 1.00000/(1.00000+exp((STATES[0]+10.6000)/- 11.4200));
ALGEBRAIC[20] = 1.00000/( 45.1600*exp( 0.0357700*(STATES[0]+50.0000))+ 98.9000*exp( - 0.100000*(STATES[0]+38.0000)));
ALGEBRAIC[21] = 1.00000/(1.00000+exp((STATES[0]+45.3000)/6.88410));
ALGEBRAIC[22] =  0.350000*exp(- pow((STATES[0]+70.0000)/15.0000, 2.00000))+0.0350000;
ALGEBRAIC[23] = 1.00000/(1.00000+exp((STATES[0]+45.3000)/6.88410));
ALGEBRAIC[24] =  3.70000*exp(( (- (STATES[0]+70.0000)/30.0000)*(STATES[0]+70.0000))/15.0000)+0.0350000;
ALGEBRAIC[25] =  CONSTANTS[16]*STATES[14]*STATES[15]*(STATES[0] - ALGEBRAIC[17]);
ALGEBRAIC[26] = 1.00000/(1.00000+exp((STATES[0]+11.5000)/- 11.8200));
ALGEBRAIC[27] = 10.0000/( 45.1600*exp( 0.0357700*(STATES[0]+50.0000))+ 98.9000*exp( - 0.100000*(STATES[0]+38.0000)));
ALGEBRAIC[28] = 1.00000/(1.00000+exp((STATES[0]+87.5000)/10.3000));
ALGEBRAIC[29] = ( (48.0000/(exp((STATES[0]+37.0000)/25.0000)+exp((STATES[0]+37.0000)/- 25.0000))+10.0000)*0.00100000)/(1.00000+exp((STATES[0] - (ALGEBRAIC[17]+76.7700))/- 17.0000))+( CONSTANTS[17]*(STATES[0] - (ALGEBRAIC[17]+1.73000)))/( (1.00000+exp(( 1.61300*CONSTANTS[2]*(STATES[0] - (ALGEBRAIC[17]+1.73000)))/( CONSTANTS[0]*CONSTANTS[1])))*(1.00000+exp((CONSTANTS[15] - 0.998800)/- 0.124000)));
ALGEBRAIC[30] =  CONSTANTS[18]*STATES[16]*CONSTANTS[19]*(STATES[0] - ALGEBRAIC[1]);
ALGEBRAIC[31] =  CONSTANTS[18]*STATES[16]*CONSTANTS[69]*(STATES[0] - ALGEBRAIC[17]);
ALGEBRAIC[32] = ALGEBRAIC[30]+ALGEBRAIC[31];
ALGEBRAIC[33] = 1.00000/(1.00000+exp((STATES[0]+138.600)/10.4800));
ALGEBRAIC[34] = 1.00000/( 0.118850*exp((STATES[0]+80.0000)/28.3700)+ 0.562300*exp((STATES[0]+80.0000)/- 14.1900));
ALGEBRAIC[35] =  CONSTANTS[20]*(STATES[0] - ALGEBRAIC[1]);
ALGEBRAIC[36] =  CONSTANTS[21]*(STATES[0] - CONSTANTS[23]);
ALGEBRAIC[37] =  CONSTANTS[22]*(STATES[0] - ALGEBRAIC[17]);
ALGEBRAIC[38] = ALGEBRAIC[35]+ALGEBRAIC[36]+ALGEBRAIC[37];
ALGEBRAIC[39] = ( (( (( CONSTANTS[25]*1.00000)/(1.00000+ 0.124500*exp(( - 0.100000*STATES[0]*CONSTANTS[2])/( CONSTANTS[0]*CONSTANTS[1]))+ 0.0365000*CONSTANTS[70]*exp(( - STATES[0]*CONSTANTS[2])/( CONSTANTS[0]*CONSTANTS[1]))))*CONSTANTS[15])/(CONSTANTS[15]+CONSTANTS[26]))*1.00000)/(1.00000+pow(CONSTANTS[27]/STATES[1], 1.50000));
ALGEBRAIC[40] = ( CONSTANTS[28]*STATES[17])/(STATES[17]+0.000400000);
ALGEBRAIC[41] = ( CONSTANTS[29]*( pow(STATES[1], 3.00000)*CONSTANTS[24]*exp( 0.0374300*STATES[0]*CONSTANTS[31]) -  pow(CONSTANTS[8], 3.00000)*STATES[17]*exp( 0.0374300*STATES[0]*(CONSTANTS[31] - 1.00000))))/(1.00000+ CONSTANTS[30]*( STATES[17]*pow(CONSTANTS[8], 3.00000)+ CONSTANTS[24]*pow(STATES[1], 3.00000)));
ALGEBRAIC[42] =  CONSTANTS[32]*(STATES[18]+STATES[19])*(STATES[22] - STATES[5]);
ALGEBRAIC[43] = pow(STATES[17]/CONSTANTS[41], CONSTANTS[46]);
ALGEBRAIC[44] = pow(STATES[23]/CONSTANTS[42], CONSTANTS[47]);
ALGEBRAIC[45] = ( CONSTANTS[45]*( CONSTANTS[43]*ALGEBRAIC[43] -  CONSTANTS[44]*ALGEBRAIC[44]))/(1.00000+ALGEBRAIC[43]+ALGEBRAIC[44]);
ALGEBRAIC[46] = (STATES[23] - STATES[22])/CONSTANTS[48];
ALGEBRAIC[47] = (STATES[5] - STATES[17])/CONSTANTS[49];
ALGEBRAIC[48] =  CONSTANTS[52]*STATES[17]*(CONSTANTS[50] - STATES[24]) -  CONSTANTS[53]*STATES[24];
ALGEBRAIC[49] =  CONSTANTS[54]*STATES[17]*(CONSTANTS[51] - STATES[25]) -  CONSTANTS[55]*STATES[25];
ALGEBRAIC[50] = ALGEBRAIC[48]+ALGEBRAIC[49];
ALGEBRAIC[51] = 1.00000/(1.00000+( CONSTANTS[63]*CONSTANTS[60])/pow(CONSTANTS[60]+STATES[17], 2.00000)+( CONSTANTS[65]*CONSTANTS[62])/pow(CONSTANTS[62]+STATES[17], 2.00000));
ALGEBRAIC[52] = 1.00000/(1.00000+( CONSTANTS[63]*CONSTANTS[60])/pow(CONSTANTS[60]+STATES[5], 2.00000));
ALGEBRAIC[53] = 1.00000/(1.00000+( CONSTANTS[64]*CONSTANTS[61])/pow(CONSTANTS[61]+STATES[22], 2.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 -  floor(VOI/CONSTANTS[4])*CONSTANTS[4]) - 0.00000;
CONDVAR[1] = (VOI -  floor(VOI/CONSTANTS[4])*CONSTANTS[4]) - CONSTANTS[5];
CONDVAR[2] = STATES[0] - - 40.0000;
CONDVAR[3] = STATES[0] - - 40.0000;
}