MOOSE - Multiscale Object Oriented Simulation Environment
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
VClamp.h
Go to the documentation of this file.
1 /* VClamp.h ---
2  *
3  * Filename: VClamp.h
4  * Description:
5  * Author:
6  * Maintainer:
7  * Created: Fri Feb 1 19:22:19 2013 (+0530)
8  * Version:
9  * Last-Updated: Wed Feb 6 17:20:48 2013 (+0530)
10  * By: subha
11  * Update #: 55
12  * URL:
13  * Keywords:
14  * Compatibility:
15  *
16  */
17 
18 /* Commentary:
19  *
20  * Class for implementing voltage clamp
21  *
22  */
23 
24 /* Change log:
25  *
26  *
27  */
28 
29 /* This program is free software; you can redistribute it and/or
30  * modify it under the terms of the GNU General Public License as
31  * published by the Free Software Foundation; either version 3, or
32  * (at your option) any later version.
33  *
34  * This program is distributed in the hope that it will be useful,
35  * but WITHOUT ANY WARRANTY; without even the implied warranty of
36  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
37  * General Public License for more details.
38  *
39  * You should have received a copy of the GNU General Public License
40  * along with this program; see the file COPYING. If not, write to
41  * the Free Software Foundation, Inc., 51 Franklin Street, Fifth
42  * Floor, Boston, MA 02110-1301, USA.
43  */
44 
45 /* Code: */
46 
47 #ifndef _VCLAMP_H
48 #define _VCLAMP_H
49 namespace moose
50 {
51  class VClamp
52  {
53  static const unsigned DERIVATIVE_ON_PV;
54  static const unsigned PROPORTIONAL_ON_PV;
55  public:
56  VClamp();
57  ~VClamp();
58  void setCommand(double v);
59  double getCommand() const;
60  void setVin(double v);
61  double getVin() const;
62  double getCurrent() const;
63  void setMode(unsigned int mode);
64  unsigned int getMode() const;
65  void setTi(double value);
66  double getTi() const;
67  void setTd(double value);
68  double getTd() const;
69  void setTau(double value);
70  double getTau() const;
71  void setGain(double value);
72  double getGain() const;
73  void process(const Eref& e, ProcPtr p);
74  void reinit(const Eref& e, ProcPtr p);
75 
76  static const Cinfo* initCinfo();
77 
78  // finfo used to send out injection current to compartment
80 
81  protected:
82  double vIn_; // membrane potential read from the compartment
83  double command_; // command potential
84  double current_; // current generated by the clamp circuit
85  unsigned int mode_; // 0 - use normal PID
86  // 1 - base derivative on PV
87  // 2 - base proportional & derivative on PV
88  double ti_; // integral time
89  double td_; // derivative time
90  double Kp_; // proportional gain - set to Cm/dt
91  double tau_; // time constant for low pass filter on command voltage
92  double tdByDt_; // internal variable for performance
93  double dtByTi_; // internal variable for performance
94  double tauByDt_;// internal variable for performance
95  double e_; // error[n] (current step)
96  double e1_; // error[n-1]
97  double e2_; // error[n-2]
98  double v1_; // internal variable used only when error term is replaced by process variable
99  double cmdIn_; // older value of command potential
100  double oldCmdIn_;
101  double expt_;
102 
103  };
104 }
105 
106 #endif // _VCLAMP_H
107 /* VClamp.h ends here */
void reinit(const Eref &e, ProcPtr p)
Definition: VClamp.cpp:313
unsigned int getMode() const
Definition: VClamp.cpp:282
double getVin() const
Definition: VClamp.cpp:271
uint32_t value
Definition: moosemodule.h:42
void setTau(double value)
Definition: VClamp.cpp:241
static SrcFinfo1< double > * currentOut()
Definition: VClamp.cpp:58
void setVin(double v)
Definition: VClamp.cpp:266
double tau_
Definition: VClamp.h:91
double dtByTi_
Definition: VClamp.h:93
double ti_
Definition: VClamp.h:88
double vIn_
Definition: VClamp.h:82
double tauByDt_
Definition: VClamp.h:94
double e2_
Definition: VClamp.h:97
double getTd() const
Definition: VClamp.cpp:236
void setTd(double value)
Definition: VClamp.cpp:231
static const unsigned DERIVATIVE_ON_PV
Definition: VClamp.h:53
double command_
Definition: VClamp.h:83
double getTau() const
Definition: VClamp.cpp:246
unsigned int mode_
Definition: VClamp.h:85
double oldCmdIn_
Definition: VClamp.h:100
void setMode(unsigned int mode)
Definition: VClamp.cpp:277
double v1_
Definition: VClamp.h:98
double tdByDt_
Definition: VClamp.h:92
void setCommand(double v)
Definition: VClamp.cpp:212
Definition: Eref.h:26
void setGain(double value)
Definition: VClamp.cpp:251
double e_
Definition: VClamp.h:95
double td_
Definition: VClamp.h:89
double Kp_
Definition: VClamp.h:90
double getTi() const
Definition: VClamp.cpp:227
double expt_
Definition: VClamp.h:101
double cmdIn_
Definition: VClamp.h:99
void process(const Eref &e, ProcPtr p)
Definition: VClamp.cpp:287
double getCurrent() const
Definition: VClamp.cpp:261
double e1_
Definition: VClamp.h:96
double current_
Definition: VClamp.h:84
void setTi(double value)
Definition: VClamp.cpp:222
double getCommand() const
Definition: VClamp.cpp:217
static const Cinfo * initCinfo()
Definition: VClamp.cpp:68
static const unsigned PROPORTIONAL_ON_PV
Definition: VClamp.h:54
Definition: Cinfo.h:18
double getGain() const
Definition: VClamp.cpp:256