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 7 entries in the constant variable array.
 */
/*
 * VOI is time in component environment (hour).
 * STATES[0] is c in component c (dimensionless).
 * ALGEBRAIC[0] is f in component c (dimensionless).
 * CONSTANTS[0] is kcd in component reaction_constants (first_order_rate_constant).
 * CONSTANTS[1] is ki1 in component reaction_constants (dimensionless).
 * STATES[1] is o in component o (dimensionless).
 * STATES[2] is a in component a (dimensionless).
 * CONSTANTS[2] is kad in component reaction_constants (first_order_rate_constant).
 * CONSTANTS[3] is ki2 in component reaction_constants (first_order_rate_constant).
 * STATES[3] is r in component r (dimensionless).
 * CONSTANTS[4] is kcr in component reaction_constants (first_order_rate_constant).
 * CONSTANTS[5] is krd in component reaction_constants (first_order_rate_constant).
 * CONSTANTS[6] is k in component reaction_constants (dimensionless).
 * RATES[0] is d/dt c in component c (dimensionless).
 * RATES[2] is d/dt a in component a (dimensionless).
 * RATES[3] is d/dt r in component r (dimensionless).
 * RATES[1] is d/dt o in component o (dimensionless).
 * There are a total of 1 condition variables.
 */
void
initConsts(double* CONSTANTS, double* RATES, double *STATES)
{
STATES[0] = 0.6;
CONSTANTS[0] = 1.0;
CONSTANTS[1] = 0.1;
STATES[1] = 0.055;
STATES[2] = 0.055;
CONSTANTS[2] = 10.0;
CONSTANTS[3] = 0.1;
STATES[3] = 0.08;
CONSTANTS[4] = 0.05;
CONSTANTS[5] = 0.9;
CONSTANTS[6] = 0.001;
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] -  1.00000*((1.00000+ALGEBRAIC[0])/(1.00000+STATES[1]/CONSTANTS[1])) -  CONSTANTS[0]*STATES[0];
resid[1] = RATES[2] - STATES[0]/(1.00000+( STATES[1]*STATES[3])/CONSTANTS[3]) -  CONSTANTS[2]*STATES[2];
resid[2] = RATES[3] - (pow( STATES[1]*STATES[3], 2.00000)/( 1.00000*(CONSTANTS[6]+pow( STATES[1]*STATES[3], 2.00000)))+CONSTANTS[4]) -  CONSTANTS[5]*STATES[3];
resid[3] = RATES[1] -  1.00000*(STATES[2] - STATES[1]);
}
void
computeVariables(double VOI, double* CONSTANTS, double* RATES, double* STATES, double* ALGEBRAIC)
{
}
void
computeEssentialVariables(double VOI, double* CONSTANTS, double* RATES, double* STATES, double* ALGEBRAIC)
{
ALGEBRAIC[0] = (CONDVAR[0]<0.00000 ? 1.00000 : 0.00000);
}
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)
{
CONDVAR[0] = VOI - 1.00000;
}