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 3 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 14 entries in the constant variable array. */ /* * VOI is time in component environment (day). * CONSTANTS[0] is s in component uninfected (per_day_mm3). * CONSTANTS[1] is p in component uninfected (per_day). * CONSTANTS[2] is gamma in component uninfected (per_day). * CONSTANTS[13] is beta in component uninfected (dimensionless). * CONSTANTS[3] is N in component free_virus_particle (dimensionless). * CONSTANTS[4] is k_1 in component latently_infected (mm3_per_day). * CONSTANTS[5] is k_2 in component actively_infected (per_day). * CONSTANTS[6] is k_3 in component latently_infected (per_day). * CONSTANTS[7] is mu_V in component free_virus_particle (per_day). * STATES[0] is T_1 in component latently_infected (per_mm3). * CONSTANTS[8] is mu_b in component actively_infected (per_day). * STATES[1] is T in component uninfected (per_mm3). * CONSTANTS[9] is k_4 in component latently_infected (per_day). * CONSTANTS[10] is T_0 in component latently_infected (per_mm3). * CONSTANTS[11] is V_0 in component latently_infected (per_mm3). * CONSTANTS[12] is t_min in component latently_infected (day). * ALGEBRAIC[0] is T_1_t in component latently_infected (per_mm3). * ALGEBRAIC[1] is T_2 in component actively_infected (per_mm3). * ALGEBRAIC[2] is V in component free_virus_particle (per_mm3). * RATES[1] is d/dt T in component uninfected (per_mm3). * RATES[0] is d/dt T_1 in component latently_infected (per_mm3). */ void initConsts(double* CONSTANTS, double* RATES, double *STATES) { CONSTANTS[0] = 10; CONSTANTS[1] = 0.01; CONSTANTS[2] = 2E-5; CONSTANTS[3] = 1000; CONSTANTS[4] = 2.4E-5; CONSTANTS[5] = 3E-3; CONSTANTS[6] = 0.023; CONSTANTS[7] = 2.4; STATES[0] = 0; CONSTANTS[8] = 0.24; STATES[1] = 1000; CONSTANTS[9] = 2.424; CONSTANTS[10] = 1000; CONSTANTS[11] = 1E-3; CONSTANTS[12] = 2; CONSTANTS[13] = (CONSTANTS[2]/CONSTANTS[6])*(1.00000+CONSTANTS[5]/CONSTANTS[8]); } void computeRates(double VOI, double* CONSTANTS, double* RATES, double* STATES, double* ALGEBRAIC) { RATES[1] = ((CONSTANTS[0]+ CONSTANTS[1]*STATES[1]) - CONSTANTS[2]*pow(STATES[1], 2.00000)) - ( CONSTANTS[6]*CONSTANTS[13]+( CONSTANTS[3]*CONSTANTS[4]*CONSTANTS[5])/( CONSTANTS[4]*STATES[1]+CONSTANTS[7]))*STATES[1]*STATES[0]; ALGEBRAIC[0] = (( CONSTANTS[4]*CONSTANTS[10]*CONSTANTS[11])/(CONSTANTS[9] - CONSTANTS[6]))*(exp( - CONSTANTS[6]*VOI) - exp( - CONSTANTS[9]*VOI)); RATES[0] = (VOI<=CONSTANTS[12] ? ALGEBRAIC[0] : (( CONSTANTS[3]*CONSTANTS[4]*CONSTANTS[5])/( CONSTANTS[4]*STATES[1]+CONSTANTS[7]))*STATES[1]*STATES[0] - CONSTANTS[6]*STATES[0]); } void computeVariables(double VOI, double* CONSTANTS, double* RATES, double* STATES, double* ALGEBRAIC) { ALGEBRAIC[0] = (( CONSTANTS[4]*CONSTANTS[10]*CONSTANTS[11])/(CONSTANTS[9] - CONSTANTS[6]))*(exp( - CONSTANTS[6]*VOI) - exp( - CONSTANTS[9]*VOI)); ALGEBRAIC[1] = ( CONSTANTS[5]*STATES[0])/CONSTANTS[8]; ALGEBRAIC[2] = ( CONSTANTS[3]*CONSTANTS[5]*STATES[0])/( CONSTANTS[4]*STATES[1]+CONSTANTS[7]); }