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 7 entries in the algebraic variable array. There are a total of 6 entries in each of the rate and state variable arrays. There are a total of 10 entries in the constant variable array. */ /* * VOI is time in component environment (minute). * STATES[0] is C2 in component C2 (millimolar). * CONSTANTS[0] is k6 in component reaction_constants (first_order_rate_constant). * CONSTANTS[8] is k8 in component reaction_constants (second_order_rate_constant). * CONSTANTS[1] is k9 in component reaction_constants (first_order_rate_constant). * STATES[1] is M in component M (millimolar). * CONSTANTS[2] is P in component reaction_constants (millimolar). * STATES[2] is CP in component CP (millimolar). * ALGEBRAIC[4] is k3 in component reaction_constants (second_order_rate_constant). * STATES[3] is Y in component Y (millimolar). * STATES[4] is pM in component pM (millimolar). * CONSTANTS[9] is k5 in component reaction_constants (second_order_rate_constant). * ALGEBRAIC[6] is F in component reaction_constants (first_order_rate_constant). * ALGEBRAIC[1] is k1 in component reaction_constants (first_order_rate_constant). * CONSTANTS[3] is k2 in component reaction_constants (first_order_rate_constant). * CONSTANTS[4] is aa in component reaction_constants (millimolar). * STATES[5] is YP in component YP (millimolar). * CONSTANTS[5] is k7 in component reaction_constants (first_order_rate_constant). * CONSTANTS[6] is k4 in component reaction_constants (first_order_rate_constant). * CONSTANTS[7] is k4_ in component reaction_constants (first_order_rate_constant). * ALGEBRAIC[0] is CT in component reaction_constants (millimolar). * ALGEBRAIC[2] is YT in component reaction_constants (millimolar). * ALGEBRAIC[5] is YT_CT in component reaction_constants (dimensionless). * ALGEBRAIC[3] is M_CT in component reaction_constants (dimensionless). * RATES[0] is d/dt C2 in component C2 (millimolar). * RATES[2] is d/dt CP in component CP (millimolar). * RATES[4] is d/dt pM in component pM (millimolar). * RATES[1] is d/dt M in component M (millimolar). * RATES[3] is d/dt Y in component Y (millimolar). * RATES[5] is d/dt YP in component YP (millimolar). */ void initConsts(double* CONSTANTS, double* RATES, double *STATES) { STATES[0] = 0.001; CONSTANTS[0] = 1.0; CONSTANTS[1] = 100.0; STATES[1] = 0.001; CONSTANTS[2] = 1.0; STATES[2] = 0.001; STATES[3] = 0.001; STATES[4] = 0.001; CONSTANTS[3] = 0.0; CONSTANTS[4] = 1.0; STATES[5] = 0.001; CONSTANTS[5] = 0.6; CONSTANTS[6] = 180.0; CONSTANTS[7] = 0.018; CONSTANTS[8] = CONSTANTS[1]/CONSTANTS[2]; CONSTANTS[9] = 0.00000/CONSTANTS[2]; } void computeRates(double VOI, double* CONSTANTS, double* RATES, double* STATES, double* ALGEBRAIC) { RATES[0] = ( CONSTANTS[0]*STATES[1]+ CONSTANTS[1]*STATES[2]) - CONSTANTS[8]*CONSTANTS[2]*STATES[0]; RATES[5] = CONSTANTS[0]*STATES[1] - CONSTANTS[5]*STATES[5]; ALGEBRAIC[0] = STATES[0]+STATES[2]+STATES[4]+STATES[1]; ALGEBRAIC[4] = 200.000/ALGEBRAIC[0]; RATES[2] = CONSTANTS[8]*CONSTANTS[2]*STATES[0] - ( CONSTANTS[1]*STATES[2]+ ALGEBRAIC[4]*STATES[2]*STATES[3]); ALGEBRAIC[1] = ( 0.0150000*ALGEBRAIC[0])/CONSTANTS[4]; RATES[3] = CONSTANTS[4]*ALGEBRAIC[1] - ( ALGEBRAIC[4]*STATES[2]*STATES[3]+ CONSTANTS[3]*STATES[3]); ALGEBRAIC[6] = CONSTANTS[7]+ CONSTANTS[6]*pow(STATES[1]/ALGEBRAIC[0], 2.00000); RATES[4] = ( ALGEBRAIC[4]*STATES[2]*STATES[3]+ CONSTANTS[9]*CONSTANTS[2]*STATES[1]) - STATES[4]*ALGEBRAIC[6]; RATES[1] = STATES[4]*ALGEBRAIC[6] - ( CONSTANTS[9]*CONSTANTS[2]*STATES[1]+ CONSTANTS[0]*STATES[1]); } void computeVariables(double VOI, double* CONSTANTS, double* RATES, double* STATES, double* ALGEBRAIC) { ALGEBRAIC[0] = STATES[0]+STATES[2]+STATES[4]+STATES[1]; ALGEBRAIC[4] = 200.000/ALGEBRAIC[0]; ALGEBRAIC[1] = ( 0.0150000*ALGEBRAIC[0])/CONSTANTS[4]; ALGEBRAIC[6] = CONSTANTS[7]+ CONSTANTS[6]*pow(STATES[1]/ALGEBRAIC[0], 2.00000); ALGEBRAIC[2] = STATES[3]+STATES[5]+STATES[4]+STATES[1]; ALGEBRAIC[3] = STATES[1]/ALGEBRAIC[0]; ALGEBRAIC[5] = ALGEBRAIC[2]/ALGEBRAIC[0]; }