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 8 entries in each of the rate and state variable arrays.
   There are a total of 11 entries in the constant variable array.
 */
/*
 * VOI is time in component environment (second).
 * STATES[0] is R in component R (molar).
 * CONSTANTS[0] is L in component L (molar).
 * STATES[1] is LR in component LR (molar).
 * STATES[2] is R_star in component R_star (molar).
 * CONSTANTS[1] is kf in component model_parameters (second_order_rate_constant).
 * CONSTANTS[2] is kr in component model_parameters (first_order_rate_constant).
 * CONSTANTS[3] is kfR in component model_parameters (first_order_rate_constant).
 * CONSTANTS[4] is Kact in component model_parameters (dimensionless).
 * STATES[3] is LR_star in component LR_star (molar).
 * CONSTANTS[5] is alpha in component model_parameters (dimensionless).
 * CONSTANTS[6] is kds in component model_parameters (first_order_rate_constant).
 * STATES[4] is LR_ds in component LR_ds (molar).
 * STATES[5] is R_ds in component R_ds (molar).
 * CONSTANTS[7] is kf2 in component model_parameters (second_order_rate_constant).
 * CONSTANTS[8] is kr2 in component model_parameters (first_order_rate_constant).
 * STATES[6] is G_star in component G_star (molar).
 * STATES[7] is G in component G (molar).
 * CONSTANTS[9] is ka in component model_parameters (second_order_rate_constant).
 * CONSTANTS[10] is ki in component model_parameters (first_order_rate_constant).
 * RATES[0] is d/dt R in component R (molar).
 * RATES[2] is d/dt R_star in component R_star (molar).
 * RATES[1] is d/dt LR in component LR (molar).
 * RATES[3] is d/dt LR_star in component LR_star (molar).
 * RATES[4] is d/dt LR_ds in component LR_ds (molar).
 * RATES[5] is d/dt R_ds in component R_ds (molar).
 * RATES[6] is d/dt G_star in component G_star (molar).
 * RATES[7] is d/dt G in component G (molar).
 * There are a total of 0 condition variables.
 */
void
initConsts(double* CONSTANTS, double* RATES, double *STATES)
{
STATES[0] = 0.01;
CONSTANTS[0] = 1E-12;
STATES[1] = 0.01;
STATES[2] = 0.01;
CONSTANTS[1] = 8.4E7;
CONSTANTS[2] = 0.37;
CONSTANTS[3] = 10;
CONSTANTS[4] = 1E-4;
STATES[3] = 0.01;
CONSTANTS[5] = 1E1;
CONSTANTS[6] = 1E-4;
STATES[4] = 0.01;
STATES[5] = 0.01;
CONSTANTS[7] = 8.4E7;
CONSTANTS[8] = 4.6E-3;
STATES[6] = 0.01;
STATES[7] = 0.01;
CONSTANTS[9] = 1E-7;
CONSTANTS[10] = 2E-1;
RATES[0] = 0.1001;
RATES[2] = 0.1001;
RATES[1] = 0.1001;
RATES[3] = 0.1001;
RATES[4] = 0.1001;
RATES[5] = 0.1001;
RATES[6] = 0.1001;
RATES[7] = 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[2]*STATES[1]+ (CONSTANTS[3]/CONSTANTS[4])*STATES[2]) - ( CONSTANTS[1]*CONSTANTS[0]*STATES[0]+ CONSTANTS[3]*STATES[0]);
resid[1] = RATES[2] - ( CONSTANTS[2]*STATES[3]+ CONSTANTS[3]*STATES[0]) - ( CONSTANTS[5]*CONSTANTS[1]*CONSTANTS[0]*STATES[2]+ (CONSTANTS[3]/CONSTANTS[4])*STATES[2]);
resid[2] = RATES[1] - ( CONSTANTS[1]*CONSTANTS[0]*STATES[0]+ (CONSTANTS[3]/( CONSTANTS[5]*CONSTANTS[4]))*STATES[3]) - ( CONSTANTS[2]*STATES[1]+ CONSTANTS[3]*STATES[1]);
resid[3] = RATES[3] - ( CONSTANTS[3]*STATES[1]+ CONSTANTS[5]*CONSTANTS[1]*CONSTANTS[0]*STATES[2]) - ( (CONSTANTS[3]/( CONSTANTS[5]*CONSTANTS[4]))*STATES[3]+ CONSTANTS[6]*STATES[3]+ CONSTANTS[2]*STATES[3]);
resid[4] = RATES[4] - ( CONSTANTS[6]*STATES[3]+ CONSTANTS[7]*CONSTANTS[0]*STATES[5]) -  CONSTANTS[8]*STATES[4];
resid[5] = RATES[5] -  CONSTANTS[8]*STATES[4] -  CONSTANTS[7]*CONSTANTS[0]*STATES[5];
resid[6] = RATES[6] -  CONSTANTS[9]*STATES[7]*(STATES[3]+STATES[2]) -  CONSTANTS[10]*STATES[6];
resid[7] = RATES[7] -  CONSTANTS[10]*STATES[6] -  CONSTANTS[9]*STATES[7]*(STATES[3]+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)
{
}
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;
}
void
computeRoots(double VOI, double* CONSTANTS, double* RATES, double* OLDRATES, double* STATES,
             double* OLDSTATES, double* ALGEBRAIC, double* CONDVARS)
{
}