Esempio n. 1
0
 def __init__(self, device, parent=None):
     super(VirtualDaq, self).__init__(parent)
     self.digitalIO = drv.Subsystem()
     self.digitalIO.setProtocol(drv.ObjectWrapperProtocol(VirtualDaq.Dio()))
     self.digitalIO.state = Cmd("state")
     self.voltage = drv.Subsystem()
     self.voltage.setProtocol(drv.ObjectWrapperProtocol(VirtualDaq.Aio()))
     self.voltage.ai = Cmd("ai")
     self.voltage.ao = Cmd("ao")
Esempio n. 2
0
 def __init__(self):
     super(VirtualAmtronInstrument, self).__init__()
     self.laser = drv.Subsystem(self)
     self.laser.command = drv.Subsystem(self.laser)
     self.laser.command.setProtocol(
         drv.ObjectWrapperProtocol(_VirtualCommand()))
     self.laser.command.laser_state = Cmd("laser_state")
     self.laser.command.gate_state = Cmd("gate_state")
     self.laser.interface = drv.Subsystem(self.laser)
     self.laser.interface.setProtocol(
         drv.ObjectWrapperProtocol(_VirtualInterface()))
     self.laser.interface.pilot_laser_state = Cmd("pilot_laser_state")
Esempio n. 3
0
 def __init__(self, socket=None):
     super(VirtualInstrument, self).__init__()
     self.pid = PidSubsystem(self)
     # Input subsystem
     self.input = drv.Subsystem(self)
     self.input.setProtocol(drv.ObjectWrapperProtocol(Input()))
     self.input.sysout = Cmd("sysout")
     self.input.measure = Cmd("measure", access=Access.RO)
     # Output subsystem
     self.output = drv.Subsystem(self)
     self.output.setProtocol(drv.ObjectWrapperProtocol(Output()))
     self.output.input = Cmd("input")
     self.output.output = Cmd("output", access=Access.RO)
     self.output.noise = Cmd("noise")
     # Connections
     self.input.measure.signal.connect(self.pid.measure.write)
     self.input.measure.signal.connect(
         lambda value, node: self.pid.output.read(node))
     self.pid.output.signal.connect(self.output.input.write)
     self.output.output.signal.connect(self.input.sysout.write)
Esempio n. 4
0
 def __init__(self,
              parent,
              proportional=2.0,
              integral_time=0.0,
              derivative_time=0.0,
              vmin=0.0,
              vmax=100.0,
              spmin=0.0,
              spmax=100.0):
     super(PidSubsystem, self).__init__(parent)
     self.setProtocol(
         drv.ObjectWrapperProtocol(
             Pid(proportional, integral_time, derivative_time, vmin, vmax)))
     self.measure = Cmd("measure", access=Access.WO)
     self.output = Cmd("output", access=Access.RO)
     self.setpoint = Cmd("setpoint", minimum=spmin, maximum=spmax)
     self.proportional = Cmd("proportional")
     self.integral_time = Cmd("integral_time")
     self.derivative_time = Cmd("derivative_time")
     self.vmin = Cmd("vmin")
     self.vmax = Cmd("vmax")
     self.anti_windup = Cmd("anti_windup")
Esempio n. 5
0
def createController():
    """Initialize controller."""
    config = ctrlr.Config("watlow")
    if not config.nodes:
        config.nodes = [None]
    if config.virtual:
        driver = virtual.VirtualInstrument()
        driver.setup = drv.Subsystem(driver)
        driver.setup.setProtocol(drv.ObjectWrapperProtocol(_VirtualRamping()))
        driver.setup.global_ = drv.Subsystem(driver.setup)
        driver.setup.global_.ramp_init = Cmd("ramp_init")
        driver.setup.global_.ramp_rate = Cmd("ramp_rate")
        iface = WatlowController.virtualInstrumentController(config, driver)
    else:
        driver = Series988(drv.Serial(config.port))
        iface = WatlowController(config, driver)
        iface.addCommand(driver.temperature1, "TC sample", poll=True, log=True)
        iface.addCommand(driver.temperature2, "TC heater", poll=True, log=True)
        iface.addCommand(driver.setpoint, "setpoint", log=True,
                         specialColumn="programmable")
        iface.addCommand(driver.power, "output", poll=True, log=True)
        iface.addCommand(driver.operation.pid.a1.gain, "PID P", hide=True,
                         specialColumn="pidp")
        iface.addCommand(driver.operation.pid.a1.integral, "PID I", hide=True,
                         specialColumn="pidi")
        iface.addCommand(driver.operation.pid.a1.derivative, "PID D", hide=True,
                         specialColumn="pidd")
    iface.addCommand(driver.setup.global_.ramp_init, "ramp_init", hide=True,
                     specialColumn="rampinit")
    iface.addCommand(driver.setup.global_.ramp_rate, "ramp_rate", hide=True,
                     specialColumn="ramprate")
    iface.editorPrototype.default_factory=QtGui.QSpinBox
    # Make sure we can read the rate
    driver.setup.global_.ramp_init.write(1)
    iface.populate()
    return iface