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 3 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 28 entries in the constant variable array. */ /* * VOI is time in component environment (day). * STATES[0] is R in component R (picomolar). * ALGEBRAIC[0] is f in component R (flux). * CONSTANTS[0] is DR in component model_parameters (flux). * ALGEBRAIC[2] is pi_C in component model_parameters (dimensionless). * CONSTANTS[23] is DB in component model_parameters (first_order_rate_constant). * STATES[1] is B in component B (picomolar). * CONSTANTS[1] is kB in component model_parameters (first_order_rate_constant). * STATES[2] is C in component C (picomolar). * CONSTANTS[2] is DC in component model_parameters (flux). * ALGEBRAIC[1] is pi_L in component pi_L (dimensionless). * CONSTANTS[3] is DA in component model_parameters (first_order_rate_constant). * CONSTANTS[4] is k1 in component pi_L (second_order_rate_constant). * CONSTANTS[5] is k2 in component pi_L (first_order_rate_constant). * CONSTANTS[6] is k3 in component pi_L (second_order_rate_constant). * CONSTANTS[7] is k4 in component pi_L (first_order_rate_constant). * CONSTANTS[8] is K in component pi_L (picomolar). * CONSTANTS[9] is ko in component pi_L (first_order_rate_constant). * CONSTANTS[10] is Io in component pi_L (flux). * CONSTANTS[11] is IL in component pi_L (flux). * CONSTANTS[12] is rL in component pi_L (flux). * CONSTANTS[13] is KOP in component pi_L (picomole_per_day_per_picomole_cells). * CONSTANTS[14] is KLP in component pi_L (picomole_per_picomole_cells). * CONSTANTS[27] is pi_P in component model_parameters (dimensionless). * CONSTANTS[15] is f0 in component model_parameters (dimensionless). * CONSTANTS[16] is dB in component model_parameters (first_order_rate_constant). * CONSTANTS[17] is IP in component model_parameters (flux). * CONSTANTS[18] is kP in component model_parameters (first_order_rate_constant). * CONSTANTS[24] is P in component model_parameters (picomolar). * CONSTANTS[25] is P_0 in component model_parameters (picomolar). * CONSTANTS[26] is P_s in component model_parameters (picomolar). * CONSTANTS[19] is C_s in component model_parameters (picomolar). * CONSTANTS[20] is SP in component model_parameters (flux). * CONSTANTS[21] is k5 in component model_parameters (second_order_rate_constant). * CONSTANTS[22] is k6 in component model_parameters (first_order_rate_constant). * RATES[0] is d/dt R in component R (picomolar). * RATES[1] is d/dt B in component B (picomolar). * RATES[2] is d/dt C in component C (picomolar). * There are a total of 2 condition variables. */ void initConsts(double* CONSTANTS, double* RATES, double *STATES) { STATES[0] = 0.00077; CONSTANTS[0] = 7E-4; STATES[1] = 0.00073; CONSTANTS[1] = 0.189; STATES[2] = 0.00091; CONSTANTS[2] = 2.1E-3; CONSTANTS[3] = 0.7; CONSTANTS[4] = 1E-2; CONSTANTS[5] = 10.0; CONSTANTS[6] = 5.8E-4; CONSTANTS[7] = 1.7E-2; CONSTANTS[8] = 10.0; CONSTANTS[9] = 0.35; CONSTANTS[10] = 0.0; CONSTANTS[11] = 0.0; CONSTANTS[12] = 1E3; CONSTANTS[13] = 2E5; CONSTANTS[14] = 3E6; CONSTANTS[15] = 0.05; CONSTANTS[16] = 0.7; CONSTANTS[17] = 0.0; CONSTANTS[18] = 86.0; CONSTANTS[19] = 5E-3; CONSTANTS[20] = 250.0; CONSTANTS[21] = 0.02; CONSTANTS[22] = 3.0; CONSTANTS[23] = CONSTANTS[15]*CONSTANTS[16]; CONSTANTS[24] = CONSTANTS[17]/CONSTANTS[18]; CONSTANTS[25] = CONSTANTS[20]/CONSTANTS[18]; CONSTANTS[26] = CONSTANTS[22]/CONSTANTS[21]; CONSTANTS[27] = (CONSTANTS[24]+CONSTANTS[25])/(CONSTANTS[24]+CONSTANTS[26]); RATES[0] = 0.1001; RATES[1] = 0.1001; RATES[2] = 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[0]*ALGEBRAIC[2] - (CONSTANTS[23]/ALGEBRAIC[2])*STATES[0])+ALGEBRAIC[0]; resid[1] = RATES[1] - (CONSTANTS[23]/ALGEBRAIC[2])*STATES[0] - CONSTANTS[1]*STATES[1]; resid[2] = RATES[2] - CONSTANTS[2]*ALGEBRAIC[1] - CONSTANTS[3]*ALGEBRAIC[2]*STATES[2]; } void computeVariables(double VOI, double* CONSTANTS, double* RATES, double* STATES, double* ALGEBRAIC) { } void computeEssentialVariables(double VOI, double* CONSTANTS, double* RATES, double* STATES, double* ALGEBRAIC) { ALGEBRAIC[0] = (CONDVAR[0]>0.00000&&CONDVAR[1]<=0.00000 ? 0.000100000 : 0.00000); ALGEBRAIC[1] = (CONSTANTS[6]/CONSTANTS[7])*(( CONSTANTS[14]*CONSTANTS[27]*STATES[1])/(1.00000+( CONSTANTS[6]*CONSTANTS[8])/CONSTANTS[7]+ (CONSTANTS[4]/( CONSTANTS[5]*CONSTANTS[9]))*( (CONSTANTS[13]/CONSTANTS[27])*STATES[0]+CONSTANTS[10])))*(1.00000+CONSTANTS[11]/CONSTANTS[12]); ALGEBRAIC[2] = (STATES[2]+ CONSTANTS[15]*CONSTANTS[19])/(STATES[2]+CONSTANTS[19]); } void getStateInformation(double* SI) { SI[0] = 1.0; SI[1] = 1.0; SI[2] = 1.0; } void computeRoots(double VOI, double* CONSTANTS, double* RATES, double* OLDRATES, double* STATES, double* OLDSTATES, double* ALGEBRAIC, double* CONDVARS) { CONDVAR[0] = VOI - 20.0000; CONDVAR[1] = VOI - 80.0000; }