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 8 entries in each of the rate and state variable arrays.
   There are a total of 11 entries in the constant variable array.
 */
/*
 * VOI is time in component environment (second).
 * STATES[0] is Ca_m in component Ca_m (micromolar).
 * ALGEBRAIC[0] is J_min in component J_min (micromolar).
 * ALGEBRAIC[1] is J_mout in component J_mout (micromolar).
 * CONSTANTS[0] is k_min in component J_min (micromolar).
 * STATES[1] is Ca_cyt in component Ca_cyt (micromolar).
 * CONSTANTS[1] is K_m in component J_min (micromolar).
 * CONSTANTS[2] is n in component J_min (micromolar).
 * CONSTANTS[3] is k_mout in component J_mout (micromolar).
 * STATES[2] is J_ERch in component J_ERch (micromolar).
 * STATES[3] is J_ERpump in component J_ERpump (micromolar).
 * STATES[4] is J_ERleak in component J_ERleak (micromolar).
 * STATES[5] is J_in in component J_in (micromolar).
 * STATES[6] is J_out in component J_out (micromolar).
 * STATES[7] is Ca_ER in component Ca_ER (micromolar).
 * CONSTANTS[4] is K_ch in component J_ERch (micromolar).
 * CONSTANTS[5] is k_ERch in component J_ERch (micromolar).
 * CONSTANTS[6] is K_ERpump in component J_ERpump (micromolar).
 * CONSTANTS[7] is K_ERleak in component J_ERleak (micromolar).
 * CONSTANTS[8] is K_in in component J_in (micromolar).
 * CONSTANTS[9] is K_out in component J_out (micromolar).
 * RATES[0] is d/dt Ca_m in component Ca_m (micromolar).
 * RATES[1] is d/dt Ca_cyt in component Ca_cyt (micromolar).
 * RATES[7] is d/dt Ca_ER in component Ca_ER (micromolar).
 * RATES[2] is d/dt J_ERch in component J_ERch (micromolar).
 * RATES[3] is d/dt J_ERpump in component J_ERpump (micromolar).
 * RATES[4] is d/dt J_ERleak in component J_ERleak (micromolar).
 * RATES[5] is d/dt J_in in component J_in (micromolar).
 * RATES[6] is d/dt J_out in component J_out (micromolar).
 */
void
initConsts(double* CONSTANTS, double* RATES, double *STATES)
{
STATES[0] = 0.1;
CONSTANTS[0] = 330;
STATES[1] = 0.1;
CONSTANTS[1] = 1.6;
CONSTANTS[2] = 8;
CONSTANTS[3] = 0.5;
STATES[2] = 0.1;
STATES[3] = 0.1;
STATES[4] = 0.1;
STATES[5] = 0.1;
STATES[6] = 0.1;
STATES[7] = 0.1;
CONSTANTS[4] = 3;
CONSTANTS[5] = 0.1;
CONSTANTS[6] = 2;
CONSTANTS[7] = 0.01;
CONSTANTS[8] = 0.8;
CONSTANTS[9] = 1;
CONSTANTS[10] = CONSTANTS[8];
}
void
computeRates(double VOI, double* CONSTANTS, double* RATES, double* STATES, double* ALGEBRAIC)
{
RATES[5] = CONSTANTS[10];
RATES[7] = (STATES[3] - STATES[4]) - STATES[2];
RATES[2] =  (( CONSTANTS[5]*pow(STATES[1], 4.00000))/(pow(CONSTANTS[4], 4.00000)+pow(STATES[1], 4.00000)))*STATES[7];
RATES[3] = ( CONSTANTS[6]*STATES[1])/1.00000;
RATES[4] =  CONSTANTS[7]*STATES[7];
RATES[6] = ( CONSTANTS[9]*STATES[1])/1.00000;
ALGEBRAIC[0] =  CONSTANTS[0]*(pow(STATES[1], CONSTANTS[2])/(pow(CONSTANTS[1], CONSTANTS[2])+pow(STATES[1], CONSTANTS[2])));
ALGEBRAIC[1] = ( CONSTANTS[3]*STATES[0])/1.00000;
RATES[0] = ALGEBRAIC[0] - ALGEBRAIC[1];
RATES[1] = ((((STATES[2] - STATES[3])+STATES[4]+STATES[5]) - STATES[6])+ALGEBRAIC[1]) - ALGEBRAIC[0];
}
void
computeVariables(double VOI, double* CONSTANTS, double* RATES, double* STATES, double* ALGEBRAIC)
{
ALGEBRAIC[0] =  CONSTANTS[0]*(pow(STATES[1], CONSTANTS[2])/(pow(CONSTANTS[1], CONSTANTS[2])+pow(STATES[1], CONSTANTS[2])));
ALGEBRAIC[1] = ( CONSTANTS[3]*STATES[0])/1.00000;
}