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 2 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 (second).
 * STATES[0] is y in component y (dimensionless).
 * CONSTANTS[0] is r in component y (first_order_rate_constant).
 * CONSTANTS[1] is a in component y (first_order_rate_constant).
 * CONSTANTS[2] is k in component y (dimensionless).
 * STATES[1] is v in component v (dimensionless).
 * CONSTANTS[3] is u in component v (first_order_rate_constant).
 * CONSTANTS[4] is eta in component v (first_order_rate_constant).
 * RATES[0] is d/dt y in component y (dimensionless).
 * RATES[1] is d/dt v in component v (dimensionless).
 */
void
initConsts(double* CONSTANTS, double* RATES, double *STATES)
{
STATES[0] = 0.0;
CONSTANTS[0] = 1.0;
CONSTANTS[1] = 0.2;
CONSTANTS[2] = 10.0;
STATES[1] = 1.0;
CONSTANTS[3] = 0.5;
CONSTANTS[4] = 1.0;
}
void
computeRates(double VOI, double* CONSTANTS, double* RATES, double* STATES, double* ALGEBRAIC)
{
RATES[0] =  CONSTANTS[0]*STATES[0]*STATES[1]*(1.00000 - STATES[0]/CONSTANTS[2]) -  CONSTANTS[1]*STATES[0];
RATES[1] =  CONSTANTS[4]*STATES[0] -  CONSTANTS[3]*STATES[1];
}
void
computeVariables(double VOI, double* CONSTANTS, double* RATES, double* STATES, double* ALGEBRAIC)
{
}