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 5 entries in each of the rate and state variable arrays. There are a total of 15 entries in the constant variable array. */ /* * VOI is time in component environment (day). * STATES[0] is X in component X (dimensionless). * CONSTANTS[0] is mu0 in component X (first_order_rate_constant). * CONSTANTS[13] is s in component X (first_order_rate_constant). * STATES[1] is K in component K (first_order_rate_constant). * STATES[2] is V in component V (dimensionless). * STATES[3] is Y in component Y (dimensionless). * CONSTANTS[1] is mu1 in component Y (first_order_rate_constant). * CONSTANTS[2] is delta1 in component Y (first_order_rate_constant). * STATES[4] is Z in component Z (dimensionless). * ALGEBRAIC[0] is CD4 in component CD4 (dimensionless). * CONSTANTS[3] is mu2 in component V (first_order_rate_constant). * CONSTANTS[4] is phi in component V (first_order_rate_constant). * CONSTANTS[5] is delta2 in component V (first_order_rate_constant). * CONSTANTS[6] is alpha in component Z (first_order_rate_constant). * CONSTANTS[7] is beta in component Z (first_order_rate_constant). * CONSTANTS[8] is gamma in component Z (first_order_rate_constant). * ALGEBRAIC[1] is f_X in component Z (dimensionless). * CONSTANTS[9] is a in component Z (dimensionless). * CONSTANTS[10] is b in component Z (dimensionless). * CONSTANTS[11] is X0 in component Z (dimensionless). * CONSTANTS[12] is omega in component K (first_order_rate_constant). * CONSTANTS[14] is Kmax in component K (first_order_rate_constant). * RATES[0] is d/dt X in component X (dimensionless). * RATES[3] is d/dt Y in component Y (dimensionless). * RATES[2] is d/dt V in component V (dimensionless). * RATES[4] is d/dt Z in component Z (dimensionless). * RATES[1] is d/dt K in component K (first_order_rate_constant). */ void initConsts(double* CONSTANTS, double* RATES, double *STATES) { STATES[0] = 1.0E11; CONSTANTS[0] = 0.004; STATES[1] = 1.35E-14; STATES[2] = 1000.0; STATES[3] = 100.0; CONSTANTS[1] = 0.30; CONSTANTS[2] = 0.30; STATES[4] = 0.0; CONSTANTS[3] = 1.0; CONSTANTS[4] = 1000.0; CONSTANTS[5] = 1.0; CONSTANTS[6] = 1.0E-6; CONSTANTS[7] = 0.5; CONSTANTS[8] = 0.5; CONSTANTS[9] = 1000.0; CONSTANTS[10] = 0.2; CONSTANTS[11] = 1.0E11; CONSTANTS[12] = 0.16E-15; CONSTANTS[13] = CONSTANTS[0]*1.00000e+11; CONSTANTS[14] = 1.35000e-14*20.0000; } void computeRates(double VOI, double* CONSTANTS, double* RATES, double* STATES, double* ALGEBRAIC) { RATES[0] = CONSTANTS[13] - ( CONSTANTS[0]*STATES[0]+ STATES[1]*STATES[2]*STATES[0]); RATES[3] = STATES[1]*STATES[2]*STATES[3] - (CONSTANTS[1]+ CONSTANTS[2]*STATES[4])*STATES[3]; RATES[2] = CONSTANTS[4]*STATES[3] - (CONSTANTS[3]+ CONSTANTS[5]*STATES[4])*STATES[2]; RATES[1] = CONSTANTS[12]*STATES[2]*(CONSTANTS[14] - STATES[1]); ALGEBRAIC[1] = pow(STATES[0]/CONSTANTS[11], 2.00000)/(CONSTANTS[10]+pow(STATES[0]/CONSTANTS[11], 2.00000)); RATES[4] = ( CONSTANTS[6]*(STATES[2]/(CONSTANTS[9]+STATES[2]))+ CONSTANTS[7]*ALGEBRAIC[1]*STATES[4]) - CONSTANTS[8]*pow(STATES[4], 2.00000); } void computeVariables(double VOI, double* CONSTANTS, double* RATES, double* STATES, double* ALGEBRAIC) { ALGEBRAIC[1] = pow(STATES[0]/CONSTANTS[11], 2.00000)/(CONSTANTS[10]+pow(STATES[0]/CONSTANTS[11], 2.00000)); ALGEBRAIC[0] = (STATES[0]+STATES[3])/1.00000e+11; }