Ejemplo n.º 1
0
        public HAMPatch(HAMPatchParameters p)
        {
            Ngating = 10;
            a       = new double[Ngating];
            b       = new double[Ngating];
            y0      = new double[Ngating + 3];

            eNa = (R * p.Tk / F) * Math.Log(p.NAo / p.NAi);
            eK  = (R * p.Tk / F) * Math.Log(p.Ko / p.Ki);

            Cm  = p.Cm;
            Cn  = p.Cn;
            Ci  = p.Ci;
            Ril = 1 / p.Gil;
            gSL = (1 / Ril) * p.nGsl;

            Ko      = p.Ko;
            Ki      = p.Ki;
            NAi     = p.NAi;
            NAo     = p.NAo;
            Tk      = p.Tk;
            ClampKo = p.ClampKo;
            L       = p.L;

            // Ionic Currents
            p.CopyRateConstants(p.q10m, p.Am, Am);
            p.CopyRateConstants(p.q10h, p.Ah, Ah);
            p.CopyRateConstants(p.q10p, p.Ap, Ap);
            p.CopyRateConstants(p.q10n, p.An, An);
            p.CopyRateConstants(p.q10s, p.As, As);
            p.CopyRateConstants(p.q10i, p.Ai, Ai);
            p.CopyRateConstants(p.q10q, p.Aq, Aq);
            p.CopyRateConstants(p.q10u, p.Au, Au);

            p.CopyRateConstants(p.q10m, p.Bm, Bm);
            p.CopyRateConstants(p.q10h, p.Bh, Bh);
            p.CopyRateConstants(p.q10p, p.Bp, Bp);
            p.CopyRateConstants(p.q10n, p.Bn, Bn);
            p.CopyRateConstants(p.q10s, p.Bs, Bs);
            p.CopyRateConstants(p.q10i, p.Bi, Bi);
            p.CopyRateConstants(p.q10q, p.Bq, Bq);
            p.CopyRateConstants(p.q10u, p.Bu, Bu);

            // Conductances
            Vi  = CircleArea(p.di) * p.L;
            Vpa = (CircleArea(p.di + p.Wpa) - CircleArea(p.di)) * p.L;
            Apa = p.di * Math.PI * p.L;

            gNat_n = (1 - p.pNap_n) * p.gNa_n * p.Area_n;
            gNap_n = p.pNap_n * p.gNa_n * p.Area_n;
            gKf_n  = p.gKf_n * p.Area_n;
            gKs_n  = p.gKs_n * p.Area_n;
            gKi_n  = p.gKi_n * p.Area_n;
            gLk_n  = p.gLk_n * p.Area_n;

            gKs_i   = p.gKs_i * p.Area_i;
            gKi_i   = p.gKi_i * p.Area_i;
            gH_Na_i = p.gH_i * p.Area_i * p.gH_SNa;
            gH_K_i  = p.gH_i * p.Area_i * (1 - p.gH_SNa);
            gLk_i   = p.gLk_i * p.Area_i;

            // Calculate inter-nodal resting potential
            En    = y0[0] = p.Vr;
            Ei    = y0[1] = p.Vi;
            y0[2] = Ko;

            SetupGatingVariables();
            double Rbb = getRbb(y0);

            iPump_n = -(Iion_n(y0) - (Ei - En) / Rbb);

            //Ei = y0[1] = Ril * Iion_n(y0) + p.Vr;

            // Calculate inter-nodal leak conductance
            SetupGatingVariables();
            iPump_i = -Iion_i(y0) - (y0[1] - y0[0]) / Rbb;

            // Calculate the value of the sodium potassium pump that will keep the
            // potassium concentration of the peri-axonal space stable at rest
            Km_K  = p.Km_K;
            Km_Na = p.Km_Na;
            L_K   = p.L_K;
            L_Na  = p.L_Na;
            Jmax  = 1;

            // We now calculate the Jmax that will keep the peri-axonal potassium
            // concentration stable at rest.
            double Jk_pa = jK_i(y0);

            Jmax = -Jk_pa / jPump(y0);
        }
Ejemplo n.º 2
0
    public HAMPatch(HAMPatchParameters p)
    {
      Ngating = 10;
      a = new double[Ngating];
      b = new double[Ngating];
      y0 = new double[Ngating + 3];

      eNa = (R*p.Tk / F) * Math.Log(p.NAo / p.NAi);
      eK = (R*p.Tk / F) * Math.Log(p.Ko / p.Ki);

      Cm = p.Cm;
      Cn = p.Cn;
      Ci = p.Ci;
      Ril = 1/p.Gil;
      gSL = (1 / Ril) * p.nGsl;

      Ko = p.Ko;
      Ki = p.Ki;
      NAi = p.NAi;
      NAo = p.NAo;
      Tk = p.Tk;
      ClampKo = p.ClampKo;
      L = p.L;

      // Ionic Currents
      p.CopyRateConstants(p.q10m, p.Am, Am);
      p.CopyRateConstants(p.q10h, p.Ah, Ah);
      p.CopyRateConstants(p.q10p, p.Ap, Ap);
      p.CopyRateConstants(p.q10n, p.An, An);
      p.CopyRateConstants(p.q10s, p.As, As);
      p.CopyRateConstants(p.q10i, p.Ai, Ai);
      p.CopyRateConstants(p.q10q, p.Aq, Aq);
      p.CopyRateConstants(p.q10u, p.Au, Au);

      p.CopyRateConstants(p.q10m, p.Bm, Bm);
      p.CopyRateConstants(p.q10h, p.Bh, Bh);
      p.CopyRateConstants(p.q10p, p.Bp, Bp);
      p.CopyRateConstants(p.q10n, p.Bn, Bn);
      p.CopyRateConstants(p.q10s, p.Bs, Bs);
      p.CopyRateConstants(p.q10i, p.Bi, Bi);
      p.CopyRateConstants(p.q10q, p.Bq, Bq);
      p.CopyRateConstants(p.q10u, p.Bu, Bu);

      // Conductances
      Vi = CircleArea(p.di) * p.L;
      Vpa = (CircleArea(p.di+p.Wpa)-CircleArea(p.di))* p.L;
      Apa = p.di * Math.PI * p.L;

      gNat_n = (1-p.pNap_n) * p.gNa_n * p.Area_n;
      gNap_n = p.pNap_n * p.gNa_n * p.Area_n;
      gKf_n  = p.gKf_n * p.Area_n;
      gKs_n  = p.gKs_n * p.Area_n;
      gKi_n = p.gKi_n * p.Area_n;
      gLk_n = p.gLk_n * p.Area_n;

      gKs_i = p.gKs_i * p.Area_i;
      gKi_i = p.gKi_i * p.Area_i;
      gH_Na_i = p.gH_i * p.Area_i * p.gH_SNa;
      gH_K_i = p.gH_i * p.Area_i * (1-p.gH_SNa);
      gLk_i = p.gLk_i * p.Area_i;

      // Calculate inter-nodal resting potential
      En = y0[0] = p.Vr;
      Ei = y0[1] = p.Vi;
      y0[2] = Ko;

      SetupGatingVariables();
      double Rbb = getRbb(y0);
      iPump_n = -(Iion_n(y0) - (Ei - En) / Rbb);
     
      //Ei = y0[1] = Ril * Iion_n(y0) + p.Vr; 

      // Calculate inter-nodal leak conductance
      SetupGatingVariables();
      iPump_i = -Iion_i(y0) - (y0[1]-y0[0])/Rbb;

      // Calculate the value of the sodium potassium pump that will keep the
      // potassium concentration of the peri-axonal space stable at rest
      Km_K = p.Km_K;
      Km_Na = p.Km_Na;
      L_K = p.L_K;
      L_Na = p.L_Na;
      Jmax = 1;

      // We now calculate the Jmax that will keep the peri-axonal potassium
      // concentration stable at rest.
      double Jk_pa = jK_i(y0);
      Jmax = -Jk_pa / jPump(y0);
    }