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 0 entries in the algebraic variable array.
   There are a total of 3 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 (day).
 * STATES[0] is T in component T (dimensionless).
 * CONSTANTS[0] is s in component T (first_order_rate_constant).
 * CONSTANTS[1] is dT in component T (first_order_rate_constant).
 * CONSTANTS[2] is b in component kinetic_parameters (first_order_rate_constant).
 * STATES[1] is I in component I (dimensionless).
 * CONSTANTS[3] is p in component I (first_order_rate_constant).
 * CONSTANTS[4] is dI in component I (first_order_rate_constant).
 * STATES[2] is E in component E (dimensionless).
 * CONSTANTS[5] is c in component E (first_order_rate_constant).
 * CONSTANTS[6] is dE in component E (first_order_rate_constant).
 * RATES[0] is d/dt T in component T (dimensionless).
 * RATES[1] is d/dt I in component I (dimensionless).
 * RATES[2] is d/dt E in component E (dimensionless).
 * There are a total of 0 condition variables.
 */
void
initConsts(double* CONSTANTS, double* RATES, double *STATES)
{
STATES[0] = 1.0;
CONSTANTS[0] = 10.0;
CONSTANTS[1] = 0.01;
CONSTANTS[2] = 0.001;
STATES[1] = 1.0;
CONSTANTS[3] = 0.05;
CONSTANTS[4] = 0.3;
STATES[2] = 1.0;
CONSTANTS[5] = 0.3;
CONSTANTS[6] = 0.1;
RATES[0] = 0.1001;
RATES[1] = 0.1001;
RATES[2] = 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[0] - ( CONSTANTS[1]*STATES[0]+ CONSTANTS[2]*STATES[0]*STATES[1]);
resid[1] = RATES[1] -  CONSTANTS[2]*STATES[0]*STATES[1] - ( CONSTANTS[4]*STATES[1]+ CONSTANTS[3]*STATES[1]*STATES[2]);
resid[2] = RATES[2] -  CONSTANTS[5]*STATES[1] -  CONSTANTS[6]*STATES[2];
}
void
computeVariables(double VOI, double* CONSTANTS, double* RATES, double* STATES, double* ALGEBRAIC)
{
}
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;
}
void
computeRoots(double VOI, double* CONSTANTS, double* RATES, double* OLDRATES, double* STATES,
             double* OLDSTATES, double* ALGEBRAIC, double* CONDVARS)
{
}