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 62 entries in the algebraic variable array.
   There are a total of 31 entries in each of the rate and state variable arrays.
   There are a total of 70 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 (gas_constant_units).
 * CONSTANTS[1] is T in component membrane (kelvin).
 * CONSTANTS[2] is F in component membrane (faradays_constant_units).
 * ALGEBRAIC[52] is i_Na in component fast_sodium_current (uA_per_mm2).
 * ALGEBRAIC[53] is i_Ca_L_Ca in component L_type_Ca_channel (uA_per_mm2).
 * ALGEBRAIC[61] is i_Ca_L_K in component L_type_Ca_channel (uA_per_mm2).
 * ALGEBRAIC[55] is i_K in component time_dependent_potassium_current (uA_per_mm2).
 * ALGEBRAIC[56] is i_K1 in component time_independent_potassium_current (uA_per_mm2).
 * ALGEBRAIC[29] is i_NaCa in component Na_Ca_exchanger (uA_per_mm2).
 * ALGEBRAIC[28] is i_Kp in component plateau_potassium_current (uA_per_mm2).
 * ALGEBRAIC[30] is i_p_Ca in component sarcolemmal_calcium_pump (uA_per_mm2).
 * ALGEBRAIC[32] is i_Na_b in component sodium_background_current (uA_per_mm2).
 * ALGEBRAIC[34] is i_Ca_b in component calcium_background_current (uA_per_mm2).
 * ALGEBRAIC[36] is i_NaK in component sodium_potassium_pump (uA_per_mm2).
 * ALGEBRAIC[59] is i_ns_Ca in component non_specific_calcium_activated_current (uA_per_mm2).
 * CONSTANTS[3] is Cm in component membrane (uF_per_mm2).
 * ALGEBRAIC[0] is I_stim in component membrane (uA_per_mm2).
 * CONSTANTS[4] is stim_start in component membrane (ms).
 * CONSTANTS[5] is stim_end in component membrane (ms).
 * CONSTANTS[6] is stim_period in component membrane (ms).
 * CONSTANTS[7] is stim_duration in component membrane (ms).
 * CONSTANTS[8] is stim_amplitude in component membrane (uA_per_mm2).
 * ALGEBRAIC[1] is E_Na in component fast_sodium_current (mV).
 * CONSTANTS[9] is g_Na in component fast_sodium_current (mS_per_mm2).
 * STATES[1] is Nai in component ionic_concentrations (mM).
 * CONSTANTS[10] is Nao in component ionic_concentrations (mM).
 * STATES[2] is m in component fast_sodium_current_m_gate (dimensionless).
 * STATES[3] is h in component fast_sodium_current_h_gate (dimensionless).
 * STATES[4] is j in component fast_sodium_current_j_gate (dimensionless).
 * ALGEBRAIC[2] is alpha_m in component fast_sodium_current_m_gate (per_ms).
 * ALGEBRAIC[3] is beta_m in component fast_sodium_current_m_gate (per_ms).
 * ALGEBRAIC[4] is alpha_h in component fast_sodium_current_h_gate (per_ms).
 * ALGEBRAIC[5] is beta_h in component fast_sodium_current_h_gate (per_ms).
 * ALGEBRAIC[6] is alpha_j in component fast_sodium_current_j_gate (per_ms).
 * ALGEBRAIC[7] is beta_j in component fast_sodium_current_j_gate (per_ms).
 * CONSTANTS[11] is P_Ca in component L_type_Ca_channel (mm_per_ms).
 * CONSTANTS[12] is P_K in component L_type_Ca_channel (mm_per_ms).
 * ALGEBRAIC[54] is p_k in component L_type_Ca_channel (mm_per_ms).
 * CONSTANTS[13] is i_Ca_L_Ca_half in component L_type_Ca_channel (uA_per_mm2).
 * ALGEBRAIC[8] is i_Ca_L_Ca_max in component L_type_Ca_channel (uA_per_mm2).
 * STATES[5] is O in component L_type_Ca_channel (dimensionless).
 * STATES[6] is O_Ca in component L_type_Ca_channel (dimensionless).
 * ALGEBRAIC[9] is alpha in component L_type_Ca_channel (per_ms).
 * ALGEBRAIC[10] is beta in component L_type_Ca_channel (per_ms).
 * ALGEBRAIC[13] is gamma in component L_type_Ca_channel (per_ms).
 * ALGEBRAIC[11] is alpha_a in component L_type_Ca_channel (per_ms).
 * ALGEBRAIC[12] is beta_b in component L_type_Ca_channel (per_ms).
 * CONSTANTS[14] is a in component L_type_Ca_channel (dimensionless).
 * CONSTANTS[15] is b in component L_type_Ca_channel (dimensionless).
 * CONSTANTS[16] is g in component L_type_Ca_channel (per_ms).
 * CONSTANTS[17] is f in component L_type_Ca_channel (per_ms).
 * CONSTANTS[18] is g_ in component L_type_Ca_channel (per_ms).
 * CONSTANTS[19] is f_ in component L_type_Ca_channel (per_ms).
 * CONSTANTS[20] is omega in component L_type_Ca_channel (per_ms).
 * STATES[7] is C0 in component L_type_Ca_channel (dimensionless).
 * STATES[8] is C1 in component L_type_Ca_channel (dimensionless).
 * STATES[9] is C2 in component L_type_Ca_channel (dimensionless).
 * STATES[10] is C3 in component L_type_Ca_channel (dimensionless).
 * STATES[11] is C4 in component L_type_Ca_channel (dimensionless).
 * STATES[12] is C_Ca0 in component L_type_Ca_channel (dimensionless).
 * STATES[13] is C_Ca1 in component L_type_Ca_channel (dimensionless).
 * STATES[14] is C_Ca2 in component L_type_Ca_channel (dimensionless).
 * STATES[15] is C_Ca3 in component L_type_Ca_channel (dimensionless).
 * STATES[16] is C_Ca4 in component L_type_Ca_channel (dimensionless).
 * STATES[17] is Ca_SS in component calcium_subsystem (mM).
 * CONSTANTS[21] is Cao in component ionic_concentrations (mM).
 * STATES[18] is Ko in component ionic_concentrations (mM).
 * STATES[19] is Ki in component ionic_concentrations (mM).
 * STATES[20] is y in component L_type_Ca_channel_y_gate (dimensionless).
 * ALGEBRAIC[14] is y_infinity in component L_type_Ca_channel_y_gate (dimensionless).
 * ALGEBRAIC[15] is tau_y in component L_type_Ca_channel_y_gate (ms).
 * ALGEBRAIC[16] is g_K in component time_dependent_potassium_current (mS_per_mm2).
 * CONSTANTS[22] is g_K_max in component time_dependent_potassium_current (mS_per_mm2).
 * ALGEBRAIC[17] is E_K in component time_dependent_potassium_current (mV).
 * CONSTANTS[23] is P_NaK in component time_dependent_potassium_current (dimensionless).
 * STATES[21] is X in component time_dependent_potassium_current_X_gate (dimensionless).
 * ALGEBRAIC[20] is Xi in component time_dependent_potassium_current_Xi_gate (dimensionless).
 * ALGEBRAIC[18] is alpha_X in component time_dependent_potassium_current_X_gate (per_ms).
 * ALGEBRAIC[19] is beta_X in component time_dependent_potassium_current_X_gate (per_ms).
 * ALGEBRAIC[22] is E_K1 in component time_independent_potassium_current (mV).
 * ALGEBRAIC[21] is g_K1 in component time_independent_potassium_current (mS_per_mm2).
 * CONSTANTS[24] is g_K1_max in component time_independent_potassium_current (mS_per_mm2).
 * ALGEBRAIC[25] is K1_infinity in component time_independent_potassium_current_K1_gate (dimensionless).
 * ALGEBRAIC[23] is alpha_K1 in component time_independent_potassium_current_K1_gate (per_ms).
 * ALGEBRAIC[24] is beta_K1 in component time_independent_potassium_current_K1_gate (per_ms).
 * ALGEBRAIC[26] is E_Kp in component plateau_potassium_current (mV).
 * CONSTANTS[25] is g_Kp in component plateau_potassium_current (mS_per_mm2).
 * ALGEBRAIC[27] is Kp in component plateau_potassium_current (dimensionless).
 * CONSTANTS[26] is k_NaCa in component Na_Ca_exchanger (uA_per_mm2).
 * CONSTANTS[27] is K_mNa in component Na_Ca_exchanger (mM).
 * CONSTANTS[28] is K_mCa in component Na_Ca_exchanger (mM).
 * CONSTANTS[29] is k_sat in component Na_Ca_exchanger (dimensionless).
 * CONSTANTS[30] is eta in component Na_Ca_exchanger (dimensionless).
 * STATES[22] is Cai in component calcium_subsystem (mM).
 * CONSTANTS[31] is K_mpCa in component sarcolemmal_calcium_pump (mM).
 * CONSTANTS[32] is I_pCa in component sarcolemmal_calcium_pump (uA_per_mm2).
 * CONSTANTS[33] is g_Nab in component sodium_background_current (mS_per_mm2).
 * ALGEBRAIC[31] is E_NaN in component sodium_background_current (mV).
 * CONSTANTS[34] is g_Cab in component calcium_background_current (mS_per_mm2).
 * ALGEBRAIC[33] is E_CaN in component calcium_background_current (mV).
 * CONSTANTS[35] is I_NaK in component sodium_potassium_pump (uA_per_mm2).
 * ALGEBRAIC[35] is f_NaK in component sodium_potassium_pump (dimensionless).
 * CONSTANTS[36] is K_mNai in component sodium_potassium_pump (mM).
 * CONSTANTS[37] is K_mKo in component sodium_potassium_pump (mM).
 * CONSTANTS[66] is sigma in component sodium_potassium_pump (dimensionless).
 * ALGEBRAIC[57] is i_ns_Na in component non_specific_calcium_activated_current (uA_per_mm2).
 * ALGEBRAIC[58] is i_ns_K in component non_specific_calcium_activated_current (uA_per_mm2).
 * ALGEBRAIC[39] is I_ns_Na in component non_specific_calcium_activated_current (uA_per_mm2).
 * ALGEBRAIC[40] is I_ns_K in component non_specific_calcium_activated_current (uA_per_mm2).
 * CONSTANTS[38] is K_m_ns_Ca in component non_specific_calcium_activated_current (mM).
 * CONSTANTS[39] is P_ns_Ca in component non_specific_calcium_activated_current (mm_per_ms).
 * ALGEBRAIC[37] is EnsCa in component non_specific_calcium_activated_current (mV).
 * ALGEBRAIC[38] is VnsCa in component non_specific_calcium_activated_current (mV).
 * CONSTANTS[40] is Am in component calcium_subsystem (per_mm).
 * CONSTANTS[41] is V_myo in component calcium_subsystem (dimensionless).
 * ALGEBRAIC[41] is RyR_open in component calcium_subsystem (dimensionless).
 * STATES[23] is P_O1 in component calcium_subsystem (dimensionless).
 * STATES[24] is P_O2 in component calcium_subsystem (dimensionless).
 * STATES[25] is P_C1 in component calcium_subsystem (dimensionless).
 * STATES[26] is P_C2 in component calcium_subsystem (dimensionless).
 * CONSTANTS[42] is v1 in component calcium_subsystem (per_ms).
 * CONSTANTS[43] is v2 in component calcium_subsystem (per_ms).
 * CONSTANTS[44] is v3 in component calcium_subsystem (mM_per_ms).
 * CONSTANTS[45] is nCa in component calcium_subsystem (dimensionless).
 * CONSTANTS[46] is mCa in component calcium_subsystem (dimensionless).
 * CONSTANTS[47] is k_a_plus in component calcium_subsystem (per_mM4_per_ms).
 * CONSTANTS[48] is k_a_minus in component calcium_subsystem (per_ms).
 * CONSTANTS[49] is k_b_plus in component calcium_subsystem (per_mM3_per_ms).
 * CONSTANTS[50] is k_b_minus in component calcium_subsystem (per_ms).
 * CONSTANTS[51] is k_c_plus in component calcium_subsystem (per_ms).
 * CONSTANTS[52] is k_c_minus in component calcium_subsystem (per_ms).
 * CONSTANTS[53] is k_htrpn_plus in component calcium_subsystem (per_mM_per_ms).
 * CONSTANTS[54] is k_htrpn_minus in component calcium_subsystem (per_ms).
 * CONSTANTS[55] is k_ltrpn_plus in component calcium_subsystem (per_mM_per_ms).
 * CONSTANTS[56] is k_ltrpn_minus in component calcium_subsystem (per_ms).
 * CONSTANTS[57] is tau_tr in component calcium_subsystem (ms).
 * STATES[27] is Ca_JSR in component calcium_subsystem (mM).
 * STATES[28] is Ca_NSR in component calcium_subsystem (mM).
 * CONSTANTS[69] is V_JSR in component calcium_subsystem (dimensionless).
 * CONSTANTS[68] is V_NSR in component calcium_subsystem (dimensionless).
 * CONSTANTS[67] is V_SS in component calcium_subsystem (dimensionless).
 * CONSTANTS[58] is K_mup in component calcium_subsystem (mM).
 * CONSTANTS[59] is K_mCMDN in component calcium_subsystem (mM).
 * CONSTANTS[60] is K_mCSQN in component calcium_subsystem (mM).
 * CONSTANTS[61] is tau_xfer in component calcium_subsystem (ms).
 * CONSTANTS[62] is HTRPN_tot in component calcium_subsystem (mM).
 * CONSTANTS[63] is LTRPN_tot in component calcium_subsystem (mM).
 * STATES[29] is HTRPNCa in component calcium_subsystem (mM).
 * STATES[30] is LTRPNCa in component calcium_subsystem (mM).
 * CONSTANTS[64] is CSQN_tot in component calcium_subsystem (mM).
 * CONSTANTS[65] is CMDN_tot in component calcium_subsystem (mM).
 * ALGEBRAIC[49] is Bi in component calcium_subsystem (dimensionless).
 * ALGEBRAIC[50] is B_SS in component calcium_subsystem (dimensionless).
 * ALGEBRAIC[51] is B_JSR in component calcium_subsystem (dimensionless).
 * ALGEBRAIC[60] is J_rel in component calcium_subsystem (mM_per_ms).
 * ALGEBRAIC[42] is J_leak in component calcium_subsystem (mM_per_ms).
 * ALGEBRAIC[43] is J_up in component calcium_subsystem (mM_per_ms).
 * ALGEBRAIC[44] is J_tr in component calcium_subsystem (mM_per_ms).
 * ALGEBRAIC[45] is J_xfer in component calcium_subsystem (mM_per_ms).
 * ALGEBRAIC[48] is J_trpn in component calcium_subsystem (mM_per_ms).
 * ALGEBRAIC[46] is J_htrpn in component calcium_subsystem (mM_per_ms).
 * ALGEBRAIC[47] is J_ltrpn in component calcium_subsystem (mM_per_ms).
 * RATES[0] is d/dt V in component membrane (mV).
 * RATES[2] is d/dt m in component fast_sodium_current_m_gate (dimensionless).
 * RATES[3] is d/dt h in component fast_sodium_current_h_gate (dimensionless).
 * RATES[4] is d/dt j in component fast_sodium_current_j_gate (dimensionless).
 * RATES[7] is d/dt C0 in component L_type_Ca_channel (dimensionless).
 * RATES[8] is d/dt C1 in component L_type_Ca_channel (dimensionless).
 * RATES[9] is d/dt C2 in component L_type_Ca_channel (dimensionless).
 * RATES[10] is d/dt C3 in component L_type_Ca_channel (dimensionless).
 * RATES[11] is d/dt C4 in component L_type_Ca_channel (dimensionless).
 * RATES[5] is d/dt O in component L_type_Ca_channel (dimensionless).
 * RATES[12] is d/dt C_Ca0 in component L_type_Ca_channel (dimensionless).
 * RATES[13] is d/dt C_Ca1 in component L_type_Ca_channel (dimensionless).
 * RATES[14] is d/dt C_Ca2 in component L_type_Ca_channel (dimensionless).
 * RATES[15] is d/dt C_Ca3 in component L_type_Ca_channel (dimensionless).
 * RATES[16] is d/dt C_Ca4 in component L_type_Ca_channel (dimensionless).
 * RATES[6] is d/dt O_Ca in component L_type_Ca_channel (dimensionless).
 * RATES[20] is d/dt y in component L_type_Ca_channel_y_gate (dimensionless).
 * RATES[21] is d/dt X in component time_dependent_potassium_current_X_gate (dimensionless).
 * RATES[25] is d/dt P_C1 in component calcium_subsystem (dimensionless).
 * RATES[23] is d/dt P_O1 in component calcium_subsystem (dimensionless).
 * RATES[24] is d/dt P_O2 in component calcium_subsystem (dimensionless).
 * RATES[26] is d/dt P_C2 in component calcium_subsystem (dimensionless).
 * RATES[29] is d/dt HTRPNCa in component calcium_subsystem (mM).
 * RATES[30] is d/dt LTRPNCa in component calcium_subsystem (mM).
 * RATES[22] is d/dt Cai in component calcium_subsystem (mM).
 * RATES[17] is d/dt Ca_SS in component calcium_subsystem (mM).
 * RATES[27] is d/dt Ca_JSR in component calcium_subsystem (mM).
 * RATES[28] is d/dt Ca_NSR in component calcium_subsystem (mM).
 * RATES[1] is d/dt Nai in component ionic_concentrations (mM).
 * RATES[19] is d/dt Ki in component ionic_concentrations (mM).
 * RATES[18] is d/dt Ko in component ionic_concentrations (mM).
 * There are a total of 7 condition variables.
 */
void
initConsts(double* CONSTANTS, double* RATES, double *STATES)
{
STATES[0] = -84.1638;
CONSTANTS[0] = 8.3145e3;
CONSTANTS[1] = 310;
CONSTANTS[2] = 9.6845e4;
CONSTANTS[3] = 0.01;
CONSTANTS[4] = 100;
CONSTANTS[5] = 10100;
CONSTANTS[6] = 500;
CONSTANTS[7] = 1;
CONSTANTS[8] = 0.516289;
CONSTANTS[9] = 0.128;
STATES[1] = 10.2042;
CONSTANTS[10] = 140;
STATES[2] = 0.0328302;
STATES[3] = 0.988354;
STATES[4] = 0.99254;
CONSTANTS[11] = 33.75e-6;
CONSTANTS[12] = 1e-9;
CONSTANTS[13] = -4.58e-3;
STATES[5] = 9.84546e-21;
STATES[6] = 0;
CONSTANTS[14] = 2;
CONSTANTS[15] = 2;
CONSTANTS[16] = 2;
CONSTANTS[17] = 0.3;
CONSTANTS[18] = 0;
CONSTANTS[19] = 0;
CONSTANTS[20] = 0.01;
STATES[7] = 0.997208;
STATES[8] = 6.38897e-5;
STATES[9] = 1.535e-9;
STATES[10] = 1.63909e-14;
STATES[11] = 6.56337e-20;
STATES[12] = 2.72826e-3;
STATES[13] = 6.99215e-7;
STATES[14] = 6.71989e-11;
STATES[15] = 2.87031e-15;
STATES[16] = 4.59752e-20;
STATES[17] = 1.36058e-4;
CONSTANTS[21] = 1.8;
STATES[18] = 5.4;
STATES[19] = 143.727;
STATES[20] = 0.998983;
CONSTANTS[22] = 0.001128;
CONSTANTS[23] = 0.01833;
STATES[21] = 0.000928836;
CONSTANTS[24] = 7.5e-3;
CONSTANTS[25] = 8.28e-5;
CONSTANTS[26] = 50;
CONSTANTS[27] = 87.5;
CONSTANTS[28] = 1.38;
CONSTANTS[29] = 0.1;
CONSTANTS[30] = 0.35;
STATES[22] = 9.94893e-11;
CONSTANTS[31] = 0.5e-3;
CONSTANTS[32] = 1.15e-2;
CONSTANTS[33] = 1.41e-5;
CONSTANTS[34] = 6.032e-5;
CONSTANTS[35] = 0.013;
CONSTANTS[36] = 10;
CONSTANTS[37] = 1.5;
CONSTANTS[38] = 1.2e-3;
CONSTANTS[39] = 1.75e-9;
CONSTANTS[40] = 546.69;
CONSTANTS[41] = 0.92;
STATES[23] = 1.19168e-3;
STATES[24] = 6.30613e-9;
STATES[25] = 0.762527;
STATES[26] = 0.236283;
CONSTANTS[42] = 1.8;
CONSTANTS[43] = 0.58e-4;
CONSTANTS[44] = 1.8e-3;
CONSTANTS[45] = 4;
CONSTANTS[46] = 3;
CONSTANTS[47] = 1.215e10;
CONSTANTS[48] = 0.1425;
CONSTANTS[49] = 4.05e7;
CONSTANTS[50] = 1.93;
CONSTANTS[51] = 0.018;
CONSTANTS[52] = 0.0008;
CONSTANTS[53] = 20;
CONSTANTS[54] = 0.066e-3;
CONSTANTS[55] = 40;
CONSTANTS[56] = 0.04;
CONSTANTS[57] = 34.48;
STATES[27] = 1.17504;
STATES[28] = 1.243891;
CONSTANTS[58] = 0.5e-3;
CONSTANTS[59] = 2.38e-3;
CONSTANTS[60] = 0.8;
CONSTANTS[61] = 3.125;
CONSTANTS[62] = 0.14;
CONSTANTS[63] = 0.07;
STATES[29] = 0.13598;
STATES[30] = 0.00635;
CONSTANTS[64] = 15;
CONSTANTS[65] = 0.05;
CONSTANTS[66] =  (1.00000/7.00000)*(exp(CONSTANTS[10]/67.3000) - 1.00000);
CONSTANTS[67] =  5.82800e-05*CONSTANTS[41];
CONSTANTS[68] =  0.0810000*CONSTANTS[41];
CONSTANTS[69] =  0.00464000*CONSTANTS[41];
RATES[0] = 0.1001;
RATES[2] = 0.1001;
RATES[3] = 0.1001;
RATES[4] = 0.1001;
RATES[7] = 0.1001;
RATES[8] = 0.1001;
RATES[9] = 0.1001;
RATES[10] = 0.1001;
RATES[11] = 0.1001;
RATES[5] = 0.1001;
RATES[12] = 0.1001;
RATES[13] = 0.1001;
RATES[14] = 0.1001;
RATES[15] = 0.1001;
RATES[16] = 0.1001;
RATES[6] = 0.1001;
RATES[20] = 0.1001;
RATES[21] = 0.1001;
RATES[25] = 0.1001;
RATES[23] = 0.1001;
RATES[24] = 0.1001;
RATES[26] = 0.1001;
RATES[29] = 0.1001;
RATES[30] = 0.1001;
RATES[22] = 0.1001;
RATES[17] = 0.1001;
RATES[27] = 0.1001;
RATES[28] = 0.1001;
RATES[1] = 0.1001;
RATES[19] = 0.1001;
RATES[18] = 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[0] - (ALGEBRAIC[52]+ALGEBRAIC[53]+ALGEBRAIC[61]+ALGEBRAIC[55]+ALGEBRAIC[29]+ALGEBRAIC[56]+ALGEBRAIC[28]+ALGEBRAIC[30]+ALGEBRAIC[32]+ALGEBRAIC[34]+ALGEBRAIC[36]+ALGEBRAIC[59]))/CONSTANTS[3];
resid[1] = RATES[2] -  ALGEBRAIC[2]*(1.00000 - STATES[2]) -  ALGEBRAIC[3]*STATES[2];
resid[2] = RATES[3] -  ALGEBRAIC[4]*(1.00000 - STATES[3]) -  ALGEBRAIC[5]*STATES[3];
resid[3] = RATES[4] -  ALGEBRAIC[6]*(1.00000 - STATES[4]) -  ALGEBRAIC[7]*STATES[4];
resid[4] = RATES[7] - ( ALGEBRAIC[10]*STATES[8]+ CONSTANTS[20]*STATES[12]) -  ( 4.00000*ALGEBRAIC[9]+ALGEBRAIC[13])*STATES[7];
resid[5] = RATES[8] - ( 4.00000*ALGEBRAIC[9]*STATES[7]+ 2.00000*ALGEBRAIC[10]*STATES[9]+ (CONSTANTS[20]/CONSTANTS[15])*STATES[13]) -  (ALGEBRAIC[10]+ 3.00000*ALGEBRAIC[9]+ ALGEBRAIC[13]*CONSTANTS[14])*STATES[8];
resid[6] = RATES[9] - ( 3.00000*ALGEBRAIC[9]*STATES[8]+ 3.00000*ALGEBRAIC[10]*STATES[10]+ (CONSTANTS[20]/pow(CONSTANTS[15], 2.00000))*STATES[14]) -  ( ALGEBRAIC[10]*2.00000+ 2.00000*ALGEBRAIC[9]+ ALGEBRAIC[13]*pow(CONSTANTS[14], 2.00000))*STATES[9];
resid[7] = RATES[10] - ( 2.00000*ALGEBRAIC[9]*STATES[9]+ 4.00000*ALGEBRAIC[10]*STATES[11]+ (CONSTANTS[20]/pow(CONSTANTS[15], 3.00000))*STATES[15]) -  ( ALGEBRAIC[10]*3.00000+ALGEBRAIC[9]+ ALGEBRAIC[13]*pow(CONSTANTS[14], 3.00000))*STATES[10];
resid[8] = RATES[11] - ( ALGEBRAIC[9]*STATES[10]+ CONSTANTS[16]*STATES[5]+ (CONSTANTS[20]/pow(CONSTANTS[15], 4.00000))*STATES[16]) -  ( ALGEBRAIC[10]*4.00000+CONSTANTS[17]+ ALGEBRAIC[13]*pow(CONSTANTS[14], 4.00000))*STATES[11];
resid[9] = RATES[5] -  CONSTANTS[17]*STATES[11] -  CONSTANTS[16]*STATES[5];
resid[10] = RATES[12] - ( ALGEBRAIC[12]*STATES[13]+ ALGEBRAIC[13]*STATES[12]) -  ( 4.00000*ALGEBRAIC[11]+CONSTANTS[20])*STATES[12];
resid[11] = RATES[13] - ( 4.00000*ALGEBRAIC[11]*STATES[12]+ 2.00000*ALGEBRAIC[12]*STATES[14]+ ALGEBRAIC[13]*CONSTANTS[14]*STATES[8]) -  (ALGEBRAIC[12]+ 3.00000*ALGEBRAIC[11]+CONSTANTS[20]/CONSTANTS[15])*STATES[13];
resid[12] = RATES[14] - ( 3.00000*ALGEBRAIC[11]*STATES[13]+ 3.00000*ALGEBRAIC[12]*STATES[15]+ ALGEBRAIC[13]*pow(CONSTANTS[14], 2.00000)*STATES[9]) -  ( ALGEBRAIC[12]*2.00000+ 2.00000*ALGEBRAIC[11]+CONSTANTS[20]/pow(CONSTANTS[15], 2.00000))*STATES[14];
resid[13] = RATES[15] - ( 2.00000*ALGEBRAIC[11]*STATES[14]+ 4.00000*ALGEBRAIC[12]*STATES[16]+ ALGEBRAIC[13]*pow(CONSTANTS[14], 3.00000)*STATES[10]) -  ( ALGEBRAIC[12]*3.00000+ALGEBRAIC[11]+CONSTANTS[20]/pow(CONSTANTS[15], 3.00000))*STATES[15];
resid[14] = RATES[16] - ( ALGEBRAIC[11]*STATES[15]+ CONSTANTS[18]*STATES[6]+ ALGEBRAIC[13]*pow(CONSTANTS[14], 4.00000)*STATES[11]) -  ( ALGEBRAIC[12]*4.00000+CONSTANTS[19]+CONSTANTS[20]/pow(CONSTANTS[15], 4.00000))*STATES[16];
resid[15] = RATES[6] -  CONSTANTS[19]*STATES[16] -  CONSTANTS[18]*STATES[6];
resid[16] = RATES[20] - (ALGEBRAIC[14] - STATES[20])/ALGEBRAIC[15];
resid[17] = RATES[21] -  ALGEBRAIC[18]*(1.00000 - STATES[21]) -  ALGEBRAIC[19]*STATES[21];
resid[18] = RATES[25] -  - CONSTANTS[47]*pow(STATES[17], CONSTANTS[45])*STATES[25]+ CONSTANTS[48]*STATES[23];
resid[19] = RATES[23] - ( CONSTANTS[47]*pow(STATES[17], CONSTANTS[45])*STATES[25] - ( CONSTANTS[48]*STATES[23]+ CONSTANTS[49]*pow(STATES[17], CONSTANTS[46])*STATES[23]+ CONSTANTS[51]*STATES[23]))+ CONSTANTS[50]*STATES[24]+ CONSTANTS[52]*STATES[26];
resid[20] = RATES[24] -  CONSTANTS[49]*pow(STATES[17], CONSTANTS[46])*STATES[23] -  CONSTANTS[50]*STATES[24];
resid[21] = RATES[26] -  CONSTANTS[51]*STATES[23] -  CONSTANTS[52]*STATES[26];
resid[22] = RATES[29] - ALGEBRAIC[46];
resid[23] = RATES[30] - ALGEBRAIC[47];
resid[24] = RATES[22] -  ALGEBRAIC[49]*((ALGEBRAIC[42]+ALGEBRAIC[45]) - (ALGEBRAIC[43]+ALGEBRAIC[48]+( ((ALGEBRAIC[34] -  2.00000*ALGEBRAIC[29])+ALGEBRAIC[30])*CONSTANTS[40])/( 2.00000*CONSTANTS[41]*CONSTANTS[2])));
resid[25] = RATES[17] -  ALGEBRAIC[50]*((( ALGEBRAIC[60]*CONSTANTS[69])/CONSTANTS[67] - ( ALGEBRAIC[45]*CONSTANTS[41])/CONSTANTS[67]) - ( ALGEBRAIC[53]*CONSTANTS[40])/( 2.00000*CONSTANTS[67]*CONSTANTS[2]));
resid[26] = RATES[27] -  ALGEBRAIC[51]*(ALGEBRAIC[44] - ALGEBRAIC[60]);
resid[27] = RATES[28] - ( (ALGEBRAIC[43] - ALGEBRAIC[42])*CONSTANTS[41])/CONSTANTS[68] - ( ALGEBRAIC[44]*CONSTANTS[69])/CONSTANTS[68];
resid[28] = RATES[1] - ( - (ALGEBRAIC[52]+ALGEBRAIC[32]+ALGEBRAIC[57]+ ALGEBRAIC[29]*3.00000+ ALGEBRAIC[36]*3.00000)*CONSTANTS[40])/( CONSTANTS[41]*CONSTANTS[2]);
resid[29] = RATES[19] - ( - (ALGEBRAIC[61]+ALGEBRAIC[55]+ALGEBRAIC[56]+ALGEBRAIC[28]+ALGEBRAIC[58]+ - ALGEBRAIC[36]*2.00000)*CONSTANTS[40])/( CONSTANTS[41]*CONSTANTS[2]);
resid[30] = RATES[18] - ( (ALGEBRAIC[61]+ALGEBRAIC[55]+ALGEBRAIC[56]+ALGEBRAIC[28]+ALGEBRAIC[58]+ - ALGEBRAIC[36]*2.00000)*CONSTANTS[40])/( CONSTANTS[41]*CONSTANTS[2]);
}
void
computeVariables(double VOI, double* CONSTANTS, double* RATES, double* STATES, double* ALGEBRAIC)
{
}
void
computeEssentialVariables(double VOI, double* CONSTANTS, double* RATES, double* STATES, double* ALGEBRAIC)
{
ALGEBRAIC[0] = (CONDVAR[0]>=0.00000&&CONDVAR[1]<=0.00000&&CONDVAR[2]<=0.00000 ? CONSTANTS[8] : 0.00000);
ALGEBRAIC[2] = ( 0.320000*(STATES[0]+47.1300))/(1.00000 - exp( - 0.100000*(STATES[0]+47.1300)));
ALGEBRAIC[3] =  0.0800000*exp(- STATES[0]/11.0000);
ALGEBRAIC[4] = (CONDVAR[3]<0.00000 ?  0.135000*exp((80.0000+STATES[0])/- 6.80000) : 0.00000);
ALGEBRAIC[5] = (CONDVAR[4]<0.00000 ?  3.56000*exp( 0.0790000*STATES[0])+ 310000.*exp( 0.350000*STATES[0]) : 1.00000/( 0.130000*(1.00000+exp((STATES[0]+10.6600)/- 11.1000))));
ALGEBRAIC[6] = (CONDVAR[5]<0.00000 ? ( ( - 127140.*exp( 0.244400*STATES[0]) -  3.47400e-05*exp( - 0.0439100*STATES[0]))*(STATES[0]+37.7800))/(1.00000+exp( 0.311000*(STATES[0]+79.2300))) : 0.00000);
ALGEBRAIC[7] = (CONDVAR[6]<0.00000 ? ( 0.121200*exp( - 0.0105200*STATES[0]))/(1.00000+exp( - 0.137800*(STATES[0]+40.1400))) : ( 0.300000*exp( - 2.53500e-07*STATES[0]))/(1.00000+exp( - 0.100000*(STATES[0]+32.0000))));
ALGEBRAIC[9] =  0.400000*exp((STATES[0]+12.0000)/10.0000);
ALGEBRAIC[10] =  0.0500000*exp((STATES[0]+12.0000)/- 13.0000);
ALGEBRAIC[11] =  ALGEBRAIC[9]*CONSTANTS[14];
ALGEBRAIC[12] = ALGEBRAIC[10]/CONSTANTS[15];
ALGEBRAIC[13] = ( 0.187500*STATES[17])/1.00000;
ALGEBRAIC[14] = 1.00000/(1.00000+exp((STATES[0]+55.0000)/7.50000))+0.100000/(1.00000+exp((- STATES[0]+21.0000)/6.00000));
ALGEBRAIC[15] = 20.0000+600.000/(1.00000+exp((STATES[0]+30.0000)/9.50000));
ALGEBRAIC[18] = ( 7.19000e-05*(STATES[0]+30.0000))/(1.00000 - exp( - 0.148000*(STATES[0]+30.0000)));
ALGEBRAIC[19] = ( 0.000131000*(STATES[0]+30.0000))/(- 1.00000+exp( 0.0687000*(STATES[0]+30.0000)));
ALGEBRAIC[22] =  (( CONSTANTS[0]*CONSTANTS[1])/CONSTANTS[2])*log(STATES[18]/STATES[19]);
ALGEBRAIC[26] = ALGEBRAIC[22];
ALGEBRAIC[27] = 1.00000/(1.00000+exp((7.48800 - STATES[0])/5.98000));
ALGEBRAIC[28] =  CONSTANTS[25]*ALGEBRAIC[27]*(STATES[0] - ALGEBRAIC[26]);
ALGEBRAIC[29] =  (( (( (( CONSTANTS[26]*1.00000)/(pow(CONSTANTS[27], 3.00000)+pow(CONSTANTS[10], 3.00000)))*1.00000)/(CONSTANTS[28]+CONSTANTS[21]))*1.00000)/(1.00000+ CONSTANTS[29]*exp(( (CONSTANTS[30] - 1.00000)*STATES[0]*CONSTANTS[2])/( CONSTANTS[0]*CONSTANTS[1]))))*( exp(( CONSTANTS[30]*STATES[0]*CONSTANTS[2])/( CONSTANTS[0]*CONSTANTS[1]))*pow(STATES[1], 3.00000)*CONSTANTS[21] -  exp(( (CONSTANTS[30] - 1.00000)*STATES[0]*CONSTANTS[2])/( CONSTANTS[0]*CONSTANTS[1]))*pow(CONSTANTS[10], 3.00000)*STATES[22]);
ALGEBRAIC[30] = ( CONSTANTS[32]*STATES[22])/(CONSTANTS[31]+STATES[22]);
ALGEBRAIC[1] =  (( CONSTANTS[0]*CONSTANTS[1])/CONSTANTS[2])*log(CONSTANTS[10]/STATES[1]);
ALGEBRAIC[31] = ALGEBRAIC[1];
ALGEBRAIC[32] =  CONSTANTS[33]*(STATES[0] - ALGEBRAIC[31]);
ALGEBRAIC[33] =  (( CONSTANTS[0]*CONSTANTS[1])/( 2.00000*CONSTANTS[2]))*log(CONSTANTS[21]/STATES[22]);
ALGEBRAIC[34] =  CONSTANTS[34]*(STATES[0] - ALGEBRAIC[33]);
ALGEBRAIC[35] = 1.00000/(1.00000+ 0.124500*exp(( - 0.100000*STATES[0]*CONSTANTS[2])/( CONSTANTS[0]*CONSTANTS[1]))+ 0.0365000*CONSTANTS[66]*exp(( - STATES[0]*CONSTANTS[2])/( CONSTANTS[0]*CONSTANTS[1])));
ALGEBRAIC[36] = ( (( CONSTANTS[35]*ALGEBRAIC[35]*1.00000)/(1.00000+pow(CONSTANTS[36]/STATES[1], 1.50000)))*STATES[18])/(STATES[18]+CONSTANTS[37]);
ALGEBRAIC[42] =  CONSTANTS[43]*(STATES[28] - STATES[22]);
ALGEBRAIC[43] = ( CONSTANTS[44]*pow(STATES[22], 2.00000))/(pow(CONSTANTS[58], 2.00000)+pow(STATES[22], 2.00000));
ALGEBRAIC[44] = (STATES[28] - STATES[27])/CONSTANTS[57];
ALGEBRAIC[45] = (STATES[17] - STATES[22])/CONSTANTS[61];
ALGEBRAIC[46] =  CONSTANTS[53]*STATES[22]*(CONSTANTS[62] - STATES[29]) -  CONSTANTS[54]*STATES[29];
ALGEBRAIC[47] =  CONSTANTS[55]*STATES[22]*(CONSTANTS[63] - STATES[30]) -  CONSTANTS[56]*STATES[30];
ALGEBRAIC[48] = ALGEBRAIC[46]+ALGEBRAIC[47];
ALGEBRAIC[49] = 1.00000/(1.00000+( CONSTANTS[65]*CONSTANTS[59])/pow(CONSTANTS[59]+STATES[22], 2.00000));
ALGEBRAIC[50] = 1.00000/(1.00000+( CONSTANTS[65]*CONSTANTS[59])/pow(CONSTANTS[59]+STATES[17], 2.00000));
ALGEBRAIC[51] = 1.00000/(1.00000+( CONSTANTS[64]*CONSTANTS[60])/pow(CONSTANTS[60]+STATES[27], 2.00000));
ALGEBRAIC[52] =  CONSTANTS[9]*pow(STATES[2], 3.00000)*STATES[3]*STATES[4]*(STATES[0] - ALGEBRAIC[1]);
ALGEBRAIC[8] =  1.00000*(( (( CONSTANTS[11]*4.00000*STATES[0]*pow(CONSTANTS[2], 2.00000))/( CONSTANTS[0]*CONSTANTS[1]))*( 0.00100000*exp(( 2.00000*STATES[0]*CONSTANTS[2])/( CONSTANTS[0]*CONSTANTS[1])) -  0.341000*CONSTANTS[21]))/(exp(( 2.00000*STATES[0]*CONSTANTS[2])/( CONSTANTS[0]*CONSTANTS[1])) - 1.00000));
ALGEBRAIC[53] =  ALGEBRAIC[8]*STATES[20]*(STATES[5]+STATES[6]);
ALGEBRAIC[16] =  CONSTANTS[22]* pow((STATES[18]/5.40000), 1.0 / 2);
ALGEBRAIC[17] =  (( CONSTANTS[0]*CONSTANTS[1])/CONSTANTS[2])*log((STATES[18]+ CONSTANTS[23]*CONSTANTS[10])/(STATES[19]+ CONSTANTS[23]*STATES[1]));
ALGEBRAIC[20] = 1.00000/(1.00000+exp((STATES[0] - 56.2600)/32.1000));
ALGEBRAIC[55] =  ALGEBRAIC[16]*ALGEBRAIC[20]*pow(STATES[21], 2.00000)*(STATES[0] - ALGEBRAIC[17]);
ALGEBRAIC[21] =  CONSTANTS[24]* pow((STATES[18]/5.40000), 1.0 / 2);
ALGEBRAIC[23] = 1.02000/(1.00000+exp( 0.238500*((STATES[0] - ALGEBRAIC[22]) - 59.2150)));
ALGEBRAIC[24] = ( 0.491240*(exp( 0.0803200*((STATES[0]+5.47600) - ALGEBRAIC[22]))+exp( 0.0617500*(STATES[0] - (ALGEBRAIC[22]+594.310)))))/(1.00000+exp( - 0.514300*((STATES[0] - ALGEBRAIC[22])+4.75300)));
ALGEBRAIC[25] = ALGEBRAIC[23]/(ALGEBRAIC[23]+ALGEBRAIC[24]);
ALGEBRAIC[56] =  ALGEBRAIC[21]*ALGEBRAIC[25]*(STATES[0] - ALGEBRAIC[22]);
ALGEBRAIC[37] =  (( CONSTANTS[0]*CONSTANTS[1])/CONSTANTS[2])*log((STATES[18]+CONSTANTS[10])/(STATES[19]+STATES[1]));
ALGEBRAIC[38] = STATES[0] - ALGEBRAIC[37];
ALGEBRAIC[39] = ( (( 1.00000*CONSTANTS[39]*pow(1.00000, 2.00000)*ALGEBRAIC[38]*pow(CONSTANTS[2], 2.00000))/( CONSTANTS[0]*CONSTANTS[1]))*( 0.750000*STATES[1]*exp(( ALGEBRAIC[38]*CONSTANTS[2])/( CONSTANTS[0]*CONSTANTS[1])) -  0.750000*CONSTANTS[10]))/(exp(( ALGEBRAIC[38]*CONSTANTS[2])/( CONSTANTS[0]*CONSTANTS[1])) - 1.00000);
ALGEBRAIC[57] = ( ALGEBRAIC[39]*1.00000)/(1.00000+pow(CONSTANTS[38]/STATES[22], 3.00000));
ALGEBRAIC[40] = ( (( 1.00000*CONSTANTS[39]*pow(1.00000, 2.00000)*ALGEBRAIC[38]*pow(CONSTANTS[2], 2.00000))/( CONSTANTS[0]*CONSTANTS[1]))*( 0.750000*STATES[19]*exp(( ALGEBRAIC[38]*CONSTANTS[2])/( CONSTANTS[0]*CONSTANTS[1])) -  0.750000*STATES[18]))/(exp(( ALGEBRAIC[38]*CONSTANTS[2])/( CONSTANTS[0]*CONSTANTS[1])) - 1.00000);
ALGEBRAIC[58] = ( ALGEBRAIC[40]*1.00000)/(1.00000+pow(CONSTANTS[38]/STATES[22], 3.00000));
ALGEBRAIC[59] = ALGEBRAIC[57]+ALGEBRAIC[58];
ALGEBRAIC[41] = STATES[23]+STATES[24];
ALGEBRAIC[60] =  CONSTANTS[42]*ALGEBRAIC[41]*(STATES[27] - STATES[17]);
ALGEBRAIC[54] = CONSTANTS[12]/(1.00000+ALGEBRAIC[8]/CONSTANTS[13]);
ALGEBRAIC[61] = ( (( 1.00000*ALGEBRAIC[54]*STATES[20]*(STATES[5]+STATES[6])*STATES[0]*pow(CONSTANTS[2], 2.00000))/( CONSTANTS[0]*CONSTANTS[1]))*( STATES[19]*exp(( STATES[0]*CONSTANTS[2])/( CONSTANTS[0]*CONSTANTS[1])) - STATES[18]))/(exp(( STATES[0]*CONSTANTS[2])/( CONSTANTS[0]*CONSTANTS[1])) - 1.00000);
}
void
getStateInformation(double* SI)
{
SI[0] = 1.0;
SI[1] = 1.0;
SI[2] = 1.0;
SI[3] = 1.0;
SI[4] = 1.0;
SI[5] = 1.0;
SI[6] = 1.0;
SI[7] = 1.0;
SI[8] = 1.0;
SI[9] = 1.0;
SI[10] = 1.0;
SI[11] = 1.0;
SI[12] = 1.0;
SI[13] = 1.0;
SI[14] = 1.0;
SI[15] = 1.0;
SI[16] = 1.0;
SI[17] = 1.0;
SI[18] = 1.0;
SI[19] = 1.0;
SI[20] = 1.0;
SI[21] = 1.0;
SI[22] = 1.0;
SI[23] = 1.0;
SI[24] = 1.0;
SI[25] = 1.0;
SI[26] = 1.0;
SI[27] = 1.0;
SI[28] = 1.0;
SI[29] = 1.0;
SI[30] = 1.0;
}
void
computeRoots(double VOI, double* CONSTANTS, double* RATES, double* OLDRATES, double* STATES,
             double* OLDSTATES, double* ALGEBRAIC, double* CONDVARS)
{
CONDVAR[0] = VOI - CONSTANTS[4];
CONDVAR[1] = VOI - CONSTANTS[5];
CONDVAR[2] = ((VOI - CONSTANTS[4]) -  floor((VOI - CONSTANTS[4])/CONSTANTS[6])*CONSTANTS[6]) - CONSTANTS[7];
CONDVAR[3] = STATES[0] - - 40.0000;
CONDVAR[4] = STATES[0] - - 40.0000;
CONDVAR[5] = STATES[0] - - 40.0000;
CONDVAR[6] = STATES[0] - - 40.0000;
}