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 3 entries in the algebraic variable array.
   There are a total of 3 entries in each of the rate and state variable arrays.
   There are a total of 18 entries in the constant variable array.
 */
/*
 * VOI is time in component environment (day).
 * ALGEBRAIC[2] is S in component population_pharmacodynamics_model (units).
 * CONSTANTS[0] is S0 in component population_pharmacodynamics_model (units).
 * CONSTANTS[1] is alpha in component population_pharmacodynamics_model (units_per_day).
 * CONSTANTS[2] is epsilon in component population_pharmacodynamics_model (units).
 * ALGEBRAIC[0] is ADAS_Cog_p in component placebo_response_model (units).
 * CONSTANTS[14] is PD_CeA in component drug_response_model (units).
 * CONSTANTS[3] is beta_P in component placebo_response_model (units).
 * CONSTANTS[15] is Keq_p in component placebo_response_model (per_day).
 * CONSTANTS[16] is Kel_p in component placebo_response_model (per_day).
 * CONSTANTS[4] is t_half_el_p in component placebo_response_model (day).
 * CONSTANTS[5] is t_half_eq_p in component placebo_response_model (day).
 * CONSTANTS[17] is CL in component pharmacokinetic_model (litre_per_day).
 * CONSTANTS[6] is smk in component pharmacokinetic_model (dimensionless).
 * CONSTANTS[7] is age in component pharmacokinetic_model (year).
 * ALGEBRAIC[1] is Sv in component drop_out_model (dimensionless).
 * CONSTANTS[8] is beta_a in component drug_response_model (units_ml_per_ng).
 * CONSTANTS[9] is CeA in component drug_response_model (ng_per_ml).
 * STATES[0] is CC in component drug_clearance (mg_per_litre).
 * STATES[1] is PC in component drug_clearance (mg_per_litre).
 * CONSTANTS[10] is Vc in component drug_clearance (litre).
 * CONSTANTS[11] is Vp in component drug_clearance (litre).
 * STATES[2] is A_in in component drug_clearance (mg).
 * CONSTANTS[12] is k_ab in component drug_clearance (per_day).
 * CONSTANTS[13] is CL_ic in component drug_clearance (litre_per_day).
 * RATES[0] is d/dt CC in component drug_clearance (mg_per_litre).
 * RATES[1] is d/dt PC in component drug_clearance (mg_per_litre).
 * RATES[2] is d/dt A_in in component drug_clearance (mg).
 * There are a total of 0 condition variables.
 */
void
initConsts(double* CONSTANTS, double* RATES, double *STATES)
{
CONSTANTS[0] = 30;
CONSTANTS[1] = 0.0164;
CONSTANTS[2] = 0.0;
CONSTANTS[3] = -3;
CONSTANTS[4] = 7;
CONSTANTS[5] = 6;
CONSTANTS[6] = 1;
CONSTANTS[7] = 40;
CONSTANTS[8] = -0.047;
CONSTANTS[9] = 25;
STATES[0] = 0;
STATES[1] = 0;
CONSTANTS[10] = 172;
CONSTANTS[11] = 222;
STATES[2] = 25;
CONSTANTS[12] = 115.44;
CONSTANTS[13] = 763.2;
CONSTANTS[14] =  CONSTANTS[8]*CONSTANTS[9];
CONSTANTS[15] = log(2.00000)/CONSTANTS[5];
CONSTANTS[16] = log(2.00000)/CONSTANTS[4];
CONSTANTS[17] =  2268.00*exp( - 0.0135000*(CONSTANTS[7] - 40.0000))*CONSTANTS[6];
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[0] - ( CONSTANTS[12]*STATES[2] - ( CONSTANTS[17]*STATES[0]+ CONSTANTS[13]*(STATES[0] - STATES[1])))/CONSTANTS[10];
resid[1] = RATES[1] - ( CONSTANTS[13]*(STATES[0] - STATES[1]))/CONSTANTS[11];
resid[2] = RATES[2] -  - 115.440*STATES[2];
}
void
computeVariables(double VOI, double* CONSTANTS, double* RATES, double* STATES, double* ALGEBRAIC)
{
ALGEBRAIC[0] =  (( CONSTANTS[3]*CONSTANTS[15])/(CONSTANTS[15] - CONSTANTS[16]))*(exp( - CONSTANTS[16]*VOI) - exp( - CONSTANTS[15]*VOI));
ALGEBRAIC[1] = exp( - 0.00145000*VOI);
ALGEBRAIC[2] = CONSTANTS[0]+ CONSTANTS[1]*VOI+ALGEBRAIC[0]+CONSTANTS[14]+CONSTANTS[2];
}
void
computeEssentialVariables(double VOI, double* CONSTANTS, double* RATES, double* STATES, double* ALGEBRAIC)
{
}
void
getStateInformation(double* SI)
{
SI[0] = 1.0;
SI[1] = 1.0;
SI[2] = 1.0;
}
void
computeRoots(double VOI, double* CONSTANTS, double* RATES, double* OLDRATES, double* STATES,
             double* OLDSTATES, double* ALGEBRAIC, double* CONDVARS)
{
}