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 3 entries in each of the rate and state variable arrays.
   There are a total of 5 entries in the constant variable array.
 */
/*
 * VOI is time in component environment (day).
 * CONSTANTS[0] is T in component T (per_ml).
 * STATES[0] is T_star in component T_star (per_ml).
 * CONSTANTS[1] is k in component T_star (second_order_rate_constant).
 * STATES[1] is VI in component VI (per_ml).
 * CONSTANTS[2] is delta in component kinetic_parameters (first_order_rate_constant).
 * CONSTANTS[3] is c in component kinetic_parameters (first_order_rate_constant).
 * STATES[2] is VNI in component VNI (per_ml).
 * CONSTANTS[4] is N in component VNI (dimensionless).
 * ALGEBRAIC[0] is V in component V (per_ml).
 * RATES[0] is d/dt T_star in component T_star (per_ml).
 * RATES[1] is d/dt VI in component VI (per_ml).
 * RATES[2] is d/dt VNI in component VNI (per_ml).
 * There are a total of 0 condition variables.
 */
void
initConsts(double* CONSTANTS, double* RATES, double *STATES)
{
CONSTANTS[0] = 170000;
STATES[0] = 0;
CONSTANTS[1] = 2.4e-5;
STATES[1] = 216000.0;
CONSTANTS[2] = 0.49;
CONSTANTS[3] = 3.07;
STATES[2] = 0;
CONSTANTS[4] = 774;
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[1]*STATES[1]*CONSTANTS[0] -  CONSTANTS[2]*STATES[0];
resid[1] = RATES[1] - - ( CONSTANTS[3]*STATES[1]);
resid[2] = RATES[2] -  CONSTANTS[4]*CONSTANTS[2]*STATES[0] -  CONSTANTS[3]*STATES[2];
}
void
computeVariables(double VOI, double* CONSTANTS, double* RATES, double* STATES, double* ALGEBRAIC)
{
ALGEBRAIC[0] = STATES[1]+STATES[2];
}
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)
{
}