Generated Code

The following is c_ida 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 4 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 (day).
 * STATES[0] is T in component T (dimensionless).
 * CONSTANTS[0] is k in component T (first_order_rate_constant).
 * CONSTANTS[1] is r in component T (first_order_rate_constant).
 * CONSTANTS[2] is d in component T (first_order_rate_constant).
 * CONSTANTS[3] is gamma in component T (first_order_rate_constant).
 * STATES[1] is C in component C (dimensionless).
 * STATES[2] is A in component A (dimensionless).
 * CONSTANTS[4] is lambda in component A (first_order_rate_constant).
 * CONSTANTS[5] is delta_1 in component A (first_order_rate_constant).
 * CONSTANTS[6] is alpha in component kinetic_parameters (first_order_rate_constant).
 * STATES[3] is A_star in component A_star (dimensionless).
 * CONSTANTS[7] is delta_2 in component A_star (first_order_rate_constant).
 * CONSTANTS[8] is eta in component C (first_order_rate_constant).
 * CONSTANTS[9] is epsilon in component C (dimensionless).
 * CONSTANTS[10] is q in component C (first_order_rate_constant).
 * CONSTANTS[11] is mu in component C (first_order_rate_constant).
 * ALGEBRAIC[0] is R in component ratio (dimensionless).
 * RATES[0] is d/dt T in component T (dimensionless).
 * RATES[2] is d/dt A in component A (dimensionless).
 * RATES[3] is d/dt A_star in component A_star (dimensionless).
 * RATES[1] is d/dt C in component C (dimensionless).
 * There are a total of 0 condition variables.
 */
void
initConsts(double* CONSTANTS, double* RATES, double *STATES)
{
STATES[0] = 0.1;
CONSTANTS[0] = 10;
CONSTANTS[1] = 0.5;
CONSTANTS[2] = 0.1;
CONSTANTS[3] = 1;
STATES[1] = 0.015;
STATES[2] = 1;
CONSTANTS[4] = 1;
CONSTANTS[5] = 0.1;
CONSTANTS[6] = 0.05;
STATES[3] = 2;
CONSTANTS[7] = 1.5;
CONSTANTS[8] = 2;
CONSTANTS[9] = 1;
CONSTANTS[10] = 0.5;
CONSTANTS[11] = 0.1;
RATES[0] = 0.1001;
RATES[2] = 0.1001;
RATES[3] = 0.1001;
RATES[1] = 0.1001;
}
void
computeResiduals(double VOI, double* CONSTANTS, double* RATES, double* OLDRATES, double* STATES,
                 double* OLDSTATES, double* ALGEBRAIC, double* CONDVARS)
{
resid[0] = RATES[0] - ( CONSTANTS[1]*STATES[0]*(1.00000 - ( STATES[0]*1.00000)/CONSTANTS[0]) -  CONSTANTS[2]*STATES[0]) -  CONSTANTS[3]*STATES[0]*STATES[1];
resid[1] = RATES[2] - (CONSTANTS[4] -  CONSTANTS[5]*STATES[2]) -  CONSTANTS[6]*STATES[2]*STATES[0];
resid[2] = RATES[3] -  CONSTANTS[6]*STATES[2]*STATES[0] -  CONSTANTS[7]*STATES[3];
resid[3] = RATES[1] - (( CONSTANTS[8]*STATES[3]*STATES[1])/( CONSTANTS[9]*STATES[1]+1.00000) -  CONSTANTS[10]*STATES[0]*STATES[1]) -  CONSTANTS[11]*STATES[1];
}
void
computeVariables(double VOI, double* CONSTANTS, double* RATES, double* STATES, double* ALGEBRAIC)
{
ALGEBRAIC[0] = ( STATES[1]*STATES[3])/( CONSTANTS[10]*1.00000*STATES[0]);
}
void
computeEssentialVariables(double VOI, double* CONSTANTS, double* RATES, double* STATES, double* ALGEBRAIC)
{
}
void
getStateInformation(double* SI)
{
SI[0] = 1.0;
SI[1] = 1.0;
SI[2] = 1.0;
SI[3] = 1.0;
}
void
computeRoots(double VOI, double* CONSTANTS, double* RATES, double* OLDRATES, double* STATES,
             double* OLDSTATES, double* ALGEBRAIC, double* CONDVARS)
{
}