/* There are a total of 12 entries in the algebraic variable array. There are a total of 5 entries in each of the rate and state variable arrays. There are a total of 31 entries in the constant variable array. */ /* * VOI is t in component interface (ms). * CONSTANTS[0] is Cm in component interface (uFpmmsq). * CONSTANTS[1] is Am in component interface (pmm). * ALGEBRAIC[0] is Istim in component interface (uApmmcu). * STATES[0] is Vm in component membrane (mV). * STATES[1] is Vt in component Ttubular_current_Vt_var (mV). * STATES[2] is m in component sodium_current_m_gate (dimensionless). * STATES[3] is h in component sodium_current_h_gate (dimensionless). * STATES[4] is n in component potassium_current_n_gate (dimensionless). * ALGEBRAIC[4] is INa in component sodium_current (uApmmsq). * ALGEBRAIC[9] is IK in component potassium_current (uApmmsq). * ALGEBRAIC[10] is IL in component leak_current (uApmmsq). * ALGEBRAIC[11] is IT in component Ttubular_current (uApmmsq). * ALGEBRAIC[5] is IStimC in component interface (uApmmcu). * CONSTANTS[30] is AmC in component interface (pmm). * CONSTANTS[2] is IstimStart in component interface (ms). * CONSTANTS[3] is IstimEnd in component interface (ms). * CONSTANTS[4] is IstimAmplitude in component interface (uApmmcu). * CONSTANTS[5] is IstimPeriod in component interface (ms). * CONSTANTS[6] is IstimPulseDuration in component interface (ms). * CONSTANTS[7] is gNa_max in component sodium_current (mSpmmsq). * CONSTANTS[8] is ENa in component sodium_current (mV). * ALGEBRAIC[1] is alpha_m in component sodium_current_m_gate (pms). * ALGEBRAIC[6] is beta_m in component sodium_current_m_gate (pms). * CONSTANTS[9] is alpha_m_max in component sodium_current_m_gate (pms). * CONSTANTS[10] is beta_m_max in component sodium_current_m_gate (pms). * CONSTANTS[11] is Em in component sodium_current_m_gate (mV). * CONSTANTS[12] is v_alpha_m in component sodium_current_m_gate (dimensionless). * CONSTANTS[13] is v_beta_m in component sodium_current_m_gate (mV). * ALGEBRAIC[2] is alpha_h in component sodium_current_h_gate (pms). * ALGEBRAIC[7] is beta_h in component sodium_current_h_gate (pms). * CONSTANTS[14] is alpha_h_max in component sodium_current_h_gate (pms). * CONSTANTS[15] is beta_h_max in component sodium_current_h_gate (pms). * CONSTANTS[16] is Eh in component sodium_current_h_gate (mV). * CONSTANTS[17] is v_alpha_h in component sodium_current_h_gate (mV). * CONSTANTS[18] is v_beta_h in component sodium_current_h_gate (mV). * CONSTANTS[19] is gK_max in component potassium_current (mSpmmsq). * CONSTANTS[20] is EK in component potassium_current (mV). * ALGEBRAIC[3] is alpha_n in component potassium_current_n_gate (pms). * ALGEBRAIC[8] is beta_n in component potassium_current_n_gate (pms). * CONSTANTS[21] is alpha_n_max in component potassium_current_n_gate (pms). * CONSTANTS[22] is beta_n_max in component potassium_current_n_gate (pms). * CONSTANTS[23] is En in component potassium_current_n_gate (mV). * CONSTANTS[24] is v_alpha_n in component potassium_current_n_gate (dimensionless). * CONSTANTS[25] is v_beta_n in component potassium_current_n_gate (mV). * CONSTANTS[26] is EL in component leak_current (mV). * CONSTANTS[27] is gL_max in component leak_current (mSpmmsq). * CONSTANTS[28] is Rs in component Ttubular_current (mmsqpmS). * CONSTANTS[29] is Ct in component Ttubular_current_Vt_var (uFpmmsq). * RATES[0] is d/dt Vm in component membrane (mV). * RATES[2] is d/dt m in component sodium_current_m_gate (dimensionless). * RATES[3] is d/dt h in component sodium_current_h_gate (dimensionless). * RATES[4] is d/dt n in component potassium_current_n_gate (dimensionless). * RATES[1] is d/dt Vt in component Ttubular_current_Vt_var (mV). */ void initConsts(double* CONSTANTS, double* RATES, double *STATES) { CONSTANTS[0] = 0.009; CONSTANTS[1] = 200.0; STATES[0] = -95.0; STATES[1] = -95.0; STATES[2] = 0.0; STATES[3] = 1.0; STATES[4] = 0.0; CONSTANTS[2] = 10; CONSTANTS[3] = 50000; CONSTANTS[4] = 0.5; CONSTANTS[5] = 1000; CONSTANTS[6] = 1; CONSTANTS[7] = 1.8; CONSTANTS[8] = 50.0; CONSTANTS[9] = 0.208; CONSTANTS[10] = 2.081; CONSTANTS[11] = -42.0; CONSTANTS[12] = 10.0; CONSTANTS[13] = 18.0; CONSTANTS[14] = 0.0156; CONSTANTS[15] = 3.382; CONSTANTS[16] = -41.0; CONSTANTS[17] = 14.7; CONSTANTS[18] = 7.6; CONSTANTS[19] = 0.415; CONSTANTS[20] = -70.0; CONSTANTS[21] = 0.0229; CONSTANTS[22] = 0.09616; CONSTANTS[23] = -40.0; CONSTANTS[24] = 7.0; CONSTANTS[25] = 40.0; CONSTANTS[26] = -95.0; CONSTANTS[27] = 0.0024; CONSTANTS[28] = 15.0; CONSTANTS[29] = 0.04; CONSTANTS[30] = CONSTANTS[1]; } void computeRates(double VOI, double* CONSTANTS, double* RATES, double* STATES, double* ALGEBRAIC) { RATES[1] = (STATES[0] - STATES[1])/( CONSTANTS[28]*CONSTANTS[29]); ALGEBRAIC[1] = ( CONSTANTS[9]*(STATES[0] - CONSTANTS[11]))/(1.00000 - exp((CONSTANTS[11] - STATES[0])/CONSTANTS[12])); ALGEBRAIC[6] = CONSTANTS[10]*exp((CONSTANTS[11] - STATES[0])/CONSTANTS[13]); RATES[2] = ALGEBRAIC[1]*(1.00000 - STATES[2]) - ALGEBRAIC[6]*STATES[2]; ALGEBRAIC[2] = CONSTANTS[14]*exp((CONSTANTS[16] - STATES[0])/CONSTANTS[17]); ALGEBRAIC[7] = CONSTANTS[15]/(1.00000+exp((CONSTANTS[16] - STATES[0])/CONSTANTS[18])); RATES[3] = ALGEBRAIC[2]*(1.00000 - STATES[3]) - ALGEBRAIC[7]*STATES[3]; ALGEBRAIC[3] = ( CONSTANTS[21]*(STATES[0] - CONSTANTS[23]))/(1.00000 - exp((CONSTANTS[23] - STATES[0])/CONSTANTS[24])); ALGEBRAIC[8] = CONSTANTS[22]*exp((CONSTANTS[23] - STATES[0])/CONSTANTS[25]); RATES[4] = ALGEBRAIC[3]*(1.00000 - STATES[4]) - ALGEBRAIC[8]*STATES[4]; ALGEBRAIC[0] = (VOI>=CONSTANTS[2]&&VOI<=CONSTANTS[3]&&(VOI - CONSTANTS[2]) - floor((VOI - CONSTANTS[2])/CONSTANTS[5])*CONSTANTS[5]<=CONSTANTS[6] ? CONSTANTS[4] : 0.00000); ALGEBRAIC[4] = CONSTANTS[7]*STATES[2]*STATES[2]*STATES[2]*STATES[3]*(STATES[0] - CONSTANTS[8]); ALGEBRAIC[9] = CONSTANTS[19]*STATES[4]*STATES[4]*STATES[4]*STATES[4]*(STATES[0] - CONSTANTS[20]); ALGEBRAIC[10] = CONSTANTS[27]*(STATES[0] - CONSTANTS[26]); ALGEBRAIC[11] = (STATES[0] - STATES[1])/CONSTANTS[28]; RATES[0] = (ALGEBRAIC[0] - (ALGEBRAIC[4]+ALGEBRAIC[9]+ALGEBRAIC[10]+ALGEBRAIC[11]))/CONSTANTS[0]; } void computeVariables(double VOI, double* CONSTANTS, double* RATES, double* STATES, double* ALGEBRAIC) { ALGEBRAIC[1] = ( CONSTANTS[9]*(STATES[0] - CONSTANTS[11]))/(1.00000 - exp((CONSTANTS[11] - STATES[0])/CONSTANTS[12])); ALGEBRAIC[6] = CONSTANTS[10]*exp((CONSTANTS[11] - STATES[0])/CONSTANTS[13]); ALGEBRAIC[2] = CONSTANTS[14]*exp((CONSTANTS[16] - STATES[0])/CONSTANTS[17]); ALGEBRAIC[7] = CONSTANTS[15]/(1.00000+exp((CONSTANTS[16] - STATES[0])/CONSTANTS[18])); ALGEBRAIC[3] = ( CONSTANTS[21]*(STATES[0] - CONSTANTS[23]))/(1.00000 - exp((CONSTANTS[23] - STATES[0])/CONSTANTS[24])); ALGEBRAIC[8] = CONSTANTS[22]*exp((CONSTANTS[23] - STATES[0])/CONSTANTS[25]); ALGEBRAIC[0] = (VOI>=CONSTANTS[2]&&VOI<=CONSTANTS[3]&&(VOI - CONSTANTS[2]) - floor((VOI - CONSTANTS[2])/CONSTANTS[5])*CONSTANTS[5]<=CONSTANTS[6] ? CONSTANTS[4] : 0.00000); ALGEBRAIC[4] = CONSTANTS[7]*STATES[2]*STATES[2]*STATES[2]*STATES[3]*(STATES[0] - CONSTANTS[8]); ALGEBRAIC[9] = CONSTANTS[19]*STATES[4]*STATES[4]*STATES[4]*STATES[4]*(STATES[0] - CONSTANTS[20]); ALGEBRAIC[10] = CONSTANTS[27]*(STATES[0] - CONSTANTS[26]); ALGEBRAIC[11] = (STATES[0] - STATES[1])/CONSTANTS[28]; ALGEBRAIC[5] = ALGEBRAIC[0]; }