/* There are a total of 3 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 9 entries in the constant variable array. */ /* * VOI is time in component environment (day). * STATES[0] is x in component x (per_mm3). * CONSTANTS[0] is lamda in component x (per_mm3_per_day). * CONSTANTS[1] is d in component x (per_day). * CONSTANTS[2] is beta in component kinetic_parameters (mm3_per_day). * ALGEBRAIC[0] is s in component kinetic_parameters (dimensionless). * STATES[1] is y in component y (per_mm3). * CONSTANTS[3] is a in component y (per_day). * CONSTANTS[4] is p in component kinetic_parameters (mm3_per_day). * STATES[2] is z in component z (per_mm3). * ALGEBRAIC[1] is log_y in component y (dimensionless). * STATES[3] is w in component w (per_mm3). * CONSTANTS[5] is b in component w (per_day). * CONSTANTS[6] is c in component kinetic_parameters (mm3_mm3_per_day). * CONSTANTS[7] is q in component kinetic_parameters (per_mm3). * ALGEBRAIC[2] is log_w in component w (dimensionless). * CONSTANTS[8] is h in component z (per_day). * RATES[0] is d/dt x in component x (per_mm3). * RATES[1] is d/dt y in component y (per_mm3). * RATES[3] is d/dt w in component w (per_mm3). * RATES[2] is d/dt z in component z (per_mm3). */ void initConsts(double* CONSTANTS, double* RATES, double *STATES) { STATES[0] = 10; CONSTANTS[0] = 1; CONSTANTS[1] = 0.1; CONSTANTS[2] = 0.5; STATES[1] = 0.1; CONSTANTS[3] = 0.2; CONSTANTS[4] = 1; STATES[2] = 0; STATES[3] = 0.001; CONSTANTS[5] = 0.01; CONSTANTS[6] = 0.1; CONSTANTS[7] = 0.5; CONSTANTS[8] = 0.1; } void computeRates(double VOI, double* CONSTANTS, double* RATES, double* STATES, double* ALGEBRAIC) { RATES[3] = CONSTANTS[6]*STATES[0]*STATES[1]*STATES[3] - ( CONSTANTS[6]*CONSTANTS[7]*STATES[1]*STATES[3]+ CONSTANTS[5]*STATES[3]); RATES[2] = CONSTANTS[6]*CONSTANTS[7]*STATES[1]*STATES[3] - CONSTANTS[8]*STATES[2]; ALGEBRAIC[0] = (VOI<=15.0000 ? 1.00000 : VOI>=40.0000 ? 1.00000 : 0.00420000); RATES[0] = CONSTANTS[0] - ( CONSTANTS[1]*STATES[0]+ ALGEBRAIC[0]*CONSTANTS[2]*STATES[0]*STATES[1]); RATES[1] = ALGEBRAIC[0]*CONSTANTS[2]*STATES[0]*STATES[1] - ( CONSTANTS[3]*STATES[1]+ CONSTANTS[4]*STATES[1]*STATES[2]); } void computeVariables(double VOI, double* CONSTANTS, double* RATES, double* STATES, double* ALGEBRAIC) { ALGEBRAIC[0] = (VOI<=15.0000 ? 1.00000 : VOI>=40.0000 ? 1.00000 : 0.00420000); ALGEBRAIC[1] = arbitrary_log( STATES[1]*1.00000, 10); ALGEBRAIC[2] = arbitrary_log( STATES[3]*1.00000, 10); }