/* Model is correctly constrained. * No equations needed Newton-Raphson evaluation. * The main variable array needs 66 entries. * The rate array needs 14 entries. * The constant array needs 33 entries. * The bound array needs 1 entries. * Variable storage is as follows: * * Variable Ach in component Neural_input * * * Variable type: constant * * * Variable index: 2 * * * Has differential: false * * Variable Ca_i in component SM_Membrane * * * Variable type: differential * * * Variable index: 1 * * * Has differential: true * * * Highest derivative: 1 * * Variable Ca_o in component Environment * * * Variable type: constant * * * Variable index: 9 * * * Has differential: false * * Variable Cl_o in component Environment * * * Variable type: constant * * * Variable index: 12 * * * Has differential: false * * Variable Cm_SM in component SM_Membrane * * * Variable type: constant * * * Variable index: 13 * * * Has differential: false * * Variable E_Ca in component I_LVA_SM * * * Variable type: computed for every bound variable * * * Variable index: 35 * * * Has differential: false * * Variable E_Ca in component I_Ltype_SM * * * Variable type: computed for every bound variable * * * Variable index: 27 * * * Has differential: false * * Variable E_K in component I_BK_SM * * * Variable type: computed once * * * Variable index: 41 * * * Has differential: false * * Variable E_K in component I_bk_SM * * * Variable type: computed once * * * Variable index: 56 * * * Has differential: false * * Variable E_K in component I_ka_SM * * * Variable type: computed once * * * Variable index: 50 * * * Has differential: false * * Variable E_K in component I_kr_SM * * * Variable type: computed once * * * Variable index: 44 * * * Has differential: false * * Variable E_NSCC in component I_NSCC_SM * * * Variable type: constant * * * Variable index: 24 * * * Has differential: false * * Variable E_Na in component I_Na_SM * * * Variable type: computed once * * * Variable index: 21 * * * Has differential: false * * Variable F in component Environment * * * Variable type: constant * * * Variable index: 6 * * * Has differential: false * * Variable FoRT in component Environment * * * Variable type: computed once * * * Variable index: 18 * * * Has differential: false * * Variable G_max_BK in component I_BK_SM * * * Variable type: constant * * * Variable index: 20 * * * Has differential: false * * Variable G_max_LVA in component I_LVA_SM * * * Variable type: constant * * * Variable index: 19 * * * Has differential: false * * Variable G_max_Ltype in component I_Ltype_SM * * * Variable type: constant * * * Variable index: 18 * * * Has differential: false * * Variable G_max_NSCC_SM in component I_NSCC_SM * * * Variable type: constant * * * Variable index: 25 * * * Has differential: false * * Variable G_max_Na_SM in component I_Na_SM * * * Variable type: constant * * * Variable index: 17 * * * Has differential: false * * Variable G_max_bk in component I_bk_SM * * * Variable type: constant * * * Variable index: 23 * * * Has differential: false * * Variable G_max_ka_SM in component I_ka_SM * * * Variable type: constant * * * Variable index: 22 * * * Has differential: false * * Variable G_max_kr_SM in component I_kr_SM * * * Variable type: constant * * * Variable index: 21 * * * Has differential: false * * Variable Gcouple in component Gap_junction * * * Variable type: constant * * * Variable index: 1 * * * Has differential: false * * Variable I_BK_SM in component I_BK_SM * * * Variable type: computed for every bound variable * * * Variable index: 40 * * * Has differential: false * * Variable I_LVA_SM in component I_LVA_SM * * * Variable type: computed for every bound variable * * * Variable index: 34 * * * Has differential: false * * Variable I_Ltype_SM in component I_Ltype_SM * * * Variable type: computed for every bound variable * * * Variable index: 26 * * * Has differential: false * * Variable I_NSCC_SM in component I_NSCC_SM * * * Variable type: computed for every bound variable * * * Variable index: 57 * * * Has differential: false * * Variable I_Na_SM in component I_Na_SM * * * Variable type: computed for every bound variable * * * Variable index: 20 * * * Has differential: false * * Variable I_bk_SM in component I_bk_SM * * * Variable type: computed for every bound variable * * * Variable index: 55 * * * Has differential: false * * Variable I_ka_SM in component I_ka_SM * * * Variable type: computed for every bound variable * * * Variable index: 49 * * * Has differential: false * * Variable I_kr_SM in component I_kr_SM * * * Variable type: computed for every bound variable * * * Variable index: 43 * * * Has differential: false * * Variable I_stim in component I_stim * * * Variable type: computed for every bound variable * * * Variable index: 65 * * * Has differential: false * * Variable J_CaSR_SM in component J_CaSR_SM * * * Variable type: computed for every bound variable * * * Variable index: 62 * * * Has differential: false * * Variable J_max_CaSR in component J_CaSR_SM * * * Variable type: constant * * * Variable index: 26 * * * Has differential: false * * Variable K_i in component SM_Membrane * * * Variable type: constant * * * Variable index: 16 * * * Has differential: false * * Variable K_o in component Environment * * * Variable type: constant * * * Variable index: 11 * * * Has differential: false * * Variable Na_i in component SM_Membrane * * * Variable type: constant * * * Variable index: 15 * * * Has differential: false * * Variable Na_o in component Environment * * * Variable type: constant * * * Variable index: 10 * * * Has differential: false * * Variable Q10Ca in component Environment * * * Variable type: constant * * * Variable index: 5 * * * Has differential: false * * Variable Q10K in component Environment * * * Variable type: constant * * * Variable index: 7 * * * Has differential: false * * Variable Q10Na in component Environment * * * Variable type: constant * * * Variable index: 8 * * * Has differential: false * * Variable R in component Environment * * * Variable type: constant * * * Variable index: 0 * * * Has differential: false * * Variable RToF in component Environment * * * Variable type: computed once * * * Variable index: 19 * * * Has differential: false * * Variable T in component Environment * * * Variable type: constant * * * Variable index: 3 * * * Has differential: false * * Variable T_correction_BK in component Environment * * * Variable type: computed once * * * Variable index: 17 * * * Has differential: false * * Variable T_correction_Ca in component Environment * * * Variable type: computed once * * * Variable index: 16 * * * Has differential: false * * Variable T_correction_K in component Environment * * * Variable type: computed once * * * Variable index: 15 * * * Has differential: false * * Variable T_correction_Na in component Environment * * * Variable type: computed once * * * Variable index: 14 * * * Has differential: false * * Variable T_exp in component Environment * * * Variable type: constant * * * Variable index: 4 * * * Has differential: false * * Variable V_decay in component I_stim * * * Variable type: constant * * * Variable index: 32 * * * Has differential: false * * Variable Vm_SM in component SM_Membrane * * * Variable type: differential * * * Variable index: 0 * * * Has differential: true * * * Highest derivative: 1 * * Variable Vol_SM in component SM_Membrane * * * Variable type: constant * * * Variable index: 14 * * * Has differential: false * * Variable d_BK_SM in component d_BK_SM * * * Variable type: computed for every bound variable * * * Variable index: 42 * * * Has differential: false * * Variable d_LVA_SM in component d_LVA_SM * * * Variable type: differential * * * Variable index: 7 * * * Has differential: true * * * Highest derivative: 1 * * Variable d_Ltype_SM in component d_Ltype_SM * * * Variable type: differential * * * Variable index: 4 * * * Has differential: true * * * Highest derivative: 1 * * Variable d_inf_LVA_SM in component d_LVA_SM * * * Variable type: computed for every bound variable * * * Variable index: 36 * * * Has differential: false * * Variable d_inf_Ltype_SM in component d_Ltype_SM * * * Variable type: computed for every bound variable * * * Variable index: 28 * * * Has differential: false * * Variable delta_VICC in component I_stim * * * Variable type: constant * * * Variable index: 28 * * * Has differential: false * * Variable f_LVA_SM in component f_LVA_SM * * * Variable type: differential * * * Variable index: 8 * * * Has differential: true * * * Highest derivative: 1 * * Variable f_Ltype_SM in component f_Ltype_SM * * * Variable type: differential * * * Variable index: 5 * * * Has differential: true * * * Highest derivative: 1 * * Variable f_ca_Ltype_SM in component f_ca_Ltype_SM * * * Variable type: differential * * * Variable index: 6 * * * Has differential: true * * * Highest derivative: 1 * * Variable f_ca_NSCC_SM in component I_NSCC_SM * * * Variable type: computed for every bound variable * * * Variable index: 58 * * * Has differential: false * * Variable f_ca_inf_Ltype_SM in component f_ca_Ltype_SM * * * Variable type: computed for every bound variable * * * Variable index: 32 * * * Has differential: false * * Variable f_inf_LVA_SM in component f_LVA_SM * * * Variable type: computed for every bound variable * * * Variable index: 38 * * * Has differential: false * * Variable f_inf_Ltype_SM in component f_Ltype_SM * * * Variable type: computed for every bound variable * * * Variable index: 30 * * * Has differential: false * * Variable h_Na_SM in component h_Na_SM * * * Variable type: differential * * * Variable index: 3 * * * Has differential: true * * * Highest derivative: 1 * * Variable h_inf_Na in component h_Na_SM * * * Variable type: computed for every bound variable * * * Variable index: 24 * * * Has differential: false * * Variable local_time in component I_stim * * * Variable type: computed for every bound variable * * * Variable index: 63 * * * Has differential: false * * Variable m_NSCC_SM in component m_NSCC_SM * * * Variable type: differential * * * Variable index: 13 * * * Has differential: true * * * Highest derivative: 1 * * Variable m_Na_SM in component m_Na_SM * * * Variable type: differential * * * Variable index: 2 * * * Has differential: true * * * Highest derivative: 1 * * Variable m_inf_NSCC_SM in component m_NSCC_SM * * * Variable type: computed for every bound variable * * * Variable index: 60 * * * Has differential: false * * Variable m_inf_Na in component m_Na_SM * * * Variable type: computed for every bound variable * * * Variable index: 22 * * * Has differential: false * * Variable period in component I_stim * * * Variable type: constant * * * Variable index: 27 * * * Has differential: false * * Variable rach_NSCC_SM in component I_NSCC_SM * * * Variable type: computed once * * * Variable index: 59 * * * Has differential: false * * Variable stim_start in component I_stim * * * Variable type: computed for every bound variable * * * Variable index: 64 * * * Has differential: false * * Variable t_ICC_stimulus in component I_stim * * * Variable type: constant * * * Variable index: 31 * * * Has differential: false * * Variable t_ICCpeak in component I_stim * * * Variable type: constant * * * Variable index: 29 * * * Has differential: false * * Variable t_ICCplateau in component I_stim * * * Variable type: constant * * * Variable index: 30 * * * Has differential: false * * Variable tau_d_LVA_SM in component d_LVA_SM * * * Variable type: computed once * * * Variable index: 37 * * * Has differential: false * * Variable tau_d_Ltype_SM in component d_Ltype_SM * * * Variable type: computed once * * * Variable index: 29 * * * Has differential: false * * Variable tau_f_LVA_SM in component f_LVA_SM * * * Variable type: computed for every bound variable * * * Variable index: 39 * * * Has differential: false * * Variable tau_f_Ltype_SM in component f_Ltype_SM * * * Variable type: computed once * * * Variable index: 31 * * * Has differential: false * * Variable tau_f_ca_Ltype_SM in component f_ca_Ltype_SM * * * Variable type: computed once * * * Variable index: 33 * * * Has differential: false * * Variable tau_h_Na in component h_Na_SM * * * Variable type: computed for every bound variable * * * Variable index: 25 * * * Has differential: false * * Variable tau_m_NSCC_SM in component m_NSCC_SM * * * Variable type: computed for every bound variable * * * Variable index: 61 * * * Has differential: false * * Variable tau_m_Na in component m_Na_SM * * * Variable type: computed for every bound variable * * * Variable index: 23 * * * Has differential: false * * Variable tau_xa1_SM in component xa1_SM * * * Variable type: computed for every bound variable * * * Variable index: 52 * * * Has differential: false * * Variable tau_xa2_SM in component xa2_SM * * * Variable type: computed once * * * Variable index: 54 * * * Has differential: false * * Variable tau_xr1_SM in component xr1_SM * * * Variable type: computed once * * * Variable index: 46 * * * Has differential: false * * Variable tau_xr2_SM in component xr2_SM * * * Variable type: computed for every bound variable * * * Variable index: 48 * * * Has differential: false * * Variable time in component Time * * * Variable type: bound variable * * * Variable index: 0 * * * Has differential: false * * Variable xa1_SM in component xa1_SM * * * Variable type: differential * * * Variable index: 11 * * * Has differential: true * * * Highest derivative: 1 * * Variable xa1_inf_SM in component xa1_SM * * * Variable type: computed for every bound variable * * * Variable index: 51 * * * Has differential: false * * Variable xa2_SM in component xa2_SM * * * Variable type: differential * * * Variable index: 12 * * * Has differential: true * * * Highest derivative: 1 * * Variable xa2_inf_SM in component xa2_SM * * * Variable type: computed for every bound variable * * * Variable index: 53 * * * Has differential: false * * Variable xr1_SM in component xr1_SM * * * Variable type: differential * * * Variable index: 9 * * * Has differential: true * * * Highest derivative: 1 * * Variable xr1_inf_SM in component xr1_SM * * * Variable type: computed for every bound variable * * * Variable index: 45 * * * Has differential: false * * Variable xr2_SM in component xr2_SM * * * Variable type: differential * * * Variable index: 10 * * * Has differential: true * * * Highest derivative: 1 * * Variable xr2_inf_SM in component xr2_SM * * * Variable type: computed for every bound variable * * * Variable index: 47 * * * Has differential: false */ void SetupFixedConstants(double* CONSTANTS) { CONSTANTS[0] = 8314.4; CONSTANTS[1] = 1.3; CONSTANTS[2] = 1e-05; CONSTANTS[3] = 310; CONSTANTS[4] = 297; CONSTANTS[5] = 2.1; CONSTANTS[6] = 96486; CONSTANTS[7] = 1.365; CONSTANTS[8] = 2.45; CONSTANTS[9] = 2.5; CONSTANTS[10] = 137; CONSTANTS[11] = 5.9; CONSTANTS[12] = 134; CONSTANTS[13] = 77; CONSTANTS[14] = 3500; CONSTANTS[15] = 10; CONSTANTS[16] = 164; CONSTANTS[17] = 3; CONSTANTS[18] = 65; CONSTANTS[19] = 0.18; CONSTANTS[20] = 45.7; CONSTANTS[21] = 35; CONSTANTS[22] = 9; CONSTANTS[23] = 0.0144; CONSTANTS[24] = -28; CONSTANTS[25] = 50; CONSTANTS[26] = 0.31705; CONSTANTS[27] = 20000; CONSTANTS[28] = 59; CONSTANTS[29] = 98; CONSTANTS[30] = 7582; CONSTANTS[31] = 10000; CONSTANTS[32] = 37.25; } void SetupComputedConstants(double* CONSTANTS, double* VARIABLES) { VARIABLES[14] = pow(CONSTANTS[8],((CONSTANTS[3]-CONSTANTS[4])/10.0000)); VARIABLES[15] = pow(CONSTANTS[7],((CONSTANTS[3]-CONSTANTS[4])/10.0000)); VARIABLES[16] = pow(CONSTANTS[5],((CONSTANTS[3]-CONSTANTS[4])/10.0000)); VARIABLES[17] = (1.10000*(CONSTANTS[3]-CONSTANTS[4])); VARIABLES[18] = (CONSTANTS[6]/(CONSTANTS[0]*CONSTANTS[3])); VARIABLES[19] = ((CONSTANTS[0]*CONSTANTS[3])/CONSTANTS[6]); VARIABLES[21] = (VARIABLES[19]*log((CONSTANTS[10]/CONSTANTS[15]))); VARIABLES[29] = (VARIABLES[16]*0.470000); VARIABLES[31] = (VARIABLES[16]*86.0000); VARIABLES[33] = (VARIABLES[16]*2.00000); VARIABLES[37] = (VARIABLES[16]*3.00000); VARIABLES[41] = (VARIABLES[19]*log((CONSTANTS[11]/CONSTANTS[16]))); VARIABLES[44] = (VARIABLES[19]*log((CONSTANTS[11]/CONSTANTS[16]))); VARIABLES[46] = (VARIABLES[15]*80.0000); VARIABLES[50] = (VARIABLES[19]*log((CONSTANTS[11]/CONSTANTS[16]))); VARIABLES[54] = (VARIABLES[15]*90.0000); VARIABLES[56] = (VARIABLES[19]*log((CONSTANTS[11]/CONSTANTS[16]))); VARIABLES[59] = (1.00000/(1.00000+(0.0100000/CONSTANTS[2]))); VARIABLES[0] = -69.7500; VARIABLES[1] = 8.00000e-05; VARIABLES[2] = 0.00500000; VARIABLES[3] = 0.0578700; VARIABLES[4] = 0.00000; VARIABLES[5] = 0.950000; VARIABLES[6] = 1.00000; VARIABLES[7] = 0.0200000; VARIABLES[8] = 0.990000; VARIABLES[9] = 0.00000; VARIABLES[10] = 0.820000; VARIABLES[11] = 0.00414000; VARIABLES[12] = 0.720000; VARIABLES[13] = 0.00000; } void ComputeRates(double* BOUND, double* RATES, double* CONSTANTS, double* VARIABLES) { RATES[0] = (-1.00000*(1.00000/CONSTANTS[13])*(VARIABLES[20]+VARIABLES[26]+VARIABLES[34]+VARIABLES[43]+VARIABLES[49]+VARIABLES[40]+VARIABLES[57]+VARIABLES[55]+(-1.00000*VARIABLES[65]))); RATES[1] = ((((-1.00000*VARIABLES[26])+(-1.00000*VARIABLES[34]))/(2.00000*0.00100000*CONSTANTS[6]*CONSTANTS[14]))+(-1.00000*VARIABLES[62])); RATES[2] = ((VARIABLES[22]-VARIABLES[2])/VARIABLES[23]); RATES[3] = ((VARIABLES[24]-VARIABLES[3])/VARIABLES[25]); RATES[4] = ((VARIABLES[28]-VARIABLES[4])/VARIABLES[29]); RATES[5] = ((VARIABLES[30]-VARIABLES[5])/VARIABLES[31]); RATES[6] = ((VARIABLES[32]-VARIABLES[6])/VARIABLES[33]); RATES[7] = ((VARIABLES[36]-VARIABLES[7])/VARIABLES[37]); RATES[8] = ((VARIABLES[38]-VARIABLES[8])/VARIABLES[39]); RATES[9] = ((VARIABLES[45]-VARIABLES[9])/VARIABLES[46]); RATES[10] = ((VARIABLES[47]-VARIABLES[10])/VARIABLES[48]); RATES[11] = ((VARIABLES[51]-VARIABLES[11])/VARIABLES[52]); RATES[12] = ((VARIABLES[53]-VARIABLES[12])/VARIABLES[54]); RATES[13] = ((VARIABLES[60]-VARIABLES[13])/VARIABLES[61]); } void ComputeVariables(double* BOUND, double* RATES, double* CONSTANTS, double* VARIABLES) { VARIABLES[20] = (CONSTANTS[17]*(VARIABLES[3]*VARIABLES[2])*(VARIABLES[0]-VARIABLES[21])); VARIABLES[22] = (1.00000/(1.00000+exp(((VARIABLES[0]+47.0000)/-4.80000)))); VARIABLES[23] = (VARIABLES[14]*((VARIABLES[0]*-0.0170000*1.00000)+0.440000)); VARIABLES[24] = (1.00000/(1.00000+exp(((VARIABLES[0]+78.0000)/3.00000)))); VARIABLES[25] = (VARIABLES[14]*((VARIABLES[0]*-0.250000*1.00000)+5.50000)); VARIABLES[27] = (0.500000*VARIABLES[19]*log((CONSTANTS[9]/VARIABLES[1]))); VARIABLES[26] = (CONSTANTS[18]*(VARIABLES[5]*VARIABLES[4]*VARIABLES[6])*(VARIABLES[0]-VARIABLES[27])); VARIABLES[28] = (1.00000/(1.00000+exp(((VARIABLES[0]+17.0000)/-4.30000)))); VARIABLES[30] = (1.00000/(1.00000+exp(((VARIABLES[0]+43.0000)/8.90000)))); VARIABLES[32] = (1.00000-(1.00000/(1.00000+exp((((VARIABLES[1]-8.99900e-05)-0.000214000)/-1.31000e-05))))); VARIABLES[35] = (0.500000*VARIABLES[19]*log((CONSTANTS[9]/VARIABLES[1]))); VARIABLES[34] = (CONSTANTS[19]*(VARIABLES[8]*VARIABLES[7])*(VARIABLES[0]-VARIABLES[35])); VARIABLES[36] = (1.00000/(1.00000+exp(((VARIABLES[0]+27.5000)/-10.9000)))); VARIABLES[38] = (1.00000/(1.00000+exp(((VARIABLES[0]+15.8000)/7.00000)))); VARIABLES[39] = (VARIABLES[16]*(7.58000*exp((VARIABLES[0]*0.00817000)))); VARIABLES[42] = (1.00000/(1.00000+exp(((VARIABLES[0]/-17.0000)-(2.00000*log((VARIABLES[1]/0.00100000))))))); VARIABLES[40] = ((CONSTANTS[20]+VARIABLES[17])*VARIABLES[42]*(VARIABLES[0]-VARIABLES[41])); VARIABLES[43] = (CONSTANTS[21]*(VARIABLES[9]*VARIABLES[10])*(VARIABLES[0]-VARIABLES[44])); VARIABLES[45] = (1.00000/(1.00000+exp(((VARIABLES[0]+27.0000)/-5.00000)))); VARIABLES[47] = (0.200000+(0.800000/(1.00000+exp(((VARIABLES[0]+58.0000)/10.0000))))); VARIABLES[48] = (VARIABLES[15]*(-707.000+(1481.00*exp(((VARIABLES[0]+36.0000)/95.0000))))); VARIABLES[49] = (CONSTANTS[22]*(VARIABLES[11]*VARIABLES[12])*(VARIABLES[0]-VARIABLES[50])); VARIABLES[51] = (1.00000/(1.00000+exp(((VARIABLES[0]+26.5000)/-7.90000)))); VARIABLES[52] = (VARIABLES[15]*(31.8000+(175.000*exp((-0.500000*pow(((VARIABLES[0]+44.4000)/22.3000),2.00000)))))); VARIABLES[53] = (0.100000+(0.900000/(1.00000+exp(((VARIABLES[0]+65.0000)/6.20000))))); VARIABLES[55] = (CONSTANTS[23]*(VARIABLES[0]-VARIABLES[56])); VARIABLES[58] = (1.00000/(1.00000+pow((VARIABLES[1]/0.000200000),-4.00000))); VARIABLES[57] = (CONSTANTS[25]*VARIABLES[13]*VARIABLES[58]*VARIABLES[59]*(VARIABLES[0]-CONSTANTS[24])); VARIABLES[60] = (1.00000/(1.00000+exp(((VARIABLES[0]+25.0000)/-20.0000)))); VARIABLES[61] = ((1.00000/(1.00000+exp(((VARIABLES[0]+66.0000)/-26.0000))))*150.000); VARIABLES[62] = (CONSTANTS[26]*pow((VARIABLES[1]*1.00000),1.34000)); VARIABLES[64] = ((((BOUND[0]>(CONSTANTS[27]*1.00000)))&&((BOUND[0]<=(CONSTANTS[27]*2.00000))))) ? ((CONSTANTS[27]*1.00000)) : ((((BOUND[0]>(CONSTANTS[27]*2.00000)))&&((BOUND[0]<=(CONSTANTS[27]*3.00000))))) ? ((CONSTANTS[27]*2.00000)) : ((((BOUND[0]>(CONSTANTS[27]*3.00000)))&&((BOUND[0]<=(CONSTANTS[27]*4.00000))))) ? ((CONSTANTS[27]*3.00000)) : ((((BOUND[0]>(CONSTANTS[27]*4.00000)))&&((BOUND[0]<=(CONSTANTS[27]*5.00000))))) ? ((CONSTANTS[27]*4.00000)) : (0.00000); VARIABLES[63] = (BOUND[0]-(VARIABLES[64]+CONSTANTS[29])); VARIABLES[65] = (((VARIABLES[63]=CONSTANTS[29]))&&((VARIABLES[63]<=CONSTANTS[30])))) ? ((CONSTANTS[1]*CONSTANTS[28]*(1.00000/(1.00000+exp(((VARIABLES[63]-8000.00)/1000.00)))))) : ((((VARIABLES[63]>CONSTANTS[30]))&&((VARIABLES[63]