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 6 entries in the algebraic variable array.
   There are a total of 9 entries in each of the rate and state variable arrays.
   There are a total of 51 entries in the constant variable array.
 */
/*
 * VOI is time in component environment (day).
 * ALGEBRAIC[0] is A_B in component A_B (mm2).
 * STATES[0] is r_B in component r_B (mm).
 * CONSTANTS[0] is X_c in component r_B (pM).
 * CONSTANTS[1] is X_b in component r_B (pM).
 * CONSTANTS[2] is X_y in component r_B (pM).
 * CONSTANTS[3] is k_rB in component r_B (first_order_rate_constant).
 * CONSTANTS[4] is k_for in component r_B (mm_per_day).
 * CONSTANTS[5] is k_res in component r_B (mm_per_day).
 * STATES[1] is xc in component xc (pM).
 * STATES[2] is xb in component xb (pM).
 * STATES[3] is xy in component xy (pM).
 * CONSTANTS[6] is X_bss in component xy (pM).
 * CONSTANTS[7] is X_yss in component xy (pM).
 * CONSTANTS[8] is k_byp in component xy (first_order_rate_constant).
 * CONSTANTS[9] is k_yd in component xy (first_order_rate_constant).
 * ALGEBRAIC[5] is F_sti in component F_sti (pM_N_per_mm2).
 * CONSTANTS[10] is k_Fs in component F_sti (mm2_per_N).
 * CONSTANTS[11] is k_y in component F_sti (per_pM).
 * ALGEBRAIC[4] is F_s in component F_s (N_per_mm2).
 * ALGEBRAIC[2] is F_a in component F_s (newton).
 * STATES[4] is x_no in component x_no (pM).
 * CONSTANTS[12] is X_noe in component x_no (flux).
 * CONSTANTS[13] is k_yno in component x_no (mm2_day_per_dyn).
 * CONSTANTS[14] is k_nod in component x_no (first_order_rate_constant).
 * STATES[5] is x_pge in component x_pge (pM).
 * CONSTANTS[15] is X_pgex in component x_pge (flux).
 * CONSTANTS[16] is k_pged in component x_pge (first_order_rate_constant).
 * CONSTANTS[17] is k_nopge in component x_pge (first_order_rate_constant).
 * CONSTANTS[18] is k_ypge in component x_pge (mm2_day_per_dyn).
 * STATES[6] is x_opg in component x_opg (pM).
 * CONSTANTS[19] is k_opgd in component x_opg (first_order_rate_constant).
 * CONSTANTS[20] is k_nopg in component x_opg (first_order_rate_constant).
 * CONSTANTS[21] is Io in component model_parameters (flux).
 * CONSTANTS[22] is K_o_p in component model_parameters (picomole_per_day_picomole_cells).
 * STATES[7] is xr in component xr (pM).
 * ALGEBRAIC[3] is pi_c in component model_parameters (dimensionless).
 * STATES[8] is x_kl in component x_kl (pM).
 * ALGEBRAIC[1] is pi_L in component x_kl (dimensionless).
 * CONSTANTS[23] is K_l_p in component x_kl (dimensionless).
 * CONSTANTS[24] is K in component x_kl (pM).
 * CONSTANTS[25] is k_nokl in component x_kl (first_order_rate_constant).
 * CONSTANTS[26] is Il in component x_kl (flux).
 * CONSTANTS[27] is rl in component x_kl (flux).
 * CONSTANTS[28] is k1 in component x_kl (second_order_rate_constant).
 * CONSTANTS[29] is k2 in component x_kl (first_order_rate_constant).
 * CONSTANTS[30] is k3 in component x_kl (second_order_rate_constant).
 * CONSTANTS[31] is k4 in component x_kl (first_order_rate_constant).
 * CONSTANTS[32] is ko in component x_kl (first_order_rate_constant).
 * CONSTANTS[50] is pi_p in component model_parameters (dimensionless).
 * CONSTANTS[33] is D_R in component xr (flux).
 * CONSTANTS[34] is k_pger in component xr (first_order_rate_constant).
 * CONSTANTS[46] is D_B in component model_parameters (first_order_rate_constant).
 * CONSTANTS[35] is k_B in component xb (first_order_rate_constant).
 * CONSTANTS[36] is D_C in component xc (flux).
 * CONSTANTS[37] is D_A in component xc (first_order_rate_constant).
 * CONSTANTS[38] is f0 in component model_parameters (dimensionless).
 * CONSTANTS[39] is dB in component model_parameters (first_order_rate_constant).
 * CONSTANTS[40] is C_s in component model_parameters (pM).
 * CONSTANTS[47] is P in component model_parameters (pM).
 * CONSTANTS[48] is P_0 in component model_parameters (pM).
 * CONSTANTS[49] is P_s in component model_parameters (pM).
 * CONSTANTS[41] is SP in component model_parameters (flux).
 * CONSTANTS[42] is k5 in component model_parameters (second_order_rate_constant).
 * CONSTANTS[43] is k6 in component model_parameters (first_order_rate_constant).
 * CONSTANTS[44] is IP in component model_parameters (flux).
 * CONSTANTS[45] is kP in component model_parameters (first_order_rate_constant).
 * RATES[0] is d/dt r_B in component r_B (mm).
 * RATES[3] is d/dt xy in component xy (pM).
 * RATES[4] is d/dt x_no in component x_no (pM).
 * RATES[5] is d/dt x_pge in component x_pge (pM).
 * RATES[6] is d/dt x_opg in component x_opg (pM).
 * RATES[8] is d/dt x_kl in component x_kl (pM).
 * RATES[7] is d/dt xr in component xr (pM).
 * RATES[2] is d/dt xb in component xb (pM).
 * RATES[1] is d/dt xc in component xc (pM).
 */
void
initConsts(double* CONSTANTS, double* RATES, double *STATES)
{
STATES[0] = 0.9912;
CONSTANTS[0] = 9.127e-4;
CONSTANTS[1] = 7.282e-4;
CONSTANTS[2] = 7.300e-3;
CONSTANTS[3] = 1.0e0;
CONSTANTS[4] = 1.0e-3;
CONSTANTS[5] = 10.0e-3;
STATES[1] = 9.127e-4;
STATES[2] = 7.282e-4;
STATES[3] = 7.300e-3;
CONSTANTS[6] = 7.282e-4;
CONSTANTS[7] = 7.300e-3;
CONSTANTS[8] = 1.00e-1;
CONSTANTS[9] = 1.00e0;
CONSTANTS[10] = 1.00e0;
CONSTANTS[11] = 1.00e0;
STATES[4] = 0.02;
CONSTANTS[12] = 0e0;
CONSTANTS[13] = 2e4;
CONSTANTS[14] = 1e3;
STATES[5] = 0.01;
CONSTANTS[15] = 0e0;
CONSTANTS[16] = 1e2;
CONSTANTS[17] = 1e0;
CONSTANTS[18] = 1e2;
STATES[6] = 0.01;
CONSTANTS[19] = 3.5e-1;
CONSTANTS[20] = 1e1;
CONSTANTS[21] = 0.0;
CONSTANTS[22] = 2e5;
STATES[7] = 7.734e-4;
STATES[8] = 0.01;
CONSTANTS[23] = 3e6;
CONSTANTS[24] = 10;
CONSTANTS[25] = 1e2;
CONSTANTS[26] = 0;
CONSTANTS[27] = 1e3;
CONSTANTS[28] = 1e-2;
CONSTANTS[29] = 10;
CONSTANTS[30] = 5.8e-4;
CONSTANTS[31] = 1.7e-2;
CONSTANTS[32] = 0.35;
CONSTANTS[33] = 7e-4;
CONSTANTS[34] = 1e-4;
CONSTANTS[35] = 0.189;
CONSTANTS[36] = 0.189;
CONSTANTS[37] = 0.7;
CONSTANTS[38] = 0.05;
CONSTANTS[39] = 0.7;
CONSTANTS[40] = 5e-3;
CONSTANTS[41] = 250;
CONSTANTS[42] = 0.02;
CONSTANTS[43] = 3;
CONSTANTS[44] = 0;
CONSTANTS[45] = 86;
CONSTANTS[46] =  CONSTANTS[38]*CONSTANTS[39];
CONSTANTS[47] = CONSTANTS[44]/CONSTANTS[45];
CONSTANTS[48] = CONSTANTS[41]/CONSTANTS[45];
CONSTANTS[49] = CONSTANTS[43]/CONSTANTS[42];
CONSTANTS[50] = (CONSTANTS[47]+CONSTANTS[48])/(CONSTANTS[47]+CONSTANTS[49]);
}
void
computeRates(double VOI, double* CONSTANTS, double* RATES, double* STATES, double* ALGEBRAIC)
{
RATES[0] = ( (CONSTANTS[4]/CONSTANTS[1])*STATES[2]+ (1.00000/CONSTANTS[2])*STATES[3]) - ( (CONSTANTS[5]/CONSTANTS[0])*STATES[1]+ CONSTANTS[3]*STATES[0]);
RATES[3] =  CONSTANTS[8]*(STATES[2] - CONSTANTS[6]) -  CONSTANTS[9]*(STATES[3] - CONSTANTS[7]);
RATES[8] = (CONSTANTS[27]+CONSTANTS[26]) - ( CONSTANTS[25]*STATES[4]+ CONSTANTS[27]*((1.00000+ (CONSTANTS[28]/CONSTANTS[29])*STATES[6]+ (CONSTANTS[30]/CONSTANTS[31])*CONSTANTS[24])/( CONSTANTS[23]*CONSTANTS[50]*STATES[2]))*STATES[8]);
ALGEBRAIC[3] = (STATES[1]+ CONSTANTS[38]*CONSTANTS[40])/(STATES[1]+CONSTANTS[40]);
RATES[6] = ( (CONSTANTS[22]/1.00000)*ALGEBRAIC[3]*STATES[7]+CONSTANTS[21]+ CONSTANTS[20]*STATES[4]) -  CONSTANTS[19]*STATES[6];
RATES[7] = ( CONSTANTS[33]*ALGEBRAIC[3]+ CONSTANTS[34]*STATES[5]) -  (CONSTANTS[46]/ALGEBRAIC[3])*STATES[7];
RATES[2] =  (CONSTANTS[46]/ALGEBRAIC[3])*STATES[7] -  CONSTANTS[35]*STATES[2];
ALGEBRAIC[1] =  (( ( (CONSTANTS[30]/CONSTANTS[31])*CONSTANTS[23])*CONSTANTS[50]*STATES[2])/(1.00000+( CONSTANTS[30]*CONSTANTS[24])/CONSTANTS[31]+ (CONSTANTS[28]/( CONSTANTS[29]*CONSTANTS[32]))*( ((CONSTANTS[22]/1.00000)/CONSTANTS[50])*STATES[7]+CONSTANTS[21])))*(1.00000+CONSTANTS[26]/CONSTANTS[27]);
RATES[1] =  CONSTANTS[36]*ALGEBRAIC[1] -  CONSTANTS[37]*ALGEBRAIC[3]*STATES[1];
ALGEBRAIC[0] =  pow(STATES[0], 2.00000)* 3.14159265358979;
ALGEBRAIC[2] = (VOI>=100.000&&VOI<130.000 ? 10000.0 : 100.000);
ALGEBRAIC[4] = ALGEBRAIC[2]/ALGEBRAIC[0];
ALGEBRAIC[5] = ( ALGEBRAIC[4]*STATES[3])/(1.00000+exp(- ( CONSTANTS[10]*ALGEBRAIC[4]+ CONSTANTS[11]*STATES[3])));
RATES[4] = ( CONSTANTS[13]*ALGEBRAIC[5]+CONSTANTS[12]) -  CONSTANTS[14]*STATES[4];
RATES[5] = ( CONSTANTS[18]*ALGEBRAIC[5]+ CONSTANTS[17]*STATES[4]+CONSTANTS[15]) -  CONSTANTS[16]*STATES[5];
}
void
computeVariables(double VOI, double* CONSTANTS, double* RATES, double* STATES, double* ALGEBRAIC)
{
ALGEBRAIC[3] = (STATES[1]+ CONSTANTS[38]*CONSTANTS[40])/(STATES[1]+CONSTANTS[40]);
ALGEBRAIC[1] =  (( ( (CONSTANTS[30]/CONSTANTS[31])*CONSTANTS[23])*CONSTANTS[50]*STATES[2])/(1.00000+( CONSTANTS[30]*CONSTANTS[24])/CONSTANTS[31]+ (CONSTANTS[28]/( CONSTANTS[29]*CONSTANTS[32]))*( ((CONSTANTS[22]/1.00000)/CONSTANTS[50])*STATES[7]+CONSTANTS[21])))*(1.00000+CONSTANTS[26]/CONSTANTS[27]);
ALGEBRAIC[0] =  pow(STATES[0], 2.00000)* 3.14159265358979;
ALGEBRAIC[2] = (VOI>=100.000&&VOI<130.000 ? 10000.0 : 100.000);
ALGEBRAIC[4] = ALGEBRAIC[2]/ALGEBRAIC[0];
ALGEBRAIC[5] = ( ALGEBRAIC[4]*STATES[3])/(1.00000+exp(- ( CONSTANTS[10]*ALGEBRAIC[4]+ CONSTANTS[11]*STATES[3])));
}