Generated Code

The following is c_ida code generated by the CellML API from this CellML file. (Back to language selection)

The raw code is available.

/*
   There are a total of 19 entries in the algebraic variable array.
   There are a total of 7 entries in each of the rate and state variable arrays.
   There are a total of 42 entries in the constant variable array.
 */
/*
 * VOI is time in component environment (s).
 * STATES[0] is F6P in component F6P (mM).
 * ALGEBRAIC[0] is V_hk in component V_hk (mM_per_s).
 * ALGEBRAIC[12] is V_pfk in component V_pfk (mM_per_s).
 * ALGEBRAIC[13] is V_pfk2 in component V_pfk2 (mM_per_s).
 * STATES[1] is F26P in component F26P (mM).
 * STATES[2] is GAP in component GAP (mM).
 * ALGEBRAIC[14] is V_pk in component V_pk (mM_per_s).
 * STATES[3] is PYR in component PYR (mM).
 * ALGEBRAIC[1] is V_ldh in component V_ldh (mM_per_s).
 * ALGEBRAIC[15] is V_op in component V_op (mM_per_s).
 * STATES[4] is LAC in component LAC (mM).
 * ALGEBRAIC[18] is V_lac in component V_lac (mM_per_s).
 * STATES[5] is ATP in component ATP (mM).
 * ALGEBRAIC[17] is V_ATPase in component V_ATPase (mM_per_s).
 * ALGEBRAIC[16] is V_ck in component V_ck (mM_per_s).
 * ALGEBRAIC[4] is dAMP_dATP in component dAMP_dATP (dimensionless).
 * STATES[6] is PCr in component PCr (mM).
 * CONSTANTS[0] is Vmax_hk in component V_hk (mM_per_s).
 * CONSTANTS[1] is Km_ATP_hk in component V_hk (mM).
 * CONSTANTS[2] is KI_F6P in component V_hk (mM).
 * CONSTANTS[3] is Vmax_pfk in component V_pfk (mM_per_s).
 * CONSTANTS[4] is Km_ATP_pfk in component V_pfk (mM).
 * CONSTANTS[5] is Km_F6P_pfk in component V_pfk (mM).
 * CONSTANTS[6] is Km_F26P_pfk in component V_pfk (mM).
 * ALGEBRAIC[9] is AMP_act in component AMP_act (dimensionless).
 * ALGEBRAIC[5] is ATP_inh in component ATP_inh (dimensionless).
 * CONSTANTS[7] is Vmaxf_pfk2 in component V_pfk2 (mM_per_s).
 * CONSTANTS[8] is Vmaxr_pfk2 in component V_pfk2 (mM_per_s).
 * CONSTANTS[9] is Km_ATP_pfk2 in component V_pfk2 (mM).
 * CONSTANTS[10] is Km_F6P_pfk2 in component V_pfk2 (mM).
 * CONSTANTS[11] is Km_F26P_pfk2 in component V_pfk2 (mM).
 * ALGEBRAIC[11] is AMP_pfk2 in component AMP_pfk2 (dimensionless).
 * CONSTANTS[12] is Vmax_pk in component V_pk (mM_per_s).
 * CONSTANTS[13] is Km_ADP_pk in component V_pk (mM).
 * CONSTANTS[14] is Km_GAP_pk in component V_pk (mM).
 * ALGEBRAIC[7] is ADP in component ADP (mM).
 * CONSTANTS[15] is Vmax_op in component V_op (mM_per_s).
 * CONSTANTS[16] is Km_ADP_op in component V_op (mM).
 * CONSTANTS[17] is Km_PYR_op in component V_op (mM).
 * CONSTANTS[18] is kf_ldh in component V_ldh (per_s).
 * CONSTANTS[19] is kr_ldh in component V_ldh (per_s).
 * CONSTANTS[20] is kf_ck in component V_ck (per_mM_s).
 * CONSTANTS[21] is kr_ck in component V_ck (per_mM_s).
 * ALGEBRAIC[2] is Cr in component Cr (mM).
 * CONSTANTS[22] is PCrtot in component Cr (mM).
 * CONSTANTS[23] is Vmax_ATPase in component V_ATPase (mM_per_s).
 * CONSTANTS[24] is Km_ATP in component V_ATPase (mM).
 * ALGEBRAIC[10] is v_stim in component v_stim (dimensionless).
 * CONSTANTS[25] is Vlac_0 in component V_lac (mM_per_s).
 * CONSTANTS[26] is K_LAC_eff in component V_lac (per_s).
 * CONSTANTS[27] is K_LAC in component V_lac (dimensionless).
 * ALGEBRAIC[3] is u in component ADP (dimensionless).
 * CONSTANTS[28] is ANP in component model_parameters (mM).
 * CONSTANTS[29] is Q_adk in component model_parameters (dimensionless).
 * ALGEBRAIC[8] is AMP in component AMP (mM).
 * CONSTANTS[30] is nATP in component ATP_inh (dimensionless).
 * CONSTANTS[31] is KI_ATP in component ATP_inh (mM).
 * CONSTANTS[32] is nAMP in component AMP_act (dimensionless).
 * CONSTANTS[33] is Ka_AMP in component AMP_act (mM).
 * ALGEBRAIC[6] is unitpulseSB in component v_stim (dimensionless).
 * CONSTANTS[34] is stim in component v_stim (dimensionless).
 * CONSTANTS[35] is to in component v_stim (s).
 * CONSTANTS[36] is tend in component v_stim (s).
 * CONSTANTS[37] is v1_n in component v_stim (dimensionless).
 * CONSTANTS[38] is v2_n in component v_stim (dimensionless).
 * CONSTANTS[39] is t_n_stim in component v_stim (s).
 * CONSTANTS[40] is Kamp_pfk2 in component AMP_pfk2 (mM).
 * CONSTANTS[41] is nh_amp in component AMP_pfk2 (dimensionless).
 * RATES[0] is d/dt F6P in component F6P (mM).
 * RATES[1] is d/dt F26P in component F26P (mM).
 * RATES[2] is d/dt GAP in component GAP (mM).
 * RATES[3] is d/dt PYR in component PYR (mM).
 * RATES[4] is d/dt LAC in component LAC (mM).
 * RATES[5] is d/dt ATP in component ATP (mM).
 * RATES[6] is d/dt PCr in component PCr (mM).
 * There are a total of 2 condition variables.
 */
void
initConsts(double* CONSTANTS, double* RATES, double *STATES)
{
STATES[0] = 0.2;
STATES[1] = 0.001;
STATES[2] = 0.0405;
STATES[3] = 0.1;
STATES[4] = 0.5;
STATES[5] = 2.402;
STATES[6] = 18.14;
CONSTANTS[0] = 2.5;
CONSTANTS[1] = 0.5;
CONSTANTS[2] = 0.068;
CONSTANTS[3] = 3.85;
CONSTANTS[4] = 0.05;
CONSTANTS[5] = 0.18;
CONSTANTS[6] = 0.01;
CONSTANTS[7] = 0;
CONSTANTS[8] = 0;
CONSTANTS[9] = 0.05;
CONSTANTS[10] = 0.01;
CONSTANTS[11] = 0.0001;
CONSTANTS[12] = 5.0;
CONSTANTS[13] = 0.005;
CONSTANTS[14] = 0.4;
CONSTANTS[15] = 1.0;
CONSTANTS[16] = 0.005;
CONSTANTS[17] = 0.5;
CONSTANTS[18] = 0;
CONSTANTS[19] = 0;
CONSTANTS[20] = 0;
CONSTANTS[21] = 0;
CONSTANTS[22] = 20.0;
CONSTANTS[23] = 0.9355;
CONSTANTS[24] = 0.5;
CONSTANTS[25] = 0.355;
CONSTANTS[26] = 0.71;
CONSTANTS[27] = 0.641;
CONSTANTS[28] = 2.51;
CONSTANTS[29] = 0.92;
CONSTANTS[30] = 0.4;
CONSTANTS[31] = 1.0;
CONSTANTS[32] = 0.5;
CONSTANTS[33] = 0.05;
CONSTANTS[34] = 1;
CONSTANTS[35] = 50;
CONSTANTS[36] = 200;
CONSTANTS[37] = 0.5;
CONSTANTS[38] = 0.0;
CONSTANTS[39] = 2;
CONSTANTS[40] = 0.005;
CONSTANTS[41] = 2;
RATES[0] = 0.1001;
RATES[1] = 0.1001;
RATES[2] = 0.1001;
RATES[3] = 0.1001;
RATES[4] = 0.1001;
RATES[5] = 0.1001;
RATES[6] = 0.1001;
}
void
computeResiduals(double VOI, double* CONSTANTS, double* RATES, double* OLDRATES, double* STATES,
                 double* OLDSTATES, double* ALGEBRAIC, double* CONDVARS)
{
resid[0] = RATES[0] - ALGEBRAIC[0] - (ALGEBRAIC[12] - ALGEBRAIC[13]);
resid[1] = RATES[1] - ALGEBRAIC[13];
resid[2] = RATES[2] -  2.00000*ALGEBRAIC[12] - ALGEBRAIC[14];
resid[3] = RATES[3] - ALGEBRAIC[14] - (ALGEBRAIC[15]+ALGEBRAIC[1]);
resid[4] = RATES[4] -  2.25000*ALGEBRAIC[1]+ALGEBRAIC[18];
resid[5] = RATES[5] -  (( 2.00000*ALGEBRAIC[14]+ 15.0000*ALGEBRAIC[15]+ALGEBRAIC[16]) - (ALGEBRAIC[0]+ALGEBRAIC[12]+ALGEBRAIC[13]+ALGEBRAIC[17]))*pow(1.00000 - ALGEBRAIC[4], -1.00000);
resid[6] = RATES[6] - - ALGEBRAIC[16];
}
void
computeVariables(double VOI, double* CONSTANTS, double* RATES, double* STATES, double* ALGEBRAIC)
{
}
void
computeEssentialVariables(double VOI, double* CONSTANTS, double* RATES, double* STATES, double* ALGEBRAIC)
{
ALGEBRAIC[0] =  CONSTANTS[0]*(STATES[5]/(STATES[5]+CONSTANTS[1]))*pow(1.00000+pow(STATES[0]/CONSTANTS[2], 4.00000), -1.00000);
ALGEBRAIC[1] =  CONSTANTS[18]*STATES[3] -  CONSTANTS[19]*STATES[4];
ALGEBRAIC[3] = pow(CONSTANTS[29], 2.00000)+ 4.00000*CONSTANTS[29]*(CONSTANTS[28]/STATES[5] - 1.00000);
ALGEBRAIC[4] = - 1.00000+CONSTANTS[29]/2.00000+- ( 0.500000* pow(ALGEBRAIC[3], 1.0 / 2))+ CONSTANTS[29]*(CONSTANTS[28]/( STATES[5]* pow(ALGEBRAIC[3], 1.0 / 2)));
ALGEBRAIC[7] =  (STATES[5]/2.00000)*(- CONSTANTS[29]+ pow(ALGEBRAIC[3], 1.0 / 2));
ALGEBRAIC[8] = CONSTANTS[28] - (STATES[5]+ALGEBRAIC[7]);
ALGEBRAIC[9] = pow((1.00000+ALGEBRAIC[8]/CONSTANTS[33])/(1.00000+ CONSTANTS[32]*(ALGEBRAIC[8]/CONSTANTS[33])), 4.00000);
ALGEBRAIC[5] = pow((1.00000+ CONSTANTS[30]*(STATES[5]/CONSTANTS[31]))/(1.00000+STATES[5]/CONSTANTS[31]), 4.00000);
ALGEBRAIC[12] =  CONSTANTS[3]*(STATES[0]/(STATES[0]+CONSTANTS[5]))*(STATES[5]/(STATES[5]+CONSTANTS[4]))*(STATES[1]/(STATES[1]+CONSTANTS[6]))*ALGEBRAIC[5]*ALGEBRAIC[9];
ALGEBRAIC[11] = pow(ALGEBRAIC[8]/CONSTANTS[40], CONSTANTS[41])/(1.00000+pow(ALGEBRAIC[8]/CONSTANTS[40], CONSTANTS[41]));
ALGEBRAIC[13] =  CONSTANTS[7]*(STATES[5]/(STATES[5]+CONSTANTS[9]))*(STATES[0]/(STATES[0]+CONSTANTS[10]))*ALGEBRAIC[11] -  CONSTANTS[8]*(STATES[1]/(STATES[1]+CONSTANTS[11]));
ALGEBRAIC[14] =  CONSTANTS[12]*(STATES[2]/(STATES[2]+CONSTANTS[14]))*(ALGEBRAIC[7]/(ALGEBRAIC[7]+CONSTANTS[13]))*ALGEBRAIC[5];
ALGEBRAIC[15] =  CONSTANTS[15]*(STATES[3]/(STATES[3]+CONSTANTS[17]))*(ALGEBRAIC[7]/(ALGEBRAIC[7]+CONSTANTS[16]))*(1.00000/(1.00000+ 0.100000*(STATES[5]/ALGEBRAIC[7])));
ALGEBRAIC[2] = CONSTANTS[22] - STATES[6];
ALGEBRAIC[16] =  CONSTANTS[20]*STATES[6]*ALGEBRAIC[7] -  CONSTANTS[21]*ALGEBRAIC[2]*STATES[5];
ALGEBRAIC[6] = (CONDVAR[0]>=0.00000&&CONDVAR[1]<=0.00000 ? 1.00000 : 0.00000);
ALGEBRAIC[10] =  CONSTANTS[34]*(CONSTANTS[37]+ CONSTANTS[38]*((VOI - CONSTANTS[35])/CONSTANTS[39])*exp(- ( (VOI - CONSTANTS[35])*(ALGEBRAIC[6]/CONSTANTS[39]))))*ALGEBRAIC[6];
ALGEBRAIC[17] =  CONSTANTS[23]*(STATES[5]/(STATES[5]+CONSTANTS[24]))*(1.00000+ALGEBRAIC[10]);
ALGEBRAIC[18] =  CONSTANTS[25]*(1.00000+ ALGEBRAIC[10]*CONSTANTS[27]) -  CONSTANTS[26]*STATES[4];
}
void
getStateInformation(double* SI)
{
SI[0] = 1.0;
SI[1] = 1.0;
SI[2] = 1.0;
SI[3] = 1.0;
SI[4] = 1.0;
SI[5] = 1.0;
SI[6] = 1.0;
}
void
computeRoots(double VOI, double* CONSTANTS, double* RATES, double* OLDRATES, double* STATES,
             double* OLDSTATES, double* ALGEBRAIC, double* CONDVARS)
{
CONDVAR[0] = VOI - CONSTANTS[35];
CONDVAR[1] = VOI - (CONSTANTS[35]+CONSTANTS[36]);
}