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 9 entries in the algebraic variable array.
   There are a total of 22 entries in each of the rate and state variable arrays.
   There are a total of 45 entries in the constant variable array.
 */
/*
 * VOI is time in component environment (second).
 * STATES[0] is T2 in component T2 (micromolar).
 * ALGEBRAIC[0] is Vmax in component T2 (flux).
 * CONSTANTS[37] is KR in component T2 (molar).
 * STATES[1] is LT2 in component LT2 (micromolar).
 * STATES[2] is T2R in component T2R (micromolar).
 * CONSTANTS[0] is R in component R (micromolar).
 * STATES[3] is T3 in component T3 (micromolar).
 * CONSTANTS[1] is L in component L (micromolar).
 * STATES[4] is Bp in component Bp (micromolar).
 * STATES[5] is T2p in component T2p (micromolar).
 * CONSTANTS[2] is Y0 in component Y0 (micromolar).
 * STATES[6] is Yp in component Yp (micromolar).
 * CONSTANTS[3] is B0 in component B0 (micromolar).
 * CONSTANTS[4] is k5 in component model_parameters (second_order_rate_constant).
 * CONSTANTS[5] is k_5 in component model_parameters (first_order_rate_constant).
 * CONSTANTS[6] is k8 in component model_parameters (first_order_rate_constant).
 * CONSTANTS[7] is k_1 in component model_parameters (second_order_rate_constant).
 * CONSTANTS[8] is ky in component model_parameters (second_order_rate_constant).
 * CONSTANTS[9] is kb in component model_parameters (second_order_rate_constant).
 * CONSTANTS[10] is k1a in component model_parameters (first_order_rate_constant).
 * CONSTANTS[11] is k1b in component model_parameters (second_order_rate_constant).
 * CONSTANTS[12] is k1c in component model_parameters (first_order_rate_constant).
 * ALGEBRAIC[1] is Vmax in component T3 (flux).
 * CONSTANTS[38] is KR in component T3 (molar).
 * STATES[7] is LT3 in component LT3 (micromolar).
 * STATES[8] is T3R in component T3R (micromolar).
 * STATES[9] is T4 in component T4 (micromolar).
 * STATES[10] is T3p in component T3p (micromolar).
 * CONSTANTS[13] is k6 in component model_parameters (second_order_rate_constant).
 * CONSTANTS[14] is k_6 in component model_parameters (first_order_rate_constant).
 * CONSTANTS[15] is k9 in component model_parameters (first_order_rate_constant).
 * CONSTANTS[16] is k_2 in component model_parameters (second_order_rate_constant).
 * CONSTANTS[17] is k2a in component model_parameters (first_order_rate_constant).
 * CONSTANTS[18] is k2b in component model_parameters (second_order_rate_constant).
 * CONSTANTS[19] is k2c in component model_parameters (first_order_rate_constant).
 * STATES[11] is LT4 in component LT4 (micromolar).
 * STATES[12] is T4p in component T4p (micromolar).
 * CONSTANTS[20] is k7 in component model_parameters (second_order_rate_constant).
 * CONSTANTS[21] is k_7 in component model_parameters (first_order_rate_constant).
 * CONSTANTS[22] is k10 in component model_parameters (first_order_rate_constant).
 * ALGEBRAIC[2] is Vmax in component T2p (flux).
 * CONSTANTS[39] is KR in component T2p (molar).
 * STATES[13] is LT2p in component LT2p (micromolar).
 * STATES[14] is T2pR in component T2pR (micromolar).
 * ALGEBRAIC[3] is Vmax in component T3p (flux).
 * CONSTANTS[40] is KR in component T3p (molar).
 * STATES[15] is LT3p in component LT3p (micromolar).
 * STATES[16] is T3pR in component T3pR (micromolar).
 * STATES[17] is LT4p in component LT4p (micromolar).
 * ALGEBRAIC[4] is Vmax in component LT2 (flux).
 * CONSTANTS[41] is KR in component LT2 (molar).
 * STATES[18] is LT2R in component LT2R (micromolar).
 * CONSTANTS[23] is k11 in component model_parameters (first_order_rate_constant).
 * CONSTANTS[24] is k_3 in component model_parameters (second_order_rate_constant).
 * CONSTANTS[25] is k3a in component model_parameters (first_order_rate_constant).
 * CONSTANTS[26] is k3b in component model_parameters (second_order_rate_constant).
 * CONSTANTS[27] is k3c in component model_parameters (first_order_rate_constant).
 * ALGEBRAIC[5] is Vmax in component LT3 (flux).
 * CONSTANTS[42] is KR in component LT3 (molar).
 * STATES[19] is LT3R in component LT3R (micromolar).
 * CONSTANTS[28] is k12 in component model_parameters (first_order_rate_constant).
 * CONSTANTS[29] is k_4 in component model_parameters (second_order_rate_constant).
 * CONSTANTS[30] is k4a in component model_parameters (first_order_rate_constant).
 * CONSTANTS[31] is k4b in component model_parameters (second_order_rate_constant).
 * CONSTANTS[32] is k4c in component model_parameters (first_order_rate_constant).
 * CONSTANTS[33] is k13 in component model_parameters (first_order_rate_constant).
 * ALGEBRAIC[6] is Vmax in component LT2p (flux).
 * CONSTANTS[43] is KR in component LT2p (molar).
 * STATES[20] is LT2pR in component LT2pR (micromolar).
 * ALGEBRAIC[7] is Vmax in component LT3p (flux).
 * CONSTANTS[44] is KR in component LT3p (molar).
 * STATES[21] is LT3pR in component LT3pR (micromolar).
 * ALGEBRAIC[8] is P in component P (micromolar).
 * CONSTANTS[34] is Z in component Z (micromolar).
 * CONSTANTS[35] is k_y in component model_parameters (second_order_rate_constant).
 * CONSTANTS[36] is k_b in component model_parameters (first_order_rate_constant).
 * RATES[0] is d/dt T2 in component T2 (micromolar).
 * RATES[3] is d/dt T3 in component T3 (micromolar).
 * RATES[9] is d/dt T4 in component T4 (micromolar).
 * RATES[5] is d/dt T2p in component T2p (micromolar).
 * RATES[10] is d/dt T3p in component T3p (micromolar).
 * RATES[12] is d/dt T4p in component T4p (micromolar).
 * RATES[1] is d/dt LT2 in component LT2 (micromolar).
 * RATES[7] is d/dt LT3 in component LT3 (micromolar).
 * RATES[11] is d/dt LT4 in component LT4 (micromolar).
 * RATES[13] is d/dt LT2p in component LT2p (micromolar).
 * RATES[15] is d/dt LT3p in component LT3p (micromolar).
 * RATES[17] is d/dt LT4p in component LT4p (micromolar).
 * RATES[6] is d/dt Yp in component Yp (micromolar).
 * RATES[4] is d/dt Bp in component Bp (micromolar).
 * RATES[2] is d/dt T2R in component T2R (micromolar).
 * RATES[8] is d/dt T3R in component T3R (micromolar).
 * RATES[14] is d/dt T2pR in component T2pR (micromolar).
 * RATES[16] is d/dt T3pR in component T3pR (micromolar).
 * RATES[18] is d/dt LT2R in component LT2R (micromolar).
 * RATES[19] is d/dt LT3R in component LT3R (micromolar).
 * RATES[20] is d/dt LT2pR in component LT2pR (micromolar).
 * RATES[21] is d/dt LT3pR in component LT3pR (micromolar).
 */
void
initConsts(double* CONSTANTS, double* RATES, double *STATES)
{
STATES[0] = 0.01;
STATES[1] = 0.01;
STATES[2] = 0.01;
CONSTANTS[0] = 0.3;
STATES[3] = 0.01;
CONSTANTS[1] = 3.0;
STATES[4] = 0.01;
STATES[5] = 0.01;
CONSTANTS[2] = 20.0;
STATES[6] = 0.01;
CONSTANTS[3] = 1.7;
CONSTANTS[4] = 7E7;
CONSTANTS[5] = 70.0;
CONSTANTS[6] = 15.0;
CONSTANTS[7] = 4E5;
CONSTANTS[8] = 3E7;
CONSTANTS[9] = 8E5;
CONSTANTS[10] = 10;
CONSTANTS[11] = 17;
CONSTANTS[12] = 0.17;
STATES[7] = 0.01;
STATES[8] = 0.01;
STATES[9] = 0.01;
STATES[10] = 0.01;
CONSTANTS[13] = 7E7;
CONSTANTS[14] = 70.0;
CONSTANTS[15] = 45.0;
CONSTANTS[16] = 3E4;
CONSTANTS[17] = 10;
CONSTANTS[18] = 17;
CONSTANTS[19] = 0.017;
STATES[11] = 0.01;
STATES[12] = 0.01;
CONSTANTS[20] = 7E7;
CONSTANTS[21] = 70.0;
CONSTANTS[22] = 48.0;
STATES[13] = 0.01;
STATES[14] = 0.01;
STATES[15] = 0.01;
STATES[16] = 0.01;
STATES[17] = 0.01;
STATES[18] = 0.01;
CONSTANTS[23] = 0.0;
CONSTANTS[24] = 4E5;
CONSTANTS[25] = 10;
CONSTANTS[26] = 17;
CONSTANTS[27] = 5.1;
STATES[19] = 0.01;
CONSTANTS[28] = 16.5;
CONSTANTS[29] = 3E4;
CONSTANTS[30] = 10;
CONSTANTS[31] = 17;
CONSTANTS[32] = 0.51;
CONSTANTS[33] = 34.56;
STATES[20] = 0.01;
STATES[21] = 0.01;
CONSTANTS[34] = 40.0;
CONSTANTS[35] = 5E5;
CONSTANTS[36] = 0.35;
CONSTANTS[37] = (CONSTANTS[10]+CONSTANTS[12])/CONSTANTS[11];
CONSTANTS[38] = (CONSTANTS[17]+CONSTANTS[19])/CONSTANTS[18];
CONSTANTS[39] = (CONSTANTS[10]+CONSTANTS[12])/CONSTANTS[11];
CONSTANTS[40] = (CONSTANTS[17]+CONSTANTS[19])/CONSTANTS[18];
CONSTANTS[41] = (CONSTANTS[25]+CONSTANTS[27])/CONSTANTS[26];
CONSTANTS[42] = (CONSTANTS[30]+CONSTANTS[32])/CONSTANTS[31];
CONSTANTS[43] = (CONSTANTS[25]+CONSTANTS[27])/CONSTANTS[26];
CONSTANTS[44] = (CONSTANTS[30]+CONSTANTS[32])/CONSTANTS[31];
}
void
computeRates(double VOI, double* CONSTANTS, double* RATES, double* STATES, double* ALGEBRAIC)
{
RATES[9] = ( CONSTANTS[21]*STATES[11]+ CONSTANTS[8]*STATES[12]*(CONSTANTS[2] - STATES[6])+ CONSTANTS[9]*STATES[12]*(CONSTANTS[3] - STATES[4])) - ( CONSTANTS[20]*CONSTANTS[1]*STATES[9]+ CONSTANTS[22]*STATES[9]);
RATES[12] = ( CONSTANTS[21]*STATES[17]+ CONSTANTS[8]*STATES[9]*(CONSTANTS[2] - STATES[6])+ CONSTANTS[9]*STATES[9]*(CONSTANTS[3] - STATES[4])) - ( CONSTANTS[20]*CONSTANTS[1]*STATES[12]+ CONSTANTS[22]*STATES[12]);
RATES[11] = ( CONSTANTS[21]*STATES[9]+ CONSTANTS[8]*STATES[17]*(CONSTANTS[2] - STATES[6])+ CONSTANTS[9]*STATES[17]*(CONSTANTS[3] - STATES[4])) - ( CONSTANTS[20]*CONSTANTS[1]*STATES[11]+ CONSTANTS[33]*STATES[11]);
RATES[17] = ( CONSTANTS[21]*STATES[12]+ CONSTANTS[8]*STATES[17]*(CONSTANTS[2] - STATES[6])+ CONSTANTS[9]*STATES[17]*(CONSTANTS[3] - STATES[4])) - ( CONSTANTS[20]*CONSTANTS[1]*STATES[17]+ CONSTANTS[33]*STATES[17]);
RATES[2] =  CONSTANTS[11]*STATES[0]*CONSTANTS[0] - ( CONSTANTS[10]*STATES[2]+ CONSTANTS[12]*STATES[2]);
RATES[8] =  CONSTANTS[18]*STATES[3]*CONSTANTS[0] - ( CONSTANTS[17]*STATES[8]+ CONSTANTS[19]*STATES[8]);
RATES[14] =  CONSTANTS[11]*STATES[5]*CONSTANTS[0] - ( CONSTANTS[10]*STATES[14]+ CONSTANTS[12]*STATES[14]);
RATES[16] =  CONSTANTS[18]*STATES[10]*CONSTANTS[0] - ( CONSTANTS[17]*STATES[16]+ CONSTANTS[19]*STATES[16]);
RATES[18] =  CONSTANTS[26]*STATES[1]*CONSTANTS[0] - ( CONSTANTS[25]*STATES[18]+ CONSTANTS[27]*STATES[18]);
RATES[19] =  CONSTANTS[31]*STATES[7]*CONSTANTS[0] - ( CONSTANTS[30]*STATES[19]+ CONSTANTS[32]*STATES[19]);
RATES[20] =  CONSTANTS[26]*STATES[13]*CONSTANTS[0] - ( CONSTANTS[25]*STATES[20]+ CONSTANTS[27]*STATES[20]);
RATES[21] =  CONSTANTS[31]*STATES[15]*CONSTANTS[0] - ( CONSTANTS[30]*STATES[21]+ CONSTANTS[32]*STATES[21]);
ALGEBRAIC[0] =  CONSTANTS[12]*(CONSTANTS[0]+STATES[2]);
RATES[0] = ( CONSTANTS[5]*STATES[1]+ CONSTANTS[7]*STATES[4]*STATES[3]+ CONSTANTS[8]*STATES[5]*(CONSTANTS[2] - STATES[6])+ CONSTANTS[9]*STATES[5]*(CONSTANTS[3] - STATES[4])) - ( CONSTANTS[4]*CONSTANTS[1]*STATES[0]+ CONSTANTS[6]*STATES[0]+ ALGEBRAIC[0]*(STATES[0]/(CONSTANTS[37]+STATES[0])));
ALGEBRAIC[1] =  CONSTANTS[19]*(CONSTANTS[0]+STATES[8]);
RATES[3] = ( CONSTANTS[14]*STATES[7]+ CONSTANTS[16]*STATES[4]*STATES[9]+ CONSTANTS[8]*STATES[10]*(CONSTANTS[2] - STATES[6])+ CONSTANTS[9]*STATES[10]*(CONSTANTS[3] - STATES[4])) - ( CONSTANTS[13]*CONSTANTS[1]*STATES[3]+ CONSTANTS[15]*STATES[3]+ ALGEBRAIC[1]*(STATES[3]/(CONSTANTS[38]+STATES[3])));
ALGEBRAIC[2] =  CONSTANTS[12]*(CONSTANTS[0]+STATES[14]);
RATES[5] = ( CONSTANTS[5]*STATES[13]+ CONSTANTS[7]*STATES[4]*STATES[10]+ CONSTANTS[8]*STATES[0]*(CONSTANTS[2] - STATES[6])+ CONSTANTS[9]*STATES[0]*(CONSTANTS[3] - STATES[4])) - ( CONSTANTS[4]*CONSTANTS[1]*STATES[5]+ CONSTANTS[6]*STATES[5]+ ALGEBRAIC[2]*(STATES[5]/(CONSTANTS[39]+STATES[5])));
ALGEBRAIC[3] =  CONSTANTS[19]*(CONSTANTS[0]+STATES[16]);
RATES[10] = ( CONSTANTS[14]*STATES[15]+ CONSTANTS[16]*STATES[4]*STATES[12]+ CONSTANTS[8]*STATES[3]*(CONSTANTS[2] - STATES[6])+ CONSTANTS[9]*STATES[3]*(CONSTANTS[3] - STATES[4])) - ( CONSTANTS[13]*CONSTANTS[1]*STATES[10]+ CONSTANTS[15]*STATES[10]+ ALGEBRAIC[3]*(STATES[10]/(CONSTANTS[40]+STATES[10])));
ALGEBRAIC[4] =  CONSTANTS[27]*(CONSTANTS[0]+STATES[18]);
RATES[1] = ( CONSTANTS[5]*STATES[0]+ CONSTANTS[24]*STATES[4]*STATES[7]+ CONSTANTS[8]*STATES[13]*(CONSTANTS[2] - STATES[6])+ CONSTANTS[9]*STATES[13]*(CONSTANTS[3] - STATES[4])) - ( CONSTANTS[4]*CONSTANTS[1]*STATES[1]+ CONSTANTS[23]*STATES[1]+ ALGEBRAIC[4]*(STATES[1]/(CONSTANTS[41]+STATES[1])));
ALGEBRAIC[5] =  CONSTANTS[32]*(CONSTANTS[0]+STATES[19]);
RATES[7] = ( CONSTANTS[14]*STATES[3]+ CONSTANTS[29]*STATES[4]*STATES[11]+ CONSTANTS[8]*STATES[15]*(CONSTANTS[2] - STATES[6])+ CONSTANTS[9]*STATES[15]*(CONSTANTS[3] - STATES[4])) - ( CONSTANTS[13]*CONSTANTS[1]*STATES[7]+ CONSTANTS[28]*STATES[7]+ ALGEBRAIC[5]*(STATES[7]/(CONSTANTS[42]+STATES[7])));
ALGEBRAIC[6] =  CONSTANTS[27]*(CONSTANTS[0]+STATES[20]);
RATES[13] = ( CONSTANTS[5]*STATES[5]+ CONSTANTS[24]*STATES[4]*STATES[15]+ CONSTANTS[8]*STATES[1]*(CONSTANTS[2] - STATES[6])+ CONSTANTS[9]*STATES[1]*(CONSTANTS[3] - STATES[4])) - ( CONSTANTS[4]*CONSTANTS[1]*STATES[13]+ CONSTANTS[23]*STATES[13]+ ALGEBRAIC[6]*(STATES[13]/(CONSTANTS[43]+STATES[13])));
ALGEBRAIC[7] =  CONSTANTS[32]*(CONSTANTS[0]+STATES[21]);
RATES[15] = ( CONSTANTS[14]*STATES[10]+ CONSTANTS[29]*STATES[4]*STATES[17]+ CONSTANTS[8]*STATES[7]*(CONSTANTS[2] - STATES[6])+ CONSTANTS[9]*STATES[7]*(CONSTANTS[3] - STATES[4])) - ( CONSTANTS[13]*CONSTANTS[1]*STATES[15]+ CONSTANTS[28]*STATES[15]+ ALGEBRAIC[7]*(STATES[15]/(CONSTANTS[44]+STATES[15])));
ALGEBRAIC[8] = STATES[5]+STATES[13]+STATES[10]+STATES[15]+STATES[12]+STATES[17];
RATES[6] =  CONSTANTS[8]*ALGEBRAIC[8]*(CONSTANTS[2] - STATES[6]) -  CONSTANTS[35]*CONSTANTS[34]*STATES[6];
RATES[4] =  CONSTANTS[9]*ALGEBRAIC[8]*(CONSTANTS[3] - STATES[4]) -  CONSTANTS[36]*STATES[4];
}
void
computeVariables(double VOI, double* CONSTANTS, double* RATES, double* STATES, double* ALGEBRAIC)
{
ALGEBRAIC[0] =  CONSTANTS[12]*(CONSTANTS[0]+STATES[2]);
ALGEBRAIC[1] =  CONSTANTS[19]*(CONSTANTS[0]+STATES[8]);
ALGEBRAIC[2] =  CONSTANTS[12]*(CONSTANTS[0]+STATES[14]);
ALGEBRAIC[3] =  CONSTANTS[19]*(CONSTANTS[0]+STATES[16]);
ALGEBRAIC[4] =  CONSTANTS[27]*(CONSTANTS[0]+STATES[18]);
ALGEBRAIC[5] =  CONSTANTS[32]*(CONSTANTS[0]+STATES[19]);
ALGEBRAIC[6] =  CONSTANTS[27]*(CONSTANTS[0]+STATES[20]);
ALGEBRAIC[7] =  CONSTANTS[32]*(CONSTANTS[0]+STATES[21]);
ALGEBRAIC[8] = STATES[5]+STATES[13]+STATES[10]+STATES[15]+STATES[12]+STATES[17];
}