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 1 entries in each of the rate and state variable arrays.
   There are a total of 5 entries in the constant variable array.
 */
/*
 * VOI is time in component environment (second).
 * CONSTANTS[0] is a in component contraction (mNpermmsq).
 * CONSTANTS[1] is b in component contraction (pms).
 * CONSTANTS[2] is Po in component contraction (mNpermmsq).
 * CONSTANTS[3] is alpha in component contraction (mNpermmsq).
 * CONSTANTS[4] is L_se_o in component contraction (dimensionless).
 * ALGEBRAIC[0] is L in component contraction (dimensionless).
 * ALGEBRAIC[3] is v in component contraction (pms).
 * ALGEBRAIC[1] is L_se in component contraction (dimensionless).
 * STATES[0] is L_ce in component contraction (dimensionless).
 * ALGEBRAIC[2] is P in component contraction (mNpermmsq).
 * RATES[0] is d/dt L_ce in component contraction (dimensionless).
 */
void
initConsts(double* CONSTANTS, double* RATES, double *STATES)
{
CONSTANTS[0] = 37.24;
CONSTANTS[1] = 0.325;
CONSTANTS[2] = 144.9;
CONSTANTS[3] = 1449.027;
CONSTANTS[4] = 0.3;
STATES[0] = 0.7;
}
void
computeRates(double VOI, double* CONSTANTS, double* RATES, double* STATES, double* ALGEBRAIC)
{
ALGEBRAIC[0] = (VOI<=1.00000 ? 1.00000 : VOI>1.00000&&VOI<5.00000 ? 0.920000 : 0.900000);
ALGEBRAIC[1] = ALGEBRAIC[0] - STATES[0];
ALGEBRAIC[2] =  CONSTANTS[3]*(ALGEBRAIC[1] - CONSTANTS[4]);
ALGEBRAIC[3] = ( - CONSTANTS[1]*(CONSTANTS[2] - ALGEBRAIC[2]))/(ALGEBRAIC[2]+CONSTANTS[0]);
RATES[0] = ALGEBRAIC[3];
}
void
computeVariables(double VOI, double* CONSTANTS, double* RATES, double* STATES, double* ALGEBRAIC)
{
ALGEBRAIC[0] = (VOI<=1.00000 ? 1.00000 : VOI>1.00000&&VOI<5.00000 ? 0.920000 : 0.900000);
ALGEBRAIC[1] = ALGEBRAIC[0] - STATES[0];
ALGEBRAIC[2] =  CONSTANTS[3]*(ALGEBRAIC[1] - CONSTANTS[4]);
ALGEBRAIC[3] = ( - CONSTANTS[1]*(CONSTANTS[2] - ALGEBRAIC[2]))/(ALGEBRAIC[2]+CONSTANTS[0]);
}