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 4 entries in the algebraic variable array.
   There are a total of 3 entries in each of the rate and state variable arrays.
   There are a total of 26 entries in the constant variable array.
 */
/*
 * VOI is time in component environment (minute).
 * STATES[0] is Pha in component Pha (dimensionless).
 * ALGEBRAIC[0] is V_1 in component V_1 (dimensionless).
 * STATES[1] is Z in component Z (dimensionless).
 * ALGEBRAIC[2] is K_1 in component K_1 (dimensionless).
 * CONSTANTS[0] is V_M2 in component Pha (per_minute).
 * CONSTANTS[1] is alpha in component Pha (dimensionless).
 * CONSTANTS[2] is Glc in component Pha (micromolar).
 * CONSTANTS[3] is K_2 in component Pha (dimensionless).
 * CONSTANTS[4] is K_a1 in component Pha (micromolar).
 * CONSTANTS[5] is K_a2 in component Pha (micromolar).
 * CONSTANTS[6] is V_M1 in component V_1 (per_minute).
 * CONSTANTS[7] is gamma in component V_1 (dimensionless).
 * CONSTANTS[8] is K_a5 in component V_1 (micromolar).
 * CONSTANTS[9] is K_11 in component K_1 (dimensionless).
 * CONSTANTS[10] is K_a6 in component K_1 (micromolar).
 * CONSTANTS[25] is V_in in component V_in (dimensionless).
 * ALGEBRAIC[1] is V_2i in component V_2i (dimensionless).
 * ALGEBRAIC[3] is V_3i in component V_3i (dimensionless).
 * CONSTANTS[11] is k_f in component Z (per_minute).
 * STATES[2] is Y in component Y (dimensionless).
 * CONSTANTS[12] is k in component Z (per_minute).
 * CONSTANTS[13] is k_f in component Y (per_minute).
 * CONSTANTS[14] is v_0 in component V_in (micromolar_per_minute).
 * CONSTANTS[15] is v_1 in component V_in (micromolar_per_minute).
 * CONSTANTS[16] is beta in component V_in (dimensionless).
 * CONSTANTS[17] is v_M2i in component V_2i (micromolar_per_minute).
 * CONSTANTS[18] is n in component V_2i (dimensionless).
 * CONSTANTS[19] is K_2i in component V_2i (micromolar).
 * CONSTANTS[20] is v_M3i in component V_3i (micromolar_per_minute).
 * CONSTANTS[21] is p in component V_3i (dimensionless).
 * CONSTANTS[22] is m in component V_3i (dimensionless).
 * CONSTANTS[23] is K_Ri in component V_3i (micromolar).
 * CONSTANTS[24] is K_Ai in component V_3i (micromolar).
 * RATES[0] is d/dt Pha in component Pha (dimensionless).
 * RATES[1] is d/dt Z in component Z (dimensionless).
 * RATES[2] is d/dt Y in component Y (dimensionless).
 */
void
initConsts(double* CONSTANTS, double* RATES, double *STATES)
{
STATES[0] = 0.098;
STATES[1] = 0.000179;
CONSTANTS[0] = 0.6;
CONSTANTS[1] = 9;
CONSTANTS[2] = 10000;
CONSTANTS[3] = 0.2;
CONSTANTS[4] = 10000;
CONSTANTS[5] = 10000;
CONSTANTS[6] = 1.5;
CONSTANTS[7] = 9;
CONSTANTS[8] = 0.5;
CONSTANTS[9] = 0.1;
CONSTANTS[10] = 0.5;
CONSTANTS[11] = 0.7;
STATES[2] = 0.00122;
CONSTANTS[12] = 10;
CONSTANTS[13] = 0.7;
CONSTANTS[14] = 1;
CONSTANTS[15] = 5.7;
CONSTANTS[16] = 0.3;
CONSTANTS[17] = 30;
CONSTANTS[18] = 2;
CONSTANTS[19] = 0.5;
CONSTANTS[20] = 325;
CONSTANTS[21] = 4;
CONSTANTS[22] = 4;
CONSTANTS[23] = 1.7;
CONSTANTS[24] = 0.46;
CONSTANTS[25] = CONSTANTS[14]+ CONSTANTS[15]*CONSTANTS[16];
}
void
computeRates(double VOI, double* CONSTANTS, double* RATES, double* STATES, double* ALGEBRAIC)
{
ALGEBRAIC[0] =  CONSTANTS[6]*(1.00000+ CONSTANTS[7]*(pow(STATES[1], 4.00000)/pow(CONSTANTS[8], 4.00000)+pow(STATES[1], 4.00000)));
ALGEBRAIC[2] = CONSTANTS[9]/(1.00000+pow(STATES[1], 4.00000)/pow(CONSTANTS[10], 4.00000));
RATES[0] =  ALGEBRAIC[0]*STATES[1]*((1.00000 - STATES[0])/(( ALGEBRAIC[2]*STATES[1]+1.00000) - STATES[0])) - ( CONSTANTS[0]*(1.00000+( CONSTANTS[1]*CONSTANTS[2])/(CONSTANTS[4]+CONSTANTS[2]))*STATES[0])/(CONSTANTS[3]/(1.00000+CONSTANTS[2]/CONSTANTS[5])+STATES[0]);
ALGEBRAIC[1] =  CONSTANTS[17]*(pow(STATES[1], CONSTANTS[18])/(pow(CONSTANTS[19], CONSTANTS[18])+pow(STATES[1], CONSTANTS[18])));
ALGEBRAIC[3] =  CONSTANTS[20]*(pow(STATES[2], CONSTANTS[22])/pow(CONSTANTS[23], CONSTANTS[22])+pow(STATES[2], CONSTANTS[18]))*(pow(STATES[1], CONSTANTS[21])/(pow(CONSTANTS[24], CONSTANTS[21])+pow(STATES[1], CONSTANTS[21])));
RATES[1] = ((CONSTANTS[25] - ALGEBRAIC[1])+ALGEBRAIC[3]+ CONSTANTS[11]*STATES[2]) -  CONSTANTS[12]*STATES[1];
RATES[2] = (ALGEBRAIC[1] - ALGEBRAIC[3]) -  CONSTANTS[13]*STATES[2];
}
void
computeVariables(double VOI, double* CONSTANTS, double* RATES, double* STATES, double* ALGEBRAIC)
{
ALGEBRAIC[0] =  CONSTANTS[6]*(1.00000+ CONSTANTS[7]*(pow(STATES[1], 4.00000)/pow(CONSTANTS[8], 4.00000)+pow(STATES[1], 4.00000)));
ALGEBRAIC[2] = CONSTANTS[9]/(1.00000+pow(STATES[1], 4.00000)/pow(CONSTANTS[10], 4.00000));
ALGEBRAIC[1] =  CONSTANTS[17]*(pow(STATES[1], CONSTANTS[18])/(pow(CONSTANTS[19], CONSTANTS[18])+pow(STATES[1], CONSTANTS[18])));
ALGEBRAIC[3] =  CONSTANTS[20]*(pow(STATES[2], CONSTANTS[22])/pow(CONSTANTS[23], CONSTANTS[22])+pow(STATES[2], CONSTANTS[18]))*(pow(STATES[1], CONSTANTS[21])/(pow(CONSTANTS[24], CONSTANTS[21])+pow(STATES[1], CONSTANTS[21])));
}