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 4 entries in each of the rate and state variable arrays. There are a total of 5 entries in the constant variable array. */ /* * VOI is time in component environment (second). * STATES[0] is M in component M (dimensionless). * STATES[1] is AM in component AM (dimensionless). * STATES[2] is Mp in component Mp (dimensionless). * ALGEBRAIC[0] is k1 in component model_parameters (first_order_rate_constant). * CONSTANTS[0] is k2 in component model_parameters (first_order_rate_constant). * CONSTANTS[1] is k7 in component model_parameters (first_order_rate_constant). * STATES[3] is AMp in component AMp (dimensionless). * CONSTANTS[2] is k3 in component model_parameters (first_order_rate_constant). * CONSTANTS[3] is k4 in component model_parameters (first_order_rate_constant). * CONSTANTS[4] is k5 in component model_parameters (first_order_rate_constant). * ALGEBRAIC[3] is k6 in component model_parameters (first_order_rate_constant). * ALGEBRAIC[1] is phosphorylation in component phosphorylation (dimensionless). * ALGEBRAIC[2] is stress in component stress (dimensionless). * RATES[0] is d/dt M in component M (dimensionless). * RATES[2] is d/dt Mp in component Mp (dimensionless). * RATES[3] is d/dt AMp in component AMp (dimensionless). * RATES[1] is d/dt AM in component AM (dimensionless). */ void initConsts(double* CONSTANTS, double* RATES, double *STATES) { STATES[0] = 1.0; STATES[1] = 0.0; STATES[2] = 0.0; CONSTANTS[0] = 0.5; CONSTANTS[1] = 0.01; STATES[3] = 0.0; CONSTANTS[2] = 0.4; CONSTANTS[3] = 0.1; CONSTANTS[4] = 0.5; } void computeRates(double VOI, double* CONSTANTS, double* RATES, double* STATES, double* ALGEBRAIC) { ALGEBRAIC[0] = (VOI>=0.00000&&VOI<5.00000 ? 0.550000 : 0.300000); RATES[0] = - ( ALGEBRAIC[0]*STATES[0])+ CONSTANTS[0]*STATES[2]+ CONSTANTS[1]*STATES[1]; RATES[2] = ( CONSTANTS[3]*STATES[3]+ ALGEBRAIC[0]*STATES[0]) - (CONSTANTS[0]+CONSTANTS[2])*STATES[2]; ALGEBRAIC[3] = ALGEBRAIC[0]; RATES[3] = ( CONSTANTS[2]*STATES[2]+ ALGEBRAIC[3]*STATES[1]) - (CONSTANTS[4]+CONSTANTS[3])*STATES[3]; RATES[1] = CONSTANTS[4]*STATES[3] - (ALGEBRAIC[3]+CONSTANTS[1])*STATES[1]; } void computeVariables(double VOI, double* CONSTANTS, double* RATES, double* STATES, double* ALGEBRAIC) { ALGEBRAIC[0] = (VOI>=0.00000&&VOI<5.00000 ? 0.550000 : 0.300000); ALGEBRAIC[3] = ALGEBRAIC[0]; ALGEBRAIC[1] = STATES[3]+STATES[2]; ALGEBRAIC[2] = STATES[3]+STATES[1]; }