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 2 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 18 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).
 * CONSTANTS[17] is V_in in component V_in (uM_per_min).
 * ALGEBRAIC[0] is V_2 in component V_2 (uM_per_min).
 * ALGEBRAIC[1] is V_3 in component V_3 (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_M2 in component V_2 (uM_per_min).
 * CONSTANTS[6] is K_2 in component V_2 (uM).
 * STATES[2] is A in component A (uM).
 * CONSTANTS[7] is K_y in component V_3 (uM).
 * CONSTANTS[8] is K_z in component V_3 (uM).
 * CONSTANTS[9] is K_a in component V_3 (uM).
 * CONSTANTS[10] is V_M3 in component V_3 (uM_per_min).
 * CONSTANTS[11] is upsilon_p in component A (uM_per_min).
 * CONSTANTS[12] is upsilon_d in component A (uM_per_min).
 * CONSTANTS[13] is K_p in component A (uM).
 * CONSTANTS[14] is K_d in component A (uM).
 * CONSTANTS[15] is n in component A (dimensionless).
 * CONSTANTS[16] is epsilon in component A (per_min).
 * 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 A in component A (uM).
 */
void
initConsts(double* CONSTANTS, double* RATES, double *STATES)
{
STATES[0] = 0.1;
STATES[1] = 1.0;
CONSTANTS[0] = 1;
CONSTANTS[1] = 10;
CONSTANTS[2] = 0.5;
CONSTANTS[3] = 2;
CONSTANTS[4] = 1;
CONSTANTS[5] = 6.5;
CONSTANTS[6] = 0.1;
STATES[2] = 0.5;
CONSTANTS[7] = 0.2;
CONSTANTS[8] = 0.3;
CONSTANTS[9] = 0.2;
CONSTANTS[10] = 19.5;
CONSTANTS[11] = 2.5;
CONSTANTS[12] = 80;
CONSTANTS[13] = 1;
CONSTANTS[14] = 0.4;
CONSTANTS[15] = 4;
CONSTANTS[16] = 0.1;
CONSTANTS[17] = CONSTANTS[3]+ CONSTANTS[4]*CONSTANTS[2];
}
void
computeRates(double VOI, double* CONSTANTS, double* RATES, double* STATES, double* ALGEBRAIC)
{
RATES[2] = ( CONSTANTS[2]*CONSTANTS[11] -  CONSTANTS[12]*(pow(STATES[2], 2.00000)/(pow(CONSTANTS[13], 2.00000)+pow(STATES[2], 2.00000)))*(pow(STATES[0], CONSTANTS[15])/(pow(CONSTANTS[14], CONSTANTS[15])+pow(STATES[0], CONSTANTS[15])))) -  CONSTANTS[16]*STATES[2];
ALGEBRAIC[0] =  CONSTANTS[5]*(pow(STATES[0], 2.00000)/(pow(CONSTANTS[6], 2.00000)+pow(STATES[0], 2.00000)));
ALGEBRAIC[1] =  CONSTANTS[10]*(pow(STATES[2], 4.00000)/(pow(CONSTANTS[9], 4.00000)+pow(STATES[2], 4.00000)))*(pow(STATES[1], 2.00000)/(pow(CONSTANTS[7], 2.00000)+pow(STATES[1], 2.00000)))*(pow(STATES[0], 4.00000)/(pow(CONSTANTS[8], 4.00000)+pow(STATES[0], 4.00000)));
RATES[0] = (CONSTANTS[17] - ALGEBRAIC[0])+ALGEBRAIC[1]+( CONSTANTS[0]*STATES[1] -  CONSTANTS[1]*STATES[0]);
RATES[1] = (ALGEBRAIC[0] - ALGEBRAIC[1]) -  CONSTANTS[0]*STATES[1];
}
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[10]*(pow(STATES[2], 4.00000)/(pow(CONSTANTS[9], 4.00000)+pow(STATES[2], 4.00000)))*(pow(STATES[1], 2.00000)/(pow(CONSTANTS[7], 2.00000)+pow(STATES[1], 2.00000)))*(pow(STATES[0], 4.00000)/(pow(CONSTANTS[8], 4.00000)+pow(STATES[0], 4.00000)));
}