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 2 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 12 entries in the constant variable array.
 */
/*
 * VOI is time in component environment (second).
 * STATES[0] is a in component a (dimensionless).
 * CONSTANTS[7] is alpha in component reaction_constants (dimensionless).
 * CONSTANTS[8] is beta in component reaction_constants (dimensionless).
 * ALGEBRAIC[1] is KP in component reaction_constants (dimensionless).
 * STATES[1] is g in component g (dimensionless).
 * CONSTANTS[9] is gamma in component reaction_constants (dimensionless).
 * CONSTANTS[10] is L in component reaction_constants (dimensionless).
 * CONSTANTS[0] is k2 in component reaction_constants (dimensionless).
 * CONSTANTS[1] is k3 in component reaction_constants (dimensionless).
 * CONSTANTS[2] is k6 in component reaction_constants (dimensionless).
 * CONSTANTS[3] is k7 in component reaction_constants (dimensionless).
 * CONSTANTS[4] is k0 in component reaction_constants (dimensionless).
 * CONSTANTS[5] is k4 in component reaction_constants (dimensionless).
 * CONSTANTS[6] is km in component reaction_constants (dimensionless).
 * CONSTANTS[11] is K in component reaction_constants (dimensionless).
 * ALGEBRAIC[0] is P in component reaction_constants (dimensionless).
 * 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] = 6.0E-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[1]/CONSTANTS[0];
CONSTANTS[8] = CONSTANTS[2]/CONSTANTS[0];
CONSTANTS[9] = CONSTANTS[3]/CONSTANTS[0];
CONSTANTS[10] = pow(( pow(CONSTANTS[6], 2.00000)*CONSTANTS[5])/pow(CONSTANTS[0], 3.00000), 0.500000);
CONSTANTS[11] = pow(( pow(CONSTANTS[4], 2.00000)*CONSTANTS[5])/pow(CONSTANTS[0], 3.00000), 0.500000);
}
void
computeRates(double VOI, double* CONSTANTS, double* RATES, double* STATES, double* ALGEBRAIC)
{
RATES[1] = ( (1.00000 - CONSTANTS[7])*STATES[0]+ STATES[0]*pow(STATES[1], 2.00000)) - (CONSTANTS[10]+ CONSTANTS[9]*STATES[1]);
ALGEBRAIC[0] = 0.735000+ 0.156300* sin(( 2.00000*3.14159*VOI)/( 24.0000*3600.00))+ 0.312700*fabs( sin(( 3.14159*VOI)/( 24.0000*3600.00)));
ALGEBRAIC[1] =  CONSTANTS[11]*ALGEBRAIC[0];
RATES[0] = ALGEBRAIC[1] - ( (1.00000+CONSTANTS[7]+CONSTANTS[8])*STATES[0]+ STATES[0]*pow(STATES[1], 2.00000));
}
void
computeVariables(double VOI, double* CONSTANTS, double* RATES, double* STATES, double* ALGEBRAIC)
{
ALGEBRAIC[0] = 0.735000+ 0.156300* sin(( 2.00000*3.14159*VOI)/( 24.0000*3600.00))+ 0.312700*fabs( sin(( 3.14159*VOI)/( 24.0000*3600.00)));
ALGEBRAIC[1] =  CONSTANTS[11]*ALGEBRAIC[0];
}