Generated Code

The following is c code generated by the CellML API from this CellML file. (Back to language selection)

The raw code is available.

/*
   There are a total of 10 entries in the algebraic variable array.
   There are a total of 7 entries in each of the rate and state variable arrays.
   There are a total of 34 entries in the constant variable array.
 */
/*
 * VOI is time in component environment (day).
 * STATES[0] is phi_I in component phi_I (cells_per_mm3).
 * ALGEBRAIC[6] is alpha in component model_parameters (dimensionless).
 * CONSTANTS[0] is k1 in component model_parameters (dimensionless).
 * CONSTANTS[1] is k2 in component model_parameters (per_day).
 * CONSTANTS[2] is k3 in component model_parameters (mm3_per_cells).
 * CONSTANTS[3] is k5 in component model_parameters (mm3_per_cells).
 * CONSTANTS[4] is k6 in component model_parameters (mm3_per_microg).
 * CONSTANTS[5] is d1 in component model_parameters (per_day).
 * STATES[1] is phi_R in component phi_R (cells_per_mm3).
 * ALGEBRAIC[0] is K_T in component K_T (cells_per_mm3_per_day).
 * STATES[2] is F in component F (cells_per_mm3).
 * STATES[3] is C in component C (microg_per_mm3).
 * STATES[4] is T in component T (pg_per_mm3).
 * ALGEBRAIC[1] is Apligraf in component T (pg_per_mm3_per_day).
 * CONSTANTS[6] is k4 in component model_parameters (pg_per_cells_per_day).
 * CONSTANTS[7] is k7 in component model_parameters (pg_per_cells_per_day).
 * CONSTANTS[8] is d2 in component model_parameters (per_day).
 * STATES[5] is P in component P (pg_per_mm3).
 * ALGEBRAIC[2] is Apligraf in component P (pg_per_mm3_per_day).
 * CONSTANTS[9] is k8 in component model_parameters (pg_per_cells_per_day).
 * CONSTANTS[10] is k9 in component model_parameters (pg_per_cells_per_day).
 * CONSTANTS[11] is d3 in component model_parameters (per_day).
 * ALGEBRAIC[3] is Apligraf in component F (cells_per_mm3_per_day).
 * CONSTANTS[12] is k10 in component model_parameters (per_day).
 * CONSTANTS[13] is d4 in component model_parameters (per_day).
 * ALGEBRAIC[7] is M_P in component M_P (cells_per_mm3_per_day).
 * ALGEBRAIC[4] is Apligraf in component C (microg_per_mm3_per_day).
 * CONSTANTS[14] is k11 in component model_parameters (microg_per_cells_per_day).
 * ALGEBRAIC[8] is f_T in component f_T (dimensionless).
 * ALGEBRAIC[9] is g_C in component g_C (dimensionless).
 * CONSTANTS[15] is d5 in component model_parameters (mm3_per_cells_per_day).
 * STATES[6] is H in component H (microg_per_mm3).
 * ALGEBRAIC[5] is Apligraf in component H (microg_per_mm3_per_day).
 * CONSTANTS[16] is k12 in component model_parameters (microg_per_cells_per_day).
 * CONSTANTS[17] is d6 in component model_parameters (per_day).
 * CONSTANTS[18] is tau1 in component K_T (mm6_cells_per_pg3_day).
 * CONSTANTS[19] is tau2 in component K_T (mm3_cells_per_pg2_day).
 * CONSTANTS[20] is tau3 in component K_T (cells_per_pg_per_day).
 * CONSTANTS[21] is tau4 in component K_T (cells_per_mm3_per_day).
 * CONSTANTS[22] is tau1 in component M_P (mm6_cells_per_pg3_day).
 * CONSTANTS[23] is tau2 in component M_P (mm3_cells_per_pg2_day).
 * CONSTANTS[24] is tau3 in component M_P (cells_per_pg_per_day).
 * CONSTANTS[25] is tau4 in component M_P (cells_per_mm3_per_day).
 * CONSTANTS[26] is tau1 in component f_T (mm9_per_pg3).
 * CONSTANTS[27] is tau2 in component f_T (mm6_per_pg2).
 * CONSTANTS[28] is tau3 in component f_T (mm3_per_pg).
 * CONSTANTS[29] is tau4 in component f_T (dimensionless).
 * CONSTANTS[30] is tau1 in component g_C (mm9_per_microg3).
 * CONSTANTS[31] is tau2 in component g_C (mm6_per_microg2).
 * CONSTANTS[32] is tau3 in component g_C (mm3_per_microg).
 * CONSTANTS[33] is tau4 in component g_C (dimensionless).
 * RATES[0] is d/dt phi_I in component phi_I (cells_per_mm3).
 * RATES[1] is d/dt phi_R in component phi_R (cells_per_mm3).
 * RATES[4] is d/dt T in component T (pg_per_mm3).
 * RATES[5] is d/dt P in component P (pg_per_mm3).
 * RATES[2] is d/dt F in component F (cells_per_mm3).
 * RATES[3] is d/dt C in component C (microg_per_mm3).
 * RATES[6] is d/dt H in component H (microg_per_mm3).
 */
void
initConsts(double* CONSTANTS, double* RATES, double *STATES)
{
STATES[0] = 200.0;
CONSTANTS[0] = 0.05;
CONSTANTS[1] = 0.693;
CONSTANTS[2] = 0.002;
CONSTANTS[3] = 0.0025;
CONSTANTS[4] = 0.0004;
CONSTANTS[5] = 0.2;
STATES[1] = 200.0;
STATES[2] = 50.0;
STATES[3] = 10.0;
STATES[4] = 6.0;
CONSTANTS[6] = 0.07;
CONSTANTS[7] = 0.004;
CONSTANTS[8] = 9.1;
STATES[5] = 2.0;
CONSTANTS[9] = 0.015;
CONSTANTS[10] = 0.0015;
CONSTANTS[11] = 4.0;
CONSTANTS[12] = 0.924;
CONSTANTS[13] = 2.5;
CONSTANTS[14] = 5.0;
CONSTANTS[15] = 1.5E-5;
STATES[6] = 0.01;
CONSTANTS[16] = 0.001;
CONSTANTS[17] = 0.7;
CONSTANTS[18] = -2.47;
CONSTANTS[19] = 21.94;
CONSTANTS[20] = 6.41;
CONSTANTS[21] = 1.75;
CONSTANTS[22] = 15.333;
CONSTANTS[23] = -167.21;
CONSTANTS[24] = 452.38;
CONSTANTS[25] = 2.6593;
CONSTANTS[26] = 0.0092;
CONSTANTS[27] = -0.1552;
CONSTANTS[28] = 0.6279;
CONSTANTS[29] = 0.2527;
CONSTANTS[30] = -4.33E-10;
CONSTANTS[31] = 0.0000009;
CONSTANTS[32] = -0.00055;
CONSTANTS[33] = 0.13;
}
void
computeRates(double VOI, double* CONSTANTS, double* RATES, double* STATES, double* ALGEBRAIC)
{
ALGEBRAIC[1] = (VOI>=0.00000&&VOI<28.0000 ? 0.00000 : VOI>=28.0000&&VOI<29.0000 ? 0.400000 : VOI>=29.0000&&VOI<35.0000 ? 0.00000 : VOI>=35.0000&&VOI<36.0000 ? 0.400000 : VOI>=36.0000&&VOI<42.0000 ? 0.00000 : VOI>=42.0000&&VOI<43.0000 ? 0.400000 : VOI>=43.0000&&VOI<49.0000 ? 0.00000 : VOI>=49.0000&&VOI<50.0000 ? 0.400000 : VOI>=50.0000&&VOI<56.0000 ? 0.00000 : VOI>=56.0000&&VOI<57.0000 ? 0.400000 : VOI>=57.0000&&VOI<63.0000 ? 0.00000 : VOI>=63.0000&&VOI<64.0000 ? 0.400000 : VOI>=64.0000&&VOI<70.0000 ? 0.00000 : VOI>=70.0000&&VOI<71.0000 ? 0.400000 : VOI>=71.0000&&VOI<77.0000 ? 0.00000 : VOI>=77.0000&&VOI<78.0000 ? 0.400000 : 0.00000);
RATES[4] = ( CONSTANTS[6]*STATES[0]+ CONSTANTS[7]*STATES[2]+ALGEBRAIC[1]) -  CONSTANTS[8]*STATES[4];
ALGEBRAIC[2] = (VOI>=0.00000&&VOI<28.0000 ? 0.00000 : VOI>=28.0000&&VOI<29.0000 ? 1.00000 : VOI>=29.0000&&VOI<35.0000 ? 0.00000 : VOI>=35.0000&&VOI<36.0000 ? 1.00000 : VOI>=36.0000&&VOI<42.0000 ? 0.00000 : VOI>=42.0000&&VOI<43.0000 ? 1.00000 : VOI>=43.0000&&VOI<49.0000 ? 0.00000 : VOI>=49.0000&&VOI<50.0000 ? 1.00000 : VOI>=50.0000&&VOI<56.0000 ? 0.00000 : VOI>=56.0000&&VOI<57.0000 ? 1.00000 : VOI>=57.0000&&VOI<63.0000 ? 0.00000 : VOI>=63.0000&&VOI<64.0000 ? 1.00000 : VOI>=64.0000&&VOI<70.0000 ? 0.00000 : VOI>=70.0000&&VOI<71.0000 ? 1.00000 : VOI>=71.0000&&VOI<77.0000 ? 0.00000 : VOI>=77.0000&&VOI<78.0000 ? 1.00000 : 0.00000);
RATES[5] = ( CONSTANTS[9]*(STATES[0]+STATES[1])+ CONSTANTS[10]*STATES[2]+ALGEBRAIC[2]) -  CONSTANTS[11]*STATES[5];
ALGEBRAIC[5] = (VOI>=0.00000&&VOI<28.0000 ? 0.00000 : VOI>=28.0000&&VOI<29.0000 ? 80.0000 : VOI>=29.0000&&VOI<35.0000 ? 0.00000 : VOI>=35.0000&&VOI<36.0000 ? 80.0000 : VOI>=36.0000&&VOI<42.0000 ? 0.00000 : VOI>=42.0000&&VOI<43.0000 ? 80.0000 : VOI>=43.0000&&VOI<49.0000 ? 0.00000 : VOI>=49.0000&&VOI<50.0000 ? 80.0000 : VOI>=50.0000&&VOI<56.0000 ? 0.00000 : VOI>=56.0000&&VOI<57.0000 ? 80.0000 : VOI>=57.0000&&VOI<63.0000 ? 0.00000 : VOI>=63.0000&&VOI<64.0000 ? 80.0000 : VOI>=64.0000&&VOI<70.0000 ? 0.00000 : VOI>=70.0000&&VOI<71.0000 ? 80.0000 : VOI>=71.0000&&VOI<77.0000 ? 0.00000 : VOI>=77.0000&&VOI<78.0000 ? 80.0000 : 0.00000);
RATES[6] = ( CONSTANTS[16]*STATES[2]+ALGEBRAIC[5]) -  CONSTANTS[17]*STATES[6];
ALGEBRAIC[6] = - ( 0.197000*arbitrary_log(STATES[6], 10))+0.440700;
ALGEBRAIC[0] =  CONSTANTS[18]*pow(STATES[4], 3.00000)+ CONSTANTS[19]*pow(STATES[4], 2.00000)+ CONSTANTS[20]*STATES[4]+CONSTANTS[21];
RATES[0] = ( ALGEBRAIC[6]*ALGEBRAIC[0]+ CONSTANTS[0]*CONSTANTS[1]*STATES[0]*(1.00000 - ( CONSTANTS[2]*(STATES[0]+STATES[1])+ CONSTANTS[3]*STATES[2]+ CONSTANTS[4]*STATES[3]))) -  CONSTANTS[5]*STATES[0];
RATES[1] = ( (1.00000 - ALGEBRAIC[6])*ALGEBRAIC[0]+ CONSTANTS[0]*CONSTANTS[1]*STATES[1]*(1.00000 - ( CONSTANTS[2]*(STATES[0]+STATES[1])+ CONSTANTS[3]*STATES[2]+ CONSTANTS[4]*STATES[3]))) -  CONSTANTS[5]*STATES[1];
ALGEBRAIC[3] = (VOI>=0.00000&&VOI<28.0000 ? 0.00000 : VOI>=28.0000&&VOI<29.0000 ? 8000.00 : VOI>=29.0000&&VOI<35.0000 ? 0.00000 : VOI>=35.0000&&VOI<36.0000 ? 8000.00 : VOI>=36.0000&&VOI<42.0000 ? 0.00000 : VOI>=42.0000&&VOI<43.0000 ? 8000.00 : VOI>=43.0000&&VOI<49.0000 ? 0.00000 : VOI>=49.0000&&VOI<50.0000 ? 8000.00 : VOI>=50.0000&&VOI<56.0000 ? 0.00000 : VOI>=56.0000&&VOI<57.0000 ? 8000.00 : VOI>=57.0000&&VOI<63.0000 ? 0.00000 : VOI>=63.0000&&VOI<64.0000 ? 8000.00 : VOI>=64.0000&&VOI<70.0000 ? 0.00000 : VOI>=70.0000&&VOI<71.0000 ? 8000.00 : VOI>=71.0000&&VOI<77.0000 ? 0.00000 : VOI>=77.0000&&VOI<78.0000 ? 8000.00 : 0.00000);
ALGEBRAIC[7] =  CONSTANTS[22]*pow(STATES[5], 3.00000)+ CONSTANTS[23]*pow(STATES[5], 2.00000)+ CONSTANTS[24]*STATES[5]+CONSTANTS[25];
RATES[2] = (ALGEBRAIC[7]+ CONSTANTS[12]*STATES[2]*(1.00000 - ( CONSTANTS[2]*(STATES[0]+STATES[1])+ CONSTANTS[3]*STATES[2]+ CONSTANTS[4]*STATES[3]))+ALGEBRAIC[3]) -  CONSTANTS[13]*STATES[2];
ALGEBRAIC[4] = (VOI>=0.00000&&VOI<28.0000 ? 0.00000 : VOI>=28.0000&&VOI<29.0000 ? 18.7500 : VOI>=29.0000&&VOI<35.0000 ? 0.00000 : VOI>=35.0000&&VOI<36.0000 ? 18.7500 : VOI>=36.0000&&VOI<42.0000 ? 0.00000 : VOI>=42.0000&&VOI<43.0000 ? 18.7500 : VOI>=43.0000&&VOI<49.0000 ? 0.00000 : VOI>=49.0000&&VOI<50.0000 ? 18.7500 : VOI>=50.0000&&VOI<56.0000 ? 0.00000 : VOI>=56.0000&&VOI<57.0000 ? 18.7500 : VOI>=57.0000&&VOI<63.0000 ? 0.00000 : VOI>=63.0000&&VOI<64.0000 ? 18.7500 : VOI>=64.0000&&VOI<70.0000 ? 0.00000 : VOI>=70.0000&&VOI<71.0000 ? 18.7500 : VOI>=71.0000&&VOI<77.0000 ? 0.00000 : VOI>=77.0000&&VOI<78.0000 ? 18.7500 : 0.00000);
ALGEBRAIC[8] =  CONSTANTS[26]*pow(STATES[4], 3.00000)+ CONSTANTS[27]*pow(STATES[4], 2.00000)+ CONSTANTS[28]*STATES[4]+CONSTANTS[29];
ALGEBRAIC[9] =  CONSTANTS[30]*pow(STATES[3], 3.00000)+ CONSTANTS[31]*pow(STATES[3], 2.00000)+ CONSTANTS[32]*STATES[3]+CONSTANTS[33];
RATES[3] = ( CONSTANTS[14]*STATES[2]*ALGEBRAIC[8]*ALGEBRAIC[9]+ALGEBRAIC[4]) -  CONSTANTS[15]*STATES[2]*STATES[3];
}
void
computeVariables(double VOI, double* CONSTANTS, double* RATES, double* STATES, double* ALGEBRAIC)
{
ALGEBRAIC[1] = (VOI>=0.00000&&VOI<28.0000 ? 0.00000 : VOI>=28.0000&&VOI<29.0000 ? 0.400000 : VOI>=29.0000&&VOI<35.0000 ? 0.00000 : VOI>=35.0000&&VOI<36.0000 ? 0.400000 : VOI>=36.0000&&VOI<42.0000 ? 0.00000 : VOI>=42.0000&&VOI<43.0000 ? 0.400000 : VOI>=43.0000&&VOI<49.0000 ? 0.00000 : VOI>=49.0000&&VOI<50.0000 ? 0.400000 : VOI>=50.0000&&VOI<56.0000 ? 0.00000 : VOI>=56.0000&&VOI<57.0000 ? 0.400000 : VOI>=57.0000&&VOI<63.0000 ? 0.00000 : VOI>=63.0000&&VOI<64.0000 ? 0.400000 : VOI>=64.0000&&VOI<70.0000 ? 0.00000 : VOI>=70.0000&&VOI<71.0000 ? 0.400000 : VOI>=71.0000&&VOI<77.0000 ? 0.00000 : VOI>=77.0000&&VOI<78.0000 ? 0.400000 : 0.00000);
ALGEBRAIC[2] = (VOI>=0.00000&&VOI<28.0000 ? 0.00000 : VOI>=28.0000&&VOI<29.0000 ? 1.00000 : VOI>=29.0000&&VOI<35.0000 ? 0.00000 : VOI>=35.0000&&VOI<36.0000 ? 1.00000 : VOI>=36.0000&&VOI<42.0000 ? 0.00000 : VOI>=42.0000&&VOI<43.0000 ? 1.00000 : VOI>=43.0000&&VOI<49.0000 ? 0.00000 : VOI>=49.0000&&VOI<50.0000 ? 1.00000 : VOI>=50.0000&&VOI<56.0000 ? 0.00000 : VOI>=56.0000&&VOI<57.0000 ? 1.00000 : VOI>=57.0000&&VOI<63.0000 ? 0.00000 : VOI>=63.0000&&VOI<64.0000 ? 1.00000 : VOI>=64.0000&&VOI<70.0000 ? 0.00000 : VOI>=70.0000&&VOI<71.0000 ? 1.00000 : VOI>=71.0000&&VOI<77.0000 ? 0.00000 : VOI>=77.0000&&VOI<78.0000 ? 1.00000 : 0.00000);
ALGEBRAIC[5] = (VOI>=0.00000&&VOI<28.0000 ? 0.00000 : VOI>=28.0000&&VOI<29.0000 ? 80.0000 : VOI>=29.0000&&VOI<35.0000 ? 0.00000 : VOI>=35.0000&&VOI<36.0000 ? 80.0000 : VOI>=36.0000&&VOI<42.0000 ? 0.00000 : VOI>=42.0000&&VOI<43.0000 ? 80.0000 : VOI>=43.0000&&VOI<49.0000 ? 0.00000 : VOI>=49.0000&&VOI<50.0000 ? 80.0000 : VOI>=50.0000&&VOI<56.0000 ? 0.00000 : VOI>=56.0000&&VOI<57.0000 ? 80.0000 : VOI>=57.0000&&VOI<63.0000 ? 0.00000 : VOI>=63.0000&&VOI<64.0000 ? 80.0000 : VOI>=64.0000&&VOI<70.0000 ? 0.00000 : VOI>=70.0000&&VOI<71.0000 ? 80.0000 : VOI>=71.0000&&VOI<77.0000 ? 0.00000 : VOI>=77.0000&&VOI<78.0000 ? 80.0000 : 0.00000);
ALGEBRAIC[6] = - ( 0.197000*arbitrary_log(STATES[6], 10))+0.440700;
ALGEBRAIC[0] =  CONSTANTS[18]*pow(STATES[4], 3.00000)+ CONSTANTS[19]*pow(STATES[4], 2.00000)+ CONSTANTS[20]*STATES[4]+CONSTANTS[21];
ALGEBRAIC[3] = (VOI>=0.00000&&VOI<28.0000 ? 0.00000 : VOI>=28.0000&&VOI<29.0000 ? 8000.00 : VOI>=29.0000&&VOI<35.0000 ? 0.00000 : VOI>=35.0000&&VOI<36.0000 ? 8000.00 : VOI>=36.0000&&VOI<42.0000 ? 0.00000 : VOI>=42.0000&&VOI<43.0000 ? 8000.00 : VOI>=43.0000&&VOI<49.0000 ? 0.00000 : VOI>=49.0000&&VOI<50.0000 ? 8000.00 : VOI>=50.0000&&VOI<56.0000 ? 0.00000 : VOI>=56.0000&&VOI<57.0000 ? 8000.00 : VOI>=57.0000&&VOI<63.0000 ? 0.00000 : VOI>=63.0000&&VOI<64.0000 ? 8000.00 : VOI>=64.0000&&VOI<70.0000 ? 0.00000 : VOI>=70.0000&&VOI<71.0000 ? 8000.00 : VOI>=71.0000&&VOI<77.0000 ? 0.00000 : VOI>=77.0000&&VOI<78.0000 ? 8000.00 : 0.00000);
ALGEBRAIC[7] =  CONSTANTS[22]*pow(STATES[5], 3.00000)+ CONSTANTS[23]*pow(STATES[5], 2.00000)+ CONSTANTS[24]*STATES[5]+CONSTANTS[25];
ALGEBRAIC[4] = (VOI>=0.00000&&VOI<28.0000 ? 0.00000 : VOI>=28.0000&&VOI<29.0000 ? 18.7500 : VOI>=29.0000&&VOI<35.0000 ? 0.00000 : VOI>=35.0000&&VOI<36.0000 ? 18.7500 : VOI>=36.0000&&VOI<42.0000 ? 0.00000 : VOI>=42.0000&&VOI<43.0000 ? 18.7500 : VOI>=43.0000&&VOI<49.0000 ? 0.00000 : VOI>=49.0000&&VOI<50.0000 ? 18.7500 : VOI>=50.0000&&VOI<56.0000 ? 0.00000 : VOI>=56.0000&&VOI<57.0000 ? 18.7500 : VOI>=57.0000&&VOI<63.0000 ? 0.00000 : VOI>=63.0000&&VOI<64.0000 ? 18.7500 : VOI>=64.0000&&VOI<70.0000 ? 0.00000 : VOI>=70.0000&&VOI<71.0000 ? 18.7500 : VOI>=71.0000&&VOI<77.0000 ? 0.00000 : VOI>=77.0000&&VOI<78.0000 ? 18.7500 : 0.00000);
ALGEBRAIC[8] =  CONSTANTS[26]*pow(STATES[4], 3.00000)+ CONSTANTS[27]*pow(STATES[4], 2.00000)+ CONSTANTS[28]*STATES[4]+CONSTANTS[29];
ALGEBRAIC[9] =  CONSTANTS[30]*pow(STATES[3], 3.00000)+ CONSTANTS[31]*pow(STATES[3], 2.00000)+ CONSTANTS[32]*STATES[3]+CONSTANTS[33];
}