Generated Code

The following is c 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).
 */
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);
}
void
computeRates(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)));
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;
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)
{
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)));
}