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 3 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 27 entries in the constant variable array.
 */
/*
 * VOI is time in component environment (day).
 * STATES[0] is R in component R (picomolar).
 * CONSTANTS[0] is DR in component model_parameters (flux).
 * ALGEBRAIC[1] is pi_C in component model_parameters (dimensionless).
 * CONSTANTS[22] is DB in component model_parameters (first_order_rate_constant).
 * STATES[1] is B in component B (picomolar).
 * CONSTANTS[1] is kB in component model_parameters (first_order_rate_constant).
 * STATES[2] is C in component C (picomolar).
 * CONSTANTS[2] is DC in component model_parameters (flux).
 * ALGEBRAIC[2] is pi_L in component pi_L (dimensionless).
 * CONSTANTS[3] is DA in component model_parameters (first_order_rate_constant).
 * CONSTANTS[4] is k1 in component pi_L (second_order_rate_constant).
 * CONSTANTS[5] is k2 in component pi_L (first_order_rate_constant).
 * CONSTANTS[6] is k3 in component pi_L (second_order_rate_constant).
 * CONSTANTS[7] is k4 in component pi_L (first_order_rate_constant).
 * CONSTANTS[8] is K in component pi_L (picomolar).
 * CONSTANTS[9] is ko in component pi_L (first_order_rate_constant).
 * ALGEBRAIC[0] is Io in component pi_L (flux).
 * CONSTANTS[10] is IL in component pi_L (flux).
 * CONSTANTS[11] is rL in component pi_L (flux).
 * CONSTANTS[12] is KOP in component pi_L (picomole_day_picomole_cells).
 * CONSTANTS[13] is KLP in component pi_L (picomole_picomole_cells).
 * CONSTANTS[26] is pi_P in component model_parameters (dimensionless).
 * CONSTANTS[14] is f0 in component model_parameters (dimensionless).
 * CONSTANTS[15] is dB in component model_parameters (first_order_rate_constant).
 * CONSTANTS[16] is IP in component model_parameters (flux).
 * CONSTANTS[17] is kP in component model_parameters (first_order_rate_constant).
 * CONSTANTS[23] is P in component model_parameters (picomolar).
 * CONSTANTS[24] is P_0 in component model_parameters (picomolar).
 * CONSTANTS[25] is P_s in component model_parameters (picomolar).
 * CONSTANTS[18] is C_s in component model_parameters (picomolar).
 * CONSTANTS[19] is SP in component model_parameters (flux).
 * CONSTANTS[20] is k5 in component model_parameters (second_order_rate_constant).
 * CONSTANTS[21] is k6 in component model_parameters (first_order_rate_constant).
 * RATES[0] is d/dt R in component R (picomolar).
 * RATES[1] is d/dt B in component B (picomolar).
 * RATES[2] is d/dt C in component C (picomolar).
 * There are a total of 2 condition variables.
 */
void
initConsts(double* CONSTANTS, double* RATES, double *STATES)
{
STATES[0] = 0;
CONSTANTS[0] = 7e-4;
STATES[1] = 0;
CONSTANTS[1] = 0.189;
STATES[2] = 0;
CONSTANTS[2] = 2.1e-3;
CONSTANTS[3] = 0.7;
CONSTANTS[4] = 1e-2;
CONSTANTS[5] = 10;
CONSTANTS[6] = 5.8e-4;
CONSTANTS[7] = 1.7e-2;
CONSTANTS[8] = 10;
CONSTANTS[9] = 0.35;
CONSTANTS[10] = 0;
CONSTANTS[11] = 1e3;
CONSTANTS[12] = 2e5;
CONSTANTS[13] = 3e6;
CONSTANTS[14] = 0.05;
CONSTANTS[15] = 0.7;
CONSTANTS[16] = 0;
CONSTANTS[17] = 86;
CONSTANTS[18] = 5e-3;
CONSTANTS[19] = 250;
CONSTANTS[20] = 0.02;
CONSTANTS[21] = 3;
CONSTANTS[22] =  CONSTANTS[14]*CONSTANTS[15];
CONSTANTS[23] = CONSTANTS[16]/CONSTANTS[17];
CONSTANTS[24] = CONSTANTS[19]/CONSTANTS[17];
CONSTANTS[25] = CONSTANTS[21]/CONSTANTS[20];
CONSTANTS[26] = (CONSTANTS[23]+CONSTANTS[24])/(CONSTANTS[23]+CONSTANTS[25]);
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[0]*ALGEBRAIC[1] -  (CONSTANTS[22]/ALGEBRAIC[1])*STATES[0];
resid[1] = RATES[1] -  (CONSTANTS[22]/ALGEBRAIC[1])*STATES[0] -  CONSTANTS[1]*STATES[1];
resid[2] = RATES[2] -  CONSTANTS[2]*ALGEBRAIC[2] -  CONSTANTS[3]*ALGEBRAIC[1]*STATES[2];
}
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[1] = (STATES[2]+ CONSTANTS[14]*CONSTANTS[18])/(STATES[2]+CONSTANTS[18]);
ALGEBRAIC[0] = (CONDVAR[0]>0.00000&&CONDVAR[1]<=0.00000 ? 200000. : 0.00000);
ALGEBRAIC[2] =  (( (( (CONSTANTS[6]/CONSTANTS[7])*CONSTANTS[13])/1.00000)*CONSTANTS[26]*STATES[1])/(1.00000+( CONSTANTS[6]*CONSTANTS[8])/CONSTANTS[7]+ (CONSTANTS[4]/( CONSTANTS[5]*CONSTANTS[9]))*( ((CONSTANTS[12]/1.00000)/CONSTANTS[26])*STATES[0]+ALGEBRAIC[0])))*(1.00000+CONSTANTS[10]/CONSTANTS[11]);
}
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)
{
CONDVAR[0] = VOI - 20.0000;
CONDVAR[1] = VOI - 80.0000;
}