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 6 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 20 entries in the constant variable array.
 */
/*
 * VOI is time in component environment (minute).
 * STATES[0] is C in component C (dimensionless).
 * ALGEBRAIC[0] is Ctot in component C (dimensionless).
 * CONSTANTS[0] is vi in component model_parameters (per_minute).
 * CONSTANTS[1] is k1 in component model_parameters (per_minute).
 * STATES[1] is X in component X (dimensionless).
 * CONSTANTS[2] is K5 in component model_parameters (dimensionless).
 * CONSTANTS[3] is kd in component model_parameters (per_minute).
 * STATES[2] is Z in component Z (dimensionless).
 * STATES[3] is M in component M (dimensionless).
 * CONSTANTS[19] is M_ in component M (dimensionless).
 * ALGEBRAIC[1] is V1 in component model_parameters (per_minute).
 * CONSTANTS[4] is K1 in component model_parameters (dimensionless).
 * CONSTANTS[5] is V2 in component model_parameters (per_minute).
 * CONSTANTS[6] is K2 in component model_parameters (dimensionless).
 * ALGEBRAIC[2] is X_ in component X (dimensionless).
 * ALGEBRAIC[4] is V3 in component model_parameters (per_minute).
 * CONSTANTS[7] is K3 in component model_parameters (dimensionless).
 * CONSTANTS[8] is V4 in component model_parameters (per_minute).
 * CONSTANTS[9] is K4 in component model_parameters (dimensionless).
 * STATES[4] is Y in component Y (dimensionless).
 * ALGEBRAIC[3] is Ytot in component Y (dimensionless).
 * CONSTANTS[10] is vs in component model_parameters (per_minute).
 * CONSTANTS[11] is d1 in component model_parameters (per_minute).
 * CONSTANTS[12] is a1 in component model_parameters (per_minute).
 * CONSTANTS[13] is a2 in component model_parameters (per_minute).
 * CONSTANTS[14] is alpha in component model_parameters (dimensionless).
 * ALGEBRAIC[5] is BP in component BP (dimensionless).
 * CONSTANTS[15] is Kd in component model_parameters (dimensionless).
 * CONSTANTS[16] is K6 in component model_parameters (dimensionless).
 * CONSTANTS[17] is V1_dash in component model_parameters (per_minute).
 * CONSTANTS[18] is V3_dash in component model_parameters (per_minute).
 * RATES[0] is d/dt C in component C (dimensionless).
 * RATES[3] is d/dt M in component M (dimensionless).
 * RATES[1] is d/dt X in component X (dimensionless).
 * RATES[4] is d/dt Y in component Y (dimensionless).
 * RATES[2] is d/dt Z in component Z (dimensionless).
 */
void
initConsts(double* CONSTANTS, double* RATES, double *STATES)
{
STATES[0] = 0.01;
CONSTANTS[0] = 0.1;
CONSTANTS[1] = 0.5;
STATES[1] = 0.01;
CONSTANTS[2] = 0.02;
CONSTANTS[3] = 0.02;
STATES[2] = 0.28;
STATES[3] = 0.01;
CONSTANTS[4] = 0.02;
CONSTANTS[5] = 0.25;
CONSTANTS[6] = 0.02;
CONSTANTS[7] = 0.1;
CONSTANTS[8] = 0.1;
CONSTANTS[9] = 0.1;
STATES[4] = 0.01;
CONSTANTS[10] = 0.1;
CONSTANTS[11] = 0.05;
CONSTANTS[12] = 1.5;
CONSTANTS[13] = 1.5;
CONSTANTS[14] = 0.1;
CONSTANTS[15] = 1;
CONSTANTS[16] = 0.3;
CONSTANTS[17] = 0.75;
CONSTANTS[18] = 0.3;
CONSTANTS[19] = - 1.00000;
}
void
computeRates(double VOI, double* CONSTANTS, double* RATES, double* STATES, double* ALGEBRAIC)
{
RATES[0] = (CONSTANTS[0] - ( CONSTANTS[1]*STATES[1]*STATES[0])/(STATES[0]+CONSTANTS[2])) -  CONSTANTS[3]*STATES[0];
RATES[4] = ((CONSTANTS[10] -  CONSTANTS[11]*STATES[4]) -  CONSTANTS[12]*STATES[0]*STATES[4])+ (CONSTANTS[13]+ CONSTANTS[14]*CONSTANTS[3])*STATES[2];
RATES[2] =  CONSTANTS[12]*STATES[0]*STATES[4] -  (CONSTANTS[13]+ CONSTANTS[14]*CONSTANTS[3]+ CONSTANTS[14]*CONSTANTS[11])*STATES[2];
ALGEBRAIC[1] = ( STATES[0]*CONSTANTS[17])/(STATES[0]+CONSTANTS[16]);
RATES[3] = ( ALGEBRAIC[1]*CONSTANTS[19])/(CONSTANTS[19]+CONSTANTS[4]) - ( CONSTANTS[5]*STATES[3])/(STATES[3]+CONSTANTS[6]);
ALGEBRAIC[2] = 1.00000 - STATES[1];
ALGEBRAIC[4] =  STATES[3]*CONSTANTS[18];
RATES[1] = ( ALGEBRAIC[4]*ALGEBRAIC[2])/(ALGEBRAIC[2]+CONSTANTS[7]) - ( CONSTANTS[8]*STATES[1])/(STATES[1]+CONSTANTS[9]);
}
void
computeVariables(double VOI, double* CONSTANTS, double* RATES, double* STATES, double* ALGEBRAIC)
{
ALGEBRAIC[1] = ( STATES[0]*CONSTANTS[17])/(STATES[0]+CONSTANTS[16]);
ALGEBRAIC[2] = 1.00000 - STATES[1];
ALGEBRAIC[4] =  STATES[3]*CONSTANTS[18];
ALGEBRAIC[0] = STATES[0]+STATES[2];
ALGEBRAIC[3] = STATES[4]+STATES[2];
ALGEBRAIC[5] = 1.00000+( CONSTANTS[15]*ALGEBRAIC[3])/pow(STATES[0]+CONSTANTS[15], 2.00000);
}