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 2 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 s in component uninfected (per_day_mm3). * CONSTANTS[1] is r in component uninfected (per_day). * CONSTANTS[2] is T_max in component uninfected (per_mm3). * CONSTANTS[3] is mu_T in component uninfected (per_day). * CONSTANTS[4] is theta in component uninfected (per_mm3). * CONSTANTS[5] is k_1 in component latently_infected (mm3_per_day). * STATES[0] is T_1 in component latently_infected (per_mm3). * STATES[1] is T_2 in component actively_infected (per_mm3). * STATES[2] is V in component free_virus_particle (per_mm3). * ALGEBRAIC[0] is s_V in component uninfected (per_day_mm3). * STATES[3] is T in component uninfected (per_mm3). * CONSTANTS[6] is k_2 in component actively_infected (per_day). * CONSTANTS[7] is mu_b in component actively_infected (per_day). * CONSTANTS[8] is mu_V in component free_virus_particle (per_day). * CONSTANTS[9] is N in component free_virus_particle (dimensionless). * ALGEBRAIC[1] is T_tot in component T_cell_population (per_mm3). * RATES[3] is d/dt T in component uninfected (per_mm3). * RATES[0] is d/dt T_1 in component latently_infected (per_mm3). * RATES[1] is d/dt T_2 in component actively_infected (per_mm3). * RATES[2] is d/dt V in component free_virus_particle (per_mm3). * There are a total of 0 condition variables. */ void initConsts(double* CONSTANTS, double* RATES, double *STATES) { CONSTANTS[0] = 10; CONSTANTS[1] = 0.03; CONSTANTS[2] = 1500; CONSTANTS[3] = 0.02; CONSTANTS[4] = 1; CONSTANTS[5] = 2.4E-5; STATES[0] = 0; STATES[1] = 0; STATES[2] = 1.0E-3; STATES[3] = 1000; CONSTANTS[6] = 3E-3; CONSTANTS[7] = 0.24; CONSTANTS[8] = 2.4; CONSTANTS[9] = 1400; RATES[3] = 0.1001; RATES[0] = 0.1001; RATES[1] = 0.1001; RATES[2] = 0.1001; } void computeResiduals(double VOI, double* CONSTANTS, double* RATES, double* OLDRATES, double* STATES, double* OLDSTATES, double* ALGEBRAIC, double* CONDVARS) { resid[0] = RATES[3] - ((ALGEBRAIC[0] - CONSTANTS[3]*STATES[3])+ CONSTANTS[1]*STATES[3]*(1.00000 - (STATES[3]+STATES[0]+STATES[1])/CONSTANTS[2])) - CONSTANTS[5]*STATES[2]*STATES[3]; resid[1] = RATES[0] - ( CONSTANTS[5]*STATES[2]*STATES[3] - CONSTANTS[3]*STATES[0]) - CONSTANTS[6]*STATES[0]; resid[2] = RATES[1] - CONSTANTS[6]*STATES[0] - CONSTANTS[7]*STATES[1]; resid[3] = RATES[2] - ( CONSTANTS[9]*CONSTANTS[7]*STATES[1] - CONSTANTS[5]*STATES[2]*STATES[3]) - CONSTANTS[8]*STATES[2]; } void computeVariables(double VOI, double* CONSTANTS, double* RATES, double* STATES, double* ALGEBRAIC) { ALGEBRAIC[1] = STATES[3]+STATES[0]+STATES[1]; } void computeEssentialVariables(double VOI, double* CONSTANTS, double* RATES, double* STATES, double* ALGEBRAIC) { ALGEBRAIC[0] = ( CONSTANTS[4]*CONSTANTS[0])/(CONSTANTS[4]+STATES[2]); } void getStateInformation(double* SI) { SI[0] = 1.0; SI[1] = 1.0; SI[2] = 1.0; SI[3] = 1.0; } void computeRoots(double VOI, double* CONSTANTS, double* RATES, double* OLDRATES, double* STATES, double* OLDSTATES, double* ALGEBRAIC, double* CONDVARS) { }