52 using namespace moose;
61 "Sends out current output of the clamping circuit. This should be"
62 " connected to the `injectMsg` field of a compartment to voltage clamp"
71 "Handles 'process' call on each time step.",
74 "Handles 'reinit' call",
76 static Finfo * processShared[] = {
82 "Shared message to receive Process messages from the scheduler",
83 processShared,
sizeof(processShared) /
sizeof(
Finfo*));
86 "Command input received by the clamp circuit.",
90 "Working mode of the PID controller.\n"
92 " mode = 0, standard PID with proportional, integral and derivative"
93 " all acting on the error.\n"
95 " mode = 1, derivative action based on command input\n"
97 " mode = 2, proportional action and derivative action are based on"
102 "Integration time of the PID controller. Defaults to 1e9, i.e. integral"
103 " action is negligibly small.",
108 "Derivative time of the PID controller. This defaults to 0,"
109 "i.e. derivative action is unused.",
113 "Time constant of the lowpass filter at input of the PID"
114 " controller. This smooths out abrupt changes in the input. Set it to "
115 " 5 * dt or more to avoid overshoots.",
119 "Proportional gain of the PID controller.",
123 "The amount of current injected by the clamp into the membrane.",
128 "Membrane potential read from compartment.",
131 "The `VmOut` message of the Compartment object should be connected"
136 " The command voltage source should be connected to this.",
139 static Finfo* vclampFinfos[] = {
154 static string doc[] = {
156 "Author",
"Subhasis Ray",
157 "Description",
"Voltage clamp object for holding neuronal compartments at a specific"
160 "This implementation uses a builtin RC circuit to filter the "
161 " command input and then use a PID to bring the sensed voltage (Vm from"
162 " compartment) to the filtered command potential.\n"
164 "Usage: Connect the `currentOut` source of VClamp to `injectMsg`"
165 " dest of Compartment. Connect the `VmOut` source of Compartment to"
166 " `set_sensed` dest of VClamp. Either set `command` field to a"
167 " fixed value, or connect an appropriate source of command potential"
168 " (like the `outputOut` message of an appropriately configured"
169 " PulseGen) to `set_command` dest.\n"
170 "The default settings for the RC filter and PID controller should be"
171 " fine. For step change in command voltage, good defaults with"
172 "integration time step dt are as follows:\n"
173 " time constant of RC filter, tau = 5 * dt\n"
174 " proportional gain of PID, gain = Cm/dt where Cm is the membrane"
175 " capacitance of the compartment\n"
176 " integration time of PID, ti = dt\n"
177 " derivative time of PID, td = 0\n"
186 sizeof(vclampFinfos) /
sizeof(
Finfo*),
189 sizeof(doc)/
sizeof(
string));
196 VClamp::VClamp(): vIn_(0.0), command_(0.0), current_(0.0), mode_(0), ti_(0.0), td_(-1.0),
328 if (p->
dt /
tau_ > 1e-15){
337 vector<Id> compartments;
void reinit(const Eref &e, ProcPtr p)
unsigned int getMode() const
void setTau(double value)
static SrcFinfo1< double > * currentOut()
static const Cinfo * vclampCinfo
Element * element() const
static const unsigned DERIVATIVE_ON_PV
void setMode(unsigned int mode)
void setCommand(double v)
void setGain(double value)
void process(const Eref &e, ProcPtr p)
double getCurrent() const
unsigned int getNeighbors(vector< Id > &ret, const Finfo *finfo) const
static A get(const ObjId &dest, const string &field)
static const Cinfo * initCinfo()
double getCommand() const
static const Cinfo * initCinfo()
static const unsigned PROPORTIONAL_ON_PV