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 3 entries in each of the rate and state variable arrays. There are a total of 13 entries in the constant variable array. */ /* * VOI is time in component environment (minute). * STATES[0] is C in component C (micromolar). * STATES[1] is X in component X (dimensionless). * CONSTANTS[0] is kd in component model_parameters (first_order_rate_constant). * CONSTANTS[1] is Kd in component model_parameters (micromolar). * CONSTANTS[2] is vi in component model_parameters (flux). * CONSTANTS[3] is vd in component model_parameters (flux). * STATES[2] is M in component M (dimensionless). * ALGEBRAIC[0] is M_star in component M_star (dimensionless). * ALGEBRAIC[2] is V1 in component model_parameters (first_order_rate_constant). * CONSTANTS[4] is V2 in component model_parameters (first_order_rate_constant). * CONSTANTS[5] is K1 in component model_parameters (dimensionless). * CONSTANTS[6] is K2 in component model_parameters (dimensionless). * ALGEBRAIC[1] is X_star in component X_star (dimensionless). * ALGEBRAIC[3] is V3 in component model_parameters (first_order_rate_constant). * CONSTANTS[7] is V4 in component model_parameters (first_order_rate_constant). * CONSTANTS[8] is K3 in component model_parameters (dimensionless). * CONSTANTS[9] is K4 in component model_parameters (dimensionless). * CONSTANTS[10] is Kc in component model_parameters (micromolar). * CONSTANTS[11] is VM1 in component model_parameters (first_order_rate_constant). * CONSTANTS[12] is VM3 in component model_parameters (first_order_rate_constant). * RATES[0] is d/dt C in component C (micromolar). * RATES[2] is d/dt M in component M (dimensionless). * RATES[1] is d/dt X in component X (dimensionless). */ void initConsts(double* CONSTANTS, double* RATES, double *STATES) { STATES[0] = 0.01; STATES[1] = 0.01; CONSTANTS[0] = 0.01; CONSTANTS[1] = 0.02; CONSTANTS[2] = 0.025; CONSTANTS[3] = 0.25; STATES[2] = 0.01; CONSTANTS[4] = 1.5; CONSTANTS[5] = 0.005; CONSTANTS[6] = 0.005; CONSTANTS[7] = 0.5; CONSTANTS[8] = 0.005; CONSTANTS[9] = 0.005; CONSTANTS[10] = 0.5; CONSTANTS[11] = 3; CONSTANTS[12] = 1; } void computeRates(double VOI, double* CONSTANTS, double* RATES, double* STATES, double* ALGEBRAIC) { RATES[0] = (CONSTANTS[2] - ( CONSTANTS[3]*STATES[1]*STATES[0])/(CONSTANTS[1]+STATES[0])) - CONSTANTS[0]*STATES[0]; ALGEBRAIC[0] = 1.00000 - STATES[2]; ALGEBRAIC[2] = ( CONSTANTS[11]*STATES[0])/(CONSTANTS[10]+STATES[0]); RATES[2] = ( ALGEBRAIC[2]*ALGEBRAIC[0])/(CONSTANTS[5]+ALGEBRAIC[0]) - ( CONSTANTS[4]*STATES[2])/(CONSTANTS[6]+STATES[2]); ALGEBRAIC[1] = 1.00000 - STATES[1]; ALGEBRAIC[3] = STATES[2]*CONSTANTS[12]; RATES[1] = ( ALGEBRAIC[3]*ALGEBRAIC[1])/(CONSTANTS[8]+ALGEBRAIC[1]) - ( CONSTANTS[7]*STATES[1])/(CONSTANTS[9]+STATES[1]); } void computeVariables(double VOI, double* CONSTANTS, double* RATES, double* STATES, double* ALGEBRAIC) { ALGEBRAIC[0] = 1.00000 - STATES[2]; ALGEBRAIC[2] = ( CONSTANTS[11]*STATES[0])/(CONSTANTS[10]+STATES[0]); ALGEBRAIC[1] = 1.00000 - STATES[1]; ALGEBRAIC[3] = STATES[2]*CONSTANTS[12]; }