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 47 entries in the algebraic variable array.
   There are a total of 13 entries in each of the rate and state variable arrays.
   There are a total of 55 entries in the constant variable array.
 */
/*
 * VOI is time in component environment (millisecond).
 * STATES[0] is V in component membrane (millivolt).
 * CONSTANTS[0] is R in component membrane (joule_per_mole_kelvin).
 * CONSTANTS[1] is T in component membrane (kelvin).
 * CONSTANTS[2] is F in component membrane (coulomb_per_millimole).
 * ALGEBRAIC[1] is i_Na in component fast_sodium_current (microA_per_microF).
 * ALGEBRAIC[46] is i_Ca in component L_type_Ca_current (microA_per_microF).
 * ALGEBRAIC[31] is i_CaK in component L_type_Ca_current (microA_per_microF).
 * ALGEBRAIC[11] is i_Kr in component rapid_activating_delayed_rectifiyer_K_current (microA_per_microF).
 * ALGEBRAIC[14] is i_Ks in component slow_activating_delayed_rectifiyer_K_current (microA_per_microF).
 * ALGEBRAIC[17] is i_to in component transient_outward_potassium_current (microA_per_microF).
 * ALGEBRAIC[44] is i_K1 in component time_independent_potassium_current (microA_per_microF).
 * ALGEBRAIC[45] is i_Kp in component plateau_potassium_current (microA_per_microF).
 * ALGEBRAIC[25] is i_NaCa in component Na_Ca_exchanger (microA_per_microF).
 * ALGEBRAIC[24] is i_NaK in component sodium_potassium_pump (microA_per_microF).
 * ALGEBRAIC[26] is i_p_Ca in component sarcolemmal_calcium_pump (microA_per_microF).
 * ALGEBRAIC[28] is i_Ca_b in component calcium_background_current (microA_per_microF).
 * ALGEBRAIC[29] is i_Na_b in component sodium_background_current (microA_per_microF).
 * ALGEBRAIC[0] is i_Stim in component membrane (microA_per_microF).
 * CONSTANTS[3] is stim_start in component membrane (millisecond).
 * CONSTANTS[4] is stim_end in component membrane (millisecond).
 * CONSTANTS[5] is stim_period in component membrane (millisecond).
 * CONSTANTS[6] is stim_duration in component membrane (millisecond).
 * CONSTANTS[7] is stim_amplitude in component membrane (microA_per_microF).
 * CONSTANTS[50] is E_Na in component fast_sodium_current (millivolt).
 * CONSTANTS[8] is g_Na in component fast_sodium_current (milliS_per_microF).
 * CONSTANTS[9] is Na_o in component standard_ionic_concentrations (millimolar).
 * CONSTANTS[10] is Na_i in component standard_ionic_concentrations (millimolar).
 * STATES[1] is m in component fast_sodium_current_m_gate (dimensionless).
 * STATES[2] is h in component fast_sodium_current_h_gate (dimensionless).
 * STATES[3] is j in component fast_sodium_current_j_gate (dimensionless).
 * ALGEBRAIC[3] is alpha_m in component fast_sodium_current_m_gate (per_millisecond).
 * ALGEBRAIC[4] is beta_m in component fast_sodium_current_m_gate (per_millisecond).
 * ALGEBRAIC[2] is E0_m in component fast_sodium_current_m_gate (millivolt).
 * ALGEBRAIC[5] is alpha_h in component fast_sodium_current_h_gate (per_millisecond).
 * ALGEBRAIC[6] is beta_h in component fast_sodium_current_h_gate (per_millisecond).
 * CONSTANTS[11] is shift_h in component fast_sodium_current_h_gate (millivolt).
 * ALGEBRAIC[7] is alpha_j in component fast_sodium_current_j_gate (per_millisecond).
 * ALGEBRAIC[8] is beta_j in component fast_sodium_current_j_gate (per_millisecond).
 * CONSTANTS[12] is shift_j in component fast_sodium_current_j_gate (millivolt).
 * CONSTANTS[13] is g_K1 in component time_independent_potassium_current (milliS_per_microF).
 * CONSTANTS[14] is K_mK1 in component time_independent_potassium_current (millimolar).
 * CONSTANTS[51] is E_K in component rapid_activating_delayed_rectifiyer_K_current (millivolt).
 * CONSTANTS[15] is K_o in component standard_ionic_concentrations (millimolar).
 * ALGEBRAIC[9] is K1_infinity in component time_independent_potassium_current_K1_gate (dimensionless).
 * CONSTANTS[16] is g_Kr in component rapid_activating_delayed_rectifiyer_K_current (milliS_per_microF).
 * ALGEBRAIC[10] is R_V in component rapid_activating_delayed_rectifiyer_K_current (dimensionless).
 * CONSTANTS[17] is K_i in component standard_ionic_concentrations (millimolar).
 * STATES[4] is X_kr in component rapid_activating_delayed_rectifiyer_K_current_X_kr_gate (dimensionless).
 * ALGEBRAIC[12] is X_kr_inf in component rapid_activating_delayed_rectifiyer_K_current_X_kr_gate (dimensionless).
 * ALGEBRAIC[13] is tau_X_kr in component rapid_activating_delayed_rectifiyer_K_current_X_kr_gate (millisecond).
 * CONSTANTS[18] is g_Ks in component slow_activating_delayed_rectifiyer_K_current (milliS_per_microF).
 * CONSTANTS[52] is E_Ks in component slow_activating_delayed_rectifiyer_K_current (millivolt).
 * STATES[5] is X_ks in component slow_activating_delayed_rectifiyer_K_current_X_ks_gate (dimensionless).
 * ALGEBRAIC[16] is tau_X_ks in component slow_activating_delayed_rectifiyer_K_current_X_ks_gate (millisecond).
 * ALGEBRAIC[15] is X_ks_infinity in component slow_activating_delayed_rectifiyer_K_current_X_ks_gate (dimensionless).
 * CONSTANTS[19] is g_to in component transient_outward_potassium_current (milliS_per_microF).
 * STATES[6] is X_to in component transient_outward_potassium_current_X_to_gate (dimensionless).
 * STATES[7] is Y_to in component transient_outward_potassium_current_Y_to_gate (dimensionless).
 * ALGEBRAIC[18] is alpha_X_to in component transient_outward_potassium_current_X_to_gate (per_millisecond).
 * ALGEBRAIC[19] is beta_X_to in component transient_outward_potassium_current_X_to_gate (per_millisecond).
 * ALGEBRAIC[20] is alpha_Y_to in component transient_outward_potassium_current_Y_to_gate (per_millisecond).
 * ALGEBRAIC[21] is beta_Y_to in component transient_outward_potassium_current_Y_to_gate (per_millisecond).
 * CONSTANTS[20] is g_Kp in component plateau_potassium_current (milliS_per_microF).
 * ALGEBRAIC[22] is Kp_V in component plateau_potassium_current_Kp_gate (dimensionless).
 * CONSTANTS[21] is i_NaK_max in component sodium_potassium_pump (microA_per_microF).
 * ALGEBRAIC[23] is f_NaK in component sodium_potassium_pump (dimensionless).
 * CONSTANTS[22] is K_mNai in component sodium_potassium_pump (millimolar).
 * CONSTANTS[23] is K_mKo in component sodium_potassium_pump (millimolar).
 * CONSTANTS[53] is sigma in component sodium_potassium_pump (dimensionless).
 * CONSTANTS[24] is K_mCa in component Na_Ca_exchanger (micromolar).
 * CONSTANTS[25] is K_mNa in component Na_Ca_exchanger (millimolar).
 * CONSTANTS[26] is K_NaCa in component Na_Ca_exchanger (microA_per_microF).
 * CONSTANTS[27] is K_sat in component Na_Ca_exchanger (dimensionless).
 * CONSTANTS[28] is eta in component Na_Ca_exchanger (dimensionless).
 * STATES[8] is Ca_i in component calcium_dynamics (micromolar).
 * CONSTANTS[29] is Ca_o in component standard_ionic_concentrations (micromolar).
 * CONSTANTS[30] is K_mpCa in component sarcolemmal_calcium_pump (micromolar).
 * CONSTANTS[31] is i_pCa_max in component sarcolemmal_calcium_pump (microA_per_microF).
 * CONSTANTS[32] is g_Cab in component calcium_background_current (milliS_per_microF).
 * ALGEBRAIC[27] is E_Ca in component calcium_background_current (millivolt).
 * CONSTANTS[33] is g_Nab in component sodium_background_current (milliS_per_microF).
 * CONSTANTS[34] is P_Ca in component L_type_Ca_current (cm_per_millisecond).
 * CONSTANTS[35] is P_CaK in component L_type_Ca_current (cm_per_millisecond).
 * CONSTANTS[36] is i_Ca_half in component L_type_Ca_current (microA_per_microF).
 * ALGEBRAIC[30] is i_Ca_max in component L_type_Ca_current (microA_per_microF).
 * CONSTANTS[37] is C_sc in component L_type_Ca_current (microF_per_cm2).
 * STATES[9] is f in component L_type_Ca_current_f_gate (dimensionless).
 * STATES[10] is d in component L_type_Ca_current_d_gate (dimensionless).
 * STATES[11] is f_Ca in component L_type_Ca_current_f_Ca_gate (dimensionless).
 * ALGEBRAIC[32] is f_infinity in component L_type_Ca_current_f_gate (dimensionless).
 * ALGEBRAIC[33] is tau_f in component L_type_Ca_current_f_gate (millisecond).
 * ALGEBRAIC[34] is d_infinity in component L_type_Ca_current_d_gate (dimensionless).
 * ALGEBRAIC[36] is tau_d in component L_type_Ca_current_d_gate (millisecond).
 * ALGEBRAIC[35] is E0_m in component L_type_Ca_current_d_gate (millivolt).
 * CONSTANTS[54] is tau_f_Ca in component L_type_Ca_current_f_Ca_gate (millisecond).
 * ALGEBRAIC[37] is f_Ca_infinity in component L_type_Ca_current_f_Ca_gate (dimensionless).
 * CONSTANTS[38] is K_mfCa in component L_type_Ca_current_f_Ca_gate (micromolar).
 * ALGEBRAIC[43] is beta_i in component calcium_dynamics (dimensionless).
 * CONSTANTS[39] is K_mCMDN in component calcium_dynamics (micromolar).
 * CONSTANTS[40] is CMDN_tot in component calcium_dynamics (micromolar).
 * CONSTANTS[41] is V_myo in component calcium_dynamics (microlitre).
 * CONSTANTS[42] is A_Cap in component calcium_dynamics (cm2).
 * ALGEBRAIC[40] is J_rel in component calcium_dynamics (micromolar_per_millisecond).
 * ALGEBRAIC[41] is J_leak in component calcium_dynamics (micromolar_per_millisecond).
 * ALGEBRAIC[38] is J_up in component calcium_dynamics (micromolar_per_millisecond).
 * STATES[12] is Ca_SR in component calcium_dynamics (micromolar).
 * CONSTANTS[43] is P_rel in component calcium_dynamics (per_millisecond).
 * CONSTANTS[44] is P_leak in component calcium_dynamics (per_millisecond).
 * CONSTANTS[45] is K_mCSQN in component calcium_dynamics (micromolar).
 * CONSTANTS[46] is CSQN_tot in component calcium_dynamics (micromolar).
 * CONSTANTS[47] is V_SR in component calcium_dynamics (microlitre).
 * CONSTANTS[48] is V_up in component calcium_dynamics (micromolar_per_millisecond).
 * CONSTANTS[49] is K_mup in component calcium_dynamics (micromolar).
 * ALGEBRAIC[39] is gamma in component calcium_dynamics (dimensionless).
 * ALGEBRAIC[42] is beta_SR in component calcium_dynamics (dimensionless).
 * RATES[0] is d/dt V in component membrane (millivolt).
 * RATES[1] is d/dt m in component fast_sodium_current_m_gate (dimensionless).
 * RATES[2] is d/dt h in component fast_sodium_current_h_gate (dimensionless).
 * RATES[3] is d/dt j in component fast_sodium_current_j_gate (dimensionless).
 * RATES[4] is d/dt X_kr in component rapid_activating_delayed_rectifiyer_K_current_X_kr_gate (dimensionless).
 * RATES[5] is d/dt X_ks in component slow_activating_delayed_rectifiyer_K_current_X_ks_gate (dimensionless).
 * RATES[6] is d/dt X_to in component transient_outward_potassium_current_X_to_gate (dimensionless).
 * RATES[7] is d/dt Y_to in component transient_outward_potassium_current_Y_to_gate (dimensionless).
 * RATES[9] is d/dt f in component L_type_Ca_current_f_gate (dimensionless).
 * RATES[10] is d/dt d in component L_type_Ca_current_d_gate (dimensionless).
 * RATES[11] is d/dt f_Ca in component L_type_Ca_current_f_Ca_gate (dimensionless).
 * RATES[12] is d/dt Ca_SR in component calcium_dynamics (micromolar).
 * RATES[8] is d/dt Ca_i in component calcium_dynamics (micromolar).
 * There are a total of 3 condition variables.
 */
void
initConsts(double* CONSTANTS, double* RATES, double *STATES)
{
STATES[0] = -94.7;
CONSTANTS[0] = 8.314;
CONSTANTS[1] = 310;
CONSTANTS[2] = 96.5;
CONSTANTS[3] = 50;
CONSTANTS[4] = 9000;
CONSTANTS[5] = 1000;
CONSTANTS[6] = 1;
CONSTANTS[7] = -80;
CONSTANTS[8] = 12.8;
CONSTANTS[9] = 138;
CONSTANTS[10] = 10;
STATES[1] = 0.00024676;
STATES[2] = 0.99869;
STATES[3] = 0.99887;
CONSTANTS[11] = 0;
CONSTANTS[12] = 0;
CONSTANTS[13] = 2.8;
CONSTANTS[14] = 13;
CONSTANTS[15] = 4;
CONSTANTS[16] = 0.0136;
CONSTANTS[17] = 149.4;
STATES[4] = 0.229;
CONSTANTS[18] = 0.0245;
STATES[5] = 0.0001;
CONSTANTS[19] = 0.23815;
STATES[6] = 0.00003742;
STATES[7] = 1;
CONSTANTS[20] = 0.002216;
CONSTANTS[21] = 0.693;
CONSTANTS[22] = 10;
CONSTANTS[23] = 1.5;
CONSTANTS[24] = 1380;
CONSTANTS[25] = 87.5;
CONSTANTS[26] = 1500;
CONSTANTS[27] = 0.2;
CONSTANTS[28] = 0.35;
STATES[8] = 0.0472;
CONSTANTS[29] = 2000;
CONSTANTS[30] = 0.05;
CONSTANTS[31] = 0.05;
CONSTANTS[32] = 0.0003842;
CONSTANTS[33] = 0.0031;
CONSTANTS[34] = 0.0000226;
CONSTANTS[35] = 0.000000579;
CONSTANTS[36] = -0.265;
CONSTANTS[37] = 1;
STATES[9] = 0.983;
STATES[10] = 0.0001;
STATES[11] = 0.942;
CONSTANTS[38] = 0.18;
CONSTANTS[39] = 2;
CONSTANTS[40] = 10;
CONSTANTS[41] = 0.00002584;
CONSTANTS[42] = 0.0001534;
STATES[12] = 320;
CONSTANTS[43] = 6;
CONSTANTS[44] = 0.000001;
CONSTANTS[45] = 600;
CONSTANTS[46] = 10000;
CONSTANTS[47] = 0.000002;
CONSTANTS[48] = 0.1;
CONSTANTS[49] = 0.32;
CONSTANTS[50] =  (( CONSTANTS[0]*CONSTANTS[1])/CONSTANTS[2])*log(CONSTANTS[9]/CONSTANTS[10]);
CONSTANTS[51] =  (( CONSTANTS[0]*CONSTANTS[1])/CONSTANTS[2])*log(CONSTANTS[15]/CONSTANTS[17]);
CONSTANTS[52] =  (( CONSTANTS[0]*CONSTANTS[1])/CONSTANTS[2])*log((CONSTANTS[15]+ 0.0183300*CONSTANTS[9])/(CONSTANTS[17]+ 0.0183300*CONSTANTS[10]));
CONSTANTS[53] =  (1.00000/7.00000)*(exp(CONSTANTS[9]/67.3000) - 1.00000);
CONSTANTS[54] = 30.0000;
RATES[0] = 0.1001;
RATES[1] = 0.1001;
RATES[2] = 0.1001;
RATES[3] = 0.1001;
RATES[4] = 0.1001;
RATES[5] = 0.1001;
RATES[6] = 0.1001;
RATES[7] = 0.1001;
RATES[9] = 0.1001;
RATES[10] = 0.1001;
RATES[11] = 0.1001;
RATES[12] = 0.1001;
RATES[8] = 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[1]+ALGEBRAIC[46]+ALGEBRAIC[31]+ALGEBRAIC[11]+ALGEBRAIC[14]+ALGEBRAIC[17]+ALGEBRAIC[44]+ALGEBRAIC[45]+ALGEBRAIC[25]+ALGEBRAIC[24]+ALGEBRAIC[26]+ALGEBRAIC[29]+ALGEBRAIC[28]+ALGEBRAIC[0]);
resid[1] = RATES[1] -  ALGEBRAIC[3]*(1.00000 - STATES[1]) -  ALGEBRAIC[4]*STATES[1];
resid[2] = RATES[2] -  ALGEBRAIC[5]*(1.00000 - STATES[2]) -  ALGEBRAIC[6]*STATES[2];
resid[3] = RATES[3] -  ALGEBRAIC[7]*(1.00000 - STATES[3]) -  ALGEBRAIC[8]*STATES[3];
resid[4] = RATES[4] - (ALGEBRAIC[12] - STATES[4])/ALGEBRAIC[13];
resid[5] = RATES[5] - (ALGEBRAIC[15] - STATES[5])/ALGEBRAIC[16];
resid[6] = RATES[6] -  ALGEBRAIC[18]*(1.00000 - STATES[6]) -  ALGEBRAIC[19]*STATES[6];
resid[7] = RATES[7] -  ALGEBRAIC[20]*(1.00000 - STATES[7]) -  ALGEBRAIC[21]*STATES[7];
resid[8] = RATES[9] - (ALGEBRAIC[32] - STATES[9])/ALGEBRAIC[33];
resid[9] = RATES[10] - (ALGEBRAIC[34] - STATES[10])/ALGEBRAIC[36];
resid[10] = RATES[11] - (ALGEBRAIC[37] - STATES[11])/CONSTANTS[54];
resid[11] = RATES[12] - ( ALGEBRAIC[42]*((ALGEBRAIC[38] - ALGEBRAIC[41]) - ALGEBRAIC[40])*CONSTANTS[41])/CONSTANTS[47];
resid[12] = RATES[8] -  ALGEBRAIC[43]*(((ALGEBRAIC[40]+ALGEBRAIC[41]) - ALGEBRAIC[38]) -  (( CONSTANTS[42]*CONSTANTS[37])/( 2.00000*CONSTANTS[2]*CONSTANTS[41]))*((ALGEBRAIC[46]+ALGEBRAIC[28]+ALGEBRAIC[26]) -  2.00000*ALGEBRAIC[25]));
}
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[7] : 0.00000);
ALGEBRAIC[1] =  CONSTANTS[8]*pow(STATES[1], 3.00000)*STATES[2]*STATES[3]*(STATES[0] - CONSTANTS[50]);
ALGEBRAIC[2] = STATES[0]+47.1300;
ALGEBRAIC[3] = ( 0.320000*ALGEBRAIC[2])/(1.00000 - exp( - 0.100000*ALGEBRAIC[2]));
ALGEBRAIC[4] =  0.0800000*exp(- STATES[0]/11.0000);
ALGEBRAIC[5] =  0.135000*exp(((STATES[0]+80.0000) - CONSTANTS[11])/- 6.80000);
ALGEBRAIC[6] = 7.50000/(1.00000+exp( - 0.100000*((STATES[0]+11.0000) - CONSTANTS[11])));
ALGEBRAIC[7] = ( 0.175000*exp(((STATES[0]+100.000) - CONSTANTS[12])/- 23.0000))/(1.00000+exp( 0.150000*((STATES[0]+79.0000) - CONSTANTS[12])));
ALGEBRAIC[8] = 0.300000/(1.00000+exp( - 0.100000*((STATES[0]+32.0000) - CONSTANTS[12])));
ALGEBRAIC[10] = 1.00000/(1.00000+ 2.50000*exp( 0.100000*(STATES[0]+28.0000)));
ALGEBRAIC[11] =  CONSTANTS[16]*ALGEBRAIC[10]*STATES[4]* pow((CONSTANTS[15]/4.00000), 1.0 / 2)*(STATES[0] - CONSTANTS[51]);
ALGEBRAIC[12] = 1.00000/(1.00000+exp(- 2.18200 -  0.181900*STATES[0]));
ALGEBRAIC[13] = 43.0000+1.00000/(exp(- 5.49500+ 0.169100*STATES[0])+exp(- 7.67700 -  0.0128000*STATES[0]));
ALGEBRAIC[14] =  CONSTANTS[18]*pow(STATES[5], 2.00000)*(STATES[0] - CONSTANTS[52]);
ALGEBRAIC[15] = 1.00000/(1.00000+exp((STATES[0] - 16.0000)/- 13.6000));
ALGEBRAIC[16] = 1.00000/(( 7.19000e-05*(STATES[0] - 10.0000))/(1.00000 - exp( - 0.148000*(STATES[0] - 10.0000)))+( 0.000131000*(STATES[0] - 10.0000))/(exp( 0.0687000*(STATES[0] - 10.0000)) - 1.00000));
ALGEBRAIC[17] =  CONSTANTS[19]*STATES[6]*STATES[7]*(STATES[0] - CONSTANTS[51]);
ALGEBRAIC[18] =  0.0451600*exp( 0.0357700*STATES[0]);
ALGEBRAIC[19] =  0.0989000*exp( - 0.0623700*STATES[0]);
ALGEBRAIC[20] = ( 0.00541500*exp((STATES[0]+33.5000)/- 5.00000))/(1.00000+ 0.0513350*exp((STATES[0]+33.5000)/- 5.00000));
ALGEBRAIC[21] = ( 0.00541500*exp((STATES[0]+33.5000)/5.00000))/(1.00000+ 0.0513350*exp((STATES[0]+33.5000)/5.00000));
ALGEBRAIC[23] = 1.00000/(1.00000+ 0.124500*exp(( - 0.100000*STATES[0]*CONSTANTS[2])/( CONSTANTS[0]*CONSTANTS[1]))+ 0.0365000*CONSTANTS[53]*exp(( - STATES[0]*CONSTANTS[2])/( CONSTANTS[0]*CONSTANTS[1])));
ALGEBRAIC[24] = ( (( CONSTANTS[21]*ALGEBRAIC[23])/(1.00000+pow(CONSTANTS[22]/CONSTANTS[10], 1.50000)))*CONSTANTS[15])/(CONSTANTS[15]+CONSTANTS[23]);
ALGEBRAIC[25] =  (CONSTANTS[26]/( (pow(CONSTANTS[25], 3.00000)+pow(CONSTANTS[9], 3.00000))*(CONSTANTS[24]+CONSTANTS[29])*(1.00000+ CONSTANTS[27]*exp(( (CONSTANTS[28] - 1.00000)*STATES[0]*CONSTANTS[2])/( CONSTANTS[0]*CONSTANTS[1])))))*( exp(( CONSTANTS[28]*STATES[0]*CONSTANTS[2])/( CONSTANTS[0]*CONSTANTS[1]))*pow(CONSTANTS[10], 3.00000)*CONSTANTS[29] -  exp(( (CONSTANTS[28] - 1.00000)*STATES[0]*CONSTANTS[2])/( CONSTANTS[0]*CONSTANTS[1]))*pow(CONSTANTS[9], 3.00000)*STATES[8]);
ALGEBRAIC[26] = ( CONSTANTS[31]*STATES[8])/(CONSTANTS[30]+STATES[8]);
ALGEBRAIC[27] =  (( CONSTANTS[0]*CONSTANTS[1])/( 2.00000*CONSTANTS[2]))*log(CONSTANTS[29]/STATES[8]);
ALGEBRAIC[28] =  CONSTANTS[32]*(STATES[0] - ALGEBRAIC[27]);
ALGEBRAIC[29] =  CONSTANTS[33]*(STATES[0] - CONSTANTS[50]);
ALGEBRAIC[30] = ( (( (CONSTANTS[34]/CONSTANTS[37])*4.00000*STATES[0]*pow(CONSTANTS[2], 2.00000))/( CONSTANTS[0]*CONSTANTS[1]))*( STATES[8]*exp(( 2.00000*STATES[0]*CONSTANTS[2])/( CONSTANTS[0]*CONSTANTS[1])) -  0.341000*CONSTANTS[29]))/(exp(( 2.00000*STATES[0]*CONSTANTS[2])/( CONSTANTS[0]*CONSTANTS[1])) - 1.00000);
ALGEBRAIC[31] = ( (( (( (CONSTANTS[35]/CONSTANTS[37])*STATES[9]*STATES[10]*STATES[11])/(1.00000+ALGEBRAIC[30]/CONSTANTS[36]))*1000.00*STATES[0]*pow(CONSTANTS[2], 2.00000))/( CONSTANTS[0]*CONSTANTS[1]))*( CONSTANTS[17]*exp(( STATES[0]*CONSTANTS[2])/( CONSTANTS[0]*CONSTANTS[1])) - CONSTANTS[15]))/(exp(( STATES[0]*CONSTANTS[2])/( CONSTANTS[0]*CONSTANTS[1])) - 1.00000);
ALGEBRAIC[32] = 1.00000/(1.00000+exp((STATES[0]+12.5000)/5.00000));
ALGEBRAIC[33] = 30.0000+200.000/(1.00000+exp((STATES[0]+20.0000)/9.50000));
ALGEBRAIC[34] = 1.00000/(1.00000+exp((STATES[0]+10.0000)/- 6.24000));
ALGEBRAIC[35] = STATES[0]+40.0000;
ALGEBRAIC[36] = 1.00000/(( 0.250000*exp( - 0.0100000*STATES[0]))/(1.00000+exp( - 0.0700000*STATES[0]))+( 0.0700000*exp( - 0.0500000*ALGEBRAIC[35]))/(1.00000+exp( 0.0500000*ALGEBRAIC[35])));
ALGEBRAIC[37] = 1.00000/(1.00000+pow(STATES[8]/CONSTANTS[38], 3.00000));
ALGEBRAIC[38] = CONSTANTS[48]/(1.00000+pow(CONSTANTS[49]/STATES[8], 2.00000));
ALGEBRAIC[39] = 1.00000/(1.00000+pow(2000.00/STATES[12], 3.00000));
ALGEBRAIC[40] = ( CONSTANTS[43]*STATES[9]*STATES[10]*STATES[11]*( ALGEBRAIC[39]*STATES[12] - STATES[8]))/(1.00000+ 1.65000*exp(STATES[0]/20.0000));
ALGEBRAIC[41] =  CONSTANTS[44]*(STATES[12] - STATES[8]);
ALGEBRAIC[42] = 1.00000/(1.00000+( CONSTANTS[46]*CONSTANTS[45])/pow(CONSTANTS[45]+STATES[12], 2.00000));
ALGEBRAIC[43] = 1.00000/(1.00000+( CONSTANTS[40]*CONSTANTS[39])/pow(CONSTANTS[39]+STATES[8], 2.00000));
ALGEBRAIC[9] = 1.00000/(2.00000+exp( (( 1.62000*CONSTANTS[2])/( CONSTANTS[0]*CONSTANTS[1]))*(STATES[0] - CONSTANTS[51])));
ALGEBRAIC[44] =  (( CONSTANTS[13]*ALGEBRAIC[9]*CONSTANTS[15])/(CONSTANTS[15]+CONSTANTS[14]))*(STATES[0] - CONSTANTS[51]);
ALGEBRAIC[22] = 1.00000/(1.00000+exp((7.48800 - STATES[0])/5.98000));
ALGEBRAIC[45] =  CONSTANTS[20]*ALGEBRAIC[22]*(STATES[0] - CONSTANTS[51]);
ALGEBRAIC[46] =  ALGEBRAIC[30]*STATES[9]*STATES[10]*STATES[11];
}
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;
}
void
computeRoots(double VOI, double* CONSTANTS, double* RATES, double* OLDRATES, double* STATES,
             double* OLDSTATES, double* ALGEBRAIC, double* CONDVARS)
{
CONDVAR[0] = VOI - CONSTANTS[3];
CONDVAR[1] = VOI - CONSTANTS[4];
CONDVAR[2] = ((VOI - CONSTANTS[3]) -  floor((VOI - CONSTANTS[3])/CONSTANTS[5])*CONSTANTS[5]) - CONSTANTS[6];
}