-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwang_1993_inap.cpp
139 lines (116 loc) · 3.68 KB
/
wang_1993_inap.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
/*
* Copyright (C) 2011 Georgia Institute of Technology, University of Utah,
* Weill Cornell Medical College
*
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
* Software Foundation, either version 3 of the License, or (at your option)
* any later version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License along with
* this program. If not, see <http://www.gnu.org/licenses/>.
*/
/*
* This is a template implementation file for a user module derived from
* DefaultGUIModel with a custom GUI.
*/
#include "wang_1993_inap.h"
#include <iostream>
#include <main_window.h>
extern "C" Plugin::Object*
createRTXIPlugin(void)
{
return new Wang_1993Inap();
}
static DefaultGUIModel::variable_t vars[] = {
{"v (V)", "Membrane potential", DefaultGUIModel::INPUT, },
{"I (nA)", "Ionic current", DefaultGUIModel::OUTPUT, },
{"g (uS)", "Conductance", DefaultGUIModel::PARAMETER | DefaultGUIModel::DOUBLE,},
{"E (mV)", "Reversion potential", DefaultGUIModel::PARAMETER | DefaultGUIModel::DOUBLE,},
};
static size_t num_vars = sizeof(vars) / sizeof(DefaultGUIModel::variable_t);
Wang_1993Inap::Wang_1993Inap(void)
: DefaultGUIModel("Persistent sodium current from (Wang, 1993) neuron model", ::vars, ::num_vars)
{
setWhatsThis("<p><b>Persistent sodium current from (Wang, 1993) neuron model.</p>");
DefaultGUIModel::createGUI(vars,
num_vars); // this is required to create the GUI
//customizeGUI();
initParameters();
update(INIT); // this is optional, you may place initialization code directly
// into the constructor
refresh(); // this is required to update the GUI with parameter and state
// values
QTimer::singleShot(0, this, SLOT(resizeMe()));
}
Wang_1993Inap::~Wang_1993Inap(void)
{
}
void
Wang_1993Inap::execute(void)
{
double v = input(0) * 1000;
double mnap = 1.0 / (1.0 + exp(- (v + 51.0) / 5.0));
output(0) = g * mnap * (v - e);
return;
}
void
Wang_1993Inap::initParameters(void)
{
g = 0.1;
e = 55;
}
void
Wang_1993Inap::update(DefaultGUIModel::update_flags_t flag)
{
switch (flag) {
case INIT:
period = RT::System::getInstance()->getPeriod() * 1e-6; // ms
setParameter("g (uS)", g);
setParameter("E (mV)", e);
break;
case MODIFY:
g = getParameter("g (uS)").toDouble();
e = getParameter("E (mV)").toDouble();
break;
case UNPAUSE:
break;
case PAUSE:
break;
case PERIOD:
period = RT::System::getInstance()->getPeriod() * 1e-6; // ms
break;
default:
break;
}
}
void
Wang_1993Inap::customizeGUI(void)
{
QGridLayout* customlayout = DefaultGUIModel::getLayout();
QGroupBox* button_group = new QGroupBox;
QPushButton* abutton = new QPushButton("Button A");
QPushButton* bbutton = new QPushButton("Button B");
QHBoxLayout* button_layout = new QHBoxLayout;
button_group->setLayout(button_layout);
button_layout->addWidget(abutton);
button_layout->addWidget(bbutton);
QObject::connect(abutton, SIGNAL(clicked()), this, SLOT(aBttn_event()));
QObject::connect(bbutton, SIGNAL(clicked()), this, SLOT(bBttn_event()));
customlayout->addWidget(button_group, 0, 0);
setLayout(customlayout);
}
// functions designated as Qt slots are implemented as regular C++ functions
void
Wang_1993Inap::aBttn_event(void)
{
}
void
Wang_1993Inap::bBttn_event(void)
{
}