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 4 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 22 entries in the constant variable array. */ /* * VOI is time in component environment (day). * STATES[0] is R in component R (nanomolar). * CONSTANTS[0] is delta_R in component R (first_order_rate_constant). * ALGEBRAIC[0] is f1 in component f1 (flux). * STATES[1] is U in component U (nanomolar). * CONSTANTS[1] is delta_U in component U (first_order_rate_constant). * CONSTANTS[2] is alpha0 in component model_parameters (per_nanomolar_day). * CONSTANTS[3] is alpha1 in component model_parameters (per_nanomolar_day). * CONSTANTS[4] is d01 in component model_parameters (first_order_rate_constant). * CONSTANTS[5] is d12 in component model_parameters (first_order_rate_constant). * STATES[2] is B1 in component B1 (nanomolar). * STATES[3] is B2 in component B2 (nanomolar). * ALGEBRAIC[2] is P in component P (nanomolar). * ALGEBRAIC[3] is f2 in component f2 (flux). * CONSTANTS[6] is delta_b1 in component B1 (first_order_rate_constant). * CONSTANTS[7] is delta_b2 in component B2 (first_order_rate_constant). * CONSTANTS[8] is PE in component P (nanomolar). * ALGEBRAIC[1] is q in component P (dimensionless). * CONSTANTS[9] is G in component P (first_order_rate_constant). * CONSTANTS[10] is ti in component P (day). * CONSTANTS[11] is T in component P (day). * CONSTANTS[12] is P0 in component model_parameters (nanomolar). * CONSTANTS[13] is a in component f1 (flux). * CONSTANTS[14] is a0 in component f1 (flux). * CONSTANTS[15] is b in component f1 (nanomolar). * CONSTANTS[16] is b0 in component f1 (nanomolar). * STATES[4] is x in component x (flux). * CONSTANTS[17] is P1 in component x (nanomolar). * CONSTANTS[18] is s in component x (nanomolar_day2). * CONSTANTS[19] is delta_x in component x (first_order_rate_constant). * CONSTANTS[20] is kappa in component f2 (flux). * CONSTANTS[21] is kappa0 in component f2 (nanomolar). * RATES[0] is d/dt R in component R (nanomolar). * RATES[1] is d/dt U in component U (nanomolar). * RATES[2] is d/dt B1 in component B1 (nanomolar). * RATES[3] is d/dt B2 in component B2 (nanomolar). * RATES[4] is d/dt x in component x (flux). */ void initConsts(double* CONSTANTS, double* RATES, double *STATES) { STATES[0] = 1.0; CONSTANTS[0] = 1.905; STATES[1] = 1.0; CONSTANTS[1] = 7.5; CONSTANTS[2] = 4.15; CONSTANTS[3] = 3.02; CONSTANTS[4] = 13.0; CONSTANTS[5] = 4.72E3; STATES[2] = 1.0; STATES[3] = 1.0; CONSTANTS[6] = 7.5; CONSTANTS[7] = 50.0; CONSTANTS[8] = 20.55; CONSTANTS[9] = 35.6; CONSTANTS[10] = 1.0; CONSTANTS[11] = 9.0; CONSTANTS[12] = 0.25; CONSTANTS[13] = 3.58E5; CONSTANTS[14] = 2.33E4; CONSTANTS[15] = 100.0; CONSTANTS[16] = 263.0; STATES[4] = 1.0; CONSTANTS[17] = 20.0; CONSTANTS[18] = 3.71E5; CONSTANTS[19] = 0.207; CONSTANTS[20] = 2.4E5; CONSTANTS[21] = 6.55E3; } void computeRates(double VOI, double* CONSTANTS, double* RATES, double* STATES, double* ALGEBRAIC) { RATES[3] = CONSTANTS[3]*STATES[2]*STATES[1] - ( CONSTANTS[5]*STATES[3]+ CONSTANTS[7]*STATES[3]); ALGEBRAIC[0] = CONSTANTS[14]*(1.00000 - STATES[3]/(CONSTANTS[15]+STATES[3]))+( STATES[4]*(1.00000 - exp(- STATES[4]/CONSTANTS[13]))*STATES[3])/(CONSTANTS[16]+STATES[3]); RATES[0] = ALGEBRAIC[0] - CONSTANTS[0]*STATES[0]; ALGEBRAIC[1] = (VOI<CONSTANTS[10] ? 0.00000 : VOI<CONSTANTS[11]+CONSTANTS[10]&&VOI>=CONSTANTS[10] ? 1.00000 - exp( - CONSTANTS[9]*(VOI - CONSTANTS[10])) : exp( CONSTANTS[9]*CONSTANTS[11] - 1.00000)*exp( CONSTANTS[9]*(VOI - CONSTANTS[10]))); ALGEBRAIC[2] = CONSTANTS[12]+ CONSTANTS[8]*ALGEBRAIC[1]; RATES[2] = ( CONSTANTS[2]*ALGEBRAIC[2]*STATES[1]+ CONSTANTS[5]*STATES[3]) - ( CONSTANTS[4]*STATES[2]+ CONSTANTS[6]*STATES[2]+ CONSTANTS[3]*STATES[2]*STATES[1]); RATES[4] = ( CONSTANTS[18]*(ALGEBRAIC[2] - CONSTANTS[12]))/(ALGEBRAIC[2]+CONSTANTS[17]) - CONSTANTS[19]*STATES[4]; ALGEBRAIC[3] = ( CONSTANTS[20]*STATES[0])/(CONSTANTS[21]+STATES[0]); RATES[1] = (ALGEBRAIC[3]+ CONSTANTS[4]*STATES[2]+ CONSTANTS[5]*STATES[3]) - ( CONSTANTS[1]*STATES[1]+ CONSTANTS[2]*ALGEBRAIC[2]*STATES[1]+ CONSTANTS[3]*STATES[2]*STATES[1]); } void computeVariables(double VOI, double* CONSTANTS, double* RATES, double* STATES, double* ALGEBRAIC) { ALGEBRAIC[0] = CONSTANTS[14]*(1.00000 - STATES[3]/(CONSTANTS[15]+STATES[3]))+( STATES[4]*(1.00000 - exp(- STATES[4]/CONSTANTS[13]))*STATES[3])/(CONSTANTS[16]+STATES[3]); ALGEBRAIC[1] = (VOI<CONSTANTS[10] ? 0.00000 : VOI<CONSTANTS[11]+CONSTANTS[10]&&VOI>=CONSTANTS[10] ? 1.00000 - exp( - CONSTANTS[9]*(VOI - CONSTANTS[10])) : exp( CONSTANTS[9]*CONSTANTS[11] - 1.00000)*exp( CONSTANTS[9]*(VOI - CONSTANTS[10]))); ALGEBRAIC[2] = CONSTANTS[12]+ CONSTANTS[8]*ALGEBRAIC[1]; ALGEBRAIC[3] = ( CONSTANTS[20]*STATES[0])/(CONSTANTS[21]+STATES[0]); }