/* There are a total of 4 entries in the algebraic variable array. There are a total of 10 entries in each of the rate and state variable arrays. There are a total of 14 entries in the constant variable array. */ /* * VOI is time in component environment (day). * STATES[0] is S in component S (dimensionless). * CONSTANTS[0] is r in component S (first_order_rate_constant). * CONSTANTS[1] is epsilon in component S (dimensionless). * ALGEBRAIC[0] is H in component S (dimensionless). * CONSTANTS[2] is d in component kinetic_parameters (first_order_rate_constant). * CONSTANTS[3] is g in component memory_duration (first_order_rate_constant). * CONSTANTS[4] is beta_1 in component kinetic_parameters (first_order_rate_constant). * CONSTANTS[5] is beta_2 in component kinetic_parameters (first_order_rate_constant). * STATES[1] is R_1 in component R1 (dimensionless). * STATES[2] is R_2 in component R2 (dimensionless). * STATES[3] is R_12 in component R12 (dimensionless). * STATES[4] is P_1 in component P1 (dimensionless). * STATES[5] is P_2 in component P2 (dimensionless). * STATES[6] is I_1 in component I1 (dimensionless). * STATES[7] is I_2 in component I2 (dimensionless). * STATES[8] is I_12 in component I12 (dimensionless). * STATES[9] is I_21 in component I21 (dimensionless). * ALGEBRAIC[1] is P in component S (dimensionless). * CONSTANTS[6] is a_1 in component kinetic_parameters (first_order_rate_constant). * CONSTANTS[7] is alpha_1 in component kinetic_parameters (first_order_rate_constant). * CONSTANTS[8] is a_2 in component kinetic_parameters (first_order_rate_constant). * CONSTANTS[9] is alpha_2 in component kinetic_parameters (first_order_rate_constant). * CONSTANTS[10] is k_1 in component P1 (first_order_rate_constant). * CONSTANTS[11] is u in component kinetic_parameters (first_order_rate_constant). * ALGEBRAIC[2] is log_P1 in component P1 (dimensionless). * CONSTANTS[12] is k_2 in component P2 (first_order_rate_constant). * ALGEBRAIC[3] is log_P2 in component P2 (dimensionless). * CONSTANTS[13] is G in component memory_duration (dimensionless). * RATES[0] is d/dt S in component S (dimensionless). * RATES[6] is d/dt I_1 in component I1 (dimensionless). * RATES[7] is d/dt I_2 in component I2 (dimensionless). * RATES[8] is d/dt I_12 in component I12 (dimensionless). * RATES[9] is d/dt I_21 in component I21 (dimensionless). * RATES[1] is d/dt R_1 in component R1 (dimensionless). * RATES[2] is d/dt R_2 in component R2 (dimensionless). * RATES[3] is d/dt R_12 in component R12 (dimensionless). * RATES[4] is d/dt P_1 in component P1 (dimensionless). * RATES[5] is d/dt P_2 in component P2 (dimensionless). */ void initConsts(double* CONSTANTS, double* RATES, double *STATES) { STATES[0] = 100; CONSTANTS[0] = 0.5; CONSTANTS[1] = 0.1; CONSTANTS[2] = 0.01; CONSTANTS[3] = 0.01; CONSTANTS[4] = 1; CONSTANTS[5] = 1; STATES[1] = 0; STATES[2] = 0; STATES[3] = 0; STATES[4] = 1; STATES[5] = 1; STATES[6] = 0; STATES[7] = 0; STATES[8] = 0; STATES[9] = 0; CONSTANTS[6] = 0.03; CONSTANTS[7] = 0.1; CONSTANTS[8] = 1; CONSTANTS[9] = 0.1; CONSTANTS[10] = 1; CONSTANTS[11] = 0.5; CONSTANTS[12] = 1; CONSTANTS[13] = 1.00000/CONSTANTS[3]; } void computeRates(double VOI, double* CONSTANTS, double* RATES, double* STATES, double* ALGEBRAIC) { RATES[6] = ( CONSTANTS[4]*STATES[0]*STATES[4] - CONSTANTS[6]*STATES[6]) - CONSTANTS[7]*STATES[6]; RATES[7] = ( CONSTANTS[5]*STATES[0]*STATES[5] - CONSTANTS[8]*STATES[7]) - CONSTANTS[9]*STATES[7]; RATES[8] = ( CONSTANTS[5]*STATES[1]*STATES[5] - CONSTANTS[8]*STATES[8]) - CONSTANTS[9]*STATES[8]; RATES[9] = ( CONSTANTS[4]*STATES[2]*STATES[4] - CONSTANTS[6]*STATES[9]) - CONSTANTS[7]*STATES[9]; RATES[1] = (( CONSTANTS[7]*STATES[6] - CONSTANTS[2]*STATES[1]) - CONSTANTS[3]*STATES[1]) - CONSTANTS[5]*STATES[1]*STATES[5]; RATES[2] = (( CONSTANTS[9]*STATES[7] - CONSTANTS[2]*STATES[2]) - CONSTANTS[3]*STATES[2]) - CONSTANTS[4]*STATES[2]*STATES[4]; RATES[3] = (( CONSTANTS[9]*STATES[8]+ CONSTANTS[7]*STATES[9]) - CONSTANTS[2]*STATES[3]) - CONSTANTS[3]*STATES[3]; RATES[4] = CONSTANTS[10]*(STATES[6]+STATES[9]) - CONSTANTS[11]*STATES[4]; RATES[5] = CONSTANTS[12]*(STATES[7]+STATES[8]) - CONSTANTS[11]*STATES[5]; ALGEBRAIC[0] = STATES[0]+STATES[6]+STATES[1]+STATES[7]+STATES[2]+STATES[8]+STATES[9]+STATES[3]; RATES[0] = (((( CONSTANTS[0]*ALGEBRAIC[0])/( CONSTANTS[1]*ALGEBRAIC[0]+1.00000) - CONSTANTS[2]*STATES[0]) - CONSTANTS[4]*STATES[0]*STATES[4]) - CONSTANTS[5]*STATES[0]*STATES[5])+ CONSTANTS[3]*(STATES[1]+STATES[2]+STATES[3]); } void computeVariables(double VOI, double* CONSTANTS, double* RATES, double* STATES, double* ALGEBRAIC) { ALGEBRAIC[0] = STATES[0]+STATES[6]+STATES[1]+STATES[7]+STATES[2]+STATES[8]+STATES[9]+STATES[3]; ALGEBRAIC[1] = STATES[4]+STATES[5]; ALGEBRAIC[2] = arbitrary_log(STATES[4], 10); ALGEBRAIC[3] = arbitrary_log(STATES[5], 10); }