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 24 entries in the algebraic variable array.
   There are a total of 33 entries in each of the rate and state variable arrays.
   There are a total of 97 entries in the constant variable array.
 */
/*
 * VOI is time in component environment (hour).
 * STATES[0] is ATbl in component ATbl (nanomole).
 * CONSTANTS[0] is k2T in component ATbl (nmol_hr).
 * ALGEBRAIC[21] is Qb in component model_parameters (l_hr).
 * ALGEBRAIC[20] is Qp in component Qp (l_hr).
 * CONSTANTS[1] is Ql in component model_parameters (l_hr).
 * CONSTANTS[2] is Qt in component model_parameters (l_hr).
 * CONSTANTS[94] is CTbf in component model_parameters (nM).
 * ALGEBRAIC[0] is CTblf in component CTblf (nM).
 * ALGEBRAIC[17] is CTpf in component CTpf (nM).
 * CONSTANTS[3] is CTbl in component model_parameters (nM).
 * CONSTANTS[90] is CTlf in component CTlf (nM).
 * CONSTANTS[93] is CTtv in component CTtv (nM).
 * CONSTANTS[4] is ts in component model_parameters (dimensionless).
 * STATES[1] is ADbl in component ADbl (nanomole).
 * ALGEBRAIC[22] is Qbt in component model_parameters (l_hr).
 * CONSTANTS[95] is CDbf in component model_parameters (nM).
 * ALGEBRAIC[1] is CDblf in component CDblf (nM).
 * ALGEBRAIC[18] is CDpf in component CDpf (nM).
 * CONSTANTS[92] is CDlf in component CDlf (nM).
 * CONSTANTS[5] is CDbl in component model_parameters (nM).
 * STATES[2] is CT_A in component CT_A (nM).
 * CONSTANTS[6] is kTA_on in component CT_A (second_order_rate_constant).
 * CONSTANTS[7] is kTA_off in component CT_A (first_order_rate_constant).
 * ALGEBRAIC[2] is CAf in component CAf (nM).
 * STATES[3] is CD_A in component CD_A (nM).
 * CONSTANTS[8] is kDA_on in component CD_A (second_order_rate_constant).
 * CONSTANTS[9] is kDA_off in component CD_A (first_order_rate_constant).
 * CONSTANTS[10] is CA in component model_parameters (nM).
 * STATES[4] is ATl in component ATl (nanomole).
 * CONSTANTS[11] is k1T in component model_parameters (first_order_rate_constant).
 * CONSTANTS[12] is km5alpha in component model_parameters (nM).
 * CONSTANTS[13] is Vmax1 in component model_parameters (nmol_hr).
 * CONSTANTS[14] is PTl in component model_parameters (dimensionless).
 * STATES[5] is ADl in component ADl (nanomole).
 * CONSTANTS[15] is k1D in component model_parameters (first_order_rate_constant).
 * CONSTANTS[16] is PDl in component model_parameters (dimensionless).
 * CONSTANTS[17] is CTl in component model_parameters (nM).
 * CONSTANTS[18] is CDl in component model_parameters (nM).
 * STATES[6] is ATif in component ATif (nanomole).
 * CONSTANTS[19] is mu in component model_parameters (l_hr).
 * CONSTANTS[20] is PTif in component model_parameters (dimensionless).
 * CONSTANTS[21] is CTif in component model_parameters (nM).
 * CONSTANTS[22] is CTst in component model_parameters (nM).
 * CONSTANTS[23] is CLH in component model_parameters (nanomole).
 * CONSTANTS[24] is PTst in component model_parameters (dimensionless).
 * STATES[7] is ATst in component ATst (nanomole).
 * STATES[8] is ATp in component ATp (nanomole).
 * CONSTANTS[25] is Vmax0 in component model_parameters (nmol_hr).
 * STATES[9] is ADp in component ADp (nanomole).
 * STATES[10] is CT_R in component CT_R (nM).
 * CONSTANTS[26] is kTR_on in component CT_R (second_order_rate_constant).
 * CONSTANTS[27] is kTR_off in component CT_R (first_order_rate_constant).
 * ALGEBRAIC[23] is CRf in component CRf (nM).
 * STATES[11] is CD_R in component CD_R (nM).
 * CONSTANTS[28] is kDR_on in component CD_R (second_order_rate_constant).
 * CONSTANTS[29] is kDR_off in component CD_R (first_order_rate_constant).
 * STATES[12] is CDT in component CDT (nM).
 * CONSTANTS[30] is kDT_on in component CDT (second_order_rate_constant).
 * CONSTANTS[31] is kDT_off in component CDT (first_order_rate_constant).
 * STATES[13] is CDD in component CDD (nM).
 * CONSTANTS[32] is kDD_on in component CDD (second_order_rate_constant).
 * CONSTANTS[33] is kDD_off in component CDD (first_order_rate_constant).
 * STATES[14] is CTT in component CTT (nM).
 * CONSTANTS[34] is kTT_on in component CTT (second_order_rate_constant).
 * CONSTANTS[35] is kTT_off in component CTT (first_order_rate_constant).
 * STATES[15] is CDD5a in component CDD5a (nM).
 * CONSTANTS[36] is kDNA_onDD5a in component CDD5a (second_order_rate_constant).
 * CONSTANTS[37] is kDNA_offDD5a in component CDD5a (first_order_rate_constant).
 * ALGEBRAIC[7] is CDNA5af in component CDNA5af (nM).
 * STATES[16] is CDDcd in component CDDcd (nM).
 * CONSTANTS[38] is kDNA_onDDcd in component CDDcd (second_order_rate_constant).
 * CONSTANTS[39] is kDNA_offDDcd in component CDDcd (first_order_rate_constant).
 * ALGEBRAIC[5] is CDNAcdf in component CDNAcdf (nM).
 * STATES[17] is CDDsec in component CDDsec (nM).
 * CONSTANTS[40] is kDNA_onDDsec in component CDDsec (second_order_rate_constant).
 * CONSTANTS[41] is kDNA_offDDsec in component CDDsec (first_order_rate_constant).
 * ALGEBRAIC[6] is CDNAsecf in component CDNAsecf (nM).
 * STATES[18] is CDDcp in component CDDcp (nM).
 * CONSTANTS[42] is kDNA_onDDcp in component CDDcp (second_order_rate_constant).
 * CONSTANTS[43] is kDNA_offDDcp in component CDDcp (first_order_rate_constant).
 * ALGEBRAIC[8] is CDNAcpf in component CDNAcpf (nM).
 * STATES[19] is CDT5a in component CDT5a (nM).
 * CONSTANTS[44] is kDNA_onDT5a in component CDT5a (second_order_rate_constant).
 * CONSTANTS[45] is kDNA_offDT5a in component CDT5a (first_order_rate_constant).
 * STATES[20] is CDTcd in component CDTcd (nM).
 * CONSTANTS[46] is kDNA_onDTcd in component CDTcd (second_order_rate_constant).
 * CONSTANTS[47] is kDNA_offDTcd in component CDTcd (first_order_rate_constant).
 * STATES[21] is CDTsec in component CDTsec (nM).
 * CONSTANTS[48] is kDNA_onDTsec in component CDTsec (second_order_rate_constant).
 * CONSTANTS[49] is kDNA_offDTsec in component CDTsec (first_order_rate_constant).
 * STATES[22] is CDTcp in component CDTcp (nM).
 * CONSTANTS[50] is kDNA_onDTcp in component CDTcp (second_order_rate_constant).
 * CONSTANTS[51] is kDNA_offDTcp in component CDTcp (first_order_rate_constant).
 * STATES[23] is CTT5a in component CTT5a (nM).
 * CONSTANTS[52] is kDNA_onTT5a in component CTT5a (second_order_rate_constant).
 * CONSTANTS[53] is kDNA_offTT5a in component CTT5a (first_order_rate_constant).
 * STATES[24] is CTTcd in component CTTcd (nM).
 * CONSTANTS[54] is kDNA_onTTcd in component CTTcd (second_order_rate_constant).
 * CONSTANTS[55] is kDNA_offTTcd in component CTTcd (first_order_rate_constant).
 * STATES[25] is CTTsec in component CTTsec (nM).
 * CONSTANTS[56] is kDNA_onTTsec in component CTTsec (second_order_rate_constant).
 * CONSTANTS[57] is kDNA_offTTsec in component CTTsec (first_order_rate_constant).
 * STATES[26] is CTTcp in component CTTcp (nM).
 * CONSTANTS[58] is kDNA_onTTcp in component CTTcp (second_order_rate_constant).
 * CONSTANTS[59] is kDNA_offTTcp in component CTTcp (first_order_rate_constant).
 * ALGEBRAIC[3] is T in component CTpf (nM).
 * CONSTANTS[60] is NTp in component CTpf (dimensionless).
 * CONSTANTS[61] is CTp in component model_parameters (nM).
 * ALGEBRAIC[4] is D in component CDpf (nM).
 * CONSTANTS[62] is NDp in component CDpf (dimensionless).
 * CONSTANTS[63] is CDp in component model_parameters (nM).
 * ALGEBRAIC[19] is CR in component CR (nM).
 * CONSTANTS[64] is CDNAcd in component model_parameters (nM).
 * CONSTANTS[65] is CDNAsec in component model_parameters (nM).
 * CONSTANTS[66] is CDNA5a in component model_parameters (nM).
 * CONSTANTS[67] is CDNAcp in component model_parameters (nM).
 * ALGEBRAIC[9] is DNAocp in component DNAocp (dimensionless).
 * ALGEBRAIC[10] is DNAosec in component DNAosec (dimensionless).
 * ALGEBRAIC[11] is DNAocd in component DNAocd (dimensionless).
 * ALGEBRAIC[12] is DNAo5a in component DNAo5a (dimensionless).
 * STATES[27] is ATb in component ATb (nanomole).
 * CONSTANTS[68] is CTb in component model_parameters (nM).
 * CONSTANTS[69] is PTb in component model_parameters (dimensionless).
 * STATES[28] is ADb in component ADb (nanomole).
 * CONSTANTS[70] is CDb in component model_parameters (nM).
 * CONSTANTS[71] is PDb in component model_parameters (dimensionless).
 * STATES[29] is ALH in component ALH (nanomole).
 * CONSTANTS[72] is kLH1 in component ALH (l_hr).
 * CONSTANTS[73] is kLH2 in component ALH (nmol_hr).
 * CONSTANTS[74] is kLH3 in component ALH (nmol_hr).
 * CONSTANTS[75] is kLH4 in component ALH (first_order_rate_constant).
 * CONSTANTS[76] is alpha_T in component ALH (dimensionless).
 * CONSTANTS[77] is alpha_D in component ALH (dimensionless).
 * ALGEBRAIC[13] is A in component ALH (nmol_hr).
 * CONSTANTS[91] is B in component ALH (nmol_hr).
 * STATES[30] is AR in component AR (nanomole).
 * CONSTANTS[78] is k1R in component AR (nmol_hr).
 * CONSTANTS[79] is keR in component AR (l_hr).
 * ALGEBRAIC[16] is Vp in component Vp (litre).
 * CONSTANTS[80] is kQp in component Qp (first_order_rate_constant).
 * ALGEBRAIC[14] is Vpc in component Qp (litre).
 * STATES[31] is VPC1 in component VPC1 (litre).
 * CONSTANTS[81] is VPC2 in component model_parameters (litre).
 * ALGEBRAIC[15] is Vmax in component Vmax (nmol_hr).
 * CONSTANTS[82] is k5a in component Vmax (nmol_hr).
 * CONSTANTS[83] is kcpl in component VPC1 (kg_hr).
 * CONSTANTS[84] is kcd1 in component VPC1 (first_order_rate_constant).
 * CONSTANTS[85] is VPC1b in component model_parameters (kg).
 * STATES[32] is VPL1 in component VPL1 (litre).
 * CONSTANTS[86] is ksec in component VPL1 (kg_hr).
 * CONSTANTS[87] is kflo in component VPL1 (first_order_rate_constant).
 * CONSTANTS[88] is VPL2 in component model_parameters (litre).
 * CONSTANTS[89] is Qc in component model_parameters (l_hr).
 * RATES[0] is d/dt ATbl in component ATbl (nanomole).
 * RATES[1] is d/dt ADbl in component ADbl (nanomole).
 * RATES[2] is d/dt CT_A in component CT_A (nM).
 * RATES[3] is d/dt CD_A in component CD_A (nM).
 * RATES[4] is d/dt ATl in component ATl (nanomole).
 * RATES[5] is d/dt ADl in component ADl (nanomole).
 * RATES[6] is d/dt ATif in component ATif (nanomole).
 * RATES[7] is d/dt ATst in component ATst (nanomole).
 * RATES[8] is d/dt ATp in component ATp (nanomole).
 * RATES[9] is d/dt ADp in component ADp (nanomole).
 * RATES[10] is d/dt CT_R in component CT_R (nM).
 * RATES[11] is d/dt CD_R in component CD_R (nM).
 * RATES[12] is d/dt CDT in component CDT (nM).
 * RATES[13] is d/dt CDD in component CDD (nM).
 * RATES[14] is d/dt CTT in component CTT (nM).
 * RATES[15] is d/dt CDD5a in component CDD5a (nM).
 * RATES[16] is d/dt CDDcd in component CDDcd (nM).
 * RATES[17] is d/dt CDDsec in component CDDsec (nM).
 * RATES[18] is d/dt CDDcp in component CDDcp (nM).
 * RATES[19] is d/dt CDT5a in component CDT5a (nM).
 * RATES[20] is d/dt CDTcd in component CDTcd (nM).
 * RATES[21] is d/dt CDTsec in component CDTsec (nM).
 * RATES[22] is d/dt CDTcp in component CDTcp (nM).
 * RATES[23] is d/dt CTT5a in component CTT5a (nM).
 * RATES[24] is d/dt CTTcd in component CTTcd (nM).
 * RATES[25] is d/dt CTTsec in component CTTsec (nM).
 * RATES[26] is d/dt CTTcp in component CTTcp (nM).
 * RATES[27] is d/dt ATb in component ATb (nanomole).
 * RATES[28] is d/dt ADb in component ADb (nanomole).
 * RATES[29] is d/dt ALH in component ALH (nanomole).
 * RATES[30] is d/dt AR in component AR (nanomole).
 * RATES[31] is d/dt VPC1 in component VPC1 (litre).
 * RATES[32] is d/dt VPL1 in component VPL1 (litre).
 * There are a total of 1 condition variables.
 */
void
initConsts(double* CONSTANTS, double* RATES, double *STATES)
{
STATES[0] = 0.0;
CONSTANTS[0] = 0.17;
CONSTANTS[1] = 1.06;
CONSTANTS[2] = 0.061;
CONSTANTS[3] = 7.60;
CONSTANTS[4] = 0.56;
STATES[1] = 0.0;
CONSTANTS[5] = 0.59;
STATES[2] = 0.0;
CONSTANTS[6] = 0.18;
CONSTANTS[7] = 8131.0;
STATES[3] = 0.0;
CONSTANTS[8] = 0.15;
CONSTANTS[9] = 5407.0;
CONSTANTS[10] = 5.00E5;
STATES[4] = 0.0;
CONSTANTS[11] = 87.93;
CONSTANTS[12] = 40.00;
CONSTANTS[13] = 3.65;
CONSTANTS[14] = 2.75;
STATES[5] = 0.0;
CONSTANTS[15] = 77.20;
CONSTANTS[16] = 2.00;
CONSTANTS[17] = 9.92;
CONSTANTS[18] = 0.92;
STATES[6] = 0.0;
CONSTANTS[19] = 1000.0;
CONSTANTS[20] = 1.96;
CONSTANTS[21] = 307.29;
CONSTANTS[22] = 307.29;
CONSTANTS[23] = 0.104;
CONSTANTS[24] = 1.00;
STATES[7] = 0.0;
STATES[8] = 0.0;
CONSTANTS[25] = 2.89;
STATES[9] = 0.0;
STATES[10] = 0.0;
CONSTANTS[26] = 0.14;
CONSTANTS[27] = 0.069;
STATES[11] = 0.0;
CONSTANTS[28] = 0.053;
CONSTANTS[29] = 0.018;
STATES[12] = 0.0;
CONSTANTS[30] = 0.14;
CONSTANTS[31] = 3.13;
STATES[13] = 0.0;
CONSTANTS[32] = 0.14;
CONSTANTS[33] = 3.13;
STATES[14] = 0.0;
CONSTANTS[34] = 0.14;
CONSTANTS[35] = 3.13;
STATES[15] = 0.0;
CONSTANTS[36] = 0.14;
CONSTANTS[37] = 0.07;
STATES[16] = 0.0;
CONSTANTS[38] = 0.14;
CONSTANTS[39] = 0.1;
STATES[17] = 0.0;
CONSTANTS[40] = 0.14;
CONSTANTS[41] = 0.2;
STATES[18] = 0.0;
CONSTANTS[42] = 0.14;
CONSTANTS[43] = 0.7;
STATES[19] = 0.0;
CONSTANTS[44] = 0.14;
CONSTANTS[45] = 0.56;
STATES[20] = 0.0;
CONSTANTS[46] = 0.14;
CONSTANTS[47] = 0.8;
STATES[21] = 0.0;
CONSTANTS[48] = 0.14;
CONSTANTS[49] = 1.6;
STATES[22] = 0.0;
CONSTANTS[50] = 0.14;
CONSTANTS[51] = 5.6;
STATES[23] = 0.0;
CONSTANTS[52] = 0.14;
CONSTANTS[53] = 0.84;
STATES[24] = 0.0;
CONSTANTS[54] = 0.14;
CONSTANTS[55] = 1.2;
STATES[25] = 0.0;
CONSTANTS[56] = 0.14;
CONSTANTS[57] = 2.4;
STATES[26] = 0.0;
CONSTANTS[58] = 0.14;
CONSTANTS[59] = 8.4;
CONSTANTS[60] = 0.79;
CONSTANTS[61] = 11.38;
CONSTANTS[62] = 1.00;
CONSTANTS[63] = 52.46;
CONSTANTS[64] = 0.075;
CONSTANTS[65] = 0.075;
CONSTANTS[66] = 0.075;
CONSTANTS[67] = 0.075;
STATES[27] = 0.0;
CONSTANTS[68] = 0.6275;
CONSTANTS[69] = 1.00;
STATES[28] = 0.0;
CONSTANTS[70] = 0.019884;
CONSTANTS[71] = 0.62;
STATES[29] = 0.0;
CONSTANTS[72] = 0.13;
CONSTANTS[73] = 0.026;
CONSTANTS[74] = 1.68E-4;
CONSTANTS[75] = 0.80;
CONSTANTS[76] = 0.25;
CONSTANTS[77] = 0.75;
STATES[30] = 0.0;
CONSTANTS[78] = 68.15;
CONSTANTS[79] = 71.90;
CONSTANTS[80] = 73.84;
STATES[31] = 0.0;
CONSTANTS[81] = 5.08E-5;
CONSTANTS[82] = 3.02;
CONSTANTS[83] = 1.17E-7;
CONSTANTS[84] = 0.014;
CONSTANTS[85] = 1E-4;
STATES[32] = 0.0;
CONSTANTS[86] = 8.44E-6;
CONSTANTS[87] = 0.043;
CONSTANTS[88] = 3.08E-6;
CONSTANTS[89] = 6.08;
CONSTANTS[90] = CONSTANTS[17]/CONSTANTS[14];
CONSTANTS[91] = CONSTANTS[74];
CONSTANTS[96] =  CONSTANTS[19]*(CONSTANTS[21] - CONSTANTS[22]/CONSTANTS[24]);
CONSTANTS[92] = CONSTANTS[18]/CONSTANTS[16];
CONSTANTS[93] = CONSTANTS[21]/CONSTANTS[20];
CONSTANTS[94] = CONSTANTS[68]/CONSTANTS[69];
CONSTANTS[95] = CONSTANTS[70]/CONSTANTS[71];
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[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;
RATES[16] = 0.1001;
RATES[17] = 0.1001;
RATES[18] = 0.1001;
RATES[19] = 0.1001;
RATES[20] = 0.1001;
RATES[21] = 0.1001;
RATES[22] = 0.1001;
RATES[23] = 0.1001;
RATES[24] = 0.1001;
RATES[25] = 0.1001;
RATES[26] = 0.1001;
RATES[27] = 0.1001;
RATES[28] = 0.1001;
RATES[29] = 0.1001;
RATES[30] = 0.1001;
RATES[31] = 0.1001;
RATES[32] = 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[21]*(CONSTANTS[94] - ALGEBRAIC[0])+ ALGEBRAIC[20]*(ALGEBRAIC[17] - CONSTANTS[3])+ CONSTANTS[1]*(CONSTANTS[90] - CONSTANTS[3])+ CONSTANTS[2]*(1.00000 - CONSTANTS[4])*(CONSTANTS[93] - ALGEBRAIC[0])+CONSTANTS[0];
resid[1] = RATES[1] -  ALGEBRAIC[22]*(CONSTANTS[95] - ALGEBRAIC[1])+ ALGEBRAIC[20]*(ALGEBRAIC[18] - ALGEBRAIC[1])+ CONSTANTS[1]*(CONSTANTS[92] - CONSTANTS[5]);
resid[2] = RATES[2] -  CONSTANTS[6]*ALGEBRAIC[0]*ALGEBRAIC[2] -  CONSTANTS[7]*STATES[2];
resid[3] = RATES[3] -  CONSTANTS[8]*ALGEBRAIC[1]*ALGEBRAIC[2] -  CONSTANTS[9]*STATES[3];
resid[4] = RATES[4] -  CONSTANTS[1]*(CONSTANTS[3] - CONSTANTS[90]) - (( CONSTANTS[13]*CONSTANTS[90])/(CONSTANTS[12]+CONSTANTS[90])+ CONSTANTS[11]*(STATES[4]/CONSTANTS[14]));
resid[5] = RATES[5] -  CONSTANTS[1]*(CONSTANTS[5] - CONSTANTS[92]) - (( CONSTANTS[13]*CONSTANTS[90])/(CONSTANTS[12]+CONSTANTS[90])+ CONSTANTS[15]*(STATES[5]/CONSTANTS[16]));
resid[6] = RATES[6] -  CONSTANTS[2]*(1.00000 - CONSTANTS[4])*(ALGEBRAIC[0] - CONSTANTS[21]/CONSTANTS[20])+ CONSTANTS[19]*(CONSTANTS[22]/CONSTANTS[24] - CONSTANTS[21])+ CONSTANTS[11]*CONSTANTS[23];
resid[7] = RATES[8] -  ALGEBRAIC[20]*(CONSTANTS[3] - ALGEBRAIC[17]) - ( CONSTANTS[25]*ALGEBRAIC[17])/(CONSTANTS[12]+ALGEBRAIC[17]);
resid[8] = RATES[9] -  ALGEBRAIC[20]*(CONSTANTS[5] - ALGEBRAIC[18]) - ( CONSTANTS[25]*ALGEBRAIC[17])/(CONSTANTS[12]+ALGEBRAIC[17]);
resid[9] = RATES[10] -  CONSTANTS[26]*ALGEBRAIC[17]*ALGEBRAIC[23] -  CONSTANTS[27]*STATES[10];
resid[10] = RATES[11] -  CONSTANTS[28]*ALGEBRAIC[18]*ALGEBRAIC[23] -  CONSTANTS[29]*STATES[11];
resid[11] = RATES[12] -  CONSTANTS[30]*STATES[11]*STATES[10] -  CONSTANTS[31]*STATES[12];
resid[12] = RATES[13] -  CONSTANTS[32]*pow(STATES[11], 2.00000) -  CONSTANTS[33]*STATES[13];
resid[13] = RATES[14] -  CONSTANTS[34]*pow(STATES[10], 2.00000) -  CONSTANTS[35]*STATES[14];
resid[14] = RATES[15] -  CONSTANTS[36]*STATES[13]*ALGEBRAIC[7] -  CONSTANTS[37]*STATES[15];
resid[15] = RATES[16] -  CONSTANTS[38]*STATES[13]*ALGEBRAIC[5] -  CONSTANTS[39]*STATES[16];
resid[16] = RATES[17] -  CONSTANTS[40]*STATES[13]*ALGEBRAIC[6] -  CONSTANTS[41]*STATES[17];
resid[17] = RATES[18] -  CONSTANTS[42]*STATES[13]*ALGEBRAIC[8] -  CONSTANTS[43]*STATES[18];
resid[18] = RATES[19] -  CONSTANTS[44]*STATES[12]*ALGEBRAIC[7] -  CONSTANTS[45]*STATES[19];
resid[19] = RATES[20] -  CONSTANTS[46]*STATES[12]*ALGEBRAIC[5] -  CONSTANTS[47]*STATES[20];
resid[20] = RATES[21] -  CONSTANTS[48]*STATES[12]*ALGEBRAIC[6] -  CONSTANTS[49]*STATES[21];
resid[21] = RATES[22] -  CONSTANTS[50]*STATES[12]*ALGEBRAIC[8] -  CONSTANTS[51]*STATES[22];
resid[22] = RATES[23] -  CONSTANTS[52]*STATES[14]*ALGEBRAIC[7] -  CONSTANTS[53]*STATES[23];
resid[23] = RATES[24] -  CONSTANTS[54]*STATES[14]*ALGEBRAIC[5] -  CONSTANTS[55]*STATES[24];
resid[24] = RATES[25] -  CONSTANTS[56]*STATES[14]*ALGEBRAIC[6] -  CONSTANTS[57]*STATES[25];
resid[25] = RATES[26] -  CONSTANTS[58]*STATES[14]*ALGEBRAIC[8] -  CONSTANTS[59]*STATES[26];
resid[26] = RATES[27] -  ALGEBRAIC[21]*(ALGEBRAIC[0] - CONSTANTS[68]/CONSTANTS[69]);
resid[27] = RATES[28] -  ALGEBRAIC[22]*(ALGEBRAIC[1] - CONSTANTS[70]/CONSTANTS[71]);
resid[28] = RATES[29] - (CONDVAR[0]>0.00000 ? ALGEBRAIC[13] -  CONSTANTS[75]*STATES[29] : CONSTANTS[91] -  CONSTANTS[75]*STATES[29]);
resid[29] = RATES[30] - CONSTANTS[78] -  CONSTANTS[79]*ALGEBRAIC[23];
resid[30] = RATES[31] -  (STATES[31]/CONSTANTS[85])*CONSTANTS[83]*ALGEBRAIC[9] -  CONSTANTS[84]*(1.00000 - ALGEBRAIC[11])*STATES[31];
resid[31] = RATES[32] -  (STATES[31]/CONSTANTS[85])*CONSTANTS[86]*ALGEBRAIC[10] -  CONSTANTS[87]*STATES[32];
resid[32] = RATES[7] - CONSTANTS[96];
}
void
computeVariables(double VOI, double* CONSTANTS, double* RATES, double* STATES, double* ALGEBRAIC)
{
ALGEBRAIC[12] = (STATES[23]+STATES[15]+STATES[19])/CONSTANTS[66];
ALGEBRAIC[15] =  CONSTANTS[82]*ALGEBRAIC[12];
}
void
computeEssentialVariables(double VOI, double* CONSTANTS, double* RATES, double* STATES, double* ALGEBRAIC)
{
ALGEBRAIC[0] = CONSTANTS[3] - STATES[2];
ALGEBRAIC[1] = CONSTANTS[5] - STATES[3];
ALGEBRAIC[2] = CONSTANTS[10] - (STATES[2]+STATES[3]);
ALGEBRAIC[5] = CONSTANTS[64] - (STATES[24]+STATES[16]+STATES[20]);
ALGEBRAIC[6] = CONSTANTS[65] - (STATES[25]+STATES[17]+STATES[21]);
ALGEBRAIC[7] = CONSTANTS[66] - (STATES[23]+STATES[15]+STATES[19]);
ALGEBRAIC[8] = CONSTANTS[67] - (STATES[26]+STATES[18]+STATES[22]);
ALGEBRAIC[9] = (STATES[26]+STATES[18]+STATES[22])/CONSTANTS[67];
ALGEBRAIC[10] = (STATES[25]+STATES[17]+STATES[21])/CONSTANTS[65];
ALGEBRAIC[11] = (STATES[24]+STATES[16]+STATES[20])/CONSTANTS[64];
ALGEBRAIC[13] =  - CONSTANTS[72]*( CONSTANTS[76]*ALGEBRAIC[0]+ CONSTANTS[77]*ALGEBRAIC[1])+CONSTANTS[73];
ALGEBRAIC[3] = STATES[25]+STATES[21]+STATES[23]+STATES[19]+STATES[24]+STATES[20]+STATES[26]+STATES[22];
ALGEBRAIC[17] = (CONSTANTS[61] - (STATES[10]+ 2.00000*STATES[14]+STATES[12]+ALGEBRAIC[3]))/(1.00000+CONSTANTS[60]);
ALGEBRAIC[4] = STATES[17]+STATES[21]+STATES[15]+STATES[19]+STATES[16]+STATES[20]+STATES[18]+STATES[22];
ALGEBRAIC[18] = (CONSTANTS[63] - (STATES[11]+ 2.00000*STATES[13]+STATES[12]+ALGEBRAIC[4]))/(1.00000+CONSTANTS[62]);
ALGEBRAIC[14] = STATES[31]+CONSTANTS[81];
ALGEBRAIC[20] =  CONSTANTS[80]*ALGEBRAIC[14];
ALGEBRAIC[21] = CONSTANTS[89] - (ALGEBRAIC[20]+CONSTANTS[2]+CONSTANTS[1]);
ALGEBRAIC[22] = CONSTANTS[89] - (ALGEBRAIC[20]+CONSTANTS[1]);
ALGEBRAIC[16] = STATES[31]+CONSTANTS[81]+STATES[32]+CONSTANTS[88];
ALGEBRAIC[19] = STATES[30]/ALGEBRAIC[16];
ALGEBRAIC[23] = ALGEBRAIC[19] - (STATES[10]+STATES[11]+ 2.00000*(STATES[14]+STATES[13]+STATES[12])+ 2.00000*(ALGEBRAIC[5]+ALGEBRAIC[6]+ALGEBRAIC[8]+ALGEBRAIC[7]));
}
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;
SI[31] = 1.0;
SI[32] = 1.0;
}
void
computeRoots(double VOI, double* CONSTANTS, double* RATES, double* OLDRATES, double* STATES,
             double* OLDSTATES, double* ALGEBRAIC, double* CONDVARS)
{
CONDVAR[0] = ALGEBRAIC[13] - CONSTANTS[91];
}