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 1 entries in the algebraic variable array.
   There are a total of 5 entries in each of the rate and state variable arrays.
   There are a total of 18 entries in the constant variable array.
 */
/*
 * VOI is time in component environment (hour).
 * STATES[0] is M in component M (micromolar).
 * CONSTANTS[0] is Km in component M (micromolar).
 * CONSTANTS[1] is vs in component M (flux).
 * CONSTANTS[2] is vm in component M (flux).
 * CONSTANTS[3] is n in component M (dimensionless).
 * CONSTANTS[4] is KI in component M (micromolar).
 * STATES[1] is PN in component PN (micromolar).
 * STATES[2] is P0 in component P0 (micromolar).
 * CONSTANTS[5] is ks in component P0 (first_order_rate_constant).
 * STATES[3] is P1 in component P1 (micromolar).
 * CONSTANTS[6] is K1 in component parameters (micromolar).
 * CONSTANTS[7] is V1 in component parameters (flux).
 * CONSTANTS[8] is K2 in component parameters (micromolar).
 * CONSTANTS[9] is V2 in component parameters (flux).
 * STATES[4] is P2 in component P2 (micromolar).
 * CONSTANTS[10] is K3 in component parameters (micromolar).
 * CONSTANTS[11] is V3 in component parameters (flux).
 * CONSTANTS[12] is K4 in component parameters (micromolar).
 * CONSTANTS[13] is V4 in component parameters (flux).
 * CONSTANTS[14] is Kd in component P2 (micromolar).
 * CONSTANTS[15] is vd in component P2 (flux).
 * CONSTANTS[16] is k1 in component parameters (first_order_rate_constant).
 * CONSTANTS[17] is k2 in component parameters (first_order_rate_constant).
 * ALGEBRAIC[0] is Pt in component Pt (micromolar).
 * RATES[0] is d/dt M in component M (micromolar).
 * RATES[2] is d/dt P0 in component P0 (micromolar).
 * RATES[3] is d/dt P1 in component P1 (micromolar).
 * RATES[4] is d/dt P2 in component P2 (micromolar).
 * RATES[1] is d/dt PN in component PN (micromolar).
 */
void
initConsts(double* CONSTANTS, double* RATES, double *STATES)
{
STATES[0] = 0.6;
CONSTANTS[0] = 0.5;
CONSTANTS[1] = 0.76;
CONSTANTS[2] = 0.65;
CONSTANTS[3] = 4.0;
CONSTANTS[4] = 1.0;
STATES[1] = 1.1;
STATES[2] = 0.5;
CONSTANTS[5] = 0.38;
STATES[3] = 0.6;
CONSTANTS[6] = 2.0;
CONSTANTS[7] = 3.2;
CONSTANTS[8] = 2.0;
CONSTANTS[9] = 1.58;
STATES[4] = 0.6;
CONSTANTS[10] = 2.0;
CONSTANTS[11] = 5.0;
CONSTANTS[12] = 2.0;
CONSTANTS[13] = 2.5;
CONSTANTS[14] = 0.2;
CONSTANTS[15] = 0.95;
CONSTANTS[16] = 1.9;
CONSTANTS[17] = 1.3;
}
void
computeRates(double VOI, double* CONSTANTS, double* RATES, double* STATES, double* ALGEBRAIC)
{
RATES[0] =  CONSTANTS[1]*(pow(CONSTANTS[4], CONSTANTS[3])/(pow(CONSTANTS[4], CONSTANTS[3])+pow(STATES[1], CONSTANTS[3]))) -  CONSTANTS[2]*(STATES[0]/(CONSTANTS[0]+STATES[0]));
RATES[2] = ( CONSTANTS[5]*STATES[0] -  CONSTANTS[7]*(STATES[2]/(CONSTANTS[6]+STATES[2])))+ CONSTANTS[9]*(STATES[3]/(CONSTANTS[8]+STATES[3]));
RATES[3] = ( CONSTANTS[7]*(STATES[2]/(CONSTANTS[6]+STATES[2])) - ( CONSTANTS[9]*(STATES[3]/(CONSTANTS[8]+STATES[3]))+ CONSTANTS[11]*(STATES[3]/(CONSTANTS[10]+STATES[3]))))+ CONSTANTS[13]*(STATES[4]/(CONSTANTS[12]+STATES[4]));
RATES[4] = (( CONSTANTS[11]*(STATES[3]/(CONSTANTS[10]+STATES[3])) - ( CONSTANTS[13]*(STATES[4]/(CONSTANTS[12]+STATES[4]))+ CONSTANTS[16]*STATES[4]))+ CONSTANTS[17]*STATES[1]) -  CONSTANTS[15]*(STATES[4]/(CONSTANTS[14]+STATES[4]));
RATES[1] =  CONSTANTS[16]*STATES[4] -  CONSTANTS[17]*STATES[1];
}
void
computeVariables(double VOI, double* CONSTANTS, double* RATES, double* STATES, double* ALGEBRAIC)
{
ALGEBRAIC[0] = STATES[2]+STATES[3]+STATES[4]+STATES[1];
}