Exemplo n.º 1
0
void Conductance::update(DefaultGUIModel::update_flags_t flag) {
    switch(flag) {
        case MODIFY:
            Cm = getParameter("Cm").toDouble();
            G_Na_max = getParameter("G_Na_max").toDouble();
            E_Na = getParameter("E_Na").toDouble();
            G_K_max = getParameter("G_K_max").toDouble();
            E_K = getParameter("E_K").toDouble();
            G_L = getParameter("G_L").toDouble();
            E_L = getParameter("E_L").toDouble();
            R_L_MC = getParameter("R_L_MC").toDouble();
            Iapp_offset = getParameter("Iapp_offset").toDouble();
            rate = getParameter("rate").toDouble();
            steps = static_cast<int>(ceil(period*rate));

            m = m_inf(Vm);
            h = h_inf(Vm);
            n = n_inf(Vm);
        break;
        case PERIOD:
            period = RT::System::getInstance()->getPeriod()*1e-9; // ms
            steps = static_cast<int>(ceil(period*rate));
        break;
        case PAUSE:
            output(0) = 0.0; 
        break;
        case UNPAUSE:
        break;
        default:
        break;
    }
}
Exemplo n.º 2
0
void
Neuron::update(DefaultGUIModel::update_flags_t flag)
{
  if (flag == MODIFY)
    {
      V0 = getParameter("V0").toDouble();
      Cm = getParameter("Cm").toDouble();
      G_Na_max = getParameter("G_Na_max").toDouble();
      E_Na = getParameter("E_Na").toDouble();
      G_K_max = getParameter("G_K_max").toDouble();
      E_K = getParameter("E_K").toDouble();
      G_L = getParameter("G_L").toDouble();
      E_L = getParameter("E_L").toDouble();
      Iapp_offset = getParameter("Iapp_offset").toDouble();
      rate = getParameter("rate").toDouble();
      steps = static_cast<int> (ceil(period * rate / 1000.0));

      V = V0;
      m = m_inf(V0);
      h = h_inf(V0);
      n = n_inf(V0);
    }
  else if (flag == PERIOD)
    {
      period = RT::System::getInstance()->getPeriod() * 1e-6; // ms
      steps = static_cast<int> (ceil(period * rate / 1000.0));
    }
}
Exemplo n.º 3
0
void
Neuron::derivs(double *y, double *dydt)
{
  dV = (Iapp - G_Na * (V - E_Na) - G_K * (V - E_K) - G_L * (V - E_L)) / Cm;
  dm = (m_inf(V) - m) / tau_m(V);
  dh = (h_inf(V) - h) / tau_h(V);
  dn = (n_inf(V) - n) / tau_n(V);
}
Exemplo n.º 4
0
void ConnorStevens::derivs(double *y, double *dydt) {
	dV = (Iapp - input(0) * 1e6 - G_Na * (V - E_Na) - G_K * (V - E_K) - G_L * (V - E_L) - G_A * (V - E_A)) * 1000 / Cm;
	dm = (m_inf(V) - m) / tau_m(V);
	dh = (h_inf(V) - h) / tau_h(V);
	dn = (n_inf(V) - n) / tau_n(V);
	da = (a_inf(V) - a) / tau_a(V);
	db = (b_inf(V) - b) / tau_b(V);
	IKA = G_A * (V - E_A) * 1e-6 ; // A
}
Exemplo n.º 5
0
void ConnorStevens::update(DefaultGUIModel::update_flags_t flag) {
	switch (flag) {
		case INIT:
			setParameter("V0 (mV)", QString::number(V0)); // initialized in mV, display in mV
			setParameter("Cm (uF/cm^2)", QString::number(Cm * 100)); // initialized in uF/mm^2, display in uF/cm^2
			setParameter("G_Na_max (mS/cm^2)", QString::number(G_Na_max * 100)); // initialized in mS/mm^2, display in mS/cm^2
			setParameter("E_Na (mV)", QString::number(E_Na)); // initialized in mV, display in mV
			setParameter("G_K_max (mS/cm^2)", QString::number(G_K_max * 100)); // initialized in mS/mm^2, display in mS/cm^2
			setParameter("E_K (mV)", QString::number(E_K)); // initialized in mV, display in mV
			setParameter("G_A_max (mS/cm^2)", QString::number(G_A_max * 100)); // initialized in mS/mm^2, display in mS/cm^2
			setParameter("E_A (mV)", QString::number(E_A)); // initialized in mV, display in mV
			setParameter("G_L (mS/cm^2)", QString::number(G_L * 100)); // initialized in mS/mm^2, display in mS/cm^2
			setParameter("E_L (mV)", QString::number(E_L)); // initialized in mV, display in mV
			setParameter("Iapp (uA/cm^2)", QString::number(Iapp * 100)); // initialized in uA/mm^2, display in uA/cm^2
			setParameter("Rate (Hz)", rate);
			setState("m", m);
			setState("h", h);
			setState("n", n);
			setState("a", a);
			setState("b", b);
			setState("IKA",IKA);
			setState("Time (s)", systime);
			break;

		case MODIFY:
			V0 = getParameter("V0 (mV)").toDouble();
			Cm = getParameter("Cm (uF/cm^2)").toDouble() / 100;
			G_Na_max = getParameter("G_Na_max (mS/cm^2)").toDouble() / 100;
			E_Na = getParameter("E_Na (mV)").toDouble();
			G_K_max = getParameter("G_K_max (mS/cm^2)").toDouble() / 100;
			E_K = getParameter("E_K (mV)").toDouble();
			G_A_max = getParameter("G_A_max (mS/cm^2)").toDouble() / 100;
			E_A = getParameter("E_A (mV)").toDouble();
			G_L = getParameter("G_L (mS/cm^2)").toDouble() / 100;
			E_L = getParameter("E_L (mV)").toDouble();
			Iapp = getParameter("Iapp (uA/cm^2)").toDouble() / 100; // displayed in uA/cm^2, calculated in uA/mm^2
			rate = getParameter("Rate (Hz)").toDouble();
			steps = static_cast<int> (ceil(period * rate));
			V = V0;
			m = m_inf(V0);
			h = h_inf(V0);
			n = n_inf(V0);
			a = a_inf(V0);
			b = b_inf(V0);
			break;

		case PERIOD:
			period = RT::System::getInstance()->getPeriod() * 1e-9; // time in seconds
			steps = static_cast<int> (ceil(period * rate));
			break;

		default:
			break;
	}
}
Exemplo n.º 6
0
void derivs_one(const double* y, double* dydt, const double* p)
{
	double V=y[0], h=y[1], n=y[2], x=y[3], Ca=y[4];
	double V_tilde = C_1*V+C_2, V_Ca=p[0];

	dydt[0] = -g_Na*powf(m_inf(V_tilde), 3)*h*(V-V_Na) - g_Ca*x*(V-V_Ca) - (g_K*powf(n, 4)+g_K_Ca*Ca/(0.5+Ca))*(V-V_K) - g_L*(V-V_L);	// dV/dt
        dydt[1] = lambda*(h_inf(V_tilde)-h)/tau_h(V_tilde);	// dh/dt
        dydt[2] = lambda*(n_inf(V_tilde)-n)/tau_n(V_tilde);	// dn/dt
        dydt[3] = (x_inf(V)-x)/tau_x;				// dx/dt
        dydt[4] = rho * (K_c * x * (V_Ca - V) - Ca);		// d[Ca2+]/dt
}
Exemplo n.º 7
0
Neuron::Neuron(void) : DefaultGUIModel("Neuron", ::vars, ::num_vars) {
	setWhatsThis("<p><b>Hodgkin-Huxley Neuron:</b><br>This module simulates a Hodgkin-Huxley neuron "
	             "in real-time. It can be used in place of a biological cell to test algorithms.</p>");
	createGUI(vars, num_vars);

	/*
	* Initialize Parameters
	*/
	V0 = -65.0;
	Cm = 1.0;
	G_Na_max = 120.0;
	E_Na = 50.0;
	G_K_max = 36.0;
	E_K = -77.0;
	G_L = 0.3;
	E_L = -54.4;
	Iapp_offset = 0.0;
	rate = 40000;

	/*
	* Initialize Variables
	*/
	V = V0;
	m = m_inf(V0);
	h = h_inf(V0);
	n = n_inf(V0);
	period = RT::System::getInstance()->getPeriod() * 1e-6;
	steps = static_cast<int> (ceil(period / rate / 1000.0));

	/*
	* Initialize States
	*/
	setState("m", m);
	setState("h", h);
	setState("n", n);

	/*
	* Initialize GUI
	*/
	setParameter("V0", V0);
	setParameter("Cm", Cm);
	setParameter("G_Na_max", G_Na_max);
	setParameter("E_Na", E_Na);
	setParameter("G_K_max", G_K_max);
	setParameter("E_K", E_K);
	setParameter("G_L", G_L);
	setParameter("E_L", E_L);
	setParameter("Iapp_offset", Iapp_offset);
	setParameter("rate", rate);
	refresh();

//	QTimer::singleShot(0, this, SLOT(resizeMe()));
	resizeMe();
}
Exemplo n.º 8
0
Conductance::Conductance(void)
    : DefaultGUIModel("HH neuron ICs",::vars,::num_vars) {
    createGUI(vars, num_vars);
    /*
     * Initialize Parameters
     */
    Cm = 22.0;
    G_Na_max = 1.0;
    E_Na = 50.0;
    G_K_max = 0.4;
    E_K = -79.0;
    G_L = 0.005;
    E_L = -54.4;
    R_L_MC = 0.5181;
    Iapp_offset = 0.0;
    rate = 40000;

    /*
     * Initialize Variables
     */
    m = m_inf(Vm);
    h = h_inf(Vm);
    n = n_inf(Vm);
    period = RT::System::getInstance()->getPeriod()*1e-9;
    steps = static_cast<int>(ceil(period*rate));

    /*
     * Initialize States
     */
    setState("m",m);
    setState("h",h);
    setState("n",n);

    /*
     * Initialize GUI
     */
    setParameter("Cm",Cm);
    setParameter("G_Na_max",G_Na_max);
    setParameter("E_Na",E_Na);
    setParameter("G_K_max",G_K_max);
    setParameter("E_K",E_K);
    setParameter("G_L",G_L);
    setParameter("E_L",E_L);
    setParameter("R_L_MC",R_L_MC);
    setParameter("Iapp_offset",Iapp_offset);
    setParameter("rate",rate);
    refresh();
}
Exemplo n.º 9
0
void ConnorStevens::initParameters() {
	V0 = -65; // mV
	Cm = 1e-2; // uF/mm^2
	G_Na_max = 1.2; // mS/mm^2
	G_K_max = 0.2;
	G_L = 0.003;
	G_A_max = 0.477;
	E_Na = 55.0; // mV
	E_K = -72.0;
	E_L = -70.0;
	E_A = -75.0;
	Iapp = .2404; // 1 Hz spiking
	rate = 40000;
	V = V0;
	m = m_inf(V0);
	h = h_inf(V0);
	n = n_inf(V0);
	a = a_inf(V0);
	b = b_inf(V0);
	count = 0;
	systime = 0;
	period = RT::System::getInstance()->getPeriod() * 1e-9; // s
	steps = static_cast<int> (ceil(period * rate)); // calculate how many integrations to perform per execution step
}
Exemplo n.º 10
0
void Conductance::derivs(double *y,double *dydt) {
    dm = (m_inf(Vm)-m)/tau_m(Vm);
    dh = (h_inf(Vm)-h)/tau_h(Vm);
    dn = (n_inf(Vm)-n)/tau_n(Vm);
}