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 2 entries in each of the rate and state variable arrays.
   There are a total of 13 entries in the constant variable array.
 */
/*
 * VOI is time in component environment (minute).
 * ALGEBRAIC[0] is B in component B (micromolar).
 * CONSTANTS[0] is F in component B (micromolar).
 * CONSTANTS[1] is n2 in component B (dimensionless).
 * CONSTANTS[2] is K2 in component B (per_micromolar).
 * STATES[0] is Ca in component Ca (micromolar).
 * ALGEBRAIC[3] is R in component R (flux).
 * CONSTANTS[3] is Vmax in component R (flux).
 * CONSTANTS[4] is Km in component R (micromolar).
 * ALGEBRAIC[2] is fu in component R (dimensionless).
 * CONSTANTS[12] is ISF in component R (dimensionless).
 * CONSTANTS[5] is age in component R (dimensionless).
 * STATES[1] is C in component C (micromolar).
 * CONSTANTS[6] is Va in component Ca (ml).
 * CONSTANTS[7] is Vv in component Ca (ml).
 * CONSTANTS[8] is Qc in component model_constants (flow).
 * ALGEBRAIC[1] is Cv in component Cv (micromolar).
 * CONSTANTS[9] is Q in component model_constants (flow).
 * CONSTANTS[10] is P in component model_constants (dimensionless).
 * CONSTANTS[11] is V in component C (ml).
 * RATES[0] is d/dt Ca in component Ca (micromolar).
 * RATES[1] is d/dt C in component C (micromolar).
 */
void
initConsts(double* CONSTANTS, double* RATES, double *STATES)
{
CONSTANTS[0] = 0.48;
CONSTANTS[1] = 1;
CONSTANTS[2] = 0.8532;
STATES[0] = 6.6685;
CONSTANTS[3] = 9.433e-3;
CONSTANTS[4] = 198;
CONSTANTS[5] = 5;
STATES[1] = 0;
CONSTANTS[6] = 2148;
CONSTANTS[7] = 3431;
CONSTANTS[8] = 6445.65;
CONSTANTS[9] = 1221.34;
CONSTANTS[10] = 15.61;
CONSTANTS[11] = 1454;
CONSTANTS[12] = - 8.32120+ 2.04010*CONSTANTS[5]+ 4.19620*arbitrary_log( CONSTANTS[5]*365.000, 10);
}
void
computeRates(double VOI, double* CONSTANTS, double* RATES, double* STATES, double* ALGEBRAIC)
{
ALGEBRAIC[1] = (( CONSTANTS[9]*STATES[1])/CONSTANTS[10])/CONSTANTS[8];
RATES[0] = ( CONSTANTS[8]*(ALGEBRAIC[1] - STATES[0]))/(CONSTANTS[6]+CONSTANTS[7]);
ALGEBRAIC[0] = ( CONSTANTS[0]*CONSTANTS[1]*CONSTANTS[2]*STATES[0])/(1.00000+ CONSTANTS[2]*CONSTANTS[0]);
ALGEBRAIC[2] = CONSTANTS[0]/(CONSTANTS[0]+ALGEBRAIC[0]);
ALGEBRAIC[3] = ( CONSTANTS[12]*CONSTANTS[3]*ALGEBRAIC[2]*STATES[1])/(CONSTANTS[4]+ ALGEBRAIC[2]*STATES[1]);
RATES[1] = ( CONSTANTS[9]*(STATES[0] - STATES[1]/CONSTANTS[10]) -  ALGEBRAIC[3]*1.00000)/CONSTANTS[11];
}
void
computeVariables(double VOI, double* CONSTANTS, double* RATES, double* STATES, double* ALGEBRAIC)
{
ALGEBRAIC[1] = (( CONSTANTS[9]*STATES[1])/CONSTANTS[10])/CONSTANTS[8];
ALGEBRAIC[0] = ( CONSTANTS[0]*CONSTANTS[1]*CONSTANTS[2]*STATES[0])/(1.00000+ CONSTANTS[2]*CONSTANTS[0]);
ALGEBRAIC[2] = CONSTANTS[0]/(CONSTANTS[0]+ALGEBRAIC[0]);
ALGEBRAIC[3] = ( CONSTANTS[12]*CONSTANTS[3]*ALGEBRAIC[2]*STATES[1])/(CONSTANTS[4]+ ALGEBRAIC[2]*STATES[1]);
}