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 41 entries in the algebraic variable array.
   There are a total of 19 entries in each of the rate and state variable arrays.
   There are a total of 114 entries in the constant variable array.
 */
/*
 * VOI is time in component environment (day).
 * STATES[0] is OBp in component OBp (pM).
 * CONSTANTS[0] is OBp_t0 in component OBp (pM).
 * ALGEBRAIC[39] is OBp_in in component OBp (flux).
 * ALGEBRAIC[27] is OBp_out in component OBp (flux).
 * CONSTANTS[1] is OBu_t0 in component model_parameters (pM).
 * CONSTANTS[77] is DifferOBpNormal in component OBp (first_order_rate_constant).
 * CONSTANTS[2] is D_OBp_t0 in component model_parameters (first_order_rate_constant).
 * CONSTANTS[3] is TGFbNormal in component OBp (pM).
 * CONSTANTS[4] is KD_TGF_beta_repress in component model_parameters (pM).
 * CONSTANTS[81] is ProlifOBpNormal in component OBp (first_order_rate_constant).
 * CONSTANTS[5] is frac_prolifOBp_vs_differOBu in component OBp (dimensionless).
 * CONSTANTS[6] is OBpNormal in component OBp (pM).
 * CONSTANTS[7] is OBp_sat in component OBp (pM).
 * CONSTANTS[86] is DifferOBu in component OBp (first_order_rate_constant).
 * ALGEBRAIC[0] is ProlifOBp in component OBp (first_order_rate_constant).
 * CONSTANTS[8] is D_OBu_t0 in component model_parameters (first_order_rate_constant).
 * CONSTANTS[9] is pd_OBp_t0 in component model_parameters (flux).
 * CONSTANTS[82] is Pi_TGFbeta_OBu_act_t0 in component TGF_beta (dimensionless).
 * ALGEBRAIC[7] is Pi_TGFbeta_OBp_rep in component TGF_beta (dimensionless).
 * ALGEBRAIC[35] is Pi_WNT in component Wnt (dimensionless).
 * CONSTANTS[112] is Pi_WNT_0 in component Wnt (dimensionless).
 * STATES[1] is OBa in component OBa (pM).
 * ALGEBRAIC[28] is OBa_in in component OBa (flux).
 * ALGEBRAIC[1] is OBa_out in component OBa (flux).
 * CONSTANTS[10] is pd_OBa_t0 in component model_parameters (flux).
 * CONSTANTS[11] is D_OBa_t0 in component model_parameters (first_order_rate_constant).
 * CONSTANTS[12] is A_OBa_t0 in component model_parameters (first_order_rate_constant).
 * STATES[2] is OCp in component OCp (pM).
 * STATES[7] is OCp_in in component OCp (flux).
 * STATES[8] is OCp_out in component OCp (flux).
 * CONSTANTS[13] is OCu_t0 in component model_parameters (pM).
 * STATES[9] is Pi_RANKL_act_OCp in component RANK_RANKL_OPG (dimensionless).
 * STATES[10] is Pi_RANKL_act_OCu in component RANK_RANKL_OPG (dimensionless).
 * CONSTANTS[14] is D_OCu_t0 in component model_parameters (first_order_rate_constant).
 * CONSTANTS[15] is pd_OCp_t0 in component model_parameters (flux).
 * CONSTANTS[16] is D_OCp_t0 in component model_parameters (first_order_rate_constant).
 * STATES[3] is OCa in component OCa (pM).
 * STATES[11] is OCa_in in component OCa (flux).
 * ALGEBRAIC[29] is OCa_out in component OCa (flux).
 * CONSTANTS[17] is pd_OCa_t0 in component model_parameters (flux).
 * CONSTANTS[18] is A_OCa_t0 in component model_parameters (first_order_rate_constant).
 * ALGEBRAIC[6] is Pi_TGFbeta_OCa_act in component TGF_beta (dimensionless).
 * STATES[4] is fbm in component fbm (dimensionless).
 * CONSTANTS[19] is K_form in component model_parameters (second_order_rate_constant).
 * CONSTANTS[20] is K_res in component model_parameters (second_order_rate_constant).
 * ALGEBRAIC[2] is dfbmdt in component fbm (first_order_rate_constant).
 * STATES[5] is OCY in component OCY (pM).
 * ALGEBRAIC[3] is OCY_act in component OCY (pM).
 * CONSTANTS[79] is OCY_act_0 in component OCY (pM).
 * CONSTANTS[21] is fact_0 in component model_parameters (pM).
 * STATES[6] is vm in component vm (dimensionless).
 * CONSTANTS[22] is XKAPPA in component model_parameters (first_order_rate_constant).
 * CONSTANTS[23] is vmmax in component model_parameters (dimensionless).
 * CONSTANTS[80] is PTH_tot in component PTH (pM).
 * CONSTANTS[83] is Pi_PTH_act in component PTH (dimensionless).
 * CONSTANTS[84] is Pi_PTH_rep in component PTH (dimensionless).
 * CONSTANTS[24] is Beta_PTH in component model_parameters (flux).
 * CONSTANTS[25] is P_PTH_d in component model_parameters (flux).
 * CONSTANTS[26] is Deg_PTH in component model_parameters (first_order_rate_constant).
 * CONSTANTS[27] is KD_PTH_act in component model_parameters (pM).
 * CONSTANTS[28] is KD_PTH_rep in component model_parameters (pM).
 * STATES[12] is RANK in component RANK_RANKL_OPG (pM).
 * STATES[13] is RANKL in component RANK_RANKL_OPG (pM).
 * STATES[14] is OPG in component RANK_RANKL_OPG (pM).
 * STATES[15] is RANKL_tot in component RANK_RANKL_OPG (pM).
 * CONSTANTS[85] is RANKL_max in component RANK_RANKL_OPG (pM).
 * STATES[16] is P_RANKL1 in component RANK_RANKL_OPG (flux).
 * STATES[17] is P_RANKL2 in component RANK_RANKL_OPG (flux).
 * STATES[18] is P_RANKL in component RANK_RANKL_OPG (flux).
 * CONSTANTS[29] is P_RANKL_d in component model_parameters (flux).
 * ALGEBRAIC[38] is Pi_NO_PTH_act_rep in component NO_PTH (dimensionless).
 * CONSTANTS[30] is N_RANK_OCp in component model_parameters (dimensionless).
 * CONSTANTS[31] is N_RANKL_OBp_max in component model_parameters (dimensionless).
 * CONSTANTS[32] is K_RANK_RANKL in component model_parameters (pM).
 * CONSTANTS[33] is Beta_OPG in component model_parameters (first_order_rate_constant).
 * CONSTANTS[34] is OPG_max in component model_parameters (pM).
 * CONSTANTS[35] is Deg_OPG in component model_parameters (first_order_rate_constant).
 * CONSTANTS[36] is Deg_OPG_RANKL in component model_parameters (first_order_rate_constant).
 * CONSTANTS[37] is K_OPG_RANKL in component model_parameters (pM).
 * CONSTANTS[38] is Beta_RANKL_OCY in component model_parameters (first_order_rate_constant).
 * CONSTANTS[39] is Beta_RANKL_OBp in component model_parameters (first_order_rate_constant).
 * CONSTANTS[40] is Deg_RANKL in component model_parameters (first_order_rate_constant).
 * CONSTANTS[41] is Deg_RANK_RANKL in component model_parameters (first_order_rate_constant).
 * CONSTANTS[42] is KD_RANKL_act_OCp in component model_parameters (pM).
 * CONSTANTS[43] is KD_RANKL_act_OCu in component model_parameters (pM).
 * ALGEBRAIC[4] is TGF_beta in component TGF_beta (pM).
 * CONSTANTS[78] is TGF_beta_t0 in component TGF_beta (pM).
 * CONSTANTS[44] is OCa_t0 in component TGF_beta (pM).
 * CONSTANTS[45] is Alpha in component model_parameters (dimensionless).
 * CONSTANTS[46] is KD_TGF_beta_activate in component model_parameters (pM).
 * ALGEBRAIC[5] is Pi_TGFbeta_OBu_act in component TGF_beta (dimensionless).
 * ALGEBRAIC[34] is Scl in component Scl (pM).
 * CONSTANTS[111] is Scl_0 in component Scl (pM).
 * ALGEBRAIC[40] is P_Scl_b in component Scl (flux).
 * CONSTANTS[113] is P_Scl_b_0 in component Scl (flux).
 * ALGEBRAIC[31] is A in component Scl (second_order_rate_constant).
 * CONSTANTS[108] is A_0 in component Scl (second_order_rate_constant).
 * ALGEBRAIC[32] is B in component Scl (first_order_rate_constant).
 * CONSTANTS[109] is B_0 in component Scl (first_order_rate_constant).
 * ALGEBRAIC[33] is C in component Scl (flux).
 * CONSTANTS[110] is C_0 in component Scl (flux).
 * ALGEBRAIC[30] is OCYprod in component Scl (flux).
 * CONSTANTS[107] is OCYprod_0 in component Scl (flux).
 * CONSTANTS[89] is Wnt in component Wnt (pM).
 * CONSTANTS[47] is Wnt_0 in component model_parameters (pM).
 * ALGEBRAIC[26] is Pi_eps_rep in component SED (dimensionless).
 * CONSTANTS[106] is Pi_eps_rep_stst in component SED (dimensionless).
 * CONSTANTS[87] is Beta_Scl in component Scl (first_order_rate_constant).
 * CONSTANTS[48] is Beta_Scl_0 in component model_parameters (first_order_rate_constant).
 * CONSTANTS[49] is KD_SclLRP5 in component model_parameters (pM).
 * CONSTANTS[50] is Deg_Scl in component model_parameters (first_order_rate_constant).
 * CONSTANTS[51] is Scl_max in component model_parameters (pM).
 * CONSTANTS[52] is KD_WntLRP5 in component model_parameters (pM).
 * CONSTANTS[53] is Deg_SclLRP5 in component model_parameters (first_order_rate_constant).
 * CONSTANTS[54] is LRP5perCell in component model_parameters (dimensionless).
 * ALGEBRAIC[8] is LRP5tot in component Scl (pM).
 * CONSTANTS[88] is LRP5tot_0 in component Scl (pM).
 * CONSTANTS[55] is P_Scl_d in component model_parameters (flux).
 * CONSTANTS[90] is PTH_tot in component NO_PTH (pM).
 * ALGEBRAIC[36] is NO_tot in component NO_PTH (pM).
 * CONSTANTS[103] is NO_eq in component NO_PTH (pM).
 * CONSTANTS[91] is Beta_NO in component NO_PTH (first_order_rate_constant).
 * CONSTANTS[56] is Beta_NO_0 in component model_parameters (first_order_rate_constant).
 * CONSTANTS[57] is P_NO_d in component model_parameters (flux).
 * CONSTANTS[58] is Deg_NO in component model_parameters (first_order_rate_constant).
 * ALGEBRAIC[25] is Pi_eps_act in component SED (dimensionless).
 * CONSTANTS[102] is Pi_eps_act_stst in component SED (dimensionless).
 * CONSTANTS[59] is NO_max in component model_parameters (pM).
 * CONSTANTS[104] is KD_rep_NO in component NO_PTH (pM).
 * CONSTANTS[60] is aa in component NO_PTH (dimensionless).
 * CONSTANTS[92] is Pi_PTH_act in component NO_PTH (dimensionless).
 * ALGEBRAIC[37] is Pi_NO_rep in component NO_PTH (dimensionless).
 * CONSTANTS[61] is lambda_s in component model_parameters (dimensionless).
 * CONSTANTS[62] is lambda_c in component model_parameters (dimensionless).
 * ALGEBRAIC[23] is SED in component SED (MPa).
 * ALGEBRAIC[24] is SED_bm in component SED (MPa).
 * CONSTANTS[63] is sig_macro_t0 in component model_parameters (MPa).
 * CONSTANTS[64] is de_sig_macro in component model_parameters (MPa).
 * CONSTANTS[98] is sig_macro in component SED (MPa).
 * CONSTANTS[93] is sig_1 in component SED (MPa).
 * CONSTANTS[94] is sig_2 in component SED (MPa).
 * CONSTANTS[99] is sig_3 in component SED (MPa).
 * CONSTANTS[95] is sig_4 in component SED (MPa).
 * CONSTANTS[96] is sig_5 in component SED (MPa).
 * CONSTANTS[97] is sig_6 in component SED (MPa).
 * ALGEBRAIC[17] is eps_1 in component SED (dimensionless).
 * ALGEBRAIC[18] is eps_2 in component SED (dimensionless).
 * ALGEBRAIC[19] is eps_3 in component SED (dimensionless).
 * ALGEBRAIC[20] is eps_4 in component SED (dimensionless).
 * ALGEBRAIC[21] is eps_5 in component SED (dimensionless).
 * ALGEBRAIC[22] is eps_6 in component SED (dimensionless).
 * ALGEBRAIC[9] is dens_tis in component SED (g_per_cm3).
 * CONSTANTS[65] is vo in component model_parameters (dimensionless).
 * CONSTANTS[66] is rho_m in component model_parameters (g_per_cm3).
 * CONSTANTS[67] is rho_o in component model_parameters (g_per_cm3).
 * ALGEBRAIC[10] is fvas in component SED (dimensionless).
 * ALGEBRAIC[11] is dens in component SED (g_per_cm3).
 * ALGEBRAIC[12] is dens_1 in component SED (dimensionless).
 * ALGEBRAIC[13] is E_mod in component SED (MPa).
 * CONSTANTS[68] is nu in component model_parameters (dimensionless).
 * ALGEBRAIC[14] is S_11 in component SED (per_MPa).
 * ALGEBRAIC[15] is S_12 in component SED (per_MPa).
 * ALGEBRAIC[16] is S_44 in component SED (per_MPa).
 * CONSTANTS[69] is omega in component model_parameters (dimensionless).
 * CONSTANTS[100] is valeq in component SED (dimensionless).
 * CONSTANTS[70] is taueq in component model_parameters (MPa).
 * CONSTANTS[71] is alphaAct in component model_parameters (dimensionless).
 * CONSTANTS[72] is alphaRep in component model_parameters (dimensionless).
 * CONSTANTS[73] is gammaAct in component model_parameters (dimensionless).
 * CONSTANTS[74] is gammaRep in component model_parameters (dimensionless).
 * CONSTANTS[75] is rhoAct in component model_parameters (dimensionless).
 * CONSTANTS[76] is rhoRep in component model_parameters (dimensionless).
 * CONSTANTS[101] is deltaAct in component SED (MPa).
 * CONSTANTS[105] is deltaRep in component SED (MPa).
 * RATES[0] is d/dt OBp in component OBp (pM).
 * RATES[1] is d/dt OBa in component OBa (pM).
 * RATES[2] is d/dt OCp in component OCp (pM).
 * RATES[3] is d/dt OCa in component OCa (pM).
 * RATES[4] is d/dt fbm in component fbm (dimensionless).
 * RATES[5] is d/dt OCY in component OCY (pM).
 * RATES[6] is d/dt vm in component vm (dimensionless).
 * There are a total of 1 condition variables.
 */
void
initConsts(double* CONSTANTS, double* RATES, double *STATES)
{
STATES[0] = 1.1631869976e-03;
CONSTANTS[0] = 1.1631869976e-03;
CONSTANTS[1] = 0.01;
CONSTANTS[2] = 0.185;
CONSTANTS[3] = 0.0001;
CONSTANTS[4] = 0.000175426051821094;
CONSTANTS[5] = 0.5;
CONSTANTS[6] = 0.001;
CONSTANTS[7] = 0.005;
CONSTANTS[8] = 0.166;
CONSTANTS[9] = 0;
STATES[1] = 9.1880026722e-04;
CONSTANTS[10] = 0;
CONSTANTS[11] = 0.0212;
CONSTANTS[12] = 0.1908;
STATES[2] = 1.3556879825e-03;
CONSTANTS[13] = 0.01;
CONSTANTS[14] = 0.0219;
CONSTANTS[15] = 0;
CONSTANTS[16] = 0.01958;
STATES[3] = 1.8376005344e-05;
CONSTANTS[17] = 0;
CONSTANTS[18] = 10;
STATES[4] = 15;
CONSTANTS[19] = 50;
CONSTANTS[20] = 2500;
STATES[5] = 1.2734398187e-02;
CONSTANTS[21] = 0.000414138;
STATES[6] = 3.5893417161e-01;
CONSTANTS[22] = 0.007;
CONSTANTS[23] = 0.516;
CONSTANTS[24] = 250;
CONSTANTS[25] = 0;
CONSTANTS[26] = 86;
CONSTANTS[27] = 0.65;
CONSTANTS[28] = 0.222581427709954;
CONSTANTS[29] = 0;
CONSTANTS[30] = 4160;
CONSTANTS[31] = 2703476;
CONSTANTS[32] = 10;
CONSTANTS[33] = 162490033.783568;
CONSTANTS[34] = 131.428571428571;
CONSTANTS[35] = 532608.695652174;
CONSTANTS[36] = 10.132471014805;
CONSTANTS[37] = 0.0151142857142857;
CONSTANTS[38] = 5660;
CONSTANTS[39] = 23600;
CONSTANTS[40] = 10.132471014805;
CONSTANTS[41] = 10.132471014805;
CONSTANTS[42] = 3.34;
CONSTANTS[43] = 16.7;
CONSTANTS[44] = 0.0001;
CONSTANTS[45] = 1;
CONSTANTS[46] = 0.000563278809675429;
CONSTANTS[47] = 170;
CONSTANTS[48] = 24000;
CONSTANTS[49] = 10;
CONSTANTS[50] = 1;
CONSTANTS[51] = 70;
CONSTANTS[52] = 1000;
CONSTANTS[53] = 50;
CONSTANTS[54] = 5;
CONSTANTS[55] = 0;
CONSTANTS[56] = 3440;
CONSTANTS[57] = 0;
CONSTANTS[58] = 0.0021;
CONSTANTS[59] = 200000000;
CONSTANTS[60] = 2;
CONSTANTS[61] = 0.450454;
CONSTANTS[62] = 0.900909;
CONSTANTS[63] = -0.1457;
CONSTANTS[64] = 0;
CONSTANTS[65] = 0.428571428571428;
CONSTANTS[66] = 3.2;
CONSTANTS[67] = 1.41;
CONSTANTS[68] = 0.3;
CONSTANTS[69] = 0.95;
CONSTANTS[70] = 0.006652;
CONSTANTS[71] = 1;
CONSTANTS[72] = 1;
CONSTANTS[73] = 7;
CONSTANTS[74] = 8.01559;
CONSTANTS[75] = 0;
CONSTANTS[76] = 0;
CONSTANTS[77] = ( CONSTANTS[2]*1.00000)/(1.00000+CONSTANTS[3]/CONSTANTS[4]);
CONSTANTS[78] =  CONSTANTS[45]*CONSTANTS[44];
CONSTANTS[79] =  CONSTANTS[21]*20.0000;
CONSTANTS[80] = (CONSTANTS[24]+CONSTANTS[25])/CONSTANTS[26];
CONSTANTS[81] = ( CONSTANTS[5]*CONSTANTS[77])/(1.00000 - CONSTANTS[6]/CONSTANTS[7]);
CONSTANTS[82] = CONSTANTS[78]/(CONSTANTS[46]+CONSTANTS[78]);
CONSTANTS[83] = CONSTANTS[80]/(CONSTANTS[80]+CONSTANTS[27]);
CONSTANTS[84] = 1.00000/(1.00000+CONSTANTS[80]/CONSTANTS[28]);
CONSTANTS[85] =  CONSTANTS[31]*CONSTANTS[0];
CONSTANTS[86] =  (1.00000 - CONSTANTS[5])*CONSTANTS[8]*CONSTANTS[82];
CONSTANTS[87] = CONSTANTS[48];
CONSTANTS[88] =  CONSTANTS[54]*CONSTANTS[0];
CONSTANTS[89] = CONSTANTS[47];
CONSTANTS[90] = (CONSTANTS[24]+CONSTANTS[25])/CONSTANTS[26];
CONSTANTS[91] = CONSTANTS[56];
CONSTANTS[92] = CONSTANTS[90]/(CONSTANTS[90]+CONSTANTS[27]);
CONSTANTS[93] = 0.00000;
CONSTANTS[94] = 0.00000;
CONSTANTS[95] = 0.00000;
CONSTANTS[96] = 0.00000;
CONSTANTS[97] = 0.00000;
CONSTANTS[98] = CONSTANTS[63]+CONSTANTS[64];
CONSTANTS[99] = CONSTANTS[98];
CONSTANTS[100] = CONSTANTS[69];
CONSTANTS[101] =  CONSTANTS[70]*pow((CONSTANTS[71] - CONSTANTS[100])/(CONSTANTS[100] - CONSTANTS[75]), 1.00000/CONSTANTS[73]);
CONSTANTS[102] = CONSTANTS[75]+( (CONSTANTS[71] - CONSTANTS[75])*pow(CONSTANTS[70], CONSTANTS[73]))/(pow(CONSTANTS[101], CONSTANTS[73])+pow(CONSTANTS[70], CONSTANTS[73]));
CONSTANTS[103] = ( CONSTANTS[56]*CONSTANTS[102]*CONSTANTS[79])/(CONSTANTS[58]+( CONSTANTS[56]*CONSTANTS[102]*CONSTANTS[79])/CONSTANTS[59]);
CONSTANTS[104] = CONSTANTS[103]/CONSTANTS[60];
CONSTANTS[105] =  CONSTANTS[70]*pow((CONSTANTS[100] - CONSTANTS[76])/(CONSTANTS[72] - CONSTANTS[100]), 1.00000/CONSTANTS[74]);
CONSTANTS[106] = CONSTANTS[72] - ( (CONSTANTS[72] - CONSTANTS[76])*pow(CONSTANTS[70], CONSTANTS[74]))/(pow(CONSTANTS[105], CONSTANTS[74])+pow(CONSTANTS[70], CONSTANTS[74]));
CONSTANTS[107] =  CONSTANTS[48]*CONSTANTS[79]*CONSTANTS[106];
CONSTANTS[108] =  (1.00000/CONSTANTS[49])*(CONSTANTS[50]+CONSTANTS[107]/CONSTANTS[51]);
CONSTANTS[109] = ( CONSTANTS[108]*CONSTANTS[49]*(1.00000+CONSTANTS[47]/CONSTANTS[52])+( CONSTANTS[53]*CONSTANTS[88])/CONSTANTS[49]) - (CONSTANTS[55]+CONSTANTS[107])/CONSTANTS[49];
CONSTANTS[110] =  - (CONSTANTS[55]+CONSTANTS[107])*(1.00000+CONSTANTS[47]/CONSTANTS[52]);
CONSTANTS[111] = (- CONSTANTS[109]+ pow((pow(CONSTANTS[109], 2.00000) -  4.00000*CONSTANTS[108]*CONSTANTS[110]), 1.0 / 2))/( 2.00000*CONSTANTS[108]);
CONSTANTS[112] = CONSTANTS[47]/( CONSTANTS[52]*(1.00000+CONSTANTS[47]/CONSTANTS[52]+CONSTANTS[111]/CONSTANTS[49]));
CONSTANTS[113] =  CONSTANTS[107]*(1.00000 - CONSTANTS[111]/CONSTANTS[51]);
STATES[7] = 0.1001;
STATES[8] = 0.1001;
STATES[9] = 0.1001;
STATES[10] = 0.1001;
STATES[11] = 0.1001;
STATES[12] = 0.1001;
STATES[13] = 0.1001;
STATES[14] = 0.1001;
STATES[15] = 0.1001;
STATES[16] = 0.1001;
STATES[17] = 0.1001;
STATES[18] = 0.1001;
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;
}
void
computeResiduals(double VOI, double* CONSTANTS, double* RATES, double* OLDRATES, double* STATES,
                 double* OLDSTATES, double* ALGEBRAIC, double* CONDVARS)
{
resid[0] = RATES[0] - ALGEBRAIC[39] - ALGEBRAIC[27];
resid[1] = RATES[1] - ALGEBRAIC[28] - ALGEBRAIC[1];
resid[2] = STATES[7] -  CONSTANTS[14]*CONSTANTS[13]*STATES[10]+CONSTANTS[15];
resid[3] = STATES[8] -  CONSTANTS[16]*STATES[9]*STATES[2];
resid[4] = RATES[2] - STATES[7] - STATES[8];
resid[5] = STATES[11] - STATES[8]+CONSTANTS[17];
resid[6] = RATES[3] - STATES[11] - ALGEBRAIC[29];
resid[7] = RATES[4] - ALGEBRAIC[2];
resid[8] = RATES[5] -  CONSTANTS[21]*ALGEBRAIC[2];
resid[9] = RATES[6] -  CONSTANTS[22]*(CONSTANTS[23] - STATES[6]) - ( STATES[6]*CONSTANTS[19]*STATES[1])/STATES[4];
resid[10] = STATES[12] - ( CONSTANTS[30]*STATES[2])/(1.00000+ (1.00000/CONSTANTS[32])*STATES[13]);
resid[11] = STATES[14] - ( CONSTANTS[33]*CONSTANTS[84]*STATES[1])/(( CONSTANTS[33]*CONSTANTS[84]*STATES[1])/CONSTANTS[34]+CONSTANTS[35]+ (CONSTANTS[36]/CONSTANTS[37])*STATES[13]);
resid[12] = STATES[15] -  STATES[13]*(1.00000+STATES[12]/CONSTANTS[32]+STATES[14]/CONSTANTS[37]);
resid[13] = STATES[16] -  CONSTANTS[38]*(1.00000 - STATES[15]/CONSTANTS[85])*ALGEBRAIC[3];
resid[14] = STATES[17] -  CONSTANTS[39]*ALGEBRAIC[38]*(1.00000 - STATES[15]/CONSTANTS[85])*STATES[0];
resid[15] = STATES[18] - STATES[16]+STATES[17];
resid[16] = STATES[13] - (STATES[18]+CONSTANTS[29])/(CONSTANTS[40]+ (CONSTANTS[41]/CONSTANTS[32])*STATES[12]+ (CONSTANTS[36]/CONSTANTS[37])*STATES[14]);
resid[17] = STATES[9] - STATES[13]/(CONSTANTS[42]+STATES[13]);
resid[18] = STATES[10] - STATES[13]/(CONSTANTS[43]+STATES[13]);
}
void
computeVariables(double VOI, double* CONSTANTS, double* RATES, double* STATES, double* ALGEBRAIC)
{
ALGEBRAIC[5] = ALGEBRAIC[4]/(CONSTANTS[46]+ALGEBRAIC[4]);
ALGEBRAIC[40] =  ALGEBRAIC[30]*(1.00000 - ALGEBRAIC[34]/CONSTANTS[51]);
}
void
computeEssentialVariables(double VOI, double* CONSTANTS, double* RATES, double* STATES, double* ALGEBRAIC)
{
ALGEBRAIC[1] =  (CONSTANTS[11]+CONSTANTS[12])*STATES[1];
ALGEBRAIC[2] =  CONSTANTS[19]*STATES[1] -  CONSTANTS[20]*STATES[3];
ALGEBRAIC[3] =  CONSTANTS[21]*STATES[4];
ALGEBRAIC[4] =  CONSTANTS[45]*STATES[3];
ALGEBRAIC[7] = 1.00000/(1.00000+ALGEBRAIC[4]/CONSTANTS[4]);
ALGEBRAIC[27] =  CONSTANTS[2]*ALGEBRAIC[7]*STATES[0];
ALGEBRAIC[28] = ALGEBRAIC[27]+CONSTANTS[10];
ALGEBRAIC[6] = ALGEBRAIC[4]/(CONSTANTS[46]+ALGEBRAIC[4]);
ALGEBRAIC[29] =  CONSTANTS[18]*ALGEBRAIC[6]*STATES[3];
ALGEBRAIC[9] = 1.00000+ (CONSTANTS[66] - 1.00000)*STATES[6]+ (CONSTANTS[67] - 1.00000)*CONSTANTS[65];
ALGEBRAIC[11] = ( ALGEBRAIC[9]*STATES[4])/100.000;
ALGEBRAIC[12] = ALGEBRAIC[11]/1.00000;
ALGEBRAIC[13] = (CONDVAR[0]<0.00000 ?  2014.00*pow(ALGEBRAIC[12], 2.50000) :  1763.00*pow(ALGEBRAIC[12], 3.20000));
ALGEBRAIC[14] = 1.00000/ALGEBRAIC[13];
ALGEBRAIC[15] = - CONSTANTS[68]/ALGEBRAIC[13];
ALGEBRAIC[17] =  ALGEBRAIC[14]*CONSTANTS[93]+ ALGEBRAIC[15]*CONSTANTS[94]+ ALGEBRAIC[15]*CONSTANTS[99];
ALGEBRAIC[18] =  ALGEBRAIC[15]*CONSTANTS[93]+ ALGEBRAIC[14]*CONSTANTS[94]+ ALGEBRAIC[15]*CONSTANTS[99];
ALGEBRAIC[19] =  ALGEBRAIC[15]*CONSTANTS[93]+ ALGEBRAIC[15]*CONSTANTS[94]+ ALGEBRAIC[14]*CONSTANTS[99];
ALGEBRAIC[16] = (2.00000+ 2.00000*CONSTANTS[68])/ALGEBRAIC[13];
ALGEBRAIC[20] =  ALGEBRAIC[16]*CONSTANTS[95];
ALGEBRAIC[21] =  ALGEBRAIC[16]*CONSTANTS[96];
ALGEBRAIC[22] =  ALGEBRAIC[16]*CONSTANTS[97];
ALGEBRAIC[23] =  0.500000*( CONSTANTS[93]*ALGEBRAIC[17]+ CONSTANTS[94]*ALGEBRAIC[18]+ CONSTANTS[99]*ALGEBRAIC[19]+ CONSTANTS[95]*ALGEBRAIC[20]+ CONSTANTS[96]*ALGEBRAIC[21]+ CONSTANTS[97]*ALGEBRAIC[22]);
ALGEBRAIC[10] = 1.00000 - STATES[4]/100.000;
ALGEBRAIC[24] = ALGEBRAIC[23]/pow(1.00000 - ALGEBRAIC[10], 2.00000);
ALGEBRAIC[25] = CONSTANTS[75]+( (CONSTANTS[71] - CONSTANTS[75])*pow(ALGEBRAIC[24], CONSTANTS[73]))/(pow(CONSTANTS[101], CONSTANTS[73])+pow(ALGEBRAIC[24], CONSTANTS[73]));
ALGEBRAIC[36] = ( CONSTANTS[91]*ALGEBRAIC[25]*ALGEBRAIC[3]+CONSTANTS[57])/(CONSTANTS[58]+( CONSTANTS[91]*ALGEBRAIC[25]*ALGEBRAIC[3])/CONSTANTS[59]);
ALGEBRAIC[37] = 1.00000/(1.00000+ALGEBRAIC[36]/CONSTANTS[104]);
ALGEBRAIC[38] =  CONSTANTS[61]*(CONSTANTS[92]+ALGEBRAIC[37])+ CONSTANTS[62]*CONSTANTS[92]*ALGEBRAIC[37];
ALGEBRAIC[0] =  CONSTANTS[81]*(1.00000 - STATES[0]/CONSTANTS[7]);
ALGEBRAIC[26] = CONSTANTS[72] - ( (CONSTANTS[72] - CONSTANTS[76])*pow(ALGEBRAIC[24], CONSTANTS[74]))/(pow(CONSTANTS[105], CONSTANTS[74])+pow(ALGEBRAIC[24], CONSTANTS[74]));
ALGEBRAIC[30] =  CONSTANTS[87]*ALGEBRAIC[3]*ALGEBRAIC[26];
ALGEBRAIC[31] =  (1.00000/CONSTANTS[49])*(CONSTANTS[50]+ALGEBRAIC[30]/CONSTANTS[51]);
ALGEBRAIC[8] =  CONSTANTS[54]*STATES[0];
ALGEBRAIC[32] = ( ALGEBRAIC[31]*CONSTANTS[49]*(1.00000+CONSTANTS[89]/CONSTANTS[52])+( CONSTANTS[53]*ALGEBRAIC[8])/CONSTANTS[49]) - (CONSTANTS[55]+ALGEBRAIC[30])/CONSTANTS[49];
ALGEBRAIC[33] =  - (CONSTANTS[55]+ALGEBRAIC[30])*(1.00000+CONSTANTS[89]/CONSTANTS[52]);
ALGEBRAIC[34] = (- ALGEBRAIC[32]+ pow((pow(ALGEBRAIC[32], 2.00000) -  4.00000*ALGEBRAIC[31]*ALGEBRAIC[33]), 1.0 / 2))/( 2.00000*ALGEBRAIC[31]);
ALGEBRAIC[35] = CONSTANTS[89]/( CONSTANTS[52]*(1.00000+CONSTANTS[89]/CONSTANTS[52]+ALGEBRAIC[34]/CONSTANTS[49]));
ALGEBRAIC[39] =  CONSTANTS[86]*CONSTANTS[1]+( ALGEBRAIC[0]*STATES[0]*ALGEBRAIC[35])/CONSTANTS[112]+CONSTANTS[9];
}
void
getStateInformation(double* SI)
{
SI[0] = 1.0;
SI[1] = 1.0;
SI[2] = 1.0;
SI[7] = 0.0;
SI[8] = 0.0;
SI[9] = 0.0;
SI[10] = 0.0;
SI[3] = 1.0;
SI[11] = 0.0;
SI[4] = 1.0;
SI[5] = 1.0;
SI[6] = 1.0;
SI[12] = 0.0;
SI[13] = 0.0;
SI[14] = 0.0;
SI[15] = 0.0;
SI[16] = 0.0;
SI[17] = 0.0;
SI[18] = 0.0;
}
void
computeRoots(double VOI, double* CONSTANTS, double* RATES, double* OLDRATES, double* STATES,
             double* OLDSTATES, double* ALGEBRAIC, double* CONDVARS)
{
CONDVAR[0] = ALGEBRAIC[12] - 1.20000;
}