예제 #1
0
파일: Decadac.py 프로젝트: zhinst/Qcodes
    def __init__(self,
                 name: str,
                 address: str,
                 min_val: number = -5,
                 max_val: number = 5,
                 **kwargs) -> None:
        """

        Creates an instance of the Decadac instruments

        Args:
            name: What this instrument is called locally.

            address: The address of the DAC. For a serial port this
                is ASRLn::INSTR where n is replaced with the address set in the
                VISA control panel. Baud rate and other serial parameters must
                also be set in the VISA control panel.

            min_val: The minimum value in volts that can be output by the DAC.
                This value should correspond to the DAC code 0.

            max_val: The maximum value in volts that can be output by the DAC.
                This value should correspond to the DAC code 65536.

        """

        super().__init__(name, address, **kwargs)

        # Do feature detection
        self._feature_detect()

        # Create channels
        channels = ChannelList(self,
                               "Channels",
                               self.DAC_CHANNEL_CLASS,
                               snapshotable=False)
        slots = ChannelList(self, "Slots", self.DAC_SLOT_CLASS)
        for i in range(5):  # Create the 6 DAC slots
            slots.append(
                self.DAC_SLOT_CLASS(self, "Slot{}".format(i), i, min_val,
                                    max_val))
            slot_channels = slots[i].channels
            slot_channels = cast(ChannelList, slot_channels)
            channels.extend(slot_channels)
        slots.lock()
        channels.lock()
        self.add_submodule("slots", slots)
        self.add_submodule("channels", channels)

        self.connect_message()
예제 #2
0
    def __init__(self, name, address,
                 reset=_DEFAULT_RESET,
                 baudrate=_DEFAULT_BAUDRATE,
                 timeout=_DEFAULT_TIMEOUT,
                 default_switch_pos=DacBase._DEFAULT_SWITCH_POS,
                 terminator='\n',
                 run_buffered_cmd=None,
                 **kwargs):
        """
        Initialize the device

        Args:
            name (str):               name of the device
            address (str):            address of the device (e.g. /dev/ttyUSB0)
            reset (bool):             if "True", set all voltages to zero, set trigger mode to "always update" and stop ramps. If "False" only the upper and lower limit is reset.
            baudrate (int):           baud rate of ASCII protocol
            timeout (int):            seconds to allow for responses. Default 5
            default_switch_pos (int): default switch position (-1, 0 or 1) that is set when reset is called (default: 0)

        Attributes:
            name (str):               name
            slots (ChannelList):      list of all slots
            channels (ChannelList):   list of all channels
        """

        super().__init__(name, address, timeout=timeout, terminator=terminator,
                         **kwargs)

        self.current_slot = None
        self.current_channel = None
        
        channels = ChannelList(self, "Channels", DacChannel)
        slots = ChannelList(self, "Slots", DacSlot)

        for slot in range(5):
            slots.append(DacSlot(self, "Slot{}".format(slot), slot, default_switch_pos=default_switch_pos))
            channels.extend(slots[slot].channels)

        slots.lock()
        channels.lock()
        
        self.add_submodule("slots", slots)
        self.add_submodule("channels", channels)
        
        self.run_buffered_cmd = run_buffered_cmd
        self._buffered_loop = None
        
        if reset:
            self.reset()
예제 #3
0
파일: Decadac.py 프로젝트: kdp22/Qcodes
    def __init__(self, name, address, min_val=-5, max_val=5, **kwargs):
        """

        Creates an instance of the Decadac instrument corresponding to one slot
        on the physical instrument.

        Args:
            name (str): What this instrument is called locally.

            port (str): The address of the DAC. For a serial port this is ASRLn::INSTR
                where n is replaced with the address set in the VISA control panel.
                Baud rate and other serial parameters must also be set in the VISA control
                panel.

            min_val (number): The minimum value in volts that can be output by the DAC.
                This value should correspond to the DAC code 0.

            max_val (number): The maximum value in volts that can be output by the DAC.
                This value should correspond to the DAC code 65536.

        """

        super().__init__(name, address, **kwargs)

        # Do feature detection
        self._feature_detect()

        # Create channels
        channels = ChannelList(self,
                               "Channels",
                               DacChannel,
                               snapshotable=False)
        slots = ChannelList(self, "Slots", DacSlot)
        for i in range(6):  # Create the 6 DAC slots
            slots.append(DacSlot(self, "Slot{}".format(i), i, min_val,
                                 max_val))
            channels.extend(self.slots[i].channels)
        slots.lock()
        channels.lock()
        self.add_submodule("slots", slots)
        self.add_submodule("channels", channels)

        self.connect_message()