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 2 entries in the algebraic variable array.
   There are a total of 6 entries in each of the rate and state variable arrays.
   There are a total of 19 entries in the constant variable array.
 */
/*
 * VOI is time in component environment (minute).
 * STATES[0] is y1 in component y1 (micromolar).
 * CONSTANTS[0] is a1 in component y1 (flux).
 * ALGEBRAIC[0] is g1 in component y1 (micromolar).
 * CONSTANTS[1] is b1 in component y1 (micromolar).
 * CONSTANTS[2] is d1 in component y1 (first_order_rate_constant).
 * STATES[1] is y2 in component y2 (micromolar).
 * CONSTANTS[3] is a2 in component y2 (flux).
 * ALGEBRAIC[1] is g2 in component y2 (micromolar).
 * CONSTANTS[4] is b2 in component y2 (micromolar).
 * CONSTANTS[5] is d2 in component y2 (first_order_rate_constant).
 * STATES[2] is y3 in component y3 (micromolar).
 * CONSTANTS[6] is f53 in component y3 (second_order_rate_constant).
 * CONSTANTS[7] is f13 in component y3 (second_order_rate_constant).
 * CONSTANTS[8] is h36 in component y3 (second_order_rate_constant).
 * CONSTANTS[9] is d3 in component y3 (first_order_rate_constant).
 * CONSTANTS[10] is E in component y3 (micromolar).
 * STATES[3] is y5 in component y5 (micromolar).
 * STATES[4] is y6 in component y6 (micromolar).
 * STATES[5] is y4 in component y4 (micromolar).
 * CONSTANTS[11] is f14 in component y4 (first_order_rate_constant).
 * CONSTANTS[12] is f24 in component y4 (first_order_rate_constant).
 * CONSTANTS[13] is d4 in component y4 (first_order_rate_constant).
 * CONSTANTS[14] is f35 in component y5 (first_order_rate_constant).
 * CONSTANTS[15] is f45 in component y5 (first_order_rate_constant).
 * CONSTANTS[16] is d5 in component y5 (first_order_rate_constant).
 * CONSTANTS[17] is h36 in component y6 (second_order_rate_constant).
 * CONSTANTS[18] is d6 in component y6 (first_order_rate_constant).
 * RATES[0] is d/dt y1 in component y1 (micromolar).
 * RATES[1] is d/dt y2 in component y2 (micromolar).
 * RATES[2] is d/dt y3 in component y3 (micromolar).
 * RATES[5] is d/dt y4 in component y4 (micromolar).
 * RATES[3] is d/dt y5 in component y5 (micromolar).
 * RATES[4] is d/dt y6 in component y6 (micromolar).
 * There are a total of 6 condition variables.
 */
void
initConsts(double* CONSTANTS, double* RATES, double *STATES)
{
STATES[0] = 0.0;
CONSTANTS[0] = 10.0;
CONSTANTS[1] = 10.0;
CONSTANTS[2] = 0.2;
STATES[1] = 0.0;
CONSTANTS[3] = 10.0;
CONSTANTS[4] = 10.0;
CONSTANTS[5] = 0.1;
STATES[2] = 0.0;
CONSTANTS[6] = 1.5;
CONSTANTS[7] = 0.6;
CONSTANTS[8] = 0.1;
CONSTANTS[9] = 1.0;
CONSTANTS[10] = 10.0;
STATES[3] = 0.0;
STATES[4] = 0.0;
STATES[5] = 0.0;
CONSTANTS[11] = 0.1;
CONSTANTS[12] = 0.8;
CONSTANTS[13] = 1.1;
CONSTANTS[14] = 0.3;
CONSTANTS[15] = 0.1;
CONSTANTS[16] = 1.0;
CONSTANTS[17] = 0.1;
CONSTANTS[18] = 0.001;
RATES[0] = 0.1001;
RATES[1] = 0.1001;
RATES[2] = 0.1001;
RATES[5] = 0.1001;
RATES[3] = 0.1001;
RATES[4] = 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[0]/(CONSTANTS[1]+ALGEBRAIC[0])) -  CONSTANTS[2]*STATES[0];
resid[1] = RATES[1] -  CONSTANTS[3]*(ALGEBRAIC[1]/(CONSTANTS[4]+ALGEBRAIC[1])) -  CONSTANTS[5]*STATES[1];
resid[2] = RATES[2] - ( CONSTANTS[7]*(CONSTANTS[10] - (STATES[2]+STATES[4]))*STATES[0]+ CONSTANTS[6]*(CONSTANTS[10] - (STATES[2]+STATES[4]))*STATES[3]) - ( CONSTANTS[8]*STATES[1]*STATES[2]+ CONSTANTS[9]*STATES[2]);
resid[3] = RATES[5] - ( CONSTANTS[11]*STATES[0]+ CONSTANTS[12]*STATES[1]) -  CONSTANTS[13]*STATES[5];
resid[4] = RATES[3] - ( CONSTANTS[14]*STATES[2]+ CONSTANTS[15]*STATES[5]) -  CONSTANTS[16]*STATES[3];
resid[5] = RATES[4] -  CONSTANTS[17]*STATES[1]*STATES[2] -  CONSTANTS[18]*STATES[4];
}
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&&CONDVAR[1]<0.00000 ? 0.00000 : CONDVAR[2]>=0.00000&&CONDVAR[3]<=0.00000 ? 1.00000 : 0.00000);
ALGEBRAIC[1] = (CONDVAR[4]>=0.00000&&CONDVAR[5]<=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;
SI[4] = 1.0;
SI[5] = 1.0;
}
void
computeRoots(double VOI, double* CONSTANTS, double* RATES, double* OLDRATES, double* STATES,
             double* OLDSTATES, double* ALGEBRAIC, double* CONDVARS)
{
CONDVAR[0] = VOI - 0.00000;
CONDVAR[1] = VOI - 5.00000;
CONDVAR[2] = VOI - 5.00000;
CONDVAR[3] = VOI - 10.0000;
CONDVAR[4] = VOI - 0.00000;
CONDVAR[5] = VOI - 5.00000;
}