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 15 entries in the constant variable array.
 */
/*
 * VOI is time in component environment (min).
 * STATES[0] is Z in component Ca (uM).
 * STATES[1] is Y in component Ca (uM).
 * STATES[2] is X in component Ca (uM).
 * CONSTANTS[14] is V_in in component V_in (uM_per_min).
 * ALGEBRAIC[0] is V_2i in component V_2i (uM_per_min).
 * ALGEBRAIC[1] is V_3i in component V_3i (uM_per_min).
 * ALGEBRAIC[2] is V_2s in component V_2s (uM_per_min).
 * ALGEBRAIC[3] is V_3s in component V_3s (uM_per_min).
 * CONSTANTS[0] is K_f in component Ca (per_min).
 * CONSTANTS[1] is K in component Ca (per_min).
 * CONSTANTS[2] is beta in component Ca_flux (dimensionless).
 * CONSTANTS[3] is v_0 in component V_in (uM_per_min).
 * CONSTANTS[4] is v_1 in component V_in (uM_per_min).
 * CONSTANTS[5] is V_M2i in component V_2i (uM_per_min).
 * CONSTANTS[6] is K_2i in component V_2i (uM).
 * CONSTANTS[7] is V_M3i in component V_3i (uM_per_min).
 * CONSTANTS[8] is K_3z in component V_3i (uM).
 * CONSTANTS[9] is K_3y in component V_3i (uM).
 * CONSTANTS[10] is V_M2s in component V_2s (uM_per_min).
 * CONSTANTS[11] is K_2s in component V_2s (uM).
 * CONSTANTS[12] is V_M3s in component V_3s (uM_per_min).
 * CONSTANTS[13] is K_3s in component V_3s (uM).
 * RATES[0] is d/dt Z in component Ca (uM).
 * RATES[1] is d/dt Y in component Ca (uM).
 * RATES[2] is d/dt X in component Ca (uM).
 */
void
initConsts(double* CONSTANTS, double* RATES, double *STATES)
{
STATES[0] = 0.0;
STATES[1] = 0.0;
STATES[2] = 0.5;
CONSTANTS[0] = 0.5;
CONSTANTS[1] = 1;
CONSTANTS[2] = 1;
CONSTANTS[3] = 0.015;
CONSTANTS[4] = 0.012;
CONSTANTS[5] = 3.1;
CONSTANTS[6] = 0.005;
CONSTANTS[7] = 25;
CONSTANTS[8] = 0.022;
CONSTANTS[9] = 0.065;
CONSTANTS[10] = 1.5;
CONSTANTS[11] = 0.0265;
CONSTANTS[12] = 0.169;
CONSTANTS[13] = 0.1;
CONSTANTS[14] = CONSTANTS[3]+ CONSTANTS[4]*CONSTANTS[2];
}
void
computeRates(double VOI, double* CONSTANTS, double* RATES, double* STATES, double* ALGEBRAIC)
{
ALGEBRAIC[0] =  CONSTANTS[5]*(pow(STATES[0], 2.00000)/(pow(CONSTANTS[6], 2.00000)+pow(STATES[0], 2.00000)));
ALGEBRAIC[1] =  CONSTANTS[7]*(pow(STATES[1], 2.00000)/(pow(CONSTANTS[9], 2.00000)+pow(STATES[1], 2.00000)))*(pow(STATES[0], 2.00000)/(pow(CONSTANTS[8], 2.00000)+pow(STATES[0], 2.00000)));
RATES[1] = ALGEBRAIC[0]+- ALGEBRAIC[1]+- ( CONSTANTS[0]*STATES[1]);
ALGEBRAIC[2] =  CONSTANTS[10]*(pow(STATES[0], 2.00000)/(pow(CONSTANTS[11], 2.00000)+pow(STATES[0], 2.00000)));
ALGEBRAIC[3] =  CONSTANTS[2]*CONSTANTS[12]*(pow(STATES[2], 2.00000)/(pow(CONSTANTS[13], 2.00000)+pow(STATES[2], 2.00000)));
RATES[0] = CONSTANTS[14]+- ALGEBRAIC[0]+ALGEBRAIC[1]+ CONSTANTS[0]*STATES[1]+- ALGEBRAIC[2]+ALGEBRAIC[3]+ CONSTANTS[0]*STATES[2]+- ( CONSTANTS[1]*STATES[0]);
RATES[2] = ALGEBRAIC[2]+- ALGEBRAIC[3]+- ( CONSTANTS[0]*STATES[2]);
}
void
computeVariables(double VOI, double* CONSTANTS, double* RATES, double* STATES, double* ALGEBRAIC)
{
ALGEBRAIC[0] =  CONSTANTS[5]*(pow(STATES[0], 2.00000)/(pow(CONSTANTS[6], 2.00000)+pow(STATES[0], 2.00000)));
ALGEBRAIC[1] =  CONSTANTS[7]*(pow(STATES[1], 2.00000)/(pow(CONSTANTS[9], 2.00000)+pow(STATES[1], 2.00000)))*(pow(STATES[0], 2.00000)/(pow(CONSTANTS[8], 2.00000)+pow(STATES[0], 2.00000)));
ALGEBRAIC[2] =  CONSTANTS[10]*(pow(STATES[0], 2.00000)/(pow(CONSTANTS[11], 2.00000)+pow(STATES[0], 2.00000)));
ALGEBRAIC[3] =  CONSTANTS[2]*CONSTANTS[12]*(pow(STATES[2], 2.00000)/(pow(CONSTANTS[13], 2.00000)+pow(STATES[2], 2.00000)));
}