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 0 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 (minute).
 * STATES[0] is X1 in component X1 (ng_ml).
 * CONSTANTS[0] is a0 in component X1 (ng_ml_min).
 * CONSTANTS[1] is a1 in component X1 (ng_ml_min).
 * CONSTANTS[2] is a2 in component X1 (dl_microg).
 * CONSTANTS[3] is b1 in component X1 (first_order_rate_constant).
 * STATES[1] is X3 in component X3 (microg_dl).
 * STATES[2] is X2 in component X2 (pg_ml).
 * CONSTANTS[4] is a3 in component X2 (pg_ml_min).
 * CONSTANTS[5] is a4 in component X2 (first_order_rate_constant).
 * CONSTANTS[6] is a5 in component X2 (dl_microg).
 * CONSTANTS[7] is b2 in component X2 (first_order_rate_constant).
 * CONSTANTS[8] is a6 in component X3 (microg_dl_min).
 * CONSTANTS[9] is a7 in component X3 (first_order_rate_constant).
 * CONSTANTS[10] is b3 in component X3 (first_order_rate_constant).
 * RATES[0] is d/dt X1 in component X1 (ng_ml).
 * RATES[2] is d/dt X2 in component X2 (pg_ml).
 * RATES[1] is d/dt X3 in component X3 (microg_dl).
 */
void
initConsts(double* CONSTANTS, double* RATES, double *STATES)
{
STATES[0] = 10.0;
CONSTANTS[0] = 0.0014;
CONSTANTS[1] = 0.000517;
CONSTANTS[2] = 0.0164;
CONSTANTS[3] = 0.0598;
STATES[1] = 0.0;
STATES[2] = 0.0;
CONSTANTS[4] = 1.38;
CONSTANTS[5] = 0.60;
CONSTANTS[6] = 0.00498;
CONSTANTS[7] = 0.053;
CONSTANTS[8] = 0.0084;
CONSTANTS[9] = 0.0081;
CONSTANTS[10] = 0.0138;
}
void
computeRates(double VOI, double* CONSTANTS, double* RATES, double* STATES, double* ALGEBRAIC)
{
RATES[0] = (CONSTANTS[0]+CONSTANTS[1]/(1.00000+ CONSTANTS[2]*STATES[1])) -  CONSTANTS[3]*STATES[0];
RATES[2] = (CONSTANTS[4]+ CONSTANTS[5]*STATES[0])/(1.00000+ CONSTANTS[6]*STATES[1]) -  CONSTANTS[7]*STATES[2];
RATES[1] = (CONSTANTS[8]+ CONSTANTS[9]*STATES[2]) -  CONSTANTS[10]*STATES[1];
}
void
computeVariables(double VOI, double* CONSTANTS, double* RATES, double* STATES, double* ALGEBRAIC)
{
}