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 5 entries in the algebraic variable array. There are a total of 2 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 G in component G (mg_l). * CONSTANTS[0] is Vg in component G (litre). * CONSTANTS[1] is Gin in component G (mg_l_min). * ALGEBRAIC[0] is f2_G in component G (mg_min). * ALGEBRAIC[2] is f3_G in component G (per_l). * ALGEBRAIC[3] is f4_I in component G (mg_min). * ALGEBRAIC[4] is f5_I in component G (mg_min). * CONSTANTS[2] is C2 in component G (mg_l). * CONSTANTS[3] is C3 in component G (mg_l). * CONSTANTS[4] is C4 in component G (mU_l). * CONSTANTS[5] is C5 in component G (mU_l). * CONSTANTS[6] is U0 in component G (mg_min). * CONSTANTS[7] is Um in component G (mg_min). * CONSTANTS[8] is Ub in component G (mg_min). * CONSTANTS[9] is beta in component G (dimensionless). * CONSTANTS[10] is Rg in component G (mg_min). * CONSTANTS[11] is alpha in component G (l_mU). * CONSTANTS[12] is ti in component G (minute). * CONSTANTS[13] is E in component G (l_min). * CONSTANTS[14] is Vp in component G (litre). * CONSTANTS[15] is Vi in component G (litre). * STATES[1] is I in component I (mU_l). * ALGEBRAIC[1] is f1_G in component I (mU_min). * CONSTANTS[16] is Rm in component I (mU_min). * CONSTANTS[17] is C1 in component I (mg_l). * CONSTANTS[18] is a1 in component I (mg_l). * CONSTANTS[19] is di in component I (first_order_rate_constant). * RATES[0] is d/dt G in component G (mg_l). * RATES[1] is d/dt I in component I (mU_l). */ void initConsts(double* CONSTANTS, double* RATES, double *STATES) { STATES[0] = 1000.0; CONSTANTS[0] = 10.0; CONSTANTS[1] = 0.54; CONSTANTS[2] = 144.0; CONSTANTS[3] = 1000.0; CONSTANTS[4] = 80.0; CONSTANTS[5] = 26.0; CONSTANTS[6] = 40.0; CONSTANTS[7] = 940.0; CONSTANTS[8] = 72.0; CONSTANTS[9] = 1.77; CONSTANTS[10] = 180.0; CONSTANTS[11] = 0.29; CONSTANTS[12] = 100; CONSTANTS[13] = 0.2; CONSTANTS[14] = 3.0; CONSTANTS[15] = 11.0; STATES[1] = 9000.0; CONSTANTS[16] = 210.0; CONSTANTS[17] = 2000.0; CONSTANTS[18] = 300.0; CONSTANTS[19] = 0.06; } void computeRates(double VOI, double* CONSTANTS, double* RATES, double* STATES, double* ALGEBRAIC) { ALGEBRAIC[1] = CONSTANTS[16]/(1.00000+exp(((CONSTANTS[17] - STATES[0])/( 1.00000*CONSTANTS[0]))/CONSTANTS[18])); RATES[1] = 1.00000*ALGEBRAIC[1] - CONSTANTS[19]*STATES[1]; ALGEBRAIC[0] = CONSTANTS[8]*(1.00000 - exp( 1.00000*(- STATES[0]/( CONSTANTS[2]*CONSTANTS[0])))); ALGEBRAIC[2] = STATES[0]/( CONSTANTS[3]*CONSTANTS[0]); ALGEBRAIC[3] = CONSTANTS[6]+(CONSTANTS[7] - CONSTANTS[6])/(1.00000+exp( - CONSTANTS[9]*log( 1.00000*(STATES[1]/( CONSTANTS[4]*(1.00000/CONSTANTS[15]+1.00000/( CONSTANTS[13]*CONSTANTS[12]))))))); ALGEBRAIC[4] = CONSTANTS[10]/(1.00000+exp( CONSTANTS[11]*(STATES[1]/( 1.00000*CONSTANTS[14] - 1.00000*CONSTANTS[5])))); RATES[0] = CONSTANTS[1]+ 1.00000*ALGEBRAIC[4]+- ( 1.00000*ALGEBRAIC[0]+ ALGEBRAIC[2]*ALGEBRAIC[3]); } void computeVariables(double VOI, double* CONSTANTS, double* RATES, double* STATES, double* ALGEBRAIC) { ALGEBRAIC[1] = CONSTANTS[16]/(1.00000+exp(((CONSTANTS[17] - STATES[0])/( 1.00000*CONSTANTS[0]))/CONSTANTS[18])); ALGEBRAIC[0] = CONSTANTS[8]*(1.00000 - exp( 1.00000*(- STATES[0]/( CONSTANTS[2]*CONSTANTS[0])))); ALGEBRAIC[2] = STATES[0]/( CONSTANTS[3]*CONSTANTS[0]); ALGEBRAIC[3] = CONSTANTS[6]+(CONSTANTS[7] - CONSTANTS[6])/(1.00000+exp( - CONSTANTS[9]*log( 1.00000*(STATES[1]/( CONSTANTS[4]*(1.00000/CONSTANTS[15]+1.00000/( CONSTANTS[13]*CONSTANTS[12]))))))); ALGEBRAIC[4] = CONSTANTS[10]/(1.00000+exp( CONSTANTS[11]*(STATES[1]/( 1.00000*CONSTANTS[14] - 1.00000*CONSTANTS[5])))); }