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 5 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).
 * STATES[0] is T in component T (per_ml).
 * CONSTANTS[0] is lamda in component T (second_order_rate_constant).
 * CONSTANTS[1] is d in component T (first_order_rate_constant).
 * CONSTANTS[2] is k in component kinetic_parameters (flux).
 * STATES[1] is VI in component VI (per_ml).
 * STATES[2] is T_ in component T_ (per_ml).
 * CONSTANTS[3] is tau in component T_ (first_order_rate_constant).
 * CONSTANTS[4] is m in component T_ (first_order_rate_constant).
 * CONSTANTS[5] is delta in component kinetic_parameters (first_order_rate_constant).
 * CONSTANTS[6] is N in component kinetic_parameters (dimensionless).
 * CONSTANTS[7] is c in component kinetic_parameters (first_order_rate_constant).
 * ALGEBRAIC[0] is epsilon_PI in component epsilon_PI (dimensionless).
 * STATES[3] is VNI in component VNI (per_ml).
 * CONSTANTS[8] is IC50 in component epsilon_PI (mg_per_ml).
 * STATES[4] is Cc in component Cc (mg_per_ml).
 * ALGEBRAIC[1] is Cb in component Cb (mg_per_ml).
 * CONSTANTS[9] is Vd in component Cb (ml).
 * CONSTANTS[10] is F in component Cb (dimensionless).
 * CONSTANTS[11] is D in component Cb (mg).
 * CONSTANTS[12] is ka in component kinetic_parameters (first_order_rate_constant).
 * CONSTANTS[13] is ke in component kinetic_parameters (first_order_rate_constant).
 * CONSTANTS[14] is kacell in component Cc (first_order_rate_constant).
 * CONSTANTS[15] is kecell in component Cc (first_order_rate_constant).
 * ALGEBRAIC[2] is Cx in component Cx (mg_per_ml).
 * CONSTANTS[16] is H in component Cx (dimensionless).
 * CONSTANTS[17] is fb in component Cx (dimensionless).
 * RATES[0] is d/dt T in component T (per_ml).
 * RATES[2] is d/dt T_ in component T_ (per_ml).
 * RATES[1] is d/dt VI in component VI (per_ml).
 * RATES[3] is d/dt VNI in component VNI (per_ml).
 * RATES[4] is d/dt Cc in component Cc (mg_per_ml).
 */
void
initConsts(double* CONSTANTS, double* RATES, double *STATES)
{
STATES[0] = 1e6;
CONSTANTS[0] = 1e4;
CONSTANTS[1] = 0.01;
CONSTANTS[2] = 2.4e-8;
STATES[1] = 1;
STATES[2] = 1;
CONSTANTS[3] = 1.5;
CONSTANTS[4] = 0.01;
CONSTANTS[5] = 0.01;
CONSTANTS[6] = 2500;
CONSTANTS[7] = 23;
STATES[3] = 2;
CONSTANTS[8] = 9e-7;
STATES[4] = 0;
CONSTANTS[9] = 28000;
CONSTANTS[10] = 1;
CONSTANTS[11] = 600;
CONSTANTS[12] = 14.64;
CONSTANTS[13] = 6.86;
CONSTANTS[14] = 24000;
CONSTANTS[15] = 1.1;
CONSTANTS[16] = 0.052;
CONSTANTS[17] = 0.99;
}
void
computeRates(double VOI, double* CONSTANTS, double* RATES, double* STATES, double* ALGEBRAIC)
{
RATES[0] = CONSTANTS[0] - ( CONSTANTS[1]*STATES[0]+ CONSTANTS[2]*STATES[0]*STATES[1]);
RATES[2] =  CONSTANTS[2]*STATES[0]*(VOI - CONSTANTS[3])*STATES[1]*(VOI - CONSTANTS[3])*exp( - CONSTANTS[4]*CONSTANTS[3]) -  CONSTANTS[5]*STATES[2];
ALGEBRAIC[0] = STATES[4]/(CONSTANTS[8]+STATES[4]);
RATES[1] =  CONSTANTS[6]*CONSTANTS[5]*STATES[2]*(1.00000 - ALGEBRAIC[0]) -  CONSTANTS[7]*STATES[1];
RATES[3] =  CONSTANTS[6]*CONSTANTS[5]*STATES[2]*ALGEBRAIC[0] -  CONSTANTS[7]*STATES[3];
ALGEBRAIC[1] =  (( CONSTANTS[10]*CONSTANTS[11])/CONSTANTS[9])*(CONSTANTS[12]/(CONSTANTS[13] - CONSTANTS[12]))*(exp( - CONSTANTS[12]*VOI) - exp( - CONSTANTS[13]*VOI));
ALGEBRAIC[2] = ( (1.00000 - CONSTANTS[17])*CONSTANTS[16]*ALGEBRAIC[1] - STATES[4]>0.00000 ?  (1.00000 - CONSTANTS[17])*CONSTANTS[16]*ALGEBRAIC[1] - STATES[4] : 0.00000);
RATES[4] =  CONSTANTS[14]*ALGEBRAIC[2] -  CONSTANTS[15]*STATES[4];
}
void
computeVariables(double VOI, double* CONSTANTS, double* RATES, double* STATES, double* ALGEBRAIC)
{
ALGEBRAIC[0] = STATES[4]/(CONSTANTS[8]+STATES[4]);
ALGEBRAIC[1] =  (( CONSTANTS[10]*CONSTANTS[11])/CONSTANTS[9])*(CONSTANTS[12]/(CONSTANTS[13] - CONSTANTS[12]))*(exp( - CONSTANTS[12]*VOI) - exp( - CONSTANTS[13]*VOI));
ALGEBRAIC[2] = ( (1.00000 - CONSTANTS[17])*CONSTANTS[16]*ALGEBRAIC[1] - STATES[4]>0.00000 ?  (1.00000 - CONSTANTS[17])*CONSTANTS[16]*ALGEBRAIC[1] - STATES[4] : 0.00000);
}