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 2 entries in each of the rate and state variable arrays.
   There are a total of 15 entries in the constant variable array.
 */
/*
 * ALGEBRAIC[0] is time in component environment (second).
 * VOI is tau in component environment (dimensionless).
 * CONSTANTS[7] is C_0 in component reaction_constants (per_second).
 * ALGEBRAIC[1] is A in component a (molar).
 * STATES[0] is a in component a (dimensionless).
 * CONSTANTS[8] is alpha in component reaction_constants (dimensionless).
 * CONSTANTS[9] is beta in component reaction_constants (dimensionless).
 * CONSTANTS[10] is K in component reaction_constants (dimensionless).
 * STATES[1] is g in component g (dimensionless).
 * CONSTANTS[11] is C_1 in component reaction_constants (molar).
 * ALGEBRAIC[2] is G in component g (molar).
 * CONSTANTS[12] is gamma in component reaction_constants (dimensionless).
 * CONSTANTS[13] is L in component reaction_constants (dimensionless).
 * CONSTANTS[14] is C_2 in component reaction_constants (molar).
 * CONSTANTS[0] is k2 in component reaction_constants (per_second).
 * CONSTANTS[1] is k3 in component reaction_constants (per_second).
 * CONSTANTS[2] is k6 in component reaction_constants (per_second).
 * CONSTANTS[3] is k7 in component reaction_constants (per_second).
 * CONSTANTS[4] is k0 in component reaction_constants (molar_per_second).
 * CONSTANTS[5] is k4 in component reaction_constants (per_molar2_per_second).
 * CONSTANTS[6] is km in component reaction_constants (molar_per_second).
 * RATES[0] is d/dt a in component a (dimensionless).
 * RATES[1] is d/dt g in component g (dimensionless).
 */
void
initConsts(double* CONSTANTS, double* RATES, double *STATES)
{
STATES[0] = 7.68e-8;
STATES[1] = 3.43e-8;
CONSTANTS[0] = 6e-4;
CONSTANTS[1] = 0.0000048;
CONSTANTS[2] = 0.000891;
CONSTANTS[3] = 0.006831;
CONSTANTS[4] = 8.7831e-11;
CONSTANTS[5] = 2.1e12;
CONSTANTS[6] = 6.9001e-14;
CONSTANTS[7] = CONSTANTS[0];
CONSTANTS[8] = CONSTANTS[1]/CONSTANTS[0];
CONSTANTS[9] = CONSTANTS[2]/CONSTANTS[0];
CONSTANTS[10] =  pow((( pow(CONSTANTS[4], 2.00000)*CONSTANTS[5])/pow(CONSTANTS[0], 3.00000)), 1.0 / 2);
CONSTANTS[11] =  pow((CONSTANTS[0]/CONSTANTS[5]), 1.0 / 2);
CONSTANTS[12] = CONSTANTS[3]/CONSTANTS[0];
CONSTANTS[13] =  pow((( pow(CONSTANTS[6], 2.00000)*CONSTANTS[5])/pow(CONSTANTS[0], 3.00000)), 1.0 / 2);
CONSTANTS[14] =  pow((CONSTANTS[0]/CONSTANTS[5]), 1.0 / 2);
}
void
computeRates(double VOI, double* CONSTANTS, double* RATES, double* STATES, double* ALGEBRAIC)
{
RATES[0] = CONSTANTS[10] - ( (1.00000+CONSTANTS[8]+CONSTANTS[9])*STATES[0]+ STATES[0]*pow(STATES[1], 2.00000));
RATES[1] = ( (1.00000 - CONSTANTS[8])*STATES[0]+ STATES[0]*pow(STATES[1], 2.00000)) - (CONSTANTS[13]+ CONSTANTS[12]*STATES[1]);
}
void
computeVariables(double VOI, double* CONSTANTS, double* RATES, double* STATES, double* ALGEBRAIC)
{
ALGEBRAIC[0] = VOI/CONSTANTS[7];
ALGEBRAIC[1] =  CONSTANTS[11]*STATES[0];
ALGEBRAIC[2] =  CONSTANTS[14]*STATES[1];
}