diff --git a/ik1ap.cpp b/ik1ap.cpp index 197510b7f49f64901055b5f10d9408d9c094e5fa..55ff071d847779e27790870f1b778ff52921c3a2 100644 --- a/ik1ap.cpp +++ b/ik1ap.cpp @@ -58,7 +58,7 @@ class IK1AP01 int Stimdens_max_pApF; int Stimdens_min_pApF; bool ik1flag; - int ik1dens; + double ik1dens; int membrane_cap; @@ -96,7 +96,7 @@ class IK1AP01 Stimdens_max_pApF = 40; Stimdens_min_pApF = 20; - ik1dens = 5; + ik1dens = 1.0; ik1flag = false; membrane_cap = 50; @@ -262,7 +262,7 @@ class IK1AP01 case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': { - int new_ik1dens = (int)(ch - '0'); + double new_ik1dens = ((double)(ch - '0'))*0.2 + 0.2; if( ik1dens != new_ik1dens ) { ik1dens = new_ik1dens ; @@ -412,7 +412,7 @@ class IK1AP01 mvprintw(y,0,"Stimperiod : %10d ms",Stimperiod_ms); ++y; mvprintw(y,0,"Stimedur : %10.3f ms",(float)(Stimedur_microsec/1000.0)); ++y; mvprintw(y,0,"Stimdens : %10d pA/pF",Stimdens_pApF); ++y; - mvprintw(y,0,"ik1dens : %10d pA/pF",ik1dens); ++y; + mvprintw(y,0,"ik1dens : %10.3f pA/pF",ik1dens); ++y; mvprintw(y,0,"membrane_cap : %10d pF",membrane_cap); ++y; mvprintw(y,0,"cell-name : %10s",cell_name.c_str()); ++y; if(calc_resistance_state!=0) @@ -510,7 +510,7 @@ class IK1AP01 if( membranePotentialValues.size()< ARRAY_SIZE && value_between( (clock_now % MILLISECONDS_TO_SECONDS(Stimperiod_ms)) , - MILLISECONDS_TO_SECONDS(((double)Stimperiod_ms - 19.5)), + MILLISECONDS_TO_SECONDS(((double)Stimperiod_ms - 19.1)), MILLISECONDS_TO_SECONDS((Stimperiod_ms - 19)) )) { @@ -527,8 +527,8 @@ class IK1AP01 controlMembranePotentialValues.size() < ARRAY_SIZE && this->value_between( (clock_now % MILLISECONDS_TO_SECONDS(Stimperiod_ms)) , - MILLISECONDS_TO_SECONDS(((double)Stimperiod_ms - 18.5)), - MILLISECONDS_TO_SECONDS((Stimperiod_ms - 18)) + MILLISECONDS_TO_SECONDS(((double)Stimperiod_ms - 21.5)), + MILLISECONDS_TO_SECONDS((Stimperiod_ms - 21)) ) ) { @@ -546,7 +546,7 @@ class IK1AP01 double avg1 = average(membranePotentialValues); double avg2 = average(controlMembranePotentialValues); - resistance = -1 * (avg1-avg2)/(25.0 * membrane_cap) * 1E6 ; + resistance = -1 * (avg1-avg2)/(25.0 * membrane_cap) * 1E3 ; membranePotentialValues.clear(); controlMembranePotentialValues.clear(); //fprintf(stderr,"CLEAR!!"); @@ -556,7 +556,7 @@ class IK1AP01 if( ik1flag ) { - injected_current += ik1dens * membrane_cap * 2.0/(-72.0+95.32)*(membrane_potential+95.32)/(1. + exp(0.093633*(membrane_potential+72))); + injected_current += -ik1dens * membrane_cap * 2.0/(-72.0+95.32)*(membrane_potential+95.32)/(1. + exp(0.093633*(membrane_potential+72))); } injected_current/=2000.0;