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 2 entries in each of the rate and state variable arrays.
   There are a total of 7 entries in the constant variable array.
 */
/*
 * VOI is time in component environment (hour).
 * STATES[0] is O2 in component O2 (CONCENTRATIONO2).
 * CONSTANTS[0] is p1 in component O2 (CONFIRMp1).
 * CONSTANTS[1] is F1 in component O2 (dimensionless).
 * CONSTANTS[2] is p2 in component model_parameters (per_day).
 * STATES[1] is H2O2 in component H2O2 (CONCENTRATIONH2O2).
 * CONSTANTS[3] is p3 in component H2O2 (per_day).
 * CONSTANTS[4] is p4 in component H2O2 (per_day).
 * ALGEBRAIC[0] is V in component V (CONFIRMV).
 * CONSTANTS[5] is Vmax in component V (microgram_per_hour).
 * CONSTANTS[6] is ki in component V (CONFIRMki).
 * RATES[0] is d/dt O2 in component O2 (CONCENTRATIONO2).
 * RATES[1] is d/dt H2O2 in component H2O2 (CONCENTRATIONH2O2).
 */
void
initConsts(double* CONSTANTS, double* RATES, double *STATES)
{
STATES[0] = 0.00235897;
CONSTANTS[0] = 0.0000143385;
CONSTANTS[1] = 20;
CONSTANTS[2] = 0.117425199;
STATES[1] = 0.000027947;
CONSTANTS[3] = 2.552293418;
CONSTANTS[4] = 8.379310334;
CONSTANTS[5] = 10400000;
CONSTANTS[6] = 0.000008982;
}
void
computeRates(double VOI, double* CONSTANTS, double* RATES, double* STATES, double* ALGEBRAIC)
{
RATES[0] =  CONSTANTS[0]*CONSTANTS[1] -  CONSTANTS[2]*STATES[0];
RATES[1] = ( CONSTANTS[2]*STATES[0] -  CONSTANTS[3]*STATES[1]) -  CONSTANTS[4]*STATES[1];
}
void
computeVariables(double VOI, double* CONSTANTS, double* RATES, double* STATES, double* ALGEBRAIC)
{
ALGEBRAIC[0] =  CONSTANTS[5]*(CONSTANTS[6]/(CONSTANTS[6]+STATES[1]));
}