# keithley 2601B sourcemeter
namespace eval k2601b {} {
}

proc stdConfig::k2601b {} {
  controller std "\n" 5
  prop startcmd "reset() smua.source.func = smua.OUTPUT_DCAMPS smua.source.autorangei = 1 smua.source.output = 0 print(localnode.description)"

  pollperiod 1.0 1.0

  obj k2601b -none
   

  kids k2601b {
    node Enable wr -int
    default 0
    prop label Output
    prop writecmd "smua.source.output = %d print(smua.source.output)"
    prop readcmd "print(smua.source.output)"
    prop readfmt "%d"
    prop enum off,on
    
    node Llim wr
    default 2.0
    prop label Voltage_Limit
    prop writecmd "smua.source.limitv = %g  print(smua.source.limitv)"
    prop readcmd "print(smua.source.limitv)"
     prop readfmt "%g"

#    node Vtrip rd
#    prop label VoltageTrip
#    prop readcmd ":SENS:VOLT:PROT:TRIP?"
#    prop readfmt "%g"
        
    node iset wr
    default  0.00
    prop label SetCurrent
    prop writecmd "smua.source.leveli = %g print(smua.source.leveli)"
    prop readcmd "print(smua.source.leveli)"
    prop readfmt "%g"

    node  Imeas rd
    prop label Current
    prop readcmd "print(smua.measure.i())"
    prop readfmt "%g"
    
    node  Vmeas rd
    prop label Voltage
    prop readcmd "print(smua.measure.v())"
    prop readfmt "%g"

    node  Rmeas rd
    prop label Resistance
    prop readcmd "print(smua.measure.r())"
    prop readfmt "%g"

    node  Pmeas rd
    prop label Power
    prop readcmd "print(smua.measure.p())"
    prop readfmt "%g"
  }
}
