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 1 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 9 entries in the constant variable array. */ /* * VOI is time in component environment (hour). * STATES[0] is R in component R (ng_ml). * CONSTANTS[0] is b1 in component R (first_order_rate_constant). * CONSTANTS[1] is b2 in component R (dimensionless). * CONSTANTS[2] is b3 in component R (dimensionless). * CONSTANTS[3] is g1 in component R (dimensionless). * CONSTANTS[4] is g2 in component R (dimensionless). * ALGEBRAIC[0] is f_T in component R (ng_ml_hr). * STATES[1] is T in component T (ng_ml). * STATES[2] is L in component L (ng_ml). * CONSTANTS[5] is b2 in component L (first_order_rate_constant). * CONSTANTS[6] is g1 in component L (first_order_rate_constant). * CONSTANTS[7] is b3 in component T (first_order_rate_constant). * CONSTANTS[8] is g2 in component T (first_order_rate_constant). * RATES[0] is d/dt R in component R (ng_ml). * RATES[2] is d/dt L in component L (ng_ml). * RATES[1] is d/dt T in component T (ng_ml). */ void initConsts(double* CONSTANTS, double* RATES, double *STATES) { STATES[0] = 0.1; CONSTANTS[0] = 1.0; CONSTANTS[1] = 1.0; CONSTANTS[2] = 1.0; CONSTANTS[3] = 10.0; CONSTANTS[4] = 10.0; STATES[1] = 0.0; STATES[2] = 0.0; CONSTANTS[5] = 1.0; CONSTANTS[6] = 10.0; CONSTANTS[7] = 1.0; CONSTANTS[8] = 10.0; } void computeRates(double VOI, double* CONSTANTS, double* RATES, double* STATES, double* ALGEBRAIC) { RATES[2] = CONSTANTS[6]*STATES[0] - CONSTANTS[5]*STATES[2]; RATES[1] = CONSTANTS[8]*STATES[2] - CONSTANTS[7]*STATES[1]; ALGEBRAIC[0] = ( CONSTANTS[0]*CONSTANTS[1]*CONSTANTS[2]*STATES[1])/( CONSTANTS[3]*CONSTANTS[4]); RATES[0] = ALGEBRAIC[0] - CONSTANTS[0]*STATES[0]; } void computeVariables(double VOI, double* CONSTANTS, double* RATES, double* STATES, double* ALGEBRAIC) { ALGEBRAIC[0] = ( CONSTANTS[0]*CONSTANTS[1]*CONSTANTS[2]*STATES[1])/( CONSTANTS[3]*CONSTANTS[4]); }