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 2 entries in the algebraic variable array.
   There are a total of 3 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).
 * STATES[0] is C in component C (micromolar).
 * CONSTANTS[0] is v_i in component C (micromolar_per_minute).
 * CONSTANTS[1] is v_d in component C (micromolar_per_minute).
 * STATES[1] is X in component X (micromolar).
 * CONSTANTS[2] is K_d in component C (micromolar).
 * CONSTANTS[3] is k_d in component C (per_minute).
 * STATES[2] is M in component M (micromolar).
 * ALGEBRAIC[0] is V_1 in component V_1 (micromolar_per_minute).
 * CONSTANTS[4] is K_1 in component M (per_minute).
 * CONSTANTS[5] is V_2 in component M (per_minute).
 * CONSTANTS[6] is K_2 in component M (per_minute).
 * ALGEBRAIC[1] is V_3 in component V_3 (micromolar_per_minute).
 * CONSTANTS[7] is K_3 in component X (per_minute).
 * CONSTANTS[8] is V_4 in component X (per_minute).
 * CONSTANTS[9] is K_4 in component X (per_minute).
 * CONSTANTS[10] is K_c in component V_1 (micromolar).
 * CONSTANTS[11] is V_M1 in component V_1 (per_minute).
 * CONSTANTS[12] is V_M3 in component V_3 (per_minute).
 * RATES[0] is d/dt C in component C (micromolar).
 * RATES[2] is d/dt M in component M (micromolar).
 * RATES[1] is d/dt X in component X (micromolar).
 */
void
initConsts(double* CONSTANTS, double* RATES, double *STATES)
{
STATES[0] = 0.1;
CONSTANTS[0] = 0.05;
CONSTANTS[1] = 0.25;
STATES[1] = 0.1;
CONSTANTS[2] = 0.02;
CONSTANTS[3] = 0.01;
STATES[2] = 0.1;
CONSTANTS[4] = 0.01;
CONSTANTS[5] = 1.5;
CONSTANTS[6] = 0.01;
CONSTANTS[7] = 0.01;
CONSTANTS[8] = 0.5;
CONSTANTS[9] = 0.01;
CONSTANTS[10] = 0.5;
CONSTANTS[11] = 3;
CONSTANTS[12] = 1;
}
void
computeRates(double VOI, double* CONSTANTS, double* RATES, double* STATES, double* ALGEBRAIC)
{
RATES[0] = (CONSTANTS[0] -  CONSTANTS[1]*STATES[1]*(STATES[0]/(CONSTANTS[2]+STATES[0]))) -  CONSTANTS[3]*STATES[0];
ALGEBRAIC[0] =  (STATES[0]/(CONSTANTS[10]+STATES[0]))*CONSTANTS[11];
RATES[2] =  ALGEBRAIC[0]*((1.00000 - STATES[2])/(CONSTANTS[4]+(1.00000 - STATES[2]))) -  CONSTANTS[5]*(STATES[2]/(CONSTANTS[6]+STATES[2]));
ALGEBRAIC[1] =  STATES[2]*CONSTANTS[12];
RATES[1] =  ALGEBRAIC[1]*((1.00000 - STATES[1])/(CONSTANTS[7]+(1.00000 - STATES[1]))) -  CONSTANTS[8]*(STATES[1]/(CONSTANTS[9]+STATES[1]));
}
void
computeVariables(double VOI, double* CONSTANTS, double* RATES, double* STATES, double* ALGEBRAIC)
{
ALGEBRAIC[0] =  (STATES[0]/(CONSTANTS[10]+STATES[0]))*CONSTANTS[11];
ALGEBRAIC[1] =  STATES[2]*CONSTANTS[12];
}