/* There are a total of 8 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 22 entries in the constant variable array. */ /* * VOI is time in component environment (ms). * STATES[0] is u in component membrane (dimensionless). * CONSTANTS[0] is Cm in component membrane (uF_per_cm2). * ALGEBRAIC[0] is Vm in component membrane (mV). * CONSTANTS[1] is V_0 in component membrane (mV). * CONSTANTS[2] is V_fi in component membrane (mV). * ALGEBRAIC[2] is J_fi in component fast_inward_current (per_ms). * ALGEBRAIC[4] is J_so in component slow_outward_current (per_ms). * ALGEBRAIC[6] is J_si in component slow_inward_current (per_ms). * ALGEBRAIC[7] is Istim in component stimulus_protocol (per_ms). * ALGEBRAIC[1] is p in component p (dimensionless). * CONSTANTS[3] is u_c in component p (dimensionless). * ALGEBRAIC[3] is q in component q (dimensionless). * CONSTANTS[4] is u_v in component q (dimensionless). * CONSTANTS[21] is tau_d in component fast_inward_current (ms). * CONSTANTS[5] is g_fi_max in component fast_inward_current (mS_per_cm2). * STATES[1] is v in component fast_inward_current_v_gate (dimensionless). * ALGEBRAIC[5] is tau_v_minus in component fast_inward_current_v_gate (ms). * CONSTANTS[6] is tau_v1_minus in component fast_inward_current_v_gate (ms). * CONSTANTS[7] is tau_v2_minus in component fast_inward_current_v_gate (ms). * CONSTANTS[8] is tau_v_plus in component fast_inward_current_v_gate (ms). * CONSTANTS[9] is tau_0 in component slow_outward_current (ms). * CONSTANTS[10] is tau_r in component slow_outward_current (ms). * CONSTANTS[11] is tau_si in component slow_inward_current (ms). * CONSTANTS[12] is u_csi in component slow_inward_current (dimensionless). * CONSTANTS[13] is k in component slow_inward_current (dimensionless). * STATES[2] is w in component slow_inward_current_w_gate (dimensionless). * CONSTANTS[14] is tau_w_minus in component slow_inward_current_w_gate (ms). * CONSTANTS[15] is tau_w_plus in component slow_inward_current_w_gate (ms). * CONSTANTS[16] is IstimStart in component stimulus_protocol (ms). * CONSTANTS[17] is IstimEnd in component stimulus_protocol (ms). * CONSTANTS[18] is IstimAmplitude in component stimulus_protocol (per_ms). * CONSTANTS[19] is IstimPeriod in component stimulus_protocol (ms). * CONSTANTS[20] is IstimPulseDuration in component stimulus_protocol (ms). * RATES[0] is d/dt u in component membrane (dimensionless). * RATES[1] is d/dt v in component fast_inward_current_v_gate (dimensionless). * RATES[2] is d/dt w in component slow_inward_current_w_gate (dimensionless). */ void initConsts(double* CONSTANTS, double* RATES, double *STATES) { STATES[0] = 0; CONSTANTS[0] = 1; CONSTANTS[1] = -85; CONSTANTS[2] = 15; CONSTANTS[3] = 0.13; CONSTANTS[4] = 0.04; CONSTANTS[5] = 4; STATES[1] = 1; CONSTANTS[6] = 1250; CONSTANTS[7] = 19.6; CONSTANTS[8] = 3.33; CONSTANTS[9] = 12.5; CONSTANTS[10] = 33.33; CONSTANTS[11] = 29; CONSTANTS[12] = 0.85; CONSTANTS[13] = 10; STATES[2] = 1; CONSTANTS[14] = 41; CONSTANTS[15] = 870; CONSTANTS[16] = 10; CONSTANTS[17] = 50000; CONSTANTS[18] = -0.2; CONSTANTS[19] = 1000; CONSTANTS[20] = 1; CONSTANTS[21] = CONSTANTS[0]/CONSTANTS[5]; } void computeRates(double VOI, double* CONSTANTS, double* RATES, double* STATES, double* ALGEBRAIC) { ALGEBRAIC[1] = (STATES[0]=CONSTANTS[16]&&VOI<=CONSTANTS[17]&&(VOI - CONSTANTS[16]) - floor((VOI - CONSTANTS[16])/CONSTANTS[19])*CONSTANTS[19]<=CONSTANTS[20] ? CONSTANTS[18] : 0.00000); RATES[0] = - (ALGEBRAIC[2]+ALGEBRAIC[4]+ALGEBRAIC[6]+ALGEBRAIC[7]); } void computeVariables(double VOI, double* CONSTANTS, double* RATES, double* STATES, double* ALGEBRAIC) { ALGEBRAIC[1] = (STATES[0]=CONSTANTS[16]&&VOI<=CONSTANTS[17]&&(VOI - CONSTANTS[16]) - floor((VOI - CONSTANTS[16])/CONSTANTS[19])*CONSTANTS[19]<=CONSTANTS[20] ? CONSTANTS[18] : 0.00000); ALGEBRAIC[0] = CONSTANTS[1]+ STATES[0]*(CONSTANTS[2] - CONSTANTS[1]); }