Generated Code
The following is c_ida 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 20 entries in each of the rate and state variable arrays. There are a total of 26 entries in the constant variable array. */ /* * VOI is time in component environment (hour). * STATES[0] is S_0 in component S_0 (dimensionless). * CONSTANTS[15] is R_0 in component R (first_order_rate_constant). * CONSTANTS[16] is u_s in component kinetic_parameters (first_order_rate_constant). * ALGEBRAIC[0] is phi in component phi (first_order_rate_constant). * STATES[1] is S_1 in component S_1 (dimensionless). * CONSTANTS[17] is R_1 in component R (first_order_rate_constant). * CONSTANTS[0] is epsilon_s in component kinetic_parameters (first_order_rate_constant). * CONSTANTS[1] is alpha in component kinetic_parameters (dimensionless). * CONSTANTS[2] is u in component kinetic_parameters (first_order_rate_constant). * STATES[2] is S_2 in component S_2 (dimensionless). * CONSTANTS[18] is R_2 in component R (first_order_rate_constant). * STATES[3] is S_3 in component S_3 (dimensionless). * CONSTANTS[19] is R_3 in component R (first_order_rate_constant). * STATES[4] is S_4 in component S_4 (dimensionless). * CONSTANTS[20] is R_4 in component R (first_order_rate_constant). * STATES[5] is S_5 in component S_5 (dimensionless). * CONSTANTS[21] is R_5 in component R (first_order_rate_constant). * STATES[6] is S_6 in component S_6 (dimensionless). * CONSTANTS[22] is R_6 in component R (first_order_rate_constant). * STATES[7] is S_7 in component S_7 (dimensionless). * CONSTANTS[23] is R_7 in component R (first_order_rate_constant). * STATES[8] is S_8 in component S_8 (dimensionless). * CONSTANTS[24] is R_8 in component R (first_order_rate_constant). * STATES[9] is M_0 in component M_0 (dimensionless). * CONSTANTS[3] is epsilon_m in component kinetic_parameters (first_order_rate_constant). * CONSTANTS[25] is u_m in component kinetic_parameters (first_order_rate_constant). * STATES[10] is M_1 in component M_1 (dimensionless). * STATES[11] is M_1_2 in component M_1 (dimensionless). * STATES[12] is M_2 in component M_2 (dimensionless). * STATES[13] is M_3 in component M_3 (dimensionless). * STATES[14] is M_4 in component M_4 (dimensionless). * STATES[15] is M_5 in component M_5 (dimensionless). * STATES[16] is M_6 in component M_6 (dimensionless). * STATES[17] is M_7 in component M_7 (dimensionless). * STATES[18] is M_8 in component M_8 (dimensionless). * CONSTANTS[4] is r_0 in component R (first_order_rate_constant). * CONSTANTS[5] is r_1 in component R (first_order_rate_constant). * CONSTANTS[6] is r_2 in component R (first_order_rate_constant). * CONSTANTS[7] is r_3 in component R (first_order_rate_constant). * CONSTANTS[8] is r_4 in component R (first_order_rate_constant). * CONSTANTS[9] is r_5 in component R (first_order_rate_constant). * CONSTANTS[10] is r_6 in component R (first_order_rate_constant). * CONSTANTS[11] is r_7 in component R (first_order_rate_constant). * CONSTANTS[12] is r_8 in component R (first_order_rate_constant). * CONSTANTS[13] is a in component kinetic_parameters (dimensionless). * STATES[19] is w in component w (dimensionless). * ALGEBRAIC[1] is total_cells in component total_cells (dimensionless). * ALGEBRAIC[2] is stable_total in component total_cells (dimensionless). * ALGEBRAIC[3] is mutant_total in component total_cells (dimensionless). * CONSTANTS[14] is beta in component kinetic_parameters (dimensionless). * RATES[0] is d/dt S_0 in component S_0 (dimensionless). * RATES[1] is d/dt S_1 in component S_1 (dimensionless). * RATES[2] is d/dt S_2 in component S_2 (dimensionless). * RATES[3] is d/dt S_3 in component S_3 (dimensionless). * RATES[4] is d/dt S_4 in component S_4 (dimensionless). * RATES[5] is d/dt S_5 in component S_5 (dimensionless). * RATES[6] is d/dt S_6 in component S_6 (dimensionless). * RATES[7] is d/dt S_7 in component S_7 (dimensionless). * RATES[8] is d/dt S_8 in component S_8 (dimensionless). * RATES[9] is d/dt M_0 in component M_0 (dimensionless). * RATES[10] is d/dt M_1 in component M_1 (dimensionless). * RATES[11] is d/dt M_1_2 in component M_1 (dimensionless). * RATES[12] is d/dt M_2 in component M_2 (dimensionless). * RATES[13] is d/dt M_3 in component M_3 (dimensionless). * RATES[14] is d/dt M_4 in component M_4 (dimensionless). * RATES[15] is d/dt M_5 in component M_5 (dimensionless). * RATES[16] is d/dt M_6 in component M_6 (dimensionless). * RATES[17] is d/dt M_7 in component M_7 (dimensionless). * RATES[18] is d/dt M_8 in component M_8 (dimensionless). * RATES[19] is d/dt w in component w (dimensionless). * There are a total of 0 condition variables. */ void initConsts(double* CONSTANTS, double* RATES, double *STATES) { STATES[0] = 0.5; STATES[1] = 0; CONSTANTS[0] = 0.99; CONSTANTS[1] = 0.6; CONSTANTS[2] = 0.07; STATES[2] = 0; STATES[3] = 0; STATES[4] = 0; STATES[5] = 0; STATES[6] = 0; STATES[7] = 0; STATES[8] = 0; STATES[9] = 0.5; CONSTANTS[3] = 0.1; STATES[10] = 0; STATES[11] = 0; STATES[12] = 0; STATES[13] = 0; STATES[14] = 0; STATES[15] = 0; STATES[16] = 0; STATES[17] = 0; STATES[18] = 0; CONSTANTS[4] = 0.5; CONSTANTS[5] = 0.6; CONSTANTS[6] = 0.7; CONSTANTS[7] = 0.8; CONSTANTS[8] = 0.9; CONSTANTS[9] = 1; CONSTANTS[10] = 1.1; CONSTANTS[11] = 1.2; CONSTANTS[12] = 1.3; CONSTANTS[13] = 0.5; STATES[19] = 0; CONSTANTS[14] = 0.2; CONSTANTS[15] = CONSTANTS[4]; CONSTANTS[16] = CONSTANTS[2]*(1.00000 - ( CONSTANTS[14]*CONSTANTS[0])/1.00000); CONSTANTS[17] = CONSTANTS[5]*(1.00000 - CONSTANTS[13]); CONSTANTS[18] = CONSTANTS[6]*(1.00000 - CONSTANTS[13]); CONSTANTS[19] = CONSTANTS[7]*(1.00000 - CONSTANTS[13]); CONSTANTS[20] = CONSTANTS[8]*(1.00000 - CONSTANTS[13]); CONSTANTS[21] = CONSTANTS[9]*(1.00000 - CONSTANTS[13]); CONSTANTS[22] = CONSTANTS[10]*(1.00000 - CONSTANTS[13]); CONSTANTS[23] = CONSTANTS[11]*(1.00000 - CONSTANTS[13]); CONSTANTS[24] = CONSTANTS[12]*(1.00000 - CONSTANTS[13]); CONSTANTS[25] = CONSTANTS[2]*(1.00000 - ( CONSTANTS[14]*CONSTANTS[3])/1.00000); RATES[0] = 0.1001; RATES[1] = 0.1001; RATES[2] = 0.1001; RATES[3] = 0.1001; RATES[4] = 0.1001; RATES[5] = 0.1001; RATES[6] = 0.1001; RATES[7] = 0.1001; RATES[8] = 0.1001; RATES[9] = 0.1001; RATES[10] = 0.1001; RATES[11] = 0.1001; RATES[12] = 0.1001; RATES[13] = 0.1001; RATES[14] = 0.1001; RATES[15] = 0.1001; RATES[16] = 0.1001; RATES[17] = 0.1001; RATES[18] = 0.1001; RATES[19] = 0.1001; } void computeResiduals(double VOI, double* CONSTANTS, double* RATES, double* OLDRATES, double* STATES, double* OLDSTATES, double* ALGEBRAIC, double* CONDVARS) { resid[0] = RATES[0] - (( CONSTANTS[15]*STATES[0])/1.00000)*(1.00000 - CONSTANTS[16]) - ALGEBRAIC[0]*STATES[0]; resid[1] = RATES[1] - ( (( CONSTANTS[1]*CONSTANTS[2]*CONSTANTS[15]*STATES[0])/1.00000)*(1.00000 - CONSTANTS[0])+ (( CONSTANTS[17]*STATES[1])/1.00000)*(1.00000 - CONSTANTS[16])) - ALGEBRAIC[0]*STATES[1]; resid[2] = RATES[2] - ( (( CONSTANTS[1]*CONSTANTS[2]*CONSTANTS[17]*STATES[1])/1.00000)*(1.00000 - CONSTANTS[0])+ (( CONSTANTS[18]*STATES[2])/1.00000)*(1.00000 - CONSTANTS[16])) - ALGEBRAIC[0]*STATES[2]; resid[3] = RATES[3] - ( (( CONSTANTS[1]*CONSTANTS[2]*CONSTANTS[18]*STATES[2])/1.00000)*(1.00000 - CONSTANTS[0])+ (( CONSTANTS[19]*STATES[3])/1.00000)*(1.00000 - CONSTANTS[16])) - ALGEBRAIC[0]*STATES[3]; resid[4] = RATES[4] - ( (( CONSTANTS[1]*CONSTANTS[2]*CONSTANTS[19]*STATES[3])/1.00000)*(1.00000 - CONSTANTS[0])+ (( CONSTANTS[20]*STATES[4])/1.00000)*(1.00000 - CONSTANTS[16])) - ALGEBRAIC[0]*STATES[4]; resid[5] = RATES[5] - ( (( CONSTANTS[1]*CONSTANTS[2]*CONSTANTS[20]*STATES[4])/1.00000)*(1.00000 - CONSTANTS[0])+ (( CONSTANTS[21]*STATES[5])/1.00000)*(1.00000 - CONSTANTS[16])) - ALGEBRAIC[0]*STATES[5]; resid[6] = RATES[6] - ( (( CONSTANTS[1]*CONSTANTS[2]*CONSTANTS[21]*STATES[5])/1.00000)*(1.00000 - CONSTANTS[0])+ (( CONSTANTS[22]*STATES[6])/1.00000)*(1.00000 - CONSTANTS[16])) - ALGEBRAIC[0]*STATES[6]; resid[7] = RATES[7] - ( (( CONSTANTS[1]*CONSTANTS[2]*CONSTANTS[22]*STATES[6])/1.00000)*(1.00000 - CONSTANTS[0])+ (( CONSTANTS[23]*STATES[7])/1.00000)*(1.00000 - CONSTANTS[16])) - ALGEBRAIC[0]*STATES[7]; resid[8] = RATES[8] - ( (( CONSTANTS[1]*CONSTANTS[2]*CONSTANTS[23]*STATES[7])/1.00000)*(1.00000 - CONSTANTS[0])+ (( CONSTANTS[24]*STATES[8])/1.00000)*(1.00000 - CONSTANTS[16])) - ALGEBRAIC[0]*STATES[8]; resid[9] = RATES[9] - (( CONSTANTS[15]*STATES[9])/1.00000)*(1.00000 - CONSTANTS[25]) - ALGEBRAIC[0]*STATES[9]; resid[10] = RATES[10] - STATES[9]*1.00000; resid[11] = RATES[11] - ( (( CONSTANTS[1]*CONSTANTS[2]*CONSTANTS[15]*STATES[9])/1.00000)*(1.00000 - CONSTANTS[3])+ (( CONSTANTS[17]*STATES[10])/1.00000)*(1.00000 - CONSTANTS[25])) - ALGEBRAIC[0]*STATES[10]; resid[12] = RATES[12] - ( (( CONSTANTS[1]*CONSTANTS[2]*CONSTANTS[17]*STATES[10])/1.00000)*(1.00000 - CONSTANTS[3])+ (( CONSTANTS[18]*STATES[12])/1.00000)*(1.00000 - CONSTANTS[25])) - ALGEBRAIC[0]*STATES[12]; resid[13] = RATES[13] - ( (( CONSTANTS[1]*CONSTANTS[2]*CONSTANTS[18]*STATES[12])/1.00000)*(1.00000 - CONSTANTS[3])+ (( CONSTANTS[19]*STATES[13])/1.00000)*(1.00000 - CONSTANTS[25])) - ALGEBRAIC[0]*STATES[13]; resid[14] = RATES[14] - ( (( CONSTANTS[1]*CONSTANTS[2]*CONSTANTS[19]*STATES[14])/1.00000)*(1.00000 - CONSTANTS[3])+ (( CONSTANTS[20]*STATES[14])/1.00000)*(1.00000 - CONSTANTS[25])) - ALGEBRAIC[0]*STATES[14]; resid[15] = RATES[15] - ( (( CONSTANTS[1]*CONSTANTS[2]*CONSTANTS[20]*STATES[14])/1.00000)*(1.00000 - CONSTANTS[3])+ (( CONSTANTS[21]*STATES[15])/1.00000)*(1.00000 - CONSTANTS[25])) - ALGEBRAIC[0]*STATES[15]; resid[16] = RATES[16] - ( (( CONSTANTS[1]*CONSTANTS[2]*CONSTANTS[21]*STATES[15])/1.00000)*(1.00000 - CONSTANTS[3])+ (( CONSTANTS[22]*STATES[16])/1.00000)*(1.00000 - CONSTANTS[25])) - ALGEBRAIC[0]*STATES[16]; resid[17] = RATES[17] - ( (( CONSTANTS[1]*CONSTANTS[2]*CONSTANTS[22]*STATES[16])/1.00000)*(1.00000 - CONSTANTS[3])+ (( CONSTANTS[23]*STATES[17])/1.00000)*(1.00000 - CONSTANTS[25])) - ALGEBRAIC[0]*STATES[17]; resid[18] = RATES[18] - ( (( CONSTANTS[1]*CONSTANTS[2]*CONSTANTS[23]*STATES[17])/1.00000)*(1.00000 - CONSTANTS[3])+ (( CONSTANTS[24]*STATES[18])/1.00000)*((1.00000 - CONSTANTS[25])+ (( CONSTANTS[1]*CONSTANTS[2])/1.00000)*(1.00000 - CONSTANTS[3]))) - ALGEBRAIC[0]*STATES[8]; resid[19] = RATES[19] - (( (1.00000 - CONSTANTS[1])*CONSTANTS[2])/1.00000)*( (1.00000 - CONSTANTS[0])*( CONSTANTS[15]*STATES[0]+ CONSTANTS[17]*STATES[1]+ CONSTANTS[18]*STATES[2]+ CONSTANTS[19]*STATES[3]+ CONSTANTS[20]*STATES[4]+ CONSTANTS[21]*STATES[5]+ CONSTANTS[22]*STATES[6]+ CONSTANTS[23]*STATES[7]+ CONSTANTS[24]*STATES[8])+ (1.00000 - CONSTANTS[3])*( CONSTANTS[15]*STATES[9]+ CONSTANTS[17]*STATES[10]+ CONSTANTS[18]*STATES[12]+ CONSTANTS[19]*STATES[13]+ CONSTANTS[20]*STATES[14]+ CONSTANTS[21]*STATES[15]+ CONSTANTS[22]*STATES[16]+ CONSTANTS[23]*STATES[17]+ CONSTANTS[24]*STATES[18])) - ALGEBRAIC[0]*STATES[19]; } void computeVariables(double VOI, double* CONSTANTS, double* RATES, double* STATES, double* ALGEBRAIC) { ALGEBRAIC[1] = STATES[0]+STATES[1]+STATES[2]+STATES[3]+STATES[4]+STATES[5]+STATES[6]+STATES[7]+STATES[8]+STATES[9]+STATES[12]+STATES[13]+STATES[14]+STATES[15]+STATES[16]+STATES[17]+STATES[18]; ALGEBRAIC[2] = STATES[0]+STATES[1]+STATES[2]+STATES[3]+STATES[4]+STATES[5]+STATES[6]+STATES[7]+STATES[8]; ALGEBRAIC[3] = STATES[9]+STATES[12]+STATES[13]+STATES[14]+STATES[15]+STATES[16]+STATES[17]+STATES[18]; } void computeEssentialVariables(double VOI, double* CONSTANTS, double* RATES, double* STATES, double* ALGEBRAIC) { ALGEBRAIC[0] = ((1.00000 - CONSTANTS[16])/1.00000)*( CONSTANTS[15]*STATES[0]+ CONSTANTS[17]*STATES[1]+ CONSTANTS[18]*STATES[2]+ CONSTANTS[19]*STATES[3]+ CONSTANTS[20]*STATES[4])+ ((1.00000 - CONSTANTS[25])/1.00000)*( CONSTANTS[17]*STATES[10]+ CONSTANTS[18]*STATES[12]+ CONSTANTS[19]*STATES[13]+ CONSTANTS[20]*STATES[14]); } void getStateInformation(double* SI) { SI[0] = 1.0; SI[1] = 1.0; SI[2] = 1.0; SI[3] = 1.0; SI[4] = 1.0; SI[5] = 1.0; SI[6] = 1.0; SI[7] = 1.0; SI[8] = 1.0; SI[9] = 1.0; SI[10] = 1.0; SI[11] = 1.0; SI[12] = 1.0; SI[13] = 1.0; SI[14] = 1.0; SI[15] = 1.0; SI[16] = 1.0; SI[17] = 1.0; SI[18] = 1.0; SI[19] = 1.0; } void computeRoots(double VOI, double* CONSTANTS, double* RATES, double* OLDRATES, double* STATES, double* OLDSTATES, double* ALGEBRAIC, double* CONDVARS) { }