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 122 entries in the algebraic variable array.
   There are a total of 2 entries in each of the rate and state variable arrays.
   There are a total of 34 entries in the constant variable array.
 */
/*
 * CONSTANTS[0] is k1_m in component gas_exchange (dimensionless).
 * CONSTANTS[1] is k1_81m in component gas_exchange (dimensionless).
 * CONSTANTS[2] is k2_m in component gas_exchange (dimensionless).
 * CONSTANTS[3] is k3_m in component gas_exchange (dimensionless).
 * CONSTANTS[4] is K3_81m in component gas_exchange (dimensionless).
 * CONSTANTS[5] is k4_m in component gas_exchange (dimensionless).
 * CONSTANTS[6] is pH_m in component gas_exchange (dimensionless).
 * CONSTANTS[7] is k1_f in component gas_exchange (dimensionless).
 * CONSTANTS[8] is k2_f in component gas_exchange (dimensionless).
 * CONSTANTS[9] is k3_f in component gas_exchange (dimensionless).
 * CONSTANTS[10] is k4_f in component gas_exchange (dimensionless).
 * CONSTANTS[11] is pH_f in component gas_exchange (dimensionless).
 * STATES[0] is Pin_m in component gas_exchange (mmHg).
 * STATES[1] is Pin_f in component gas_exchange (mmHg).
 * ALGEBRAIC[0] is x_m in component gas_exchange (dimensionless).
 * ALGEBRAIC[1] is x_m1 in component gas_exchange (dimensionless).
 * ALGEBRAIC[3] is x_f in component gas_exchange (dimensionless).
 * ALGEBRAIC[4] is x_f1 in component gas_exchange (dimensionless).
 * ALGEBRAIC[2] is S_m in component gas_exchange (dimensionless).
 * ALGEBRAIC[5] is S_f in component gas_exchange (dimensionless).
 * VOI is t in component gas_exchange (second).
 * ALGEBRAIC[6] is O2_m in component gas_exchange (ml_per_ml).
 * ALGEBRAIC[7] is O2_f in component gas_exchange (ml_per_ml).
 * CONSTANTS[12] is Hb_m in component gas_exchange (dimensionless).
 * CONSTANTS[13] is Hb_f in component gas_exchange (dimensionless).
 * CONSTANTS[14] is a in component gas_exchange (dimensionless).
 * CONSTANTS[15] is ks_m in component gas_exchange (dimensionless).
 * CONSTANTS[16] is ks_f in component gas_exchange (dimensionless).
 * CONSTANTS[17] is kh in component gas_exchange (dimensionless).
 * CONSTANTS[18] is B in component gas_exchange (dimensionless).
 * CONSTANTS[19] is V_m in component gas_exchange (ml).
 * CONSTANTS[20] is V_f in component gas_exchange (ml).
 * CONSTANTS[21] is Q_m in component gas_exchange (ml_per_min).
 * CONSTANTS[22] is Q_f in component gas_exchange (ml_per_min).
 * CONSTANTS[23] is Dm in component gas_exchange (ml_per_ml_min_mmHg).
 * CONSTANTS[24] is c1 in component gas_exchange (dimensionless).
 * CONSTANTS[25] is c2 in component gas_exchange (dimensionless).
 * CONSTANTS[26] is c3 in component gas_exchange (dimensionless).
 * CONSTANTS[27] is c4 in component gas_exchange (dimensionless).
 * ALGEBRAIC[10] is theta_m in component gas_exchange (dimensionless).
 * ALGEBRAIC[13] is theta_f in component gas_exchange (dimensionless).
 * ALGEBRAIC[8] is x1_m in component gas_exchange (dimensionless).
 * ALGEBRAIC[11] is x1_f in component gas_exchange (dimensionless).
 * ALGEBRAIC[14] is R_m in component gas_exchange (dimensionless).
 * ALGEBRAIC[15] is R_f in component gas_exchange (dimensionless).
 * CONSTANTS[28] is R_p in component gas_exchange (dimensionless).
 * ALGEBRAIC[16] is R_t in component gas_exchange (dimensionless).
 * ALGEBRAIC[17] is Dp in component gas_exchange (dimensionless).
 * ALGEBRAIC[18] is dodt_m in component gas_exchange (dimensionless).
 * ALGEBRAIC[19] is dodt_f in component gas_exchange (dimensionless).
 * ALGEBRAIC[20] is O2_mnew in component gas_exchange (ml_per_ml).
 * ALGEBRAIC[21] is O2_fnew in component gas_exchange (ml_per_ml).
 * ALGEBRAIC[22] is f_m in component gas_exchange (dimensionless).
 * ALGEBRAIC[23] is f_f in component gas_exchange (dimensionless).
 * ALGEBRAIC[24] is upper_m in component gas_exchange (dimensionless).
 * ALGEBRAIC[25] is lower_m in component gas_exchange (dimensionless).
 * ALGEBRAIC[27] is upper_f in component gas_exchange (dimensionless).
 * ALGEBRAIC[28] is lower_f in component gas_exchange (dimensionless).
 * ALGEBRAIC[29] is dfdP_f in component gas_exchange (dimensionless).
 * ALGEBRAIC[26] is dfdP_m in component gas_exchange (dimensionless).
 * CONSTANTS[29] is tt in component gas_exchange (second).
 * CONSTANTS[30] is dt in component gas_exchange (second).
 * ALGEBRAIC[30] is Pend1_m in component gas_exchange (mmHg).
 * ALGEBRAIC[31] is Pend1_f in component gas_exchange (mmHg).
 * ALGEBRAIC[9] is theta_96_m in component gas_exchange (dimensionless).
 * ALGEBRAIC[12] is theta_96_f in component gas_exchange (dimensionless).
 * ALGEBRAIC[32] is x_m_sec in component gas_exchange (dimensionless).
 * ALGEBRAIC[33] is x_m1_sec in component gas_exchange (dimensionless).
 * ALGEBRAIC[34] is S_m_sec in component gas_exchange (dimensionless).
 * ALGEBRAIC[35] is x_f_sec in component gas_exchange (dimensionless).
 * ALGEBRAIC[36] is x_f1_sec in component gas_exchange (dimensionless).
 * ALGEBRAIC[37] is S_f_sec in component gas_exchange (dimensionless).
 * ALGEBRAIC[39] is theta_96_m_sec in component gas_exchange (dimensionless).
 * ALGEBRAIC[42] is theta_96_f_sec in component gas_exchange (dimensionless).
 * ALGEBRAIC[38] is x1_m_sec in component gas_exchange (dimensionless).
 * ALGEBRAIC[40] is theta_m_sec in component gas_exchange (dimensionless).
 * ALGEBRAIC[41] is x1_f_sec in component gas_exchange (dimensionless).
 * ALGEBRAIC[43] is theta_f_sec in component gas_exchange (dimensionless).
 * ALGEBRAIC[44] is R_m_sec in component gas_exchange (dimensionless).
 * ALGEBRAIC[45] is R_f_sec in component gas_exchange (dimensionless).
 * CONSTANTS[31] is R_p_sec in component gas_exchange (dimensionless).
 * ALGEBRAIC[46] is R_t_sec in component gas_exchange (dimensionless).
 * ALGEBRAIC[47] is Dp_sec in component gas_exchange (dimensionless).
 * ALGEBRAIC[48] is dodt_m_sec in component gas_exchange (dimensionless).
 * ALGEBRAIC[49] is dodt_f_sec in component gas_exchange (dimensionless).
 * ALGEBRAIC[50] is O2_mnew_sec in component gas_exchange (ml_per_ml).
 * ALGEBRAIC[51] is O2_fnew_sec in component gas_exchange (ml_per_ml).
 * ALGEBRAIC[52] is f_m_sec in component gas_exchange (dimensionless).
 * ALGEBRAIC[53] is f_f_sec in component gas_exchange (dimensionless).
 * ALGEBRAIC[54] is upper_m_sec in component gas_exchange (dimensionless).
 * ALGEBRAIC[55] is lower_m_sec in component gas_exchange (dimensionless).
 * ALGEBRAIC[56] is dfdP_m_sec in component gas_exchange (dimensionless).
 * ALGEBRAIC[57] is upper_f_sec in component gas_exchange (dimensionless).
 * ALGEBRAIC[58] is lower_f_sec in component gas_exchange (dimensionless).
 * ALGEBRAIC[59] is dfdP_f_sec in component gas_exchange (dimensionless).
 * ALGEBRAIC[60] is Pend2_m in component gas_exchange (mmHg).
 * ALGEBRAIC[61] is Pend2_f in component gas_exchange (mmHg).
 * ALGEBRAIC[62] is x_m_trd in component gas_exchange (dimensionless).
 * ALGEBRAIC[63] is x_m1_trd in component gas_exchange (dimensionless).
 * ALGEBRAIC[64] is S_m_trd in component gas_exchange (dimensionless).
 * ALGEBRAIC[65] is x_f_trd in component gas_exchange (dimensionless).
 * ALGEBRAIC[66] is x_f1_trd in component gas_exchange (dimensionless).
 * ALGEBRAIC[67] is S_f_trd in component gas_exchange (dimensionless).
 * ALGEBRAIC[69] is theta_96_m_trd in component gas_exchange (dimensionless).
 * ALGEBRAIC[72] is theta_96_f_trd in component gas_exchange (dimensionless).
 * ALGEBRAIC[68] is x1_m_trd in component gas_exchange (dimensionless).
 * ALGEBRAIC[70] is theta_m_trd in component gas_exchange (dimensionless).
 * ALGEBRAIC[71] is x1_f_trd in component gas_exchange (dimensionless).
 * ALGEBRAIC[73] is theta_f_trd in component gas_exchange (dimensionless).
 * ALGEBRAIC[74] is R_m_trd in component gas_exchange (dimensionless).
 * ALGEBRAIC[75] is R_f_trd in component gas_exchange (dimensionless).
 * CONSTANTS[32] is R_p_trd in component gas_exchange (dimensionless).
 * ALGEBRAIC[76] is R_t_trd in component gas_exchange (dimensionless).
 * ALGEBRAIC[77] is Dp_trd in component gas_exchange (dimensionless).
 * ALGEBRAIC[78] is dodt_m_trd in component gas_exchange (dimensionless).
 * ALGEBRAIC[79] is dodt_f_trd in component gas_exchange (dimensionless).
 * ALGEBRAIC[80] is O2_mnew_trd in component gas_exchange (ml_per_ml).
 * ALGEBRAIC[81] is O2_fnew_trd in component gas_exchange (ml_per_ml).
 * ALGEBRAIC[82] is f_m_trd in component gas_exchange (dimensionless).
 * ALGEBRAIC[83] is f_f_trd in component gas_exchange (dimensionless).
 * ALGEBRAIC[84] is upper_m_trd in component gas_exchange (dimensionless).
 * ALGEBRAIC[85] is lower_m_trd in component gas_exchange (dimensionless).
 * ALGEBRAIC[86] is dfdP_m_trd in component gas_exchange (dimensionless).
 * ALGEBRAIC[87] is upper_f_trd in component gas_exchange (dimensionless).
 * ALGEBRAIC[88] is lower_f_trd in component gas_exchange (dimensionless).
 * ALGEBRAIC[89] is dfdP_f_trd in component gas_exchange (dimensionless).
 * ALGEBRAIC[90] is Pend3_m in component gas_exchange (mmHg).
 * ALGEBRAIC[91] is Pend3_f in component gas_exchange (mmHg).
 * ALGEBRAIC[92] is x_m_for in component gas_exchange (dimensionless).
 * ALGEBRAIC[93] is x_m1_for in component gas_exchange (dimensionless).
 * ALGEBRAIC[94] is S_m_for in component gas_exchange (dimensionless).
 * ALGEBRAIC[95] is x_f_for in component gas_exchange (dimensionless).
 * ALGEBRAIC[96] is x_f1_for in component gas_exchange (dimensionless).
 * ALGEBRAIC[97] is S_f_for in component gas_exchange (dimensionless).
 * ALGEBRAIC[99] is theta_96_m_for in component gas_exchange (dimensionless).
 * ALGEBRAIC[102] is theta_96_f_for in component gas_exchange (dimensionless).
 * ALGEBRAIC[98] is x1_m_for in component gas_exchange (dimensionless).
 * ALGEBRAIC[100] is theta_m_for in component gas_exchange (dimensionless).
 * ALGEBRAIC[101] is x1_f_for in component gas_exchange (dimensionless).
 * ALGEBRAIC[103] is theta_f_for in component gas_exchange (dimensionless).
 * ALGEBRAIC[104] is R_m_for in component gas_exchange (dimensionless).
 * ALGEBRAIC[105] is R_f_for in component gas_exchange (dimensionless).
 * CONSTANTS[33] is R_p_for in component gas_exchange (dimensionless).
 * ALGEBRAIC[106] is R_t_for in component gas_exchange (dimensionless).
 * ALGEBRAIC[107] is Dp_for in component gas_exchange (dimensionless).
 * ALGEBRAIC[108] is dodt_m_for in component gas_exchange (dimensionless).
 * ALGEBRAIC[109] is dodt_f_for in component gas_exchange (dimensionless).
 * ALGEBRAIC[110] is O2_mnew_final in component gas_exchange (ml_per_ml).
 * ALGEBRAIC[111] is O2_fnew_final in component gas_exchange (ml_per_ml).
 * ALGEBRAIC[112] is f_m_final in component gas_exchange (dimensionless).
 * ALGEBRAIC[113] is f_f_final in component gas_exchange (dimensionless).
 * ALGEBRAIC[114] is upper_m_final in component gas_exchange (dimensionless).
 * ALGEBRAIC[115] is lower_m_final in component gas_exchange (dimensionless).
 * ALGEBRAIC[116] is dfdP_m_final in component gas_exchange (dimensionless).
 * ALGEBRAIC[117] is upper_f_final in component gas_exchange (dimensionless).
 * ALGEBRAIC[118] is lower_f_final in component gas_exchange (dimensionless).
 * ALGEBRAIC[119] is dfdP_f_final in component gas_exchange (dimensionless).
 * ALGEBRAIC[120] is Pfinal_m in component gas_exchange (mmHg).
 * ALGEBRAIC[121] is Pfinal_f in component gas_exchange (mmHg).
 * RATES[0] is d/dt Pin_m in component gas_exchange (mmHg).
 * RATES[1] is d/dt Pin_f in component gas_exchange (mmHg).
 * There are a total of 16 condition variables.
 */
void
initConsts(double* CONSTANTS, double* RATES, double *STATES)
{
CONSTANTS[0] = 1.4452;
CONSTANTS[1] = 1.4452;
CONSTANTS[2] = 0.456;
CONSTANTS[3] = 0.3711;
CONSTANTS[4] = 0.3711;
CONSTANTS[5] = 7.8322e+03;
CONSTANTS[6] = 7.4;
CONSTANTS[7] = 1.302;
CONSTANTS[8] = 0.464;
CONSTANTS[9] = 0.395;
CONSTANTS[10] = 2.2643e+03;
CONSTANTS[11] = 7.35;
STATES[0] = 33;
STATES[1] = 15;
CONSTANTS[12] = 12.5;
CONSTANTS[13] = 15.5;
CONSTANTS[14] = 3.0263e-05;
CONSTANTS[15] = 164;
CONSTANTS[16] = 164;
CONSTANTS[17] = 164;
CONSTANTS[18] = 1;
CONSTANTS[19] = 4.89e-7;
CONSTANTS[20] = 4.89e-7;
CONSTANTS[21] = 1.2014e-04;
CONSTANTS[22] = 1.2014e-04;
CONSTANTS[23] = 6.21;
CONSTANTS[24] = 3.287;
CONSTANTS[25] = 0.1117;
CONSTANTS[26] = 7.05e-3;
CONSTANTS[27] = 0.8142;
CONSTANTS[28] = 1.00000/CONSTANTS[23];
CONSTANTS[29] = CONSTANTS[20]/(CONSTANTS[22]/60.0000);
CONSTANTS[30] = CONSTANTS[29]/100.000;
CONSTANTS[31] = 1.00000/CONSTANTS[23];
CONSTANTS[32] = 1.00000/CONSTANTS[23];
CONSTANTS[33] = 1.00000/CONSTANTS[23];
RATES[0] = 0.1001;
RATES[1] = 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[120] - STATES[0])/CONSTANTS[30];
resid[1] = RATES[1] - (ALGEBRAIC[121] - STATES[1])/CONSTANTS[30];
}
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] = (( 1.34000*CONSTANTS[12])/100.000)/( CONSTANTS[5]*pow(STATES[0], - 1.00000/CONSTANTS[3])+1.00000)+ CONSTANTS[14]*STATES[0];
ALGEBRAIC[0] = ((arbitrary_log(STATES[0], 10) - CONSTANTS[0])+ CONSTANTS[2]*(CONSTANTS[6] - 7.40000))/CONSTANTS[3];
ALGEBRAIC[1] = pow(10.0000, ALGEBRAIC[0]);
ALGEBRAIC[2] = ( 100.000*ALGEBRAIC[1])/(1.00000+ALGEBRAIC[1]);
ALGEBRAIC[8] = (CONDVAR[0]>0.00000 ? exp( - 1.00000*CONSTANTS[25]*(100.000 - 96.0000)) : exp( - 1.00000*CONSTANTS[25]*(100.000 - ALGEBRAIC[2])));
ALGEBRAIC[9] = ( (( (( (( CONSTANTS[24]*(1.00000 - ALGEBRAIC[8])+ CONSTANTS[26]*ALGEBRAIC[2]) - CONSTANTS[27])*1.34000)/100.000)*CONSTANTS[12])/0.200000)*CONSTANTS[15])/CONSTANTS[17];
ALGEBRAIC[10] = (CONDVAR[1]>0.00000 ? ALGEBRAIC[9] - ( ALGEBRAIC[9]*(96.0000 - ALGEBRAIC[2]))/- 4.00000 : ( (( (( (( CONSTANTS[24]*(1.00000 - ALGEBRAIC[8])+ CONSTANTS[26]*ALGEBRAIC[2]) - CONSTANTS[27])*1.34000)/100.000)*CONSTANTS[12])/0.200000)*CONSTANTS[15])/CONSTANTS[17]);
ALGEBRAIC[14] = 1.00000/( ALGEBRAIC[10]*CONSTANTS[19]);
ALGEBRAIC[3] = ((arbitrary_log(STATES[1], 10) - CONSTANTS[7])+ CONSTANTS[8]*(CONSTANTS[11] - 7.40000))/CONSTANTS[9];
ALGEBRAIC[4] = pow(10.0000, ALGEBRAIC[3]);
ALGEBRAIC[5] = ( 100.000*ALGEBRAIC[4])/(1.00000+ALGEBRAIC[4]);
ALGEBRAIC[11] = (CONDVAR[2]>0.00000 ? exp( - 1.00000*CONSTANTS[25]*(100.000 - 96.0000)) : exp( - 1.00000*CONSTANTS[25]*(100.000 - ALGEBRAIC[5])));
ALGEBRAIC[12] = ( (( (( (( CONSTANTS[24]*(1.00000 - ALGEBRAIC[11])+ CONSTANTS[26]*ALGEBRAIC[5]) - CONSTANTS[27])*1.34000)/100.000)*CONSTANTS[13])/0.200000)*CONSTANTS[16])/CONSTANTS[17];
ALGEBRAIC[13] = (CONDVAR[3]>0.00000 ? ALGEBRAIC[12] - ( ALGEBRAIC[12]*(96.0000 - ALGEBRAIC[5]))/- 4.00000 : ( (( (( (( CONSTANTS[24]*(1.00000 - ALGEBRAIC[11])+ CONSTANTS[26]*ALGEBRAIC[5]) - CONSTANTS[27])*1.34000)/100.000)*CONSTANTS[13])/0.200000)*CONSTANTS[16])/CONSTANTS[17]);
ALGEBRAIC[15] = 1.00000/( ALGEBRAIC[13]*CONSTANTS[20]);
ALGEBRAIC[16] = ALGEBRAIC[14]+ALGEBRAIC[15]+CONSTANTS[28];
ALGEBRAIC[17] = (1.00000/ALGEBRAIC[16])/60.0000;
ALGEBRAIC[18] = ( CONSTANTS[18]*- 1.00000*ALGEBRAIC[17]*(STATES[0] - STATES[1]))/CONSTANTS[19];
ALGEBRAIC[20] = ALGEBRAIC[6]+( ALGEBRAIC[18]*CONSTANTS[30])/2.00000;
ALGEBRAIC[22] = ((( 1.34000*CONSTANTS[12])/100.000)/( CONSTANTS[5]*pow(STATES[0], - 1.00000/CONSTANTS[3])+1.00000)+ CONSTANTS[14]*STATES[0]) - ALGEBRAIC[20];
ALGEBRAIC[24] =  1.34000*CONSTANTS[12]*CONSTANTS[5]*pow(STATES[0], - 1.00000/CONSTANTS[3] - 1.00000);
ALGEBRAIC[25] =  100.000*CONSTANTS[3]*pow( CONSTANTS[5]*pow(STATES[0], - 1.00000/CONSTANTS[3])+1.00000, 2.00000);
ALGEBRAIC[26] = ALGEBRAIC[24]/ALGEBRAIC[25]+CONSTANTS[14];
ALGEBRAIC[30] = STATES[0] - ALGEBRAIC[22]/ALGEBRAIC[26];
ALGEBRAIC[7] = (( 1.34000*CONSTANTS[13])/100.000)/( CONSTANTS[10]*pow(STATES[1], - 1.00000/CONSTANTS[9])+1.00000)+ CONSTANTS[14]*STATES[1];
ALGEBRAIC[19] =  (( (- 1.00000/CONSTANTS[18])*CONSTANTS[19])/CONSTANTS[20])*ALGEBRAIC[18];
ALGEBRAIC[21] = ALGEBRAIC[7]+( ALGEBRAIC[19]*CONSTANTS[30])/2.00000;
ALGEBRAIC[23] = ((( 1.34000*CONSTANTS[13])/100.000)/( CONSTANTS[10]*pow(STATES[1], - 1.00000/CONSTANTS[9])+1.00000)+ CONSTANTS[14]*STATES[1]) - ALGEBRAIC[21];
ALGEBRAIC[27] =  1.34000*CONSTANTS[13]*CONSTANTS[10]*pow(STATES[1], - 1.00000/CONSTANTS[9] - 1.00000);
ALGEBRAIC[28] =  100.000*CONSTANTS[9]*pow( CONSTANTS[10]*pow(STATES[1], - 1.00000/CONSTANTS[9])+1.00000, 2.00000);
ALGEBRAIC[29] = ALGEBRAIC[27]/ALGEBRAIC[28]+CONSTANTS[14];
ALGEBRAIC[31] = STATES[1] - ALGEBRAIC[23]/ALGEBRAIC[29];
ALGEBRAIC[32] = ((arbitrary_log(ALGEBRAIC[30], 10) - CONSTANTS[0])+ CONSTANTS[2]*(CONSTANTS[6] - 7.40000))/CONSTANTS[3];
ALGEBRAIC[33] = pow(10.0000, ALGEBRAIC[32]);
ALGEBRAIC[34] = ( 100.000*ALGEBRAIC[33])/(1.00000+ALGEBRAIC[33]);
ALGEBRAIC[38] = (CONDVAR[4]>0.00000 ? exp( - 1.00000*CONSTANTS[25]*(100.000 - 96.0000)) : exp( - 1.00000*CONSTANTS[25]*(100.000 - ALGEBRAIC[34])));
ALGEBRAIC[39] = ( (( (( (( CONSTANTS[24]*(1.00000 - ALGEBRAIC[38])+ CONSTANTS[26]*ALGEBRAIC[34]) - CONSTANTS[27])*1.34000)/100.000)*CONSTANTS[12])/0.200000)*CONSTANTS[15])/CONSTANTS[17];
ALGEBRAIC[40] = (CONDVAR[5]>0.00000 ? ALGEBRAIC[39] - ( ALGEBRAIC[39]*(96.0000 - ALGEBRAIC[34]))/- 4.00000 : ( (( (( (( CONSTANTS[24]*(1.00000 - ALGEBRAIC[38])+ CONSTANTS[26]*ALGEBRAIC[34]) - CONSTANTS[27])*1.34000)/100.000)*CONSTANTS[12])/0.200000)*CONSTANTS[15])/CONSTANTS[17]);
ALGEBRAIC[44] = 1.00000/( ALGEBRAIC[40]*CONSTANTS[19]);
ALGEBRAIC[35] = ((arbitrary_log(ALGEBRAIC[31], 10) - CONSTANTS[7])+ CONSTANTS[8]*(CONSTANTS[11] - 7.40000))/CONSTANTS[9];
ALGEBRAIC[36] = pow(10.0000, ALGEBRAIC[35]);
ALGEBRAIC[37] = ( 100.000*ALGEBRAIC[36])/(1.00000+ALGEBRAIC[36]);
ALGEBRAIC[41] = (CONDVAR[6]>0.00000 ? exp( - 1.00000*CONSTANTS[25]*(100.000 - 96.0000)) : exp( - 1.00000*CONSTANTS[25]*(100.000 - ALGEBRAIC[37])));
ALGEBRAIC[42] = ( (( (( (( CONSTANTS[24]*(1.00000 - ALGEBRAIC[41])+ CONSTANTS[26]*ALGEBRAIC[37]) - CONSTANTS[27])*1.34000)/100.000)*CONSTANTS[13])/0.200000)*CONSTANTS[16])/CONSTANTS[17];
ALGEBRAIC[43] = (CONDVAR[7]>0.00000 ? ALGEBRAIC[42] - ( ALGEBRAIC[42]*(96.0000 - ALGEBRAIC[37]))/- 4.00000 : ( (( (( (( CONSTANTS[24]*(1.00000 - ALGEBRAIC[41])+ CONSTANTS[26]*ALGEBRAIC[37]) - CONSTANTS[27])*1.34000)/100.000)*CONSTANTS[13])/0.200000)*CONSTANTS[16])/CONSTANTS[17]);
ALGEBRAIC[45] = 1.00000/( ALGEBRAIC[43]*CONSTANTS[20]);
ALGEBRAIC[46] = ALGEBRAIC[44]+ALGEBRAIC[45]+CONSTANTS[31];
ALGEBRAIC[47] = (1.00000/ALGEBRAIC[46])/60.0000;
ALGEBRAIC[48] = ( CONSTANTS[18]*- 1.00000*ALGEBRAIC[47]*(ALGEBRAIC[30] - ALGEBRAIC[31]))/CONSTANTS[19];
ALGEBRAIC[50] = ALGEBRAIC[6]+( ALGEBRAIC[48]*CONSTANTS[30])/2.00000;
ALGEBRAIC[52] = ((( 1.34000*CONSTANTS[12])/100.000)/( CONSTANTS[5]*pow(ALGEBRAIC[30], - 1.00000/CONSTANTS[3])+1.00000)+ CONSTANTS[14]*ALGEBRAIC[30]) - ALGEBRAIC[50];
ALGEBRAIC[54] =  1.34000*CONSTANTS[12]*CONSTANTS[5]*pow(ALGEBRAIC[30], - 1.00000/CONSTANTS[3] - 1.00000);
ALGEBRAIC[55] =  100.000*CONSTANTS[3]*pow( CONSTANTS[5]*pow(ALGEBRAIC[30], - 1.00000/CONSTANTS[3])+1.00000, 2.00000);
ALGEBRAIC[56] = ALGEBRAIC[54]/ALGEBRAIC[55]+CONSTANTS[14];
ALGEBRAIC[60] = ALGEBRAIC[30] - ALGEBRAIC[52]/ALGEBRAIC[56];
ALGEBRAIC[49] =  (( (- 1.00000/CONSTANTS[18])*CONSTANTS[19])/CONSTANTS[20])*ALGEBRAIC[48];
ALGEBRAIC[51] = ALGEBRAIC[7]+( ALGEBRAIC[49]*CONSTANTS[30])/2.00000;
ALGEBRAIC[53] = ((( 1.34000*CONSTANTS[13])/100.000)/( CONSTANTS[10]*pow(ALGEBRAIC[31], - 1.00000/CONSTANTS[9])+1.00000)+ CONSTANTS[14]*ALGEBRAIC[31]) - ALGEBRAIC[51];
ALGEBRAIC[57] =  1.34000*CONSTANTS[13]*CONSTANTS[10]*pow(ALGEBRAIC[31], - 1.00000/CONSTANTS[9] - 1.00000);
ALGEBRAIC[58] =  100.000*CONSTANTS[9]*pow( CONSTANTS[10]*pow(ALGEBRAIC[31], - 1.00000/CONSTANTS[9])+1.00000, 2.00000);
ALGEBRAIC[59] = ALGEBRAIC[57]/ALGEBRAIC[58]+CONSTANTS[14];
ALGEBRAIC[61] = ALGEBRAIC[31] - ALGEBRAIC[53]/ALGEBRAIC[59];
ALGEBRAIC[62] = ((arbitrary_log(ALGEBRAIC[60], 10) - CONSTANTS[0])+ CONSTANTS[2]*(CONSTANTS[6] - 7.40000))/CONSTANTS[3];
ALGEBRAIC[63] = pow(10.0000, ALGEBRAIC[62]);
ALGEBRAIC[64] = ( 100.000*ALGEBRAIC[63])/(1.00000+ALGEBRAIC[63]);
ALGEBRAIC[68] = (CONDVAR[8]>0.00000 ? exp( - 1.00000*CONSTANTS[25]*(100.000 - 96.0000)) : exp( - 1.00000*CONSTANTS[25]*(100.000 - ALGEBRAIC[64])));
ALGEBRAIC[69] = ( (( (( (( CONSTANTS[24]*(1.00000 - ALGEBRAIC[68])+ CONSTANTS[26]*ALGEBRAIC[64]) - CONSTANTS[27])*1.34000)/100.000)*CONSTANTS[12])/0.200000)*CONSTANTS[15])/CONSTANTS[17];
ALGEBRAIC[70] = (CONDVAR[9]>0.00000 ? ALGEBRAIC[69] - ( ALGEBRAIC[69]*(96.0000 - ALGEBRAIC[64]))/- 4.00000 : ( (( (( (( CONSTANTS[24]*(1.00000 - ALGEBRAIC[68])+ CONSTANTS[26]*ALGEBRAIC[64]) - CONSTANTS[27])*1.34000)/100.000)*CONSTANTS[12])/0.200000)*CONSTANTS[15])/CONSTANTS[17]);
ALGEBRAIC[74] = 1.00000/( ALGEBRAIC[70]*CONSTANTS[19]);
ALGEBRAIC[65] = ((arbitrary_log(ALGEBRAIC[61], 10) - CONSTANTS[7])+ CONSTANTS[8]*(CONSTANTS[11] - 7.40000))/CONSTANTS[9];
ALGEBRAIC[66] = pow(10.0000, ALGEBRAIC[65]);
ALGEBRAIC[67] = ( 100.000*ALGEBRAIC[66])/(1.00000+ALGEBRAIC[66]);
ALGEBRAIC[71] = (CONDVAR[10]>0.00000 ? exp( - 1.00000*CONSTANTS[25]*(100.000 - 96.0000)) : exp( - 1.00000*CONSTANTS[25]*(100.000 - ALGEBRAIC[67])));
ALGEBRAIC[72] = ( (( (( (( CONSTANTS[24]*(1.00000 - ALGEBRAIC[71])+ CONSTANTS[26]*ALGEBRAIC[67]) - CONSTANTS[27])*1.34000)/100.000)*CONSTANTS[13])/0.200000)*CONSTANTS[16])/CONSTANTS[17];
ALGEBRAIC[73] = (CONDVAR[11]>0.00000 ? ALGEBRAIC[72] - ( ALGEBRAIC[72]*(96.0000 - ALGEBRAIC[67]))/- 4.00000 : ( (( (( (( CONSTANTS[24]*(1.00000 - ALGEBRAIC[71])+ CONSTANTS[26]*ALGEBRAIC[67]) - CONSTANTS[27])*1.34000)/100.000)*CONSTANTS[13])/0.200000)*CONSTANTS[16])/CONSTANTS[17]);
ALGEBRAIC[75] = 1.00000/( ALGEBRAIC[73]*CONSTANTS[20]);
ALGEBRAIC[76] = ALGEBRAIC[74]+ALGEBRAIC[75]+CONSTANTS[32];
ALGEBRAIC[77] = (1.00000/ALGEBRAIC[76])/60.0000;
ALGEBRAIC[78] = ( CONSTANTS[18]*- 1.00000*ALGEBRAIC[77]*(ALGEBRAIC[60] - ALGEBRAIC[61]))/CONSTANTS[19];
ALGEBRAIC[80] = ALGEBRAIC[6]+ ALGEBRAIC[78]*CONSTANTS[30];
ALGEBRAIC[82] = ((( 1.34000*CONSTANTS[12])/100.000)/( CONSTANTS[5]*pow(ALGEBRAIC[60], - 1.00000/CONSTANTS[3])+1.00000)+ CONSTANTS[14]*ALGEBRAIC[60]) - ALGEBRAIC[80];
ALGEBRAIC[84] =  1.34000*CONSTANTS[12]*CONSTANTS[5]*pow(ALGEBRAIC[60], - 1.00000/CONSTANTS[3] - 1.00000);
ALGEBRAIC[85] =  100.000*CONSTANTS[3]*pow( CONSTANTS[5]*pow(ALGEBRAIC[60], - 1.00000/CONSTANTS[3])+1.00000, 2.00000);
ALGEBRAIC[86] = ALGEBRAIC[84]/ALGEBRAIC[85]+CONSTANTS[14];
ALGEBRAIC[90] = ALGEBRAIC[60] - ALGEBRAIC[82]/ALGEBRAIC[86];
ALGEBRAIC[79] =  (( (- 1.00000/CONSTANTS[18])*CONSTANTS[19])/CONSTANTS[20])*ALGEBRAIC[78];
ALGEBRAIC[81] = ALGEBRAIC[7]+ ALGEBRAIC[79]*CONSTANTS[30];
ALGEBRAIC[83] = ((( 1.34000*CONSTANTS[13])/100.000)/( CONSTANTS[10]*pow(ALGEBRAIC[61], - 1.00000/CONSTANTS[9])+1.00000)+ CONSTANTS[14]*ALGEBRAIC[61]) - ALGEBRAIC[81];
ALGEBRAIC[87] =  1.34000*CONSTANTS[13]*CONSTANTS[10]*pow(ALGEBRAIC[61], - 1.00000/CONSTANTS[9] - 1.00000);
ALGEBRAIC[88] =  100.000*CONSTANTS[9]*pow( CONSTANTS[10]*pow(ALGEBRAIC[61], - 1.00000/CONSTANTS[9])+1.00000, 2.00000);
ALGEBRAIC[89] = ALGEBRAIC[87]/ALGEBRAIC[88]+CONSTANTS[14];
ALGEBRAIC[91] = ALGEBRAIC[61] - ALGEBRAIC[83]/ALGEBRAIC[89];
ALGEBRAIC[92] = ((arbitrary_log(ALGEBRAIC[90], 10) - CONSTANTS[0])+ CONSTANTS[2]*(CONSTANTS[6] - 7.40000))/CONSTANTS[3];
ALGEBRAIC[93] = pow(10.0000, ALGEBRAIC[92]);
ALGEBRAIC[94] = ( 100.000*ALGEBRAIC[93])/(1.00000+ALGEBRAIC[93]);
ALGEBRAIC[98] = (CONDVAR[12]>0.00000 ? exp( - 1.00000*CONSTANTS[25]*(100.000 - 96.0000)) : exp( - 1.00000*CONSTANTS[25]*(100.000 - ALGEBRAIC[94])));
ALGEBRAIC[99] = ( (( (( (( CONSTANTS[24]*(1.00000 - ALGEBRAIC[98])+ CONSTANTS[26]*ALGEBRAIC[94]) - CONSTANTS[27])*1.34000)/100.000)*CONSTANTS[12])/0.200000)*CONSTANTS[15])/CONSTANTS[17];
ALGEBRAIC[100] = (CONDVAR[13]>0.00000 ? ALGEBRAIC[99] - ( ALGEBRAIC[99]*(96.0000 - ALGEBRAIC[94]))/- 4.00000 : ( (( (( (( CONSTANTS[24]*(1.00000 - ALGEBRAIC[98])+ CONSTANTS[26]*ALGEBRAIC[94]) - CONSTANTS[27])*1.34000)/100.000)*CONSTANTS[12])/0.200000)*CONSTANTS[15])/CONSTANTS[17]);
ALGEBRAIC[104] = 1.00000/( ALGEBRAIC[100]*CONSTANTS[19]);
ALGEBRAIC[95] = ((arbitrary_log(ALGEBRAIC[91], 10) - CONSTANTS[7])+ CONSTANTS[8]*(CONSTANTS[11] - 7.40000))/CONSTANTS[9];
ALGEBRAIC[96] = pow(10.0000, ALGEBRAIC[95]);
ALGEBRAIC[97] = ( 100.000*ALGEBRAIC[96])/(1.00000+ALGEBRAIC[96]);
ALGEBRAIC[101] = (CONDVAR[14]>0.00000 ? exp( - 1.00000*CONSTANTS[25]*(100.000 - 96.0000)) : exp( - 1.00000*CONSTANTS[25]*(100.000 - ALGEBRAIC[97])));
ALGEBRAIC[102] = ( (( (( (( CONSTANTS[24]*(1.00000 - ALGEBRAIC[101])+ CONSTANTS[26]*ALGEBRAIC[97]) - CONSTANTS[27])*1.34000)/100.000)*CONSTANTS[13])/0.200000)*CONSTANTS[16])/CONSTANTS[17];
ALGEBRAIC[103] = (CONDVAR[15]>0.00000 ? ALGEBRAIC[102] - ( ALGEBRAIC[102]*(96.0000 - ALGEBRAIC[97]))/- 4.00000 : ( (( (( (( CONSTANTS[24]*(1.00000 - ALGEBRAIC[101])+ CONSTANTS[26]*ALGEBRAIC[97]) - CONSTANTS[27])*1.34000)/100.000)*CONSTANTS[13])/0.200000)*CONSTANTS[16])/CONSTANTS[17]);
ALGEBRAIC[105] = 1.00000/( ALGEBRAIC[103]*CONSTANTS[20]);
ALGEBRAIC[106] = ALGEBRAIC[104]+ALGEBRAIC[105]+CONSTANTS[33];
ALGEBRAIC[107] = (1.00000/ALGEBRAIC[106])/60.0000;
ALGEBRAIC[108] = ( CONSTANTS[18]*- 1.00000*ALGEBRAIC[107]*(ALGEBRAIC[90] - ALGEBRAIC[91]))/CONSTANTS[19];
ALGEBRAIC[110] = ALGEBRAIC[6]+ (1.00000/6.00000)*(ALGEBRAIC[18]+ 2.00000*ALGEBRAIC[48]+ 2.00000*ALGEBRAIC[78]+ALGEBRAIC[108])*CONSTANTS[30];
ALGEBRAIC[112] = ((( 1.34000*CONSTANTS[12])/100.000)/( CONSTANTS[5]*pow(ALGEBRAIC[90], - 1.00000/CONSTANTS[3])+1.00000)+ CONSTANTS[14]*ALGEBRAIC[90]) - ALGEBRAIC[110];
ALGEBRAIC[114] =  1.34000*CONSTANTS[12]*CONSTANTS[5]*pow(ALGEBRAIC[90], - 1.00000/CONSTANTS[3] - 1.00000);
ALGEBRAIC[115] =  100.000*CONSTANTS[3]*pow( CONSTANTS[5]*pow(ALGEBRAIC[90], - 1.00000/CONSTANTS[3])+1.00000, 2.00000);
ALGEBRAIC[116] = ALGEBRAIC[114]/ALGEBRAIC[115]+CONSTANTS[14];
ALGEBRAIC[120] = ALGEBRAIC[90] - ALGEBRAIC[112]/ALGEBRAIC[116];
ALGEBRAIC[109] =  (( (- 1.00000/CONSTANTS[18])*CONSTANTS[19])/CONSTANTS[20])*ALGEBRAIC[108];
ALGEBRAIC[111] = ALGEBRAIC[7]+ (1.00000/6.00000)*(ALGEBRAIC[19]+ 2.00000*ALGEBRAIC[49]+ 2.00000*ALGEBRAIC[79]+ALGEBRAIC[109])*CONSTANTS[30];
ALGEBRAIC[113] = ((( 1.34000*CONSTANTS[13])/100.000)/( CONSTANTS[10]*pow(ALGEBRAIC[91], - 1.00000/CONSTANTS[9])+1.00000)+ CONSTANTS[14]*ALGEBRAIC[91]) - ALGEBRAIC[111];
ALGEBRAIC[117] =  1.34000*CONSTANTS[13]*CONSTANTS[10]*pow(ALGEBRAIC[91], - 1.00000/CONSTANTS[9] - 1.00000);
ALGEBRAIC[118] =  100.000*CONSTANTS[9]*pow( CONSTANTS[10]*pow(ALGEBRAIC[91], - 1.00000/CONSTANTS[9])+1.00000, 2.00000);
ALGEBRAIC[119] = ALGEBRAIC[117]/ALGEBRAIC[118]+CONSTANTS[14];
ALGEBRAIC[121] = ALGEBRAIC[91] - ALGEBRAIC[113]/ALGEBRAIC[119];
}
void
getStateInformation(double* SI)
{
SI[0] = 1.0;
SI[1] = 1.0;
}
void
computeRoots(double VOI, double* CONSTANTS, double* RATES, double* OLDRATES, double* STATES,
             double* OLDSTATES, double* ALGEBRAIC, double* CONDVARS)
{
CONDVAR[0] = ALGEBRAIC[2] - 96.0000;
CONDVAR[1] = ALGEBRAIC[2] - 96.0000;
CONDVAR[2] = ALGEBRAIC[5] - 96.0000;
CONDVAR[3] = ALGEBRAIC[5] - 96.0000;
CONDVAR[4] = ALGEBRAIC[34] - 96.0000;
CONDVAR[5] = ALGEBRAIC[34] - 96.0000;
CONDVAR[6] = ALGEBRAIC[37] - 96.0000;
CONDVAR[7] = ALGEBRAIC[37] - 96.0000;
CONDVAR[8] = ALGEBRAIC[64] - 96.0000;
CONDVAR[9] = ALGEBRAIC[64] - 96.0000;
CONDVAR[10] = ALGEBRAIC[67] - 96.0000;
CONDVAR[11] = ALGEBRAIC[67] - 96.0000;
CONDVAR[12] = ALGEBRAIC[94] - 96.0000;
CONDVAR[13] = ALGEBRAIC[94] - 96.0000;
CONDVAR[14] = ALGEBRAIC[97] - 96.0000;
CONDVAR[15] = ALGEBRAIC[97] - 96.0000;
}