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 35 entries in the algebraic variable array.
   There are a total of 16 entries in each of the rate and state variable arrays.
   There are a total of 134 entries in the constant variable array.
 */
/*
 * VOI is time in component environment (second).
 * STATES[0] is ADP_m in component ADP_m (millimolar).
 * ALGEBRAIC[25] is V_ANT in component calcium_dynamics (flux).
 * ALGEBRAIC[31] is V_ATPase in component oxidative_phosphorylation (flux).
 * ALGEBRAIC[10] is V_SL in component V_SL (flux).
 * STATES[1] is NADH in component NADH (millimolar).
 * ALGEBRAIC[27] is V_O2 in component oxidative_phosphorylation (flux).
 * ALGEBRAIC[8] is V_IDH in component V_IDH (flux).
 * ALGEBRAIC[9] is V_KGDH in component V_KGDH (flux).
 * ALGEBRAIC[12] is V_MDH in component V_MDH (flux).
 * STATES[2] is ISOC in component ISOC (millimolar).
 * ALGEBRAIC[7] is V_ACO in component V_ACO (flux).
 * STATES[3] is alpha_KG in component alpha_KG (millimolar).
 * ALGEBRAIC[14] is V_AAT in component V_AAT (flux).
 * STATES[4] is SCoA in component SCoA (millimolar).
 * STATES[5] is Suc in component Suc (millimolar).
 * ALGEBRAIC[11] is V_SDH in component V_SDH (flux).
 * STATES[6] is FUM in component FUM (millimolar).
 * ALGEBRAIC[13] is V_FH in component V_FH (flux).
 * STATES[7] is MAL in component MAL (millimolar).
 * STATES[8] is OAA in component OAA (millimolar).
 * ALGEBRAIC[6] is V_CS in component V_CS (flux).
 * STATES[9] is ASP in component ASP (millimolar).
 * ALGEBRAIC[15] is V_C_ASP in component V_C_ASP (flux).
 * STATES[10] is Ca_m in component Ca_m (micromolar).
 * CONSTANTS[0] is f in component Ca_m (dimensionless).
 * ALGEBRAIC[33] is V_uni in component calcium_dynamics (flux).
 * ALGEBRAIC[34] is V_NaCa in component calcium_dynamics (flux).
 * ALGEBRAIC[26] is Ca_i in component Ca_i (micromolar).
 * CONSTANTS[1] is stim_start in component Ca_i (second).
 * CONSTANTS[2] is stim_end in component Ca_i (second).
 * ALGEBRAIC[0] is stim_period in component Ca_i (second).
 * CONSTANTS[3] is stim_duration in component Ca_i (second).
 * CONSTANTS[4] is pulse_value in component Ca_i (micromolar).
 * CONSTANTS[5] is Na_i in component Na_i (millimolar).
 * CONSTANTS[6] is ATP_i in component ATP_i (millimolar).
 * ALGEBRAIC[1] is ATP_m in component ATP_m (millimolar).
 * CONSTANTS[7] is Cm in component ATP_m (millimolar).
 * ALGEBRAIC[2] is ADP_i in component ADP_i (millimolar).
 * CONSTANTS[8] is pulse_value in component ADP_i (millimolar).
 * CONSTANTS[9] is GLU in component GLU (millimolar).
 * CONSTANTS[10] is Mg in component Mg (millimolar).
 * CONSTANTS[11] is H in component H (millimolar).
 * CONSTANTS[12] is Pi in component Pi (millimolar).
 * CONSTANTS[13] is CoA in component CoA (millimolar).
 * CONSTANTS[14] is AcCoA in component AcCoA (millimolar).
 * CONSTANTS[15] is FAD in component FAD (millimolar).
 * CONSTANTS[16] is FADH2 in component FADH2 (millimolar).
 * ALGEBRAIC[3] is NAD in component NAD (millimolar).
 * CONSTANTS[17] is C_PN in component NAD (millimolar).
 * CONSTANTS[18] is NADPH in component NADPH (millimolar).
 * STATES[11] is O2_m in component O2_m (millimolar).
 * CONSTANTS[19] is shunt in component O2_m (dimensionless).
 * ALGEBRAIC[21] is VTr_ROS in component VTr_ROS (flux).
 * STATES[12] is O2_i in component O2_i (millimolar).
 * ALGEBRAIC[16] is V_SOD in component V_SOD (flux).
 * STATES[13] is H2O2 in component H2O2 (millimolar).
 * ALGEBRAIC[17] is V_CAT in component V_CAT (flux).
 * ALGEBRAIC[18] is V_GPX in component V_GPX (flux).
 * STATES[14] is GSH in component GSH (millimolar).
 * ALGEBRAIC[19] is V_GR in component V_GR (flux).
 * ALGEBRAIC[4] is GSSG in component GSSG (millimolar).
 * CONSTANTS[20] is GT in component GSSG (millimolar).
 * ALGEBRAIC[5] is CIT in component CIT (millimolar).
 * CONSTANTS[21] is C_Kint in component CIT (millimolar).
 * STATES[15] is delta_psi_m in component mitochondrial_membrane (volt).
 * CONSTANTS[22] is R in component mitochondrial_membrane (volt_coulomb_per_mole_kelvin).
 * CONSTANTS[23] is T in component mitochondrial_membrane (kelvin).
 * CONSTANTS[24] is F in component mitochondrial_membrane (coulomb_per_mole).
 * CONSTANTS[25] is C_mito in component mitochondrial_membrane (millimolar_per_volt).
 * ALGEBRAIC[28] is V_He in component oxidative_phosphorylation (flux).
 * ALGEBRAIC[29] is V_He_F in component oxidative_phosphorylation (flux).
 * ALGEBRAIC[32] is V_Hu in component oxidative_phosphorylation (flux).
 * ALGEBRAIC[30] is V_Hleak in component oxidative_phosphorylation (flux).
 * CONSTANTS[26] is Km_AcCoA in component V_CS (millimolar).
 * CONSTANTS[27] is Km_OAA in component V_CS (millimolar).
 * CONSTANTS[28] is Kcat_CS in component V_CS (first_order_rate_constant).
 * CONSTANTS[29] is ET_CS in component V_CS (millimolar).
 * CONSTANTS[30] is Kf_ACO in component V_ACO (first_order_rate_constant).
 * CONSTANTS[31] is KE_ACO in component V_ACO (dimensionless).
 * CONSTANTS[32] is Kh_1 in component V_IDH (millimolar).
 * CONSTANTS[33] is Kh_2 in component V_IDH (millimolar).
 * CONSTANTS[34] is Km_ISOC in component V_IDH (millimolar).
 * CONSTANTS[35] is Ka_ADP in component V_IDH (millimolar).
 * CONSTANTS[36] is Ka_Ca in component V_IDH (micromolar).
 * CONSTANTS[37] is Km_NAD in component V_IDH (millimolar).
 * CONSTANTS[38] is Ki_NADH in component V_IDH (millimolar).
 * CONSTANTS[39] is Kcat_IDH in component V_IDH (first_order_rate_constant).
 * CONSTANTS[40] is ET_IDH in component V_IDH (millimolar).
 * CONSTANTS[41] is ni in component V_IDH (dimensionless).
 * CONSTANTS[42] is Km_alpha_KG in component V_KGDH (millimolar).
 * CONSTANTS[43] is Kcat_KGDH in component V_KGDH (first_order_rate_constant).
 * CONSTANTS[44] is ET_KGDH in component V_KGDH (millimolar).
 * CONSTANTS[45] is Kd_Mg in component V_KGDH (millimolar).
 * CONSTANTS[46] is Kd_Ca in component V_KGDH (micromolar).
 * CONSTANTS[47] is n_alpha_KG in component V_KGDH (dimensionless).
 * CONSTANTS[48] is Km_NAD in component V_KGDH (millimolar).
 * CONSTANTS[49] is kf_SL in component V_SL (second_order_rate_constant).
 * CONSTANTS[50] is Ke_SL in component V_SL (millimolar).
 * CONSTANTS[51] is Kisdh_OAA in component V_SDH (millimolar).
 * CONSTANTS[52] is Kcat_SDH in component V_SDH (first_order_rate_constant).
 * CONSTANTS[53] is ET_SDH in component V_SDH (millimolar).
 * CONSTANTS[54] is Km_Suc in component V_SDH (millimolar).
 * CONSTANTS[55] is Ki_FUM in component V_SDH (millimolar).
 * CONSTANTS[56] is Km_MAL in component V_MDH (millimolar).
 * CONSTANTS[57] is Kcat_MDH in component V_MDH (first_order_rate_constant).
 * CONSTANTS[58] is ET_MDH in component V_MDH (millimolar).
 * CONSTANTS[59] is Ki_OAA in component V_MDH (millimolar).
 * CONSTANTS[132] is fh_a in component V_MDH (dimensionless).
 * CONSTANTS[133] is fh_i in component V_MDH (dimensionless).
 * CONSTANTS[60] is Km_NAD in component V_MDH (millimolar).
 * CONSTANTS[61] is kh1 in component V_MDH (millimolar).
 * CONSTANTS[62] is kh2 in component V_MDH (millimolar).
 * CONSTANTS[63] is kh3 in component V_MDH (millimolar).
 * CONSTANTS[64] is kh4 in component V_MDH (millimolar).
 * CONSTANTS[65] is k_offset in component V_MDH (dimensionless).
 * CONSTANTS[66] is Ke_FH in component V_FH (dimensionless).
 * CONSTANTS[67] is kf_FH in component V_FH (first_order_rate_constant).
 * CONSTANTS[68] is Ke_AAT in component V_AAT (dimensionless).
 * CONSTANTS[69] is kf_AAT in component V_AAT (second_order_rate_constant).
 * CONSTANTS[70] is k_C_ASP in component V_C_ASP (first_order_rate_constant).
 * CONSTANTS[71] is k1_SOD in component V_SOD (second_order_rate_constant).
 * CONSTANTS[72] is k3_SOD in component V_SOD (second_order_rate_constant).
 * CONSTANTS[73] is k5_SOD in component V_SOD (first_order_rate_constant).
 * CONSTANTS[74] is ET_SOD in component V_SOD (millimolar).
 * CONSTANTS[75] is Ki_H2O2 in component V_SOD (millimolar).
 * CONSTANTS[76] is k1_CAT in component V_CAT (second_order_rate_constant).
 * CONSTANTS[77] is ET_CAT in component V_CAT (millimolar).
 * CONSTANTS[78] is fr in component V_CAT (per_millimolar).
 * CONSTANTS[79] is phi1_GPX in component V_GPX (millimolar_second).
 * CONSTANTS[80] is phi2_GPX in component V_GPX (millimolar_second).
 * CONSTANTS[81] is ET_GPX in component V_GPX (millimolar).
 * CONSTANTS[82] is k1_GR in component V_GR (first_order_rate_constant).
 * CONSTANTS[83] is KM_GSSG in component V_GR (millimolar).
 * CONSTANTS[84] is KM_NADPH in component V_GR (millimolar).
 * CONSTANTS[85] is ET_GR in component V_GR (millimolar).
 * ALGEBRAIC[20] is V_IMAC in component V_IMAC (flux).
 * CONSTANTS[86] is Gmax in component V_IMAC (millimolar_per_second_volt).
 * CONSTANTS[87] is GL in component V_IMAC (millimolar_per_second_volt).
 * CONSTANTS[88] is a in component V_IMAC (dimensionless).
 * CONSTANTS[89] is b in component V_IMAC (dimensionless).
 * CONSTANTS[90] is kappa in component V_IMAC (per_volt).
 * CONSTANTS[91] is delta_psi_bm in component V_IMAC (volt).
 * CONSTANTS[92] is Kcc in component V_IMAC (millimolar).
 * CONSTANTS[93] is j in component VTr_ROS (dimensionless).
 * CONSTANTS[94] is rho_res in component oxidative_phosphorylation (millimolar).
 * CONSTANTS[95] is rho_res_F in component oxidative_phosphorylation (millimolar).
 * CONSTANTS[96] is ra in component oxidative_phosphorylation (first_order_rate_constant).
 * CONSTANTS[97] is rc1 in component oxidative_phosphorylation (first_order_rate_constant).
 * ALGEBRAIC[22] is Ares in component oxidative_phosphorylation (volt).
 * CONSTANTS[131] is Ares_F in component oxidative_phosphorylation (volt).
 * CONSTANTS[98] is r1 in component oxidative_phosphorylation (dimensionless).
 * CONSTANTS[99] is r2 in component oxidative_phosphorylation (dimensionless).
 * CONSTANTS[100] is r3 in component oxidative_phosphorylation (dimensionless).
 * CONSTANTS[101] is rb in component oxidative_phosphorylation (first_order_rate_constant).
 * CONSTANTS[102] is rc2 in component oxidative_phosphorylation (first_order_rate_constant).
 * CONSTANTS[103] is Kres in component oxidative_phosphorylation (dimensionless).
 * CONSTANTS[104] is Kres_F in component oxidative_phosphorylation (dimensionless).
 * CONSTANTS[105] is gH in component oxidative_phosphorylation (millimolar_per_second_volt).
 * CONSTANTS[106] is delta_psi_B in component oxidative_phosphorylation (volt).
 * CONSTANTS[107] is g in component oxidative_phosphorylation (dimensionless).
 * ALGEBRAIC[23] is delta_mu_H in component oxidative_phosphorylation (volt).
 * CONSTANTS[108] is delta_pH in component oxidative_phosphorylation (dimensionless).
 * CONSTANTS[109] is rho_F1 in component oxidative_phosphorylation (millimolar).
 * CONSTANTS[110] is pa in component oxidative_phosphorylation (first_order_rate_constant).
 * CONSTANTS[111] is pc1 in component oxidative_phosphorylation (first_order_rate_constant).
 * ALGEBRAIC[24] is AF1 in component oxidative_phosphorylation (volt).
 * CONSTANTS[112] is p1 in component oxidative_phosphorylation (dimensionless).
 * CONSTANTS[113] is p2 in component oxidative_phosphorylation (dimensionless).
 * CONSTANTS[114] is p3 in component oxidative_phosphorylation (dimensionless).
 * CONSTANTS[115] is pb in component oxidative_phosphorylation (first_order_rate_constant).
 * CONSTANTS[116] is pc2 in component oxidative_phosphorylation (first_order_rate_constant).
 * CONSTANTS[117] is KF1 in component oxidative_phosphorylation (millimolar).
 * CONSTANTS[118] is h in component calcium_dynamics (dimensionless).
 * CONSTANTS[119] is delta_psi_0 in component calcium_dynamics (volt).
 * CONSTANTS[120] is Vmax_ANT in component calcium_dynamics (flux).
 * CONSTANTS[121] is L in component calcium_dynamics (dimensionless).
 * CONSTANTS[122] is na in component calcium_dynamics (dimensionless).
 * CONSTANTS[123] is Vmax_uni in component calcium_dynamics (flux).
 * CONSTANTS[124] is K_act in component calcium_dynamics (micromolar).
 * CONSTANTS[125] is K_trans in component calcium_dynamics (micromolar).
 * CONSTANTS[126] is n in component calcium_dynamics (dimensionless).
 * CONSTANTS[127] is Vmax_NaCa in component calcium_dynamics (flux).
 * CONSTANTS[128] is KNa in component calcium_dynamics (millimolar).
 * CONSTANTS[129] is KCa in component calcium_dynamics (micromolar).
 * CONSTANTS[130] is b in component calcium_dynamics (dimensionless).
 * RATES[0] is d/dt ADP_m in component ADP_m (millimolar).
 * RATES[1] is d/dt NADH in component NADH (millimolar).
 * RATES[2] is d/dt ISOC in component ISOC (millimolar).
 * RATES[3] is d/dt alpha_KG in component alpha_KG (millimolar).
 * RATES[4] is d/dt SCoA in component SCoA (millimolar).
 * RATES[5] is d/dt Suc in component Suc (millimolar).
 * RATES[6] is d/dt FUM in component FUM (millimolar).
 * RATES[7] is d/dt MAL in component MAL (millimolar).
 * RATES[8] is d/dt OAA in component OAA (millimolar).
 * RATES[9] is d/dt ASP in component ASP (millimolar).
 * RATES[10] is d/dt Ca_m in component Ca_m (micromolar).
 * RATES[11] is d/dt O2_m in component O2_m (millimolar).
 * RATES[12] is d/dt O2_i in component O2_i (millimolar).
 * RATES[13] is d/dt H2O2 in component H2O2 (millimolar).
 * RATES[14] is d/dt GSH in component GSH (millimolar).
 * RATES[15] is d/dt delta_psi_m in component mitochondrial_membrane (volt).
 * There are a total of 7 condition variables.
 */
void
initConsts(double* CONSTANTS, double* RATES, double *STATES)
{
STATES[0] = 0.1;
STATES[1] = 0.01;
STATES[2] = 0.01;
STATES[3] = 0.01;
STATES[4] = 0.01;
STATES[5] = 0.01;
STATES[6] = 0.01;
STATES[7] = 0.01;
STATES[8] = 0.01;
STATES[9] = 0.01;
STATES[10] = 0.01;
CONSTANTS[0] = 0.0003;
CONSTANTS[1] = 0;
CONSTANTS[2] = 10000;
CONSTANTS[3] = 0.4;
CONSTANTS[4] = 1;
CONSTANTS[5] = 10.0;
CONSTANTS[6] = 6.5;
CONSTANTS[7] = 15.0;
CONSTANTS[8] = 0.15;
CONSTANTS[9] = 20;
CONSTANTS[10] = 0.4;
CONSTANTS[11] = 2.5E-5;
CONSTANTS[12] = 20.0;
CONSTANTS[13] = 0.02;
CONSTANTS[14] = 0.0002;
CONSTANTS[15] = 0.01;
CONSTANTS[16] = 1.24;
CONSTANTS[17] = 10.0;
CONSTANTS[18] = 1.0;
STATES[11] = 0.01;
CONSTANTS[19] = 0.05;
STATES[12] = 0.01;
STATES[13] = 0.01;
STATES[14] = 0.01;
CONSTANTS[20] = 1.0;
CONSTANTS[21] = 1.0;
STATES[15] = 0.01;
CONSTANTS[22] = 8.315;
CONSTANTS[23] = 310.16;
CONSTANTS[24] = 96480;
CONSTANTS[25] = 1.812;
CONSTANTS[26] = 1.26E-2;
CONSTANTS[27] = 6.4E-4;
CONSTANTS[28] = 3.2;
CONSTANTS[29] = 0.4;
CONSTANTS[30] = 12.5;
CONSTANTS[31] = 2.22;
CONSTANTS[32] = 8.1E-5;
CONSTANTS[33] = 5.98E-5;
CONSTANTS[34] = 1.52;
CONSTANTS[35] = 6.2E-2;
CONSTANTS[36] = 1.41;
CONSTANTS[37] = 0.923;
CONSTANTS[38] = 0.19;
CONSTANTS[39] = 1.94;
CONSTANTS[40] = 0.109;
CONSTANTS[41] = 1;
CONSTANTS[42] = 1.94;
CONSTANTS[43] = 0.15;
CONSTANTS[44] = 0.5;
CONSTANTS[45] = 0.0308;
CONSTANTS[46] = 1.27;
CONSTANTS[47] = 1.2;
CONSTANTS[48] = 38.7;
CONSTANTS[49] = 0.127;
CONSTANTS[50] = 3.115;
CONSTANTS[51] = 0.15;
CONSTANTS[52] = 1.0;
CONSTANTS[53] = 0.5;
CONSTANTS[54] = 3.0E-2;
CONSTANTS[55] = 1.3;
CONSTANTS[56] = 1.493;
CONSTANTS[57] = 2.775E1;
CONSTANTS[58] = 0.154;
CONSTANTS[59] = 3.1E-3;
CONSTANTS[60] = 0.2244;
CONSTANTS[61] = 1.13E-5;
CONSTANTS[62] = 26.7;
CONSTANTS[63] = 6.68E-9;
CONSTANTS[64] = 5.62E-6;
CONSTANTS[65] = 3.99E-2;
CONSTANTS[66] = 1.0;
CONSTANTS[67] = 0.83;
CONSTANTS[68] = 6.6;
CONSTANTS[69] = 0.644;
CONSTANTS[70] = 0.01;
CONSTANTS[71] = 2.4E6;
CONSTANTS[72] = 4.8E4;
CONSTANTS[73] = 5.0E-1;
CONSTANTS[74] = 0.4E-3;
CONSTANTS[75] = 0.5;
CONSTANTS[76] = 1.7E4;
CONSTANTS[77] = 0.001;
CONSTANTS[78] = 50.0;
CONSTANTS[79] = 0.15;
CONSTANTS[80] = 0.5;
CONSTANTS[81] = 0.00141;
CONSTANTS[82] = 0.0308;
CONSTANTS[83] = 1.94;
CONSTANTS[84] = 38.7;
CONSTANTS[85] = 1.27E-3;
CONSTANTS[86] = 7.82;
CONSTANTS[87] = 0.0782;
CONSTANTS[88] = 1.0E-3;
CONSTANTS[89] = 1.0E4;
CONSTANTS[90] = 70.0;
CONSTANTS[91] = 0.004;
CONSTANTS[92] = 0.01;
CONSTANTS[93] = 0.12;
CONSTANTS[94] = 0.0006;
CONSTANTS[95] = 0.0045;
CONSTANTS[96] = 6.394E-10;
CONSTANTS[97] = 2.656E-19;
CONSTANTS[98] = 2.077E-18;
CONSTANTS[99] = 1.728E-9;
CONSTANTS[100] = 1.059E-26;
CONSTANTS[101] = 1.762E-13;
CONSTANTS[102] = 8.632E-27;
CONSTANTS[103] = 1.35E18;
CONSTANTS[104] = 5.765E13;
CONSTANTS[105] = 0.01;
CONSTANTS[106] = 0.05;
CONSTANTS[107] = 0.85;
CONSTANTS[108] = -0.6;
CONSTANTS[109] = 0.06;
CONSTANTS[110] = 1.656E-5;
CONSTANTS[111] = 9.651E-14;
CONSTANTS[112] = 1.346E-8;
CONSTANTS[113] = 7.739E-7;
CONSTANTS[114] = 6.65E-15;
CONSTANTS[115] = 3.373E-7;
CONSTANTS[116] = 4.585E-14;
CONSTANTS[117] = 1.71E6;
CONSTANTS[118] = 0.5;
CONSTANTS[119] = 0.091;
CONSTANTS[120] = 0.05;
CONSTANTS[121] = 110.0;
CONSTANTS[122] = 2.8;
CONSTANTS[123] = 0.000625;
CONSTANTS[124] = 0.38;
CONSTANTS[125] = 19.0;
CONSTANTS[126] = 3.0;
CONSTANTS[127] = 0.005;
CONSTANTS[128] = 9.4;
CONSTANTS[129] = 3.75E-1;
CONSTANTS[130] = 0.5;
CONSTANTS[131] =  (( CONSTANTS[22]*CONSTANTS[23])/CONSTANTS[24])*log( CONSTANTS[104]*pow(CONSTANTS[16]/CONSTANTS[15], 0.500000));
CONSTANTS[132] = 1.00000/(1.00000+CONSTANTS[11]/CONSTANTS[61]+pow(CONSTANTS[11], 2.00000)/( CONSTANTS[61]*CONSTANTS[62]))+CONSTANTS[65];
CONSTANTS[133] = pow(1.00000/(1.00000+CONSTANTS[63]/CONSTANTS[11]+( CONSTANTS[63]*CONSTANTS[64])/pow(CONSTANTS[11], 2.00000)), 2.00000);
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[8] = 0.1001;
RATES[9] = 0.1001;
RATES[10] = 0.1001;
RATES[11] = 0.1001;
RATES[12] = 0.1001;
RATES[13] = 0.1001;
RATES[14] = 0.1001;
RATES[15] = 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[25] - (ALGEBRAIC[31]+ALGEBRAIC[10]);
resid[1] = RATES[1] - - ALGEBRAIC[27]+ALGEBRAIC[8]+ALGEBRAIC[9]+ALGEBRAIC[12];
resid[2] = RATES[2] - ALGEBRAIC[7] - ALGEBRAIC[8];
resid[3] = RATES[3] - ALGEBRAIC[14]+ALGEBRAIC[8]+- ALGEBRAIC[9];
resid[4] = RATES[4] - ALGEBRAIC[9] - ALGEBRAIC[10];
resid[5] = RATES[5] - ALGEBRAIC[10] - ALGEBRAIC[11];
resid[6] = RATES[6] - ALGEBRAIC[11] - ALGEBRAIC[13];
resid[7] = RATES[7] - ALGEBRAIC[13] - ALGEBRAIC[12];
resid[8] = RATES[8] - ALGEBRAIC[12] - (ALGEBRAIC[6]+ALGEBRAIC[14]);
resid[9] = RATES[9] - ALGEBRAIC[14] - ALGEBRAIC[15];
resid[10] = RATES[10] -  CONSTANTS[0]*1.00000*(ALGEBRAIC[33] - ALGEBRAIC[34]);
resid[11] = RATES[11] -  CONSTANTS[19]*ALGEBRAIC[27] - ALGEBRAIC[21];
resid[12] = RATES[12] - ALGEBRAIC[21] - ALGEBRAIC[16];
resid[13] = RATES[13] - ALGEBRAIC[16] - (ALGEBRAIC[17]+ALGEBRAIC[18]);
resid[14] = RATES[14] - ALGEBRAIC[19] - ALGEBRAIC[18];
resid[15] = RATES[15] - (ALGEBRAIC[28]+ALGEBRAIC[29]+- (ALGEBRAIC[32]+ALGEBRAIC[25]+ALGEBRAIC[30]+ALGEBRAIC[34]+ 2.00000*ALGEBRAIC[33]))/CONSTANTS[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[6] = ( CONSTANTS[28]*CONSTANTS[29])/(1.00000+CONSTANTS[26]/CONSTANTS[14]+CONSTANTS[27]/STATES[8]+ (CONSTANTS[26]/CONSTANTS[14])*(CONSTANTS[27]/STATES[8]));
ALGEBRAIC[5] = CONSTANTS[21] - (STATES[2]+STATES[3]+STATES[4]+STATES[5]+STATES[6]+STATES[7]+STATES[8]);
ALGEBRAIC[7] =  CONSTANTS[30]*(ALGEBRAIC[5] - STATES[2]/CONSTANTS[31]);
ALGEBRAIC[3] = CONSTANTS[17] - STATES[1];
ALGEBRAIC[8] = ( CONSTANTS[39]*CONSTANTS[40])/(1.00000+CONSTANTS[11]/CONSTANTS[32]+CONSTANTS[33]/CONSTANTS[11]+pow(CONSTANTS[34]/STATES[2], CONSTANTS[41])/( (1.00000+STATES[0]/CONSTANTS[35])*(1.00000+STATES[10]/CONSTANTS[36]))+ (CONSTANTS[37]/ALGEBRAIC[3])*(1.00000+STATES[1]/CONSTANTS[38])+( pow(CONSTANTS[34]/STATES[2], CONSTANTS[41])*(CONSTANTS[37]/ALGEBRAIC[3])*(1.00000+STATES[1]/CONSTANTS[38]))/( (1.00000+STATES[0]/CONSTANTS[35])*(1.00000+STATES[10]/CONSTANTS[36])));
ALGEBRAIC[9] = ( CONSTANTS[43]*CONSTANTS[44])/(1.00000+pow(CONSTANTS[42]/STATES[3], CONSTANTS[47])/( (1.00000+CONSTANTS[10]/CONSTANTS[45])*(1.00000+STATES[10]/CONSTANTS[46]))+(CONSTANTS[48]/ALGEBRAIC[3])/( (1.00000+CONSTANTS[10]/CONSTANTS[45])*(1.00000+STATES[10]/CONSTANTS[46])));
ALGEBRAIC[1] = CONSTANTS[7] - STATES[0];
ALGEBRAIC[10] =  CONSTANTS[49]*( STATES[4]*STATES[0] - ( STATES[5]*ALGEBRAIC[1]*CONSTANTS[13])/CONSTANTS[50]);
ALGEBRAIC[11] = ( CONSTANTS[52]*CONSTANTS[53])/(1.00000+ (CONSTANTS[54]/STATES[5])*(1.00000+STATES[8]/CONSTANTS[51])*(1.00000+STATES[6]/CONSTANTS[55]));
ALGEBRAIC[12] = ( CONSTANTS[57]*CONSTANTS[58]*CONSTANTS[132]*CONSTANTS[133])/(1.00000+ (CONSTANTS[56]/STATES[7])*(1.00000+STATES[8]/CONSTANTS[59])+CONSTANTS[60]/ALGEBRAIC[3]+ (CONSTANTS[56]/STATES[7])*(1.00000+STATES[8]/CONSTANTS[59])*(CONSTANTS[60]/ALGEBRAIC[3]));
ALGEBRAIC[13] =  CONSTANTS[67]*(STATES[6] - STATES[7]/CONSTANTS[66]);
ALGEBRAIC[14] =  CONSTANTS[69]*( STATES[8]*CONSTANTS[9] - ( STATES[3]*STATES[9])/CONSTANTS[68]);
ALGEBRAIC[15] =  CONSTANTS[70]*STATES[9];
ALGEBRAIC[16] = ( 2.00000*CONSTANTS[71]*CONSTANTS[73]*(CONSTANTS[71]+ CONSTANTS[72]*(1.00000+STATES[13]/CONSTANTS[75]))*CONSTANTS[74]*STATES[12])/( CONSTANTS[73]*( 2.00000*CONSTANTS[71]+ CONSTANTS[72]*(1.00000+STATES[13]/CONSTANTS[75]))+ STATES[12]*CONSTANTS[71]*CONSTANTS[72]*(1.00000+STATES[13]/CONSTANTS[75]));
ALGEBRAIC[17] =  2.00000*CONSTANTS[76]*CONSTANTS[77]*STATES[13]*exp( - CONSTANTS[78]*STATES[13]);
ALGEBRAIC[18] = ( CONSTANTS[81]*STATES[13]*STATES[14])/( CONSTANTS[79]*STATES[14]+ CONSTANTS[80]*STATES[13]);
ALGEBRAIC[4] =  2.00000*(CONSTANTS[20] - STATES[14]);
ALGEBRAIC[19] = ( CONSTANTS[82]*CONSTANTS[85])/(1.00000+CONSTANTS[83]/ALGEBRAIC[4]+CONSTANTS[84]/CONSTANTS[18]+ (CONSTANTS[83]/ALGEBRAIC[4])*(CONSTANTS[84]/CONSTANTS[18]));
ALGEBRAIC[20] =  (CONSTANTS[88]+CONSTANTS[89]/(1.00000+CONSTANTS[92]/STATES[12]))*(CONSTANTS[87]+CONSTANTS[86]/(1.00000+exp( CONSTANTS[90]*(CONSTANTS[91] - STATES[15]))))*STATES[15];
ALGEBRAIC[21] =  CONSTANTS[93]*(ALGEBRAIC[20]/STATES[15])*(STATES[15] -  (( CONSTANTS[22]*CONSTANTS[23])/CONSTANTS[24])*arbitrary_log(STATES[11]/STATES[12], 10));
ALGEBRAIC[2] = (CONDVAR[5]>=0.00000&&CONDVAR[6]<0.00000 ? CONSTANTS[8] : 0.0500000);
ALGEBRAIC[25] =  CONSTANTS[120]*((1.00000 - ( 0.0500000*CONSTANTS[6]*0.450000*0.800000*STATES[0])/( 0.450000*ALGEBRAIC[2]*0.0500000*ALGEBRAIC[1]))/( (1.00000+ (( 0.0500000*CONSTANTS[6])/( 0.450000*ALGEBRAIC[2]))*exp(( - CONSTANTS[118]*CONSTANTS[24]*CONSTANTS[119])/( CONSTANTS[22]*CONSTANTS[23])))*(1.00000+( 0.450000*0.800000*STATES[0])/( 0.0500000*ALGEBRAIC[1]))));
ALGEBRAIC[22] =  (( CONSTANTS[22]*CONSTANTS[23])/CONSTANTS[24])*log( CONSTANTS[103]*pow(STATES[1]/ALGEBRAIC[3], 0.500000));
ALGEBRAIC[23] =  (( CONSTANTS[22]*CONSTANTS[23])/CONSTANTS[24])*CONSTANTS[108]+STATES[15];
ALGEBRAIC[27] =  0.500000*CONSTANTS[94]*((( (CONSTANTS[96]+ CONSTANTS[97]*exp(( 6.00000*CONSTANTS[24]*CONSTANTS[106])/( CONSTANTS[22]*CONSTANTS[23])))*exp(( ALGEBRAIC[22]*CONSTANTS[24])/( CONSTANTS[22]*CONSTANTS[23])) -  CONSTANTS[96]*exp(( CONSTANTS[107]*6.00000*CONSTANTS[24]*ALGEBRAIC[23])/( CONSTANTS[22]*CONSTANTS[23])))+ CONSTANTS[102]*exp(( ALGEBRAIC[22]*CONSTANTS[24])/( CONSTANTS[22]*CONSTANTS[23]))*exp(( CONSTANTS[107]*6.00000*CONSTANTS[24]*ALGEBRAIC[23])/( CONSTANTS[22]*CONSTANTS[23])))/( (1.00000+ CONSTANTS[98]*exp(( CONSTANTS[24]*ALGEBRAIC[22])/( CONSTANTS[22]*CONSTANTS[23])))*exp(( 6.00000*CONSTANTS[24]*CONSTANTS[106])/( CONSTANTS[22]*CONSTANTS[23]))+ (CONSTANTS[99]+ CONSTANTS[100]*exp(( CONSTANTS[24]*ALGEBRAIC[22])/( CONSTANTS[22]*CONSTANTS[23])))*exp(( CONSTANTS[107]*6.00000*CONSTANTS[24]*ALGEBRAIC[23])/( CONSTANTS[22]*CONSTANTS[23]))));
ALGEBRAIC[28] =  6.00000*CONSTANTS[94]*(( CONSTANTS[96]*exp(( CONSTANTS[24]*ALGEBRAIC[22])/( CONSTANTS[22]*CONSTANTS[23])) -  (CONSTANTS[96]+CONSTANTS[101])*exp(( CONSTANTS[107]*6.00000*CONSTANTS[24]*ALGEBRAIC[23])/( CONSTANTS[22]*CONSTANTS[23])))/( (1.00000+ CONSTANTS[98]*exp(( CONSTANTS[24]*ALGEBRAIC[22])/( CONSTANTS[22]*CONSTANTS[23])))*exp(( 6.00000*CONSTANTS[24]*CONSTANTS[106])/( CONSTANTS[22]*CONSTANTS[23]))+ (CONSTANTS[99]+ CONSTANTS[100]*exp(( CONSTANTS[24]*ALGEBRAIC[22])/( CONSTANTS[22]*CONSTANTS[23])))*exp(( CONSTANTS[107]*6.00000*CONSTANTS[24]*ALGEBRAIC[23])/( CONSTANTS[22]*CONSTANTS[23]))));
ALGEBRAIC[29] =  6.00000*CONSTANTS[95]*(( CONSTANTS[96]*exp(( CONSTANTS[24]*CONSTANTS[131])/( CONSTANTS[22]*CONSTANTS[23])) -  (CONSTANTS[96]+CONSTANTS[101])*exp(( CONSTANTS[107]*6.00000*CONSTANTS[24]*ALGEBRAIC[23])/( CONSTANTS[22]*CONSTANTS[23])))/( (1.00000+ CONSTANTS[98]*exp(( CONSTANTS[24]*CONSTANTS[131])/( CONSTANTS[22]*CONSTANTS[23])))*exp(( 6.00000*CONSTANTS[24]*CONSTANTS[106])/( CONSTANTS[22]*CONSTANTS[23]))+ (CONSTANTS[99]+ CONSTANTS[100]*exp(( CONSTANTS[24]*CONSTANTS[131])/( CONSTANTS[22]*CONSTANTS[23])))*exp(( CONSTANTS[107]*6.00000*CONSTANTS[24]*ALGEBRAIC[23])/( CONSTANTS[22]*CONSTANTS[23]))));
ALGEBRAIC[30] =  CONSTANTS[105]*ALGEBRAIC[23];
ALGEBRAIC[24] =  (( CONSTANTS[22]*CONSTANTS[23])/CONSTANTS[24])*log( CONSTANTS[117]*(ALGEBRAIC[1]/( STATES[0]*CONSTANTS[12])));
ALGEBRAIC[31] =  - CONSTANTS[109]*(( ( 100.000*CONSTANTS[110]+ CONSTANTS[111]*exp(( 3.00000*CONSTANTS[24]*CONSTANTS[106])/( CONSTANTS[22]*CONSTANTS[23])))*exp(( ALGEBRAIC[24]*CONSTANTS[24])/( CONSTANTS[22]*CONSTANTS[23])) - ( CONSTANTS[110]*exp(( 3.00000*CONSTANTS[24]*ALGEBRAIC[23])/( CONSTANTS[22]*CONSTANTS[23]))+ CONSTANTS[116]*exp(( ALGEBRAIC[24]*CONSTANTS[24])/( CONSTANTS[22]*CONSTANTS[23]))*exp(( 3.00000*CONSTANTS[24]*ALGEBRAIC[23])/( CONSTANTS[22]*CONSTANTS[23]))))/( (1.00000+ CONSTANTS[112]*exp(( CONSTANTS[24]*ALGEBRAIC[24])/( CONSTANTS[22]*CONSTANTS[23])))*exp(( 3.00000*CONSTANTS[24]*CONSTANTS[106])/( CONSTANTS[22]*CONSTANTS[23]))+ (CONSTANTS[113]+ CONSTANTS[114]*exp(( CONSTANTS[24]*ALGEBRAIC[24])/( CONSTANTS[22]*CONSTANTS[23])))*exp(( 3.00000*CONSTANTS[24]*ALGEBRAIC[23])/( CONSTANTS[22]*CONSTANTS[23]))));
ALGEBRAIC[32] =  -3.00000*CONSTANTS[109]*(( 100.000*CONSTANTS[110]*(1.00000+exp(( CONSTANTS[24]*ALGEBRAIC[24])/( CONSTANTS[22]*CONSTANTS[23]))) -  (CONSTANTS[110]+CONSTANTS[115])*exp(( 3.00000*CONSTANTS[24]*ALGEBRAIC[23])/( CONSTANTS[22]*CONSTANTS[23])))/( (1.00000+ CONSTANTS[112]*exp(( CONSTANTS[24]*ALGEBRAIC[24])/( CONSTANTS[22]*CONSTANTS[23])))*exp(( 3.00000*CONSTANTS[24]*CONSTANTS[106])/( CONSTANTS[22]*CONSTANTS[23]))+ (CONSTANTS[113]+ CONSTANTS[114]*exp(( CONSTANTS[24]*ALGEBRAIC[24])/( CONSTANTS[22]*CONSTANTS[23])))*exp(( 3.00000*CONSTANTS[24]*ALGEBRAIC[23])/( CONSTANTS[22]*CONSTANTS[23]))));
ALGEBRAIC[0] = (CONDVAR[3]>=0.00000&&CONDVAR[4]<0.00000 ? 0.500000 : 4.00000);
ALGEBRAIC[26] = (CONDVAR[0]>=0.00000&&CONDVAR[1]<=0.00000&&CONDVAR[2]<=0.00000 ? CONSTANTS[4] : 0.100000);
ALGEBRAIC[33] =  CONSTANTS[123]*(( (ALGEBRAIC[26]/CONSTANTS[125])*pow(1.00000+ALGEBRAIC[26]/CONSTANTS[125], 3.00000)*(( 2.00000*CONSTANTS[24]*(STATES[15] - CONSTANTS[119]))/( CONSTANTS[22]*CONSTANTS[23])))/(pow(1.00000+ALGEBRAIC[26]/CONSTANTS[125], 4.00000)+ (CONSTANTS[121]/pow(1.00000+ALGEBRAIC[26]/CONSTANTS[124], CONSTANTS[122]))*(1.00000 - exp(( -2.00000*CONSTANTS[24]*(STATES[15] - CONSTANTS[119]))/( CONSTANTS[22]*CONSTANTS[23])))));
ALGEBRAIC[34] =  CONSTANTS[127]*(( exp(( CONSTANTS[130]*CONSTANTS[24]*(STATES[15] - CONSTANTS[119]))/( CONSTANTS[22]*CONSTANTS[23]))*exp(log(ALGEBRAIC[26]/STATES[10])))/( pow(1.00000+CONSTANTS[128]/CONSTANTS[5], CONSTANTS[126])*(1.00000+CONSTANTS[129]/STATES[10])));
}
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;
}
void
computeRoots(double VOI, double* CONSTANTS, double* RATES, double* OLDRATES, double* STATES,
             double* OLDSTATES, double* ALGEBRAIC, double* CONDVARS)
{
CONDVAR[0] = VOI - CONSTANTS[1];
CONDVAR[1] = VOI - CONSTANTS[2];
CONDVAR[2] = ((VOI - CONSTANTS[1]) -  floor((VOI - CONSTANTS[1])/ALGEBRAIC[0])*ALGEBRAIC[0]) - CONSTANTS[3];
CONDVAR[3] = VOI - 100.000;
CONDVAR[4] = VOI - 300.000;
CONDVAR[5] = VOI - 100.000;
CONDVAR[6] = VOI - 300.000;
}