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 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).
 */
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;
}
void
computeRates(double VOI, double* CONSTANTS, double* RATES, double* STATES, double* ALGEBRAIC)
{
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]);
RATES[5] = ( CONSTANTS[11]*STATES[0]+ CONSTANTS[12]*STATES[1]) -  CONSTANTS[13]*STATES[5];
RATES[3] = ( CONSTANTS[14]*STATES[2]+ CONSTANTS[15]*STATES[5]) -  CONSTANTS[16]*STATES[3];
RATES[4] =  CONSTANTS[17]*STATES[1]*STATES[2] -  CONSTANTS[18]*STATES[4];
ALGEBRAIC[0] = (VOI>=0.00000&&VOI<5.00000 ? 0.00000 : VOI>=5.00000&&VOI<=10.0000 ? 1.00000 : 0.00000);
RATES[0] =  CONSTANTS[0]*(ALGEBRAIC[0]/(CONSTANTS[1]+ALGEBRAIC[0])) -  CONSTANTS[2]*STATES[0];
ALGEBRAIC[1] = (VOI>=0.00000&&VOI<=5.00000 ? 1.00000 : 0.00000);
RATES[1] =  CONSTANTS[3]*(ALGEBRAIC[1]/(CONSTANTS[4]+ALGEBRAIC[1])) -  CONSTANTS[5]*STATES[1];
}
void
computeVariables(double VOI, double* CONSTANTS, double* RATES, double* STATES, double* ALGEBRAIC)
{
ALGEBRAIC[0] = (VOI>=0.00000&&VOI<5.00000 ? 0.00000 : VOI>=5.00000&&VOI<=10.0000 ? 1.00000 : 0.00000);
ALGEBRAIC[1] = (VOI>=0.00000&&VOI<=5.00000 ? 1.00000 : 0.00000);
}