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 3 entries in each of the rate and state variable arrays.
There are a total of 11 entries in the constant variable array.
*/
/*
* VOI is time in component environment (day).
* STATES[0] is phi_I in component phi_I (cells_per_mm3).
* CONSTANTS[0] is alpha in component model_parameters (dimensionless).
* CONSTANTS[1] is k1 in component model_parameters (dimensionless).
* CONSTANTS[2] is k2 in component model_parameters (first_order_rate_constant).
* CONSTANTS[3] is k3 in component model_parameters (per_cells_per_mm3).
* CONSTANTS[4] is d1 in component model_parameters (first_order_rate_constant).
* STATES[1] is phi_R in component phi_R (cells_per_mm3).
* ALGEBRAIC[0] is K_T in component K_T (cells_per_mm3_day).
* STATES[2] is T in component T (pg_per_mm3).
* CONSTANTS[5] is k4 in component model_parameters (second_order_rate_constant).
* CONSTANTS[6] is d2 in component model_parameters (first_order_rate_constant).
* CONSTANTS[7] is tau1 in component K_T (mm6_cells_per_pg3_day).
* CONSTANTS[8] is tau2 in component K_T (mm3_cells_per_pg2_day).
* CONSTANTS[9] is tau3 in component K_T (cells_per_pg_day).
* CONSTANTS[10] is tau4 in component K_T (cells_per_mm3_day).
* RATES[0] is d/dt phi_I in component phi_I (cells_per_mm3).
* RATES[1] is d/dt phi_R in component phi_R (cells_per_mm3).
* RATES[2] is d/dt T in component T (pg_per_mm3).
* There are a total of 0 condition variables.
*/
void
initConsts(double* CONSTANTS, double* RATES, double *STATES)
{
STATES[0] = 200.0;
CONSTANTS[0] = 0.5;
CONSTANTS[1] = 0.05;
CONSTANTS[2] = 0.693;
CONSTANTS[3] = 0.002;
CONSTANTS[4] = 0.2;
STATES[1] = 200.0;
STATES[2] = 6.0;
CONSTANTS[5] = 0.07;
CONSTANTS[6] = 9.1;
CONSTANTS[7] = -2.47;
CONSTANTS[8] = 21.94;
CONSTANTS[9] = 6.41;
CONSTANTS[10] = 1.75;
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[0]*ALGEBRAIC[0]+ CONSTANTS[1]*CONSTANTS[2]*STATES[0]*(1.00000 - CONSTANTS[3]*(STATES[0]+STATES[1]))) - CONSTANTS[4]*STATES[0];
resid[1] = RATES[1] - ( (1.00000 - CONSTANTS[0])*ALGEBRAIC[0]+ CONSTANTS[1]*CONSTANTS[2]*STATES[1]*(1.00000 - CONSTANTS[3]*(STATES[0]+STATES[1]))) - CONSTANTS[4]*STATES[1];
resid[2] = RATES[2] - CONSTANTS[5]*STATES[0] - CONSTANTS[6]*STATES[2];
}
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] = CONSTANTS[7]*pow(STATES[2], 3.00000)+ CONSTANTS[8]*pow(STATES[2], 2.00000)+ CONSTANTS[9]*STATES[2]+CONSTANTS[10];
}
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)
{
}
