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 23 entries in the algebraic variable array.
   There are a total of 13 entries in each of the rate and state variable arrays.
   There are a total of 28 entries in the constant variable array.
 */
/*
 * VOI is time in component environment (minute).
 * STATES[0] is S1 in component S1 (millimolar).
 * ALGEBRAIC[13] is v8 in component v8 (flux).
 * ALGEBRAIC[15] is v9 in component v9 (flux).
 * CONSTANTS[0] is S in component S (millimolar).
 * ALGEBRAIC[0] is S2 in component S (millimolar).
 * STATES[1] is sul in component sul (millimolar).
 * ALGEBRAIC[5] is v1 in component v1 (flux).
 * ALGEBRAIC[6] is v2 in component v2 (flux).
 * STATES[2] is aps in component aps (millimolar).
 * ALGEBRAIC[7] is v3 in component v3 (flux).
 * STATES[3] is pap in component pap (millimolar).
 * ALGEBRAIC[8] is v4 in component v4 (flux).
 * STATES[4] is hyd in component hyd (millimolar).
 * ALGEBRAIC[9] is v5 in component v5 (flux).
 * ALGEBRAIC[11] is v17 in component v17 (flux).
 * STATES[5] is cys in component cys (millimolar).
 * ALGEBRAIC[12] is v6 in component v6 (flux).
 * STATES[6] is eth in component eth (millimolar).
 * CONSTANTS[1] is v13 in component v13 (flux).
 * ALGEBRAIC[10] is v7 in component v7 (flux).
 * STATES[7] is aco in component aco (millimolar).
 * ALGEBRAIC[14] is v15 in component v15 (flux).
 * STATES[8] is oxy in component oxy (millimolar).
 * CONSTANTS[2] is v10 in component v10 (flux).
 * ALGEBRAIC[18] is v11A in component v11A (flux).
 * ALGEBRAIC[19] is v14 in component v14 (flux).
 * STATES[9] is A3_c in component A3_c (millimolar).
 * ALGEBRAIC[21] is v12 in component v12 (flux).
 * ALGEBRAIC[22] is v16 in component v16 (flux).
 * STATES[10] is A3_m in component A3_m (millimolar).
 * ALGEBRAIC[20] is v11B in component v11B (flux).
 * CONSTANTS[3] is A_c in component A_c (millimolar).
 * ALGEBRAIC[1] is A2_c in component A_c (millimolar).
 * CONSTANTS[4] is A_m in component A_m (millimolar).
 * ALGEBRAIC[2] is A2_m in component A_m (millimolar).
 * STATES[11] is N2 in component N2 (millimolar).
 * CONSTANTS[5] is N in component N (millimolar).
 * ALGEBRAIC[3] is N1 in component N (millimolar).
 * STATES[12] is oah in component oah (millimolar).
 * ALGEBRAIC[17] is v18 in component v18 (flux).
 * CONSTANTS[6] is v0 in component v1 (flux).
 * ALGEBRAIC[4] is f1 in component v1 (dimensionless).
 * CONSTANTS[7] is n in component v1 (dimensionless).
 * CONSTANTS[8] is Kc in component v1 (millimolar).
 * CONSTANTS[9] is k2 in component v2 (second_order_rate_constant).
 * CONSTANTS[10] is k3 in component v3 (second_order_rate_constant).
 * CONSTANTS[11] is k4 in component v4 (second_order_rate_constant).
 * CONSTANTS[12] is k5 in component v5 (second_order_rate_constant).
 * CONSTANTS[13] is k6 in component v6 (first_order_rate_constant).
 * CONSTANTS[14] is k7 in component v7 (second_order_rate_constant).
 * CONSTANTS[15] is k8 in component v8 (second_order_rate_constant).
 * CONSTANTS[16] is k9 in component v9 (second_order_rate_constant).
 * CONSTANTS[17] is alpha in component v11A (dimensionless).
 * ALGEBRAIC[16] is f2 in component v11A (dimensionless).
 * CONSTANTS[18] is m in component v11A (dimensionless).
 * CONSTANTS[19] is KH in component v11A (millimolar).
 * CONSTANTS[20] is k11 in component v11A (first_order_rate_constant).
 * CONSTANTS[21] is KA in component v11B (millimolar).
 * CONSTANTS[22] is k12 in component v12 (first_order_rate_constant).
 * CONSTANTS[23] is k14 in component v14 (first_order_rate_constant).
 * CONSTANTS[24] is k15 in component v15 (first_order_rate_constant).
 * CONSTANTS[25] is k16 in component v16 (second_order_rate_constant).
 * CONSTANTS[26] is k17 in component v17 (first_order_rate_constant).
 * CONSTANTS[27] is k18 in component v18 (first_order_rate_constant).
 * RATES[0] is d/dt S1 in component S1 (millimolar).
 * RATES[1] is d/dt sul in component sul (millimolar).
 * RATES[2] is d/dt aps in component aps (millimolar).
 * RATES[3] is d/dt pap in component pap (millimolar).
 * RATES[4] is d/dt hyd in component hyd (millimolar).
 * RATES[5] is d/dt cys in component cys (millimolar).
 * RATES[6] is d/dt eth in component eth (millimolar).
 * RATES[7] is d/dt aco in component aco (millimolar).
 * RATES[8] is d/dt oxy in component oxy (millimolar).
 * RATES[9] is d/dt A3_c in component A3_c (millimolar).
 * RATES[10] is d/dt A3_m in component A3_m (millimolar).
 * RATES[11] is d/dt N2 in component N2 (millimolar).
 * RATES[12] is d/dt oah in component oah (millimolar).
 */
void
initConsts(double* CONSTANTS, double* RATES, double *STATES)
{
STATES[0] = 1.892468811;
CONSTANTS[0] = 2;
STATES[1] = 0.012871557;
STATES[2] = 0.053366179;
STATES[3] = 0.082791522;
STATES[4] = 0.159317029;
STATES[5] = 0.805117739;
STATES[6] = 10.25246999;
CONSTANTS[1] = 4;
STATES[7] = 1.139360412;
STATES[8] = 6.146549084;
CONSTANTS[2] = 80;
STATES[9] = 1.570847601;
STATES[10] = 1.835158493;
CONSTANTS[3] = 2;
CONSTANTS[4] = 2;
STATES[11] = 1.933616149;
CONSTANTS[5] = 2;
STATES[12] = 5.571685096;
CONSTANTS[6] = 1.6;
CONSTANTS[7] = 4;
CONSTANTS[8] = 0.1;
CONSTANTS[9] = 0.2;
CONSTANTS[10] = 0.2;
CONSTANTS[11] = 0.2;
CONSTANTS[12] = 0.1;
CONSTANTS[13] = 0.12;
CONSTANTS[14] = 10;
CONSTANTS[15] = 10;
CONSTANTS[16] = 10;
CONSTANTS[17] = 0.1;
CONSTANTS[18] = 4;
CONSTANTS[19] = 0.5;
CONSTANTS[20] = 10;
CONSTANTS[21] = 1;
CONSTANTS[22] = 5;
CONSTANTS[23] = 10;
CONSTANTS[24] = 5;
CONSTANTS[25] = 10;
CONSTANTS[26] = 0.02;
CONSTANTS[27] = 1;
}
void
computeRates(double VOI, double* CONSTANTS, double* RATES, double* STATES, double* ALGEBRAIC)
{
ALGEBRAIC[4] = pow(1.00000+pow(STATES[5]/CONSTANTS[8], CONSTANTS[7]), - 1.00000);
ALGEBRAIC[5] =  CONSTANTS[6]*ALGEBRAIC[4];
ALGEBRAIC[6] =  CONSTANTS[9]*STATES[1]*STATES[9];
RATES[1] = ALGEBRAIC[5] - ALGEBRAIC[6];
ALGEBRAIC[7] =  CONSTANTS[10]*STATES[2]*STATES[9];
RATES[2] = ALGEBRAIC[6] - ALGEBRAIC[7];
ALGEBRAIC[8] =  CONSTANTS[11]*STATES[3]*STATES[11];
RATES[3] = ALGEBRAIC[7] - ALGEBRAIC[8];
ALGEBRAIC[9] =  CONSTANTS[12]*STATES[4]*STATES[12];
ALGEBRAIC[11] =  CONSTANTS[26]*STATES[4];
RATES[4] = ALGEBRAIC[8] - (ALGEBRAIC[9]+ALGEBRAIC[11]);
ALGEBRAIC[12] =  CONSTANTS[13]*STATES[5];
RATES[5] = ALGEBRAIC[9] - ALGEBRAIC[12];
ALGEBRAIC[3] = CONSTANTS[5] - STATES[11];
ALGEBRAIC[10] =  CONSTANTS[14]*STATES[6]*ALGEBRAIC[3];
RATES[6] = CONSTANTS[1] - ALGEBRAIC[10];
ALGEBRAIC[0] = CONSTANTS[0] - STATES[0];
ALGEBRAIC[13] =  CONSTANTS[15]*STATES[7]*ALGEBRAIC[0];
ALGEBRAIC[15] =  CONSTANTS[16]*STATES[0]*ALGEBRAIC[3];
RATES[0] = ALGEBRAIC[13] - ALGEBRAIC[15];
ALGEBRAIC[14] =  CONSTANTS[24]*STATES[7];
RATES[7] = ALGEBRAIC[10] - (ALGEBRAIC[13]+ALGEBRAIC[14]);
ALGEBRAIC[17] =  CONSTANTS[27]*STATES[12];
RATES[12] = ALGEBRAIC[14] - (ALGEBRAIC[9]+ALGEBRAIC[17]);
ALGEBRAIC[16] = pow(1.00000+pow(STATES[4]/CONSTANTS[19], CONSTANTS[18]), - 1.00000);
ALGEBRAIC[18] = ( CONSTANTS[20]*STATES[11]*STATES[8]*ALGEBRAIC[16])/( CONSTANTS[17]*STATES[11]+STATES[8]);
RATES[11] = ( 2.00000*ALGEBRAIC[10]+ 4.00000*ALGEBRAIC[15]) - ( 3.00000*ALGEBRAIC[8]+ALGEBRAIC[18]);
ALGEBRAIC[19] =  CONSTANTS[23]*STATES[8];
RATES[8] = CONSTANTS[2] - (ALGEBRAIC[18]+ALGEBRAIC[19]);
ALGEBRAIC[21] =  CONSTANTS[22]*STATES[9];
ALGEBRAIC[1] = CONSTANTS[3] - STATES[9];
ALGEBRAIC[22] =  CONSTANTS[25]*STATES[10]*ALGEBRAIC[1];
RATES[9] = ALGEBRAIC[22] - (ALGEBRAIC[6]+ALGEBRAIC[7]+ALGEBRAIC[21]);
ALGEBRAIC[2] = CONSTANTS[4] - STATES[10];
ALGEBRAIC[20] = ( 3.00000*ALGEBRAIC[18]*ALGEBRAIC[2])/(CONSTANTS[21]+ALGEBRAIC[2]);
RATES[10] = ALGEBRAIC[20] - ALGEBRAIC[22];
}
void
computeVariables(double VOI, double* CONSTANTS, double* RATES, double* STATES, double* ALGEBRAIC)
{
ALGEBRAIC[4] = pow(1.00000+pow(STATES[5]/CONSTANTS[8], CONSTANTS[7]), - 1.00000);
ALGEBRAIC[5] =  CONSTANTS[6]*ALGEBRAIC[4];
ALGEBRAIC[6] =  CONSTANTS[9]*STATES[1]*STATES[9];
ALGEBRAIC[7] =  CONSTANTS[10]*STATES[2]*STATES[9];
ALGEBRAIC[8] =  CONSTANTS[11]*STATES[3]*STATES[11];
ALGEBRAIC[9] =  CONSTANTS[12]*STATES[4]*STATES[12];
ALGEBRAIC[11] =  CONSTANTS[26]*STATES[4];
ALGEBRAIC[12] =  CONSTANTS[13]*STATES[5];
ALGEBRAIC[3] = CONSTANTS[5] - STATES[11];
ALGEBRAIC[10] =  CONSTANTS[14]*STATES[6]*ALGEBRAIC[3];
ALGEBRAIC[0] = CONSTANTS[0] - STATES[0];
ALGEBRAIC[13] =  CONSTANTS[15]*STATES[7]*ALGEBRAIC[0];
ALGEBRAIC[15] =  CONSTANTS[16]*STATES[0]*ALGEBRAIC[3];
ALGEBRAIC[14] =  CONSTANTS[24]*STATES[7];
ALGEBRAIC[17] =  CONSTANTS[27]*STATES[12];
ALGEBRAIC[16] = pow(1.00000+pow(STATES[4]/CONSTANTS[19], CONSTANTS[18]), - 1.00000);
ALGEBRAIC[18] = ( CONSTANTS[20]*STATES[11]*STATES[8]*ALGEBRAIC[16])/( CONSTANTS[17]*STATES[11]+STATES[8]);
ALGEBRAIC[19] =  CONSTANTS[23]*STATES[8];
ALGEBRAIC[21] =  CONSTANTS[22]*STATES[9];
ALGEBRAIC[1] = CONSTANTS[3] - STATES[9];
ALGEBRAIC[22] =  CONSTANTS[25]*STATES[10]*ALGEBRAIC[1];
ALGEBRAIC[2] = CONSTANTS[4] - STATES[10];
ALGEBRAIC[20] = ( 3.00000*ALGEBRAIC[18]*ALGEBRAIC[2])/(CONSTANTS[21]+ALGEBRAIC[2]);
}