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 4 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 (month).
 * STATES[0] is L in component L (fraction).
 * CONSTANTS[0] is mu_T in component reaction_constants (month).
 * CONSTANTS[1] is mu_L in component reaction_constants (month).
 * CONSTANTS[2] is mu_A in component reaction_constants (month).
 * CONSTANTS[3] is epsilon in component reaction_constants (first_order_rate_constant).
 * STATES[1] is M in component M (fraction).
 * STATES[2] is T in component T (fraction).
 * CONSTANTS[4] is L_0 in component L (dimensionless).
 * STATES[3] is A in component A (fraction).
 * CONSTANTS[5] is A_0 in component A (dimensionless).
 * CONSTANTS[6] is T_0 in component T (dimensionless).
 * RATES[0] is d/dt L in component L (fraction).
 * RATES[3] is d/dt A in component A (fraction).
 * RATES[2] is d/dt T in component T (fraction).
 * RATES[1] is d/dt M in component M (fraction).
 */
void
initConsts(double* CONSTANTS, double* RATES, double *STATES)
{
STATES[0] = 0.33;
CONSTANTS[0] = 2.4;
CONSTANTS[1] = 2;
CONSTANTS[2] = 3.6;
CONSTANTS[3] = 0;
STATES[1] = 0;
STATES[2] = 0.33;
STATES[3] = 0.34;
CONSTANTS[4] = CONSTANTS[1]/(CONSTANTS[2]+CONSTANTS[0]+CONSTANTS[1]);
CONSTANTS[5] = CONSTANTS[2]/(CONSTANTS[2]+CONSTANTS[0]+CONSTANTS[1]);
CONSTANTS[6] = CONSTANTS[0]/(CONSTANTS[2]+CONSTANTS[0]+CONSTANTS[1]);
}
void
computeRates(double VOI, double* CONSTANTS, double* RATES, double* STATES, double* ALGEBRAIC)
{
RATES[0] = ( (1.00000/CONSTANTS[0])*STATES[2] -  (1.00000/CONSTANTS[1])*STATES[0])+ CONSTANTS[3]*STATES[1];
RATES[3] =  (1.00000/CONSTANTS[1])*STATES[0] -  (1.00000/CONSTANTS[2])*STATES[3];
RATES[2] =  (1.00000/CONSTANTS[2])*STATES[3] -  (1.00000/CONSTANTS[0])*STATES[2];
RATES[1] =  CONSTANTS[3]*STATES[2];
}
void
computeVariables(double VOI, double* CONSTANTS, double* RATES, double* STATES, double* ALGEBRAIC)
{
}