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 10 entries in each of the rate and state variable arrays.
   There are a total of 15 entries in the constant variable array.
 */
/*
 * VOI is time in component environment (hour).
 * STATES[0] is c11 in component c11 (per_millilitre).
 * CONSTANTS[0] is p1 in component model_parameters (per_hour).
 * CONSTANTS[1] is p2 in component model_parameters (per_hour).
 * CONSTANTS[2] is p5 in component model_parameters (per_hour).
 * CONSTANTS[3] is p6 in component model_parameters (per_hour).
 * STATES[1] is c12 in component c12 (per_millilitre).
 * STATES[2] is c21 in component c21 (per_millilitre).
 * CONSTANTS[4] is p4 in component model_parameters (per_hour).
 * CONSTANTS[5] is p11 in component model_parameters (per_hour).
 * CONSTANTS[6] is p12 in component model_parameters (per_hour).
 * STATES[3] is c22 in component c22 (per_millilitre).
 * STATES[4] is c31 in component c31 (per_millilitre).
 * CONSTANTS[7] is p3 in component model_parameters (per_hour).
 * CONSTANTS[8] is p7 in component model_parameters (per_hour).
 * CONSTANTS[9] is p8 in component model_parameters (per_hour).
 * STATES[5] is c32 in component c32 (per_millilitre).
 * STATES[6] is c41 in component c41 (per_millilitre).
 * CONSTANTS[10] is p9 in component model_parameters (per_hour).
 * CONSTANTS[11] is p10 in component model_parameters (per_hour).
 * STATES[7] is c42 in component c42 (per_millilitre).
 * STATES[8] is c51 in component c51 (per_millilitre).
 * CONSTANTS[12] is p13 in component model_parameters (per_hour).
 * CONSTANTS[13] is p14 in component model_parameters (per_hour).
 * CONSTANTS[14] is p15 in component model_parameters (per_hour).
 * STATES[9] is c52 in component c52 (per_millilitre).
 * RATES[0] is d/dt c11 in component c11 (per_millilitre).
 * RATES[2] is d/dt c21 in component c21 (per_millilitre).
 * RATES[4] is d/dt c31 in component c31 (per_millilitre).
 * RATES[6] is d/dt c41 in component c41 (per_millilitre).
 * RATES[8] is d/dt c51 in component c51 (per_millilitre).
 * RATES[1] is d/dt c12 in component c12 (per_millilitre).
 * RATES[3] is d/dt c22 in component c22 (per_millilitre).
 * RATES[5] is d/dt c32 in component c32 (per_millilitre).
 * RATES[7] is d/dt c42 in component c42 (per_millilitre).
 * RATES[9] is d/dt c52 in component c52 (per_millilitre).
 * There are a total of 0 condition variables.
 */
void
initConsts(double* CONSTANTS, double* RATES, double *STATES)
{
STATES[0] = 9000;
CONSTANTS[0] = 0.032044;
CONSTANTS[1] = 0.016630;
CONSTANTS[2] = 6.363016;
CONSTANTS[3] = 7.574118;
STATES[1] = 12000;
STATES[2] = 0;
CONSTANTS[4] = 0.019571;
CONSTANTS[5] = 4.881967;
CONSTANTS[6] = 5.356513;
STATES[3] = 0;
STATES[4] = 0;
CONSTANTS[7] = 0.001885;
CONSTANTS[8] = 1.140535;
CONSTANTS[9] = 1.429125;
STATES[5] = 0;
STATES[6] = 0;
CONSTANTS[10] = 9.768637;
CONSTANTS[11] = 5.3640806;
STATES[7] = 0;
STATES[8] = 0;
CONSTANTS[12] = 0.052968;
CONSTANTS[13] = 0.443166;
CONSTANTS[14] = 0.103700;
STATES[9] = 0;
RATES[0] = 0.1;
RATES[2] = 0.1;
RATES[4] = 0.1;
RATES[6] = 0.1;
RATES[8] = 0.1;
RATES[1] = 0.1;
RATES[3] = 0.1;
RATES[5] = 0.1;
RATES[7] = 0.1;
RATES[9] = 0.1;
}
void
computeResiduals(double VOI, double* CONSTANTS, double* RATES, double* OLDRATES, double* STATES,
                 double* OLDSTATES, double* ALGEBRAIC, double* CONDVARS)
{
resid[0] = RATES[0] -  - CONSTANTS[0]*STATES[0] -  CONSTANTS[1]*STATES[0] -  CONSTANTS[2]*STATES[0]+ CONSTANTS[3]*STATES[1];
resid[1] = RATES[2] -  CONSTANTS[0]*STATES[0] -  CONSTANTS[4]*STATES[2] -  CONSTANTS[5]*STATES[2]+ CONSTANTS[6]*STATES[3];
resid[2] = RATES[4] -  CONSTANTS[1]*STATES[0] -  CONSTANTS[7]*STATES[4] -  CONSTANTS[8]*STATES[4]+ CONSTANTS[9]*STATES[5];
resid[3] = RATES[6] -  CONSTANTS[7]*STATES[4]+ CONSTANTS[4]*STATES[2] -  CONSTANTS[10]*STATES[6]+ CONSTANTS[11]*STATES[7];
resid[4] = RATES[8] -  CONSTANTS[12]*STATES[0] -  CONSTANTS[13]*STATES[8]+ CONSTANTS[14]*STATES[9];
resid[5] = RATES[1] -  CONSTANTS[2]*STATES[0] -  CONSTANTS[3]*STATES[1];
resid[6] = RATES[3] -  CONSTANTS[5]*STATES[2] -  CONSTANTS[6]*STATES[3];
resid[7] = RATES[5] -  CONSTANTS[8]*STATES[4] -  CONSTANTS[9]*STATES[5];
resid[8] = RATES[7] -  CONSTANTS[10]*STATES[6] -  CONSTANTS[11]*STATES[7];
resid[9] = RATES[9] -  CONSTANTS[13]*STATES[8] -  CONSTANTS[14]*STATES[9];
}
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;
SI[3] = 1.0;
SI[4] = 1.0;
SI[5] = 1.0;
SI[6] = 1.0;
SI[7] = 1.0;
SI[8] = 1.0;
SI[9] = 1.0;
}
void
computeRoots(double VOI, double* CONSTANTS, double* RATES, double* OLDRATES, double* STATES,
             double* OLDSTATES, double* ALGEBRAIC, double* CONDVARS)
{
}