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 2 entries in each of the rate and state variable arrays.
   There are a total of 9 entries in the constant variable array.
 */
/*
 * VOI is time in component environment (hour).
 * STATES[0] is S in component S (dimensionless).
 * CONSTANTS[0] is rs in component kinetic_parameters (first_order_rate_constant).
 * CONSTANTS[1] is epsilon_s in component kinetic_parameters (first_order_rate_constant).
 * CONSTANTS[2] is alpha in component kinetic_parameters (first_order_rate_constant).
 * CONSTANTS[3] is u in component kinetic_parameters (first_order_rate_constant).
 * CONSTANTS[4] is beta in component kinetic_parameters (first_order_rate_constant).
 * ALGEBRAIC[0] is phi in component phi (dimensionless).
 * STATES[1] is M in component M (dimensionless).
 * CONSTANTS[5] is rm in component kinetic_parameters (first_order_rate_constant).
 * CONSTANTS[6] is epsilon_m in component kinetic_parameters (first_order_rate_constant).
 * CONSTANTS[8] is growth_rate in component phi (first_order_rate_constant).
 * CONSTANTS[7] is a in component kinetic_parameters (first_order_rate_constant).
 * RATES[0] is d/dt S in component S (dimensionless).
 * RATES[1] is d/dt M in component M (dimensionless).
 * There are a total of 0 condition variables.
 */
void
initConsts(double* CONSTANTS, double* RATES, double *STATES)
{
STATES[0] = 0.5;
CONSTANTS[0] = 1;
CONSTANTS[1] = 0.99;
CONSTANTS[2] = 0.1;
CONSTANTS[3] = 0.07;
CONSTANTS[4] = 0.2;
STATES[1] = 0.5;
CONSTANTS[5] = 1.3;
CONSTANTS[6] = 0.1;
CONSTANTS[7] = 0.5;
CONSTANTS[8] =  (CONSTANTS[0]+CONSTANTS[5])*(1.00000 - CONSTANTS[7]/1.00000);
RATES[0] = 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[0]*STATES[0]*((1.00000 -  CONSTANTS[3]*1.00000)+( CONSTANTS[4]*CONSTANTS[1]*CONSTANTS[3])/1.00000)+ (( CONSTANTS[2]*CONSTANTS[3]*CONSTANTS[0]*STATES[0])/1.00000)*(1.00000 - CONSTANTS[1])) -  ALGEBRAIC[0]*STATES[0]*1.00000;
resid[1] = RATES[1] - ( CONSTANTS[5]*STATES[1]*((1.00000 - CONSTANTS[3]/1.00000)+( CONSTANTS[4]*CONSTANTS[6]*CONSTANTS[3])/1.00000)+ (( CONSTANTS[2]*CONSTANTS[3]*CONSTANTS[5]*STATES[1])/1.00000)*(1.00000 - CONSTANTS[6])) -  ALGEBRAIC[0]*STATES[1]*1.00000;
}
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] =  (( STATES[0]*CONSTANTS[0])/1.00000)*(1.00000 -  (CONSTANTS[3]/1.00000)*((1.00000 - ( CONSTANTS[4]*CONSTANTS[1])/1.00000) -  (CONSTANTS[2]/1.00000)*(1.00000 - CONSTANTS[1]/1.00000)))+ (( STATES[1]*CONSTANTS[5])/1.00000)*(1.00000 -  (CONSTANTS[3]/1.00000)*((1.00000 - ( CONSTANTS[4]*CONSTANTS[6])/1.00000) -  (CONSTANTS[2]/1.00000)*(1.00000 - CONSTANTS[6]/1.00000)));
}
void
getStateInformation(double* SI)
{
SI[0] = 1.0;
SI[1] = 1.0;
}
void
computeRoots(double VOI, double* CONSTANTS, double* RATES, double* OLDRATES, double* STATES,
             double* OLDSTATES, double* ALGEBRAIC, double* CONDVARS)
{
}