@@ -325,6 +325,84 @@ def make_LCa( name = 'LCa', parent = '/library' ):
325325 ygate .tableA = yA
326326 ygate .tableB = yB
327327 return Ca
328+ ######################################################################
329+
330+ # Derived from : squid/electronics.py
331+ # Description:
332+ # Author: Subhasis Ray
333+ # Maintainer:
334+ # Created: Wed Feb 22 00:53:38 2012 (+0530)
335+ # Version:
336+ # Last-Updated: Fri May 04 16:35:40 2018 (+0530)
337+ # By: Upi
338+ # Update #: 221
339+
340+ # Change log:
341+ #
342+ # 2012-02-22 23:22:30 (+0530) Subha - the circuitry put in a class.
343+ # 2018-05-04 23:22:30 (+0530) Upi - Adapted for Rdesigneur
344+ #
345+
346+ # Code:
347+
348+ class ClampCircuit (moose .Neutral ):
349+ """Container for a Voltage-Clamp/Current clamp circuit."""
350+ defaults = {
351+ 'level1' : 25.0e-3 ,
352+ 'width1' : 50.0e-3 ,
353+ 'delay1' : 2.0e-3 ,
354+ 'delay2' : 1e3 ,
355+ 'trigMode' : 0 ,
356+ 'delay3' : 1e6
357+ }
358+ def __init__ (self , path ):
359+ moose .Neutral .__init__ (self , path )
360+ '''
361+ self.pulsegen = moose.PulseGen(path+"/pulse") # holding voltage/current generator
362+ self.pulsegen.count = 2
363+ self.pulsegen.baseLevel = -65.0e-3
364+ self.pulsegen.firstLevel = -40.0e-3
365+ self.pulsegen.firstWidth = 50.0e-3
366+ self.pulsegen.firstDelay = 2.0e-3
367+ self.pulsegen.secondDelay = 0.0
368+ self.pulsegen.trigMode = 2
369+ self.gate = moose.PulseGen(path+"/gate") # holding voltage/current generator
370+ self.gate.level[0] = 1.0
371+ self.gate.delay[0] = 0.0
372+ self.gate.width[0] = 1e3
373+ moose.connect(self.gate, 'output', self.pulsegen, 'input')
374+ '''
375+ self .lowpass = moose .RC (path + "/lowpass" ) # lowpass filter
376+ self .lowpass .R = 1.0
377+ self .lowpass .C = 0.03
378+ self .vclamp = moose .DiffAmp (path + "/vclamp" )
379+ self .vclamp .gain = 1.0
380+ self .vclamp .saturation = 1e10
381+ self .iclamp = moose .DiffAmp (path + "/iclamp" )
382+ self .iclamp .gain = 0.0
383+ self .iclamp .saturation = 1e10
384+ self .pid = moose .PIDController (path + "/pid" )
385+ self .pid .gain = 0.5
386+ self .pid .tauI = 0.02e-3
387+ self .pid .tauD = 0.005e-3
388+ self .pid .saturation = 1e7
389+ # Connect voltage clamp circuitry
390+ #moose.connect(self.pulsegen, "output", self.lowpass, "injectIn")
391+ moose .connect (self .lowpass , "output" , self .vclamp , "plusIn" )
392+ moose .connect (self .vclamp , "output" , self .pid , "commandIn" )
393+ #moose.connect(compartment, "VmOut", self.pid, "sensedIn")
394+ #moose.connect(self.pid, "output", compartment, "injectMsg")
395+ addmsg1 = moose .Mstring ( path + '/addmsg1' )
396+ addmsg1 .value = './pid output .. injectMsg'
397+ addmsg2 = moose .Mstring ( path + '/addmsg2' )
398+ addmsg2 .value = '.. VmOut ./pid sensedIn'
399+
400+ def make_vclamp ( name = 'Vclamp' , parent = '/library' ):
401+ if moose .exists ( '/library/' + name ):
402+ return
403+ vclamp = ClampCircuit ( parent + '/' + name )
404+
405+ ######################################################################
328406
329407 ################################################################
330408 # API function for building spine prototypes. Here we put in the
0 commit comments