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 1 entries in the algebraic variable array. There are a total of 5 entries in each of the rate and state variable arrays. There are a total of 15 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 eta in component latently_infected (dimensionless). * CONSTANTS[5] is d_0 in component latently_infected (per_day). * ALGEBRAIC[0] is f in component activated (dimensionless). * CONSTANTS[6] is a in component latently_infected (per_day). * CONSTANTS[7] is rho in component latently_infected (per_day). * STATES[2] is L_a in component activated (per_ml). * STATES[3] is L_0 in component latently_infected (per_ml). * CONSTANTS[8] is p in component activated (per_day). * CONSTANTS[9] is a_L in component activated (per_day). * CONSTANTS[10] is T_off in component activated (day). * CONSTANTS[11] is T_on in component activated (day). * CONSTANTS[12] is delta in component productively_infected (per_day). * STATES[4] is T_star in component productively_infected (per_ml). * CONSTANTS[13] is p_v in component viral_load (per_day). * CONSTANTS[14] is c in component viral_load (per_day). * RATES[1] is d/dt T in component uninfected (per_ml). * RATES[3] is d/dt L_0 in component latently_infected (per_ml). * RATES[2] is d/dt L_a in component activated (per_ml). * RATES[4] is d/dt T_star in component productively_infected (per_ml). * RATES[0] is d/dt V in component viral_load (per_ml). * There are a total of 2 condition variables. */ void initConsts(double* CONSTANTS, double* RATES, double *STATES) { CONSTANTS[0] = 1E4; CONSTANTS[1] = 0.01; CONSTANTS[2] = 0.85; CONSTANTS[3] = 2.4E-8; STATES[0] = 50; STATES[1] = 600000; CONSTANTS[4] = 0.001; CONSTANTS[5] = 0.001; CONSTANTS[6] = 0.03; CONSTANTS[7] = 0.01; STATES[2] = 0; STATES[3] = 2; CONSTANTS[8] = 1.4; CONSTANTS[9] = 0.1; CONSTANTS[10] = 54; CONSTANTS[11] = 50; CONSTANTS[12] = 1; STATES[4] = 0.3; CONSTANTS[13] = 2000; CONSTANTS[14] = 23; RATES[1] = 0.1001; RATES[3] = 0.1001; RATES[2] = 0.1001; RATES[4] = 0.1001; RATES[0] = 0.1001; } void computeResiduals(double VOI, double* CONSTANTS, double* RATES, double* OLDRATES, double* STATES, double* OLDSTATES, double* ALGEBRAIC, double* CONDVARS) { resid[0] = RATES[1] - (CONSTANTS[0] - CONSTANTS[1]*STATES[1]) - (1.00000 - CONSTANTS[2])*CONSTANTS[3]*STATES[0]*STATES[1]; resid[1] = RATES[3] - (( CONSTANTS[4]*(1.00000 - CONSTANTS[2])*CONSTANTS[3]*STATES[0]*STATES[1] - CONSTANTS[5]*STATES[3]) - ALGEBRAIC[0]*CONSTANTS[6]*STATES[3])+ (1.00000 - ALGEBRAIC[0])*CONSTANTS[7]*STATES[2]; resid[2] = RATES[2] - ( ALGEBRAIC[0]*( CONSTANTS[6]*STATES[3]+ CONSTANTS[8]*STATES[2]) - (1.00000 - ALGEBRAIC[0])*(CONSTANTS[6]+CONSTANTS[7])*STATES[2]) - CONSTANTS[9]*STATES[2]; resid[3] = RATES[4] - ( (1.00000 - CONSTANTS[4])*(1.00000 - CONSTANTS[2])*CONSTANTS[3]*STATES[0]*STATES[1] - 1.00000*CONSTANTS[12]*STATES[4]*STATES[4])+ CONSTANTS[9]*STATES[2]; resid[4] = RATES[0] - CONSTANTS[13]*STATES[4] - CONSTANTS[14]*STATES[0]; } 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[0] = (CONDVAR[0]<0.00000 ? 0.00000 : CONDVAR[1]<0.00000 ? 0.00000 : 1.00000); } void getStateInformation(double* SI) { SI[0] = 1.0; SI[1] = 1.0; SI[2] = 1.0; SI[3] = 1.0; SI[4] = 1.0; } void computeRoots(double VOI, double* CONSTANTS, double* RATES, double* OLDRATES, double* STATES, double* OLDSTATES, double* ALGEBRAIC, double* CONDVARS) { CONDVAR[0] = CONSTANTS[10] - VOI; CONDVAR[1] = VOI - CONSTANTS[11]; }