# TDK Lambda Genesys 40-38 DC power supply

class pymeasure.instruments.tdk.tdk_gen40_38.TDK_Gen40_38(adapter, name='TDK Lambda Gen40-38', address=6, **kwargs)

  Bases: `TDK_Lambda_Base`

  Represents the TDK Lambda Genesys 40-38 DC power supply. Class inherits commands from the TDK_Lambda_Base parent class and utilizes dynamic properties adjust valid values on various properties.

      psu = TDK_Gen40_38("COM3", 6)       # COM port and daisy-chain address
      psu.remote = "REM"                  # PSU in remote mode
      psu.output_enabled = True           # Turn on output
      psu.ramp_to_current(2.0)            # Ramp to 2.0 A of current
      print(psu.current)                  # Measure actual PSU current
      print(psu.voltage)                  # Measure actual PSU voltage
      psu.shutdown()                      # Run shutdown command

  The initialization of a TDK instrument requires the current address of the TDK power supply. The default address for the TDK Lambda is 6.

  Parameters:

    - adapter – VISAAdapter instance

    - name – Instrument name. Default is “TDK Lambda Gen40-38”

    - address – Serial port daisy chain number. Default is 6.

  property address

    Set the address of the power supply.

    Valid values are integers between 0 - 30 (inclusive).

  property auto_restart_enabled

    Control the auto restart mode, which restores the power supply to the last output voltage and current settings with output enabled on startup.

    Valid values are `True` to restore output settings with output enabled on startup and `False` to disable restoration of settings and output disabled on startup.

  check_errors()

    Read all errors from the instrument and log them.

    Returns:

      List of error entries.

  check_get_errors()

    Check for errors after having gotten a property and log them.

    Called if `check_get_errors=True` is set for that property.

    If you override this method, you may choose to raise an Exception for certain errors.

    Returns:

      List of error entries.

  check_set_errors()

    Only use this command for setting commands, i.e. non-querying commands.

    Any non-querying commands (i.e., a command that does NOT have the “?” symbol in it like the instrument command “PV 10”) will automatically return an “OK” reply for valid command or an error code. This is done to confirm that the instrument has received the command. Any querying commands (i.e., a command that does have the “?” symbol in it like the instrument command “PV?”) will return the requested value, not the confirmation.

  clear()

    Clear FEVE and SEVE registers to zero.

  property complete

    Get the synchronization bit.

    This property allows synchronization between a controller and a device. The Operation Complete query places an ASCII character 1 into the device’s Output Queue when all pending selected device operations have been finished.

  property current

    Measure the actual output current.

    Returns a float with five digits of precision.

  property current_setpoint

    Control the programmed (set) output current.(dynamic)

  property display

    Get the displayed voltage and current.

    Returns a list of floating point numbers in the order of [ measured voltage, programmed voltage, measured current, programmed current, over voltage set point, under voltage set point ].

  property foldback_delay

    Control the fold back delay.

    Adds an additional delay to the standard fold back delay (250 ms) by multiplying the set value by 0.1. Valid values are integers between 0 to 255.

  property foldback_enabled

    Control the fold back protection of the power supply.

    Valid values are `True` to arm the fold back protection and `False` to cancel the fold back protection.

  foldback_reset()

    Reset the fold back delay to 0 s, restoring the standard 250 ms delay.

    Property is UNTESTED.

  property id

    Get the identity of the instrument.

    Returns a list of instrument manufacturer and model in the format: `["LAMBDA", "GENX-Y"]`

  property last_test_date

    Get the date of the last test, possibly calibration date.

    Returns a string in the format: yyyy/mm/dd.

  property master_slave_setting

    Get the master and slave settings.

    Possible master return values are 1, 2, 3, and 4. The slave value is 0.

    Property is UNTESTED.

  property mode

    Measure the output mode of the power supply.

    When power supply is on, the returned value will be either `'CV'` for control voltage or `'CC'` for or control current. If the power supply is off, the returned value will be `'OFF'`.

  property multidrop_capability

    Get whether the multi-drop option is available on the power supply.

    If return value is `False`, the option is not available, if `True` it is available.

    Property is UNTESTED.

  property next_error

    Get the next error of the instrument (tuple of code and message).

  property options

    Get the device options installed.

  property output_enabled

    Control the output of the power supply.

    Valid values are `True` to turn output on and `False` to turn output off, shutting down any voltage or current.

  property over_voltage

    Control the over voltage protection. (dynamic)

  property pass_filter

    Control the low pass filter frequency of the A to D converter for voltage and current measurement.

    Valid frequency values are 18, 23, or 46 Hz. Default value is 18 Hz.

  ramp_to_current(target_current, steps=20, pause=0.2)

    Ramps to a target current from the set current value over a certain number of linear steps, each separated by a pause duration.

    Parameters:

      - target_current – Target current in amps

      - steps – Integer number of steps

      - pause – Pause duration in seconds to wait between steps

  read(**kwargs)

    Read up to (excluding) read_termination or the whole read buffer.

  read_binary_values(**kwargs)

    Read binary values from the device.

  read_bytes(count, **kwargs)

    Read a certain number of bytes from the instrument.

    Parameters:

      - count (int) – Number of bytes to read. A value of -1 indicates to read the whole read buffer.

      - kwargs – Keyword arguments for the adapter.

    Returns bytes:

      Bytes response of the instrument (including termination).

  recall()

    Recall last saved instrument settings.

  property remote

    Control the current remote operation of the power supply.

    Valid values are `'LOC'` for local mode, `'REM'` for remote mode, and `'LLO'` for local lockout mode.

  property repeat

    Measure the last command again.

    Returns output of the last command.

  reset()

    Reset the instrument to default values.

  save()

    Save current instrument settings.

  property serial

    Get the serial number of the instrument.

    Returns the serial number of of the instrument as an ASCII string.

  set_max_over_voltage()

    Set the over voltage protection to the maximum level for the power supply.

  shutdown()

    Safety shutdown the power supply.

    Ramps the power supply down to zero current using the `self.ramp_to_current(0.0)` method and turns the output off.

  property status

    Get the power supply status.

    Returns a list in the order of [ actual voltage (MV), the programmed voltage (PV), the actual current (MC), the programmed current (PC), the status register (SR), and the fault register (FR) ].

  property under_voltage

    Control the under voltage limit.

    Property is UNTESTED. (dynamic)

  property version

    Get the software version on instrument.

    Returns the software version as an ASCII string.

  property voltage

    Measure the actual output voltage.

  property voltage_setpoint

    Control the programmed (set) output voltage.(dynamic)

  wait_for(query_delay=None)

    Wait for some time. Used by ‘ask’ to wait before reading.

    Parameters:

      query_delay – Delay between writing and reading in seconds. None is default delay.

  write(command, **kwargs)

    Write a string command to the instrument appending write_termination.

    Parameters:

      - command – command string to be sent to the instrument

      - kwargs – Keyword arguments for the adapter.

  write_binary_values(command, values, *args, **kwargs)

    Write binary values to the device.

    Parameters:

      - command – Command to send.

      - values – The values to transmit.

      - **kwargs (*args,) – Further arguments to hand to the Adapter.

  write_bytes(content, **kwargs)

    Write the bytes content to the instrument.