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 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 5 entries in the constant variable array.
 */
/*
 * VOI is time in component environment (day).
 * CONSTANTS[0] is T in component T (per_ml).
 * STATES[0] is T_star in component T_star (per_ml).
 * CONSTANTS[1] is k in component T_star (second_order_rate_constant).
 * STATES[1] is VI in component VI (per_ml).
 * CONSTANTS[2] is delta in component kinetic_parameters (first_order_rate_constant).
 * CONSTANTS[3] is c in component kinetic_parameters (first_order_rate_constant).
 * STATES[2] is VNI in component VNI (per_ml).
 * CONSTANTS[4] is N in component VNI (dimensionless).
 * ALGEBRAIC[0] is V in component V (per_ml).
 * RATES[0] is d/dt T_star in component T_star (per_ml).
 * RATES[1] is d/dt VI in component VI (per_ml).
 * RATES[2] is d/dt VNI in component VNI (per_ml).
 */
void
initConsts(double* CONSTANTS, double* RATES, double *STATES)
{
CONSTANTS[0] = 170000;
STATES[0] = 0;
CONSTANTS[1] = 2.4e-5;
STATES[1] = 216000.0;
CONSTANTS[2] = 0.49;
CONSTANTS[3] = 3.07;
STATES[2] = 0;
CONSTANTS[4] = 774;
}
void
computeRates(double VOI, double* CONSTANTS, double* RATES, double* STATES, double* ALGEBRAIC)
{
RATES[0] =  CONSTANTS[1]*STATES[1]*CONSTANTS[0] -  CONSTANTS[2]*STATES[0];
RATES[1] = - ( CONSTANTS[3]*STATES[1]);
RATES[2] =  CONSTANTS[4]*CONSTANTS[2]*STATES[0] -  CONSTANTS[3]*STATES[2];
}
void
computeVariables(double VOI, double* CONSTANTS, double* RATES, double* STATES, double* ALGEBRAIC)
{
ALGEBRAIC[0] = STATES[1]+STATES[2];
}