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 5 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 17 entries in the constant variable array.
 */
/*
 * VOI is time in component environment (minute).
 * STATES[0] is x1 in component x1 (picomole).
 * CONSTANTS[14] is k in component k (flux).
 * ALGEBRAIC[4] is lambda_Ca in component lambda_Ca (per_minute).
 * CONSTANTS[0] is lambda1 in component model_parameters (per_minute).
 * CONSTANTS[15] is A in component A (per_minute).
 * CONSTANTS[16] is B in component B (per_minute).
 * ALGEBRAIC[0] is Ca in component Ca (millimolar).
 * ALGEBRAIC[3] is S in component S (millimolar).
 * ALGEBRAIC[2] is m_Ca in component m_Ca (dimensionless).
 * CONSTANTS[1] is m1 in component model_parameters (dimensionless).
 * CONSTANTS[2] is m2 in component model_parameters (dimensionless).
 * CONSTANTS[3] is beta in component model_parameters (litre_per_millimole).
 * CONSTANTS[4] is R in component model_parameters (millimolar).
 * STATES[1] is x2 in component x2 (picomole).
 * ALGEBRAIC[1] is PTH in component x2 (picomole).
 * CONSTANTS[5] is lambda2 in component model_parameters (per_minute).
 * CONSTANTS[6] is Ca_0 in component model_parameters (millimolar).
 * CONSTANTS[7] is Ca_1 in component model_parameters (millimolar).
 * CONSTANTS[8] is alpha in component model_parameters (per_minute).
 * CONSTANTS[9] is t0 in component model_parameters (minute).
 * CONSTANTS[10] is x1_n in component model_parameters (picomole).
 * CONSTANTS[11] is x2_n in component model_parameters (picomole).
 * CONSTANTS[12] is x2_max in component model_parameters (picomole).
 * CONSTANTS[13] is x2_min in component model_parameters (picomole).
 * RATES[0] is d/dt x1 in component x1 (picomole).
 * RATES[1] is d/dt x2 in component x2 (picomole).
 */
void
initConsts(double* CONSTANTS, double* RATES, double *STATES)
{
STATES[0] = 0.00;
CONSTANTS[0] = 0.0125;
CONSTANTS[1] = 112.5200;
CONSTANTS[2] = 15.00;
CONSTANTS[3] = 1e6;
CONSTANTS[4] = 1.2162;
STATES[1] = 0.00;
CONSTANTS[5] = 0.5595;
CONSTANTS[6] = 1.255;
CONSTANTS[7] = 0.1817;
CONSTANTS[8] = 0.0442;
CONSTANTS[9] = 575.0;
CONSTANTS[10] = 490.7800;
CONSTANTS[11] = 6.6290;
CONSTANTS[12] = 14.0430;
CONSTANTS[13] = 0.6697;
CONSTANTS[14] =  CONSTANTS[5]*CONSTANTS[11]+ CONSTANTS[0]*CONSTANTS[10];
CONSTANTS[15] = ( CONSTANTS[0]*CONSTANTS[5]*CONSTANTS[12])/(CONSTANTS[14] -  CONSTANTS[5]*CONSTANTS[12]);
CONSTANTS[16] = ( CONSTANTS[0]*CONSTANTS[5]*CONSTANTS[13])/(CONSTANTS[14] -  CONSTANTS[5]*CONSTANTS[13]);
}
void
computeRates(double VOI, double* CONSTANTS, double* RATES, double* STATES, double* ALGEBRAIC)
{
ALGEBRAIC[0] = (VOI<CONSTANTS[9] ? CONSTANTS[6] : CONSTANTS[6] -  CONSTANTS[7]*(1.00000 - exp( - CONSTANTS[8]*(VOI - CONSTANTS[9]))));
ALGEBRAIC[2] = CONSTANTS[1]/(1.00000+exp( - CONSTANTS[3]*(CONSTANTS[4] - ALGEBRAIC[0])))+CONSTANTS[2];
ALGEBRAIC[3] =  CONSTANTS[6]*pow(- (( CONSTANTS[10]*CONSTANTS[16] -  CONSTANTS[5]*CONSTANTS[11])/( CONSTANTS[10]*CONSTANTS[15] -  CONSTANTS[5]*CONSTANTS[11])), 1.00000/ALGEBRAIC[2]);
ALGEBRAIC[4] = (CONSTANTS[15] - CONSTANTS[16])/(1.00000+pow(ALGEBRAIC[0]/ALGEBRAIC[3], ALGEBRAIC[2]))+CONSTANTS[16];
RATES[0] = CONSTANTS[14] - ( ALGEBRAIC[4]*STATES[0]+ CONSTANTS[0]*STATES[0]);
RATES[1] =  ALGEBRAIC[4]*STATES[0] -  CONSTANTS[5]*STATES[1];
}
void
computeVariables(double VOI, double* CONSTANTS, double* RATES, double* STATES, double* ALGEBRAIC)
{
ALGEBRAIC[0] = (VOI<CONSTANTS[9] ? CONSTANTS[6] : CONSTANTS[6] -  CONSTANTS[7]*(1.00000 - exp( - CONSTANTS[8]*(VOI - CONSTANTS[9]))));
ALGEBRAIC[2] = CONSTANTS[1]/(1.00000+exp( - CONSTANTS[3]*(CONSTANTS[4] - ALGEBRAIC[0])))+CONSTANTS[2];
ALGEBRAIC[3] =  CONSTANTS[6]*pow(- (( CONSTANTS[10]*CONSTANTS[16] -  CONSTANTS[5]*CONSTANTS[11])/( CONSTANTS[10]*CONSTANTS[15] -  CONSTANTS[5]*CONSTANTS[11])), 1.00000/ALGEBRAIC[2]);
ALGEBRAIC[4] = (CONSTANTS[15] - CONSTANTS[16])/(1.00000+pow(ALGEBRAIC[0]/ALGEBRAIC[3], ALGEBRAIC[2]))+CONSTANTS[16];
ALGEBRAIC[1] = STATES[1]/2.75000;
}