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 0 entries in the algebraic variable array.
   There are a total of 4 entries in each of the rate and state variable arrays.
   There are a total of 10 entries in the constant variable array.
 */
/*
 * VOI is time in component environment (day).
 * CONSTANTS[0] is lambda in component uninfected (per_ml_day).
 * CONSTANTS[1] is d_T in component uninfected (per_day).
 * CONSTANTS[2] is efficacy in component drug_efficacy (dimensionless).
 * CONSTANTS[3] is k in component uninfected (ml_per_day).
 * STATES[0] is V in component viral_load (per_ml).
 * STATES[1] is T in component uninfected (per_ml).
 * CONSTANTS[4] is d_0 in component latently_infected (per_day).
 * CONSTANTS[5] is a_L in component latently_infected (per_day).
 * CONSTANTS[6] is eta in component latently_infected (dimensionless).
 * STATES[2] is L in component latently_infected (per_ml).
 * CONSTANTS[7] is delta in component productively_infected (per_day).
 * STATES[3] is T_star in component productively_infected (per_ml).
 * CONSTANTS[8] is N in component viral_load (dimensionless).
 * CONSTANTS[9] is c in component viral_load (per_day).
 * RATES[1] is d/dt T in component uninfected (per_ml).
 * RATES[2] is d/dt L in component latently_infected (per_ml).
 * RATES[3] is d/dt T_star in component productively_infected (per_ml).
 * RATES[0] is d/dt V in component viral_load (per_ml).
 */
void
initConsts(double* CONSTANTS, double* RATES, double *STATES)
{
CONSTANTS[0] = 1E4;
CONSTANTS[1] = 0.01;
CONSTANTS[2] = 0.4;
CONSTANTS[3] = 2.4E-8;
STATES[0] = 50;
STATES[1] = 600000;
CONSTANTS[4] = 0.001;
CONSTANTS[5] = 0.1;
CONSTANTS[6] = 0.001;
STATES[2] = 2;
CONSTANTS[7] = 1;
STATES[3] = 0.3;
CONSTANTS[8] = 2000;
CONSTANTS[9] = 23;
}
void
computeRates(double VOI, double* CONSTANTS, double* RATES, double* STATES, double* ALGEBRAIC)
{
RATES[1] = (CONSTANTS[0] -  CONSTANTS[1]*STATES[1]) -  (1.00000 - CONSTANTS[2])*CONSTANTS[3]*STATES[0]*STATES[1];
RATES[2] = ( CONSTANTS[6]*(1.00000 - CONSTANTS[2])*CONSTANTS[3]*STATES[0]*STATES[1] -  CONSTANTS[4]*STATES[2]) -  CONSTANTS[5]*STATES[2];
RATES[3] = ( (1.00000 - CONSTANTS[6])*(1.00000 - CONSTANTS[2])*CONSTANTS[3]*STATES[0]*STATES[1] -  CONSTANTS[7]*STATES[3])+ CONSTANTS[5]*STATES[2];
RATES[0] =  CONSTANTS[8]*CONSTANTS[7]*STATES[3] -  CONSTANTS[9]*STATES[0];
}
void
computeVariables(double VOI, double* CONSTANTS, double* RATES, double* STATES, double* ALGEBRAIC)
{
}