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 15 entries in the algebraic variable array.
   There are a total of 10 entries in each of the rate and state variable arrays.
   There are a total of 38 entries in the constant variable array.
 */
/*
 * VOI is time in component environment (second).
 * STATES[0] is ATP_cyt in component ATP_cyt (micromolar).
 * ALGEBRAIC[9] is J_hyd in component J_hyd (flux).
 * ALGEBRAIC[1] is J_CKMM in component J_CKMM (flux).
 * ALGEBRAIC[12] is J_diff_ATP in component J_diff_ATP (flux).
 * CONSTANTS[0] is V_cyt in component fractional_volumes (dimensionless).
 * STATES[1] is ADP_cyt in component ADP_cyt (micromolar).
 * ALGEBRAIC[13] is J_diff_ADP in component J_diff_ADP (flux).
 * STATES[2] is PCr_cyt in component PCr_cyt (micromolar).
 * ALGEBRAIC[5] is J_diff_PCr in component J_diff_PCr (flux).
 * STATES[3] is Cr_cyt in component Cr_cyt (micromolar).
 * ALGEBRAIC[6] is J_diff_Cr in component J_diff_Cr (flux).
 * STATES[4] is Pi_cyt in component Pi_cyt (micromolar).
 * ALGEBRAIC[14] is J_diff_Pi in component J_diff_Pi (flux).
 * STATES[5] is ATP_ims in component ATP_ims (micromolar).
 * ALGEBRAIC[3] is J_CKMi in component J_CKMi (flux).
 * ALGEBRAIC[11] is J_syn in component J_syn (flux).
 * CONSTANTS[1] is V_ims in component fractional_volumes (dimensionless).
 * STATES[6] is ADP_ims in component ADP_ims (micromolar).
 * STATES[7] is PCr_ims in component PCr_ims (micromolar).
 * STATES[8] is Cr_ims in component Cr_ims (micromolar).
 * STATES[9] is Pi_ims in component Pi_ims (micromolar).
 * ALGEBRAIC[0] is Den_MMCK in component J_CKMM (dimensionless).
 * CONSTANTS[2] is Kia in component J_CKMM (micromolar).
 * CONSTANTS[3] is Kb in component J_CKMM (micromolar).
 * CONSTANTS[4] is Kib in component J_CKMM (micromolar).
 * CONSTANTS[31] is KIb in component J_CKMM (micromolar).
 * CONSTANTS[32] is Kc in component J_CKMM (micromolar).
 * CONSTANTS[5] is Kic in component J_CKMM (micromolar).
 * CONSTANTS[6] is Kd in component J_CKMM (micromolar).
 * CONSTANTS[7] is Kid in component J_CKMM (micromolar).
 * CONSTANTS[8] is Vmax_MM_f in component J_CKMM (flux).
 * CONSTANTS[9] is Vmax_MM_b in component J_CKMM (flux).
 * ALGEBRAIC[2] is Den_MiCK in component J_CKMi (dimensionless).
 * CONSTANTS[10] is Kia in component J_CKMi (micromolar).
 * CONSTANTS[11] is Kb in component J_CKMi (micromolar).
 * CONSTANTS[12] is Kib in component J_CKMi (micromolar).
 * CONSTANTS[33] is KIb in component J_CKMi (micromolar).
 * CONSTANTS[34] is Kc in component J_CKMi (micromolar).
 * CONSTANTS[13] is Kic in component J_CKMi (micromolar).
 * CONSTANTS[14] is Kd in component J_CKMi (micromolar).
 * CONSTANTS[15] is Kid in component J_CKMi (micromolar).
 * CONSTANTS[16] is Vmax_Mi_f in component J_CKMi (flux).
 * CONSTANTS[17] is Vmax_Mi_b in component J_CKMi (flux).
 * ALGEBRAIC[8] is H_ATPmax in component J_hyd (flux).
 * CONSTANTS[18] is J_hyd_basis_1 in component J_hyd (flux).
 * CONSTANTS[19] is J_hyd_basis_2 in component J_hyd (flux).
 * CONSTANTS[20] is freq_1 in component J_hyd (dimensionless).
 * CONSTANTS[21] is freq_2 in component J_hyd (dimensionless).
 * CONSTANTS[35] is t_cycle_1 in component J_hyd (second).
 * CONSTANTS[36] is t_cycle_2 in component J_hyd (second).
 * ALGEBRAIC[7] is t_cycle in component J_hyd (second).
 * CONSTANTS[22] is nb_of_cycles_1 in component J_hyd (dimensionless).
 * CONSTANTS[37] is duration_1 in component J_hyd (second).
 * ALGEBRAIC[4] is ltime in component J_hyd (second).
 * ALGEBRAIC[10] is Den_syn in component J_syn (dimensionless).
 * CONSTANTS[23] is KPi in component J_syn (micromolar).
 * CONSTANTS[24] is KADP in component J_syn (micromolar).
 * CONSTANTS[25] is V_max_syn in component J_syn (flux).
 * CONSTANTS[26] is PS_tot_ATP in component J_diff_ATP (first_order_rate_constant).
 * CONSTANTS[27] is PS_tot_ADP in component J_diff_ADP (first_order_rate_constant).
 * CONSTANTS[28] is PS_tot_PCr in component J_diff_PCr (first_order_rate_constant).
 * CONSTANTS[29] is PS_tot_Cr in component J_diff_Cr (first_order_rate_constant).
 * CONSTANTS[30] is PS_tot_Pi in component J_diff_Pi (first_order_rate_constant).
 * RATES[0] is d/dt ATP_cyt in component ATP_cyt (micromolar).
 * RATES[1] is d/dt ADP_cyt in component ADP_cyt (micromolar).
 * RATES[2] is d/dt PCr_cyt in component PCr_cyt (micromolar).
 * RATES[3] is d/dt Cr_cyt in component Cr_cyt (micromolar).
 * RATES[4] is d/dt Pi_cyt in component Pi_cyt (micromolar).
 * RATES[5] is d/dt ATP_ims in component ATP_ims (micromolar).
 * RATES[6] is d/dt ADP_ims in component ADP_ims (micromolar).
 * RATES[7] is d/dt PCr_ims in component PCr_ims (micromolar).
 * RATES[8] is d/dt Cr_ims in component Cr_ims (micromolar).
 * RATES[9] is d/dt Pi_ims in component Pi_ims (micromolar).
 */
void
initConsts(double* CONSTANTS, double* RATES, double *STATES)
{
STATES[0] = 5912.77;
CONSTANTS[0] = 0.75;
STATES[1] = 64;
STATES[2] = 5000;
STATES[3] = 10500;
STATES[4] = 913;
STATES[5] = 5912.77;
CONSTANTS[1] = 0.0625;
STATES[6] = 39;
STATES[7] = 5000;
STATES[8] = 10500;
STATES[9] = 910;
CONSTANTS[2] = 9.0E2;
CONSTANTS[3] = 1.55E4;
CONSTANTS[4] = 3.49E4;
CONSTANTS[5] = 2.224E2;
CONSTANTS[6] = 1.67E3;
CONSTANTS[7] = 4.73E3;
CONSTANTS[8] = 1.144E4;
CONSTANTS[9] = 4.804E4;
CONSTANTS[10] = 7.5E2;
CONSTANTS[11] = 5.2E3;
CONSTANTS[12] = 2.88E4;
CONSTANTS[13] = 2.048E2;
CONSTANTS[14] = 5.0E2;
CONSTANTS[15] = 1.6E3;
CONSTANTS[16] = 8.82E2;
CONSTANTS[17] = 3.704E3;
CONSTANTS[18] = 4.865e2;
CONSTANTS[19] = 6.276e2;
CONSTANTS[20] = 135;
CONSTANTS[21] = 220;
CONSTANTS[22] = 5;
CONSTANTS[23] = 8E2;
CONSTANTS[24] = 25;
CONSTANTS[25] = 1.504E4;
CONSTANTS[26] = 13.3;
CONSTANTS[27] = 13.3;
CONSTANTS[28] = 155.0;
CONSTANTS[29] = 155.0;
CONSTANTS[30] = 194.0;
CONSTANTS[31] = CONSTANTS[4];
CONSTANTS[32] = ( CONSTANTS[5]*CONSTANTS[6])/CONSTANTS[7];
CONSTANTS[33] = CONSTANTS[12];
CONSTANTS[34] = ( CONSTANTS[13]*CONSTANTS[14])/CONSTANTS[15];
CONSTANTS[35] = 60.0000/CONSTANTS[20];
CONSTANTS[36] = 60.0000/CONSTANTS[21];
CONSTANTS[37] =  CONSTANTS[22]*CONSTANTS[35];
}
void
computeRates(double VOI, double* CONSTANTS, double* RATES, double* STATES, double* ALGEBRAIC)
{
ALGEBRAIC[0] = 1.00000+STATES[3]/CONSTANTS[4]+STATES[2]/CONSTANTS[7]+ STATES[0]*(1.00000/CONSTANTS[2]+STATES[3]/( CONSTANTS[2]*CONSTANTS[3]))+ STATES[1]*(1.00000/CONSTANTS[5]+STATES[2]/( CONSTANTS[7]*CONSTANTS[32])+STATES[3]/( CONSTANTS[5]*CONSTANTS[31]));
ALGEBRAIC[1] = ( CONSTANTS[8]*(( STATES[0]*STATES[3])/( CONSTANTS[2]*CONSTANTS[3])) -  CONSTANTS[9]*(( STATES[1]*STATES[2])/( CONSTANTS[5]*CONSTANTS[6])))/ALGEBRAIC[0];
ALGEBRAIC[5] =  CONSTANTS[28]*(STATES[7] - STATES[2]);
RATES[2] = (ALGEBRAIC[5]+ALGEBRAIC[1])/CONSTANTS[0];
ALGEBRAIC[6] =  CONSTANTS[29]*(STATES[8] - STATES[3]);
RATES[3] = (ALGEBRAIC[6] - ALGEBRAIC[1])/CONSTANTS[0];
ALGEBRAIC[2] = 1.00000+STATES[8]/CONSTANTS[12]+STATES[7]/CONSTANTS[15]+ STATES[5]*(1.00000/CONSTANTS[10]+STATES[8]/( CONSTANTS[10]*CONSTANTS[11]))+ STATES[6]*(1.00000/CONSTANTS[13]+STATES[7]/( CONSTANTS[15]*CONSTANTS[34])+STATES[8]/( CONSTANTS[13]*CONSTANTS[33]));
ALGEBRAIC[3] = ( CONSTANTS[16]*(( STATES[5]*STATES[8])/( CONSTANTS[10]*CONSTANTS[11])) -  CONSTANTS[17]*(( STATES[6]*STATES[7])/( CONSTANTS[13]*CONSTANTS[14])))/ALGEBRAIC[2];
RATES[7] = (ALGEBRAIC[3] - ALGEBRAIC[5])/CONSTANTS[1];
RATES[8] = - (ALGEBRAIC[3]+ALGEBRAIC[6])/CONSTANTS[1];
ALGEBRAIC[8] = (VOI<=CONSTANTS[37] ?  6.00000*CONSTANTS[18] :  6.00000*CONSTANTS[19]);
ALGEBRAIC[7] = (VOI<=CONSTANTS[37] ? CONSTANTS[35] : CONSTANTS[36]);
ALGEBRAIC[4] = (VOI<=CONSTANTS[37] ? VOI -  CONSTANTS[35]*floor(VOI/CONSTANTS[35]) : (VOI - CONSTANTS[37]) -  CONSTANTS[36]*floor((VOI - CONSTANTS[37])/CONSTANTS[36]));
ALGEBRAIC[9] = (ALGEBRAIC[4]>=0.00000&&ALGEBRAIC[4]< (1.00000/6.00000)*ALGEBRAIC[7] ?  (( ALGEBRAIC[8]*ALGEBRAIC[4])/ALGEBRAIC[7])*6.00000 : ALGEBRAIC[4]>= (1.00000/6.00000)*ALGEBRAIC[7]&&ALGEBRAIC[4]< (1.00000/3.00000)*ALGEBRAIC[7] ?  ALGEBRAIC[8]*(1.00000 -  6.00000*(ALGEBRAIC[4]/ALGEBRAIC[7] - 1.00000/6.00000)) : ALGEBRAIC[4]>= (1.00000/3.00000)*ALGEBRAIC[7]&&ALGEBRAIC[4]<ALGEBRAIC[7] ? 0.00000 : 0.0/0.0);
ALGEBRAIC[12] =  CONSTANTS[26]*(STATES[5] - STATES[0]);
RATES[0] = (ALGEBRAIC[12] - (ALGEBRAIC[9]+ALGEBRAIC[1]))/CONSTANTS[0];
ALGEBRAIC[13] =  CONSTANTS[27]*(STATES[6] - STATES[1]);
RATES[1] = (ALGEBRAIC[13]+ALGEBRAIC[9]+ALGEBRAIC[1])/CONSTANTS[0];
ALGEBRAIC[14] =  CONSTANTS[30]*(STATES[9] - STATES[4]);
RATES[4] = (ALGEBRAIC[14]+ALGEBRAIC[9])/CONSTANTS[0];
ALGEBRAIC[10] = 1.00000+STATES[6]/CONSTANTS[24]+STATES[9]/CONSTANTS[23]+( STATES[6]*STATES[9])/( CONSTANTS[24]*CONSTANTS[23]);
ALGEBRAIC[11] =  CONSTANTS[25]*(( STATES[6]*STATES[9])/( CONSTANTS[23]*CONSTANTS[24]*ALGEBRAIC[10]));
RATES[5] = (ALGEBRAIC[11] - (ALGEBRAIC[12]+ALGEBRAIC[3]))/CONSTANTS[1];
RATES[6] = (ALGEBRAIC[3] - (ALGEBRAIC[11]+ALGEBRAIC[13]))/CONSTANTS[1];
RATES[9] = - (ALGEBRAIC[11]+ALGEBRAIC[14])/CONSTANTS[1];
}
void
computeVariables(double VOI, double* CONSTANTS, double* RATES, double* STATES, double* ALGEBRAIC)
{
ALGEBRAIC[0] = 1.00000+STATES[3]/CONSTANTS[4]+STATES[2]/CONSTANTS[7]+ STATES[0]*(1.00000/CONSTANTS[2]+STATES[3]/( CONSTANTS[2]*CONSTANTS[3]))+ STATES[1]*(1.00000/CONSTANTS[5]+STATES[2]/( CONSTANTS[7]*CONSTANTS[32])+STATES[3]/( CONSTANTS[5]*CONSTANTS[31]));
ALGEBRAIC[1] = ( CONSTANTS[8]*(( STATES[0]*STATES[3])/( CONSTANTS[2]*CONSTANTS[3])) -  CONSTANTS[9]*(( STATES[1]*STATES[2])/( CONSTANTS[5]*CONSTANTS[6])))/ALGEBRAIC[0];
ALGEBRAIC[5] =  CONSTANTS[28]*(STATES[7] - STATES[2]);
ALGEBRAIC[6] =  CONSTANTS[29]*(STATES[8] - STATES[3]);
ALGEBRAIC[2] = 1.00000+STATES[8]/CONSTANTS[12]+STATES[7]/CONSTANTS[15]+ STATES[5]*(1.00000/CONSTANTS[10]+STATES[8]/( CONSTANTS[10]*CONSTANTS[11]))+ STATES[6]*(1.00000/CONSTANTS[13]+STATES[7]/( CONSTANTS[15]*CONSTANTS[34])+STATES[8]/( CONSTANTS[13]*CONSTANTS[33]));
ALGEBRAIC[3] = ( CONSTANTS[16]*(( STATES[5]*STATES[8])/( CONSTANTS[10]*CONSTANTS[11])) -  CONSTANTS[17]*(( STATES[6]*STATES[7])/( CONSTANTS[13]*CONSTANTS[14])))/ALGEBRAIC[2];
ALGEBRAIC[8] = (VOI<=CONSTANTS[37] ?  6.00000*CONSTANTS[18] :  6.00000*CONSTANTS[19]);
ALGEBRAIC[7] = (VOI<=CONSTANTS[37] ? CONSTANTS[35] : CONSTANTS[36]);
ALGEBRAIC[4] = (VOI<=CONSTANTS[37] ? VOI -  CONSTANTS[35]*floor(VOI/CONSTANTS[35]) : (VOI - CONSTANTS[37]) -  CONSTANTS[36]*floor((VOI - CONSTANTS[37])/CONSTANTS[36]));
ALGEBRAIC[9] = (ALGEBRAIC[4]>=0.00000&&ALGEBRAIC[4]< (1.00000/6.00000)*ALGEBRAIC[7] ?  (( ALGEBRAIC[8]*ALGEBRAIC[4])/ALGEBRAIC[7])*6.00000 : ALGEBRAIC[4]>= (1.00000/6.00000)*ALGEBRAIC[7]&&ALGEBRAIC[4]< (1.00000/3.00000)*ALGEBRAIC[7] ?  ALGEBRAIC[8]*(1.00000 -  6.00000*(ALGEBRAIC[4]/ALGEBRAIC[7] - 1.00000/6.00000)) : ALGEBRAIC[4]>= (1.00000/3.00000)*ALGEBRAIC[7]&&ALGEBRAIC[4]<ALGEBRAIC[7] ? 0.00000 : 0.0/0.0);
ALGEBRAIC[12] =  CONSTANTS[26]*(STATES[5] - STATES[0]);
ALGEBRAIC[13] =  CONSTANTS[27]*(STATES[6] - STATES[1]);
ALGEBRAIC[14] =  CONSTANTS[30]*(STATES[9] - STATES[4]);
ALGEBRAIC[10] = 1.00000+STATES[6]/CONSTANTS[24]+STATES[9]/CONSTANTS[23]+( STATES[6]*STATES[9])/( CONSTANTS[24]*CONSTANTS[23]);
ALGEBRAIC[11] =  CONSTANTS[25]*(( STATES[6]*STATES[9])/( CONSTANTS[23]*CONSTANTS[24]*ALGEBRAIC[10]));
}