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 3 entries in the algebraic variable array.
   There are a total of 2 entries in each of the rate and state variable arrays.
   There are a total of 14 entries in the constant variable array.
 */
/*
 * VOI is time in component environment (second).
 * CONSTANTS[0] is v0 in component parameters (micromolar_s).
 * CONSTANTS[1] is v1 in component parameters (micromolar_s).
 * ALGEBRAIC[0] is v2 in component parameters (micromolar_s).
 * ALGEBRAIC[1] is v3 in component parameters (micromolar_s).
 * ALGEBRAIC[2] is beta in component beta_pulse (dimensionless).
 * CONSTANTS[2] is VM2 in component parameters (micromolar_s).
 * CONSTANTS[3] is VM3 in component parameters (micromolar_s).
 * CONSTANTS[4] is KR in component parameters (micromolar).
 * CONSTANTS[5] is KA in component parameters (micromolar).
 * CONSTANTS[6] is kf in component parameters (per_second).
 * CONSTANTS[7] is k in component parameters (per_second).
 * CONSTANTS[8] is K2 in component parameters (micromolar).
 * CONSTANTS[9] is n in component parameters (dimensionless).
 * CONSTANTS[10] is m in component parameters (dimensionless).
 * CONSTANTS[11] is p in component parameters (dimensionless).
 * STATES[0] is Z in component cytosol (micromolar).
 * STATES[1] is Y in component insensitive_pool (micromolar).
 * CONSTANTS[12] is betaf in component beta_pulse (dimensionless).
 * CONSTANTS[13] is tp in component beta_pulse (second).
 * RATES[0] is d/dt Z in component cytosol (micromolar).
 * RATES[1] is d/dt Y in component insensitive_pool (micromolar).
 */
void
initConsts(double* CONSTANTS, double* RATES, double *STATES)
{
CONSTANTS[0] = 1;
CONSTANTS[1] = 7.3;
CONSTANTS[2] = 65;
CONSTANTS[3] = 500;
CONSTANTS[4] = 2;
CONSTANTS[5] = 0.9;
CONSTANTS[6] = 1;
CONSTANTS[7] = 10;
CONSTANTS[8] = 1;
CONSTANTS[9] = 2;
CONSTANTS[10] = 2;
CONSTANTS[11] = 4;
STATES[0] = 0.1;
STATES[1] = 0.64;
CONSTANTS[12] = 0.96;
CONSTANTS[13] = 4;
}
void
computeRates(double VOI, double* CONSTANTS, double* RATES, double* STATES, double* ALGEBRAIC)
{
ALGEBRAIC[0] = ( CONSTANTS[2]*pow(STATES[0], CONSTANTS[9]))/(pow(CONSTANTS[8], CONSTANTS[9])+pow(STATES[0], CONSTANTS[9]));
ALGEBRAIC[1] =  CONSTANTS[3]*(pow(STATES[1], CONSTANTS[10])/(pow(CONSTANTS[4], CONSTANTS[10])+pow(STATES[1], CONSTANTS[10])))*(pow(STATES[0], CONSTANTS[11])/(pow(CONSTANTS[5], CONSTANTS[11])+pow(STATES[0], CONSTANTS[11])));
RATES[1] = (ALGEBRAIC[0] - ALGEBRAIC[1]) -  CONSTANTS[6]*STATES[1];
ALGEBRAIC[2] = (VOI<CONSTANTS[13] ? 0.00000 : VOI>=CONSTANTS[13] ?  CONSTANTS[12]*exp( -0.200000*(VOI - CONSTANTS[13])) : 0.0/0.0);
RATES[0] = (((CONSTANTS[0]+ CONSTANTS[1]*ALGEBRAIC[2]) - ALGEBRAIC[0])+ALGEBRAIC[1]+ CONSTANTS[6]*STATES[1]) -  CONSTANTS[7]*STATES[0];
}
void
computeVariables(double VOI, double* CONSTANTS, double* RATES, double* STATES, double* ALGEBRAIC)
{
ALGEBRAIC[0] = ( CONSTANTS[2]*pow(STATES[0], CONSTANTS[9]))/(pow(CONSTANTS[8], CONSTANTS[9])+pow(STATES[0], CONSTANTS[9]));
ALGEBRAIC[1] =  CONSTANTS[3]*(pow(STATES[1], CONSTANTS[10])/(pow(CONSTANTS[4], CONSTANTS[10])+pow(STATES[1], CONSTANTS[10])))*(pow(STATES[0], CONSTANTS[11])/(pow(CONSTANTS[5], CONSTANTS[11])+pow(STATES[0], CONSTANTS[11])));
ALGEBRAIC[2] = (VOI<CONSTANTS[13] ? 0.00000 : VOI>=CONSTANTS[13] ?  CONSTANTS[12]*exp( -0.200000*(VOI - CONSTANTS[13])) : 0.0/0.0);
}