Agilent 33522A controller¶
This is the controller class for the Agilent 33522A function generator. Based on pyvisa to send commands to the USB.
copyright: | 2020by Hyperion Authors, see AUTHORS for more details. |
---|---|
license: | BSD, see LICENSE for more details. |
-
class
hyperion.controller.agilent.agilent33522A.
Agilent33522A
(settings)¶ Agilent 33522A arbitrary waveform generator, 30MHz, 2 channels. It takes a dictionary that passes the settings needed. In this case it needs
instrument_id : ‘8967’ # instrument id for the device you have dummy : FalseParameters: settings (dict) – a dictionary for the settings you need to send to the device -
check_channel
(channel)¶ Function to check if the channel is present in the system.
Parameters: channel (int) – number of channel. it can be 1 or 2 for this model Returns: The number of the channel Return type: string
-
enable_output
(channel, state)¶ Enable the output of channel 1 or 2
Parameters: - channel (int) – To activate or deactivate
- state (logical) – logical state. True sets the output on and false off.
-
enable_voltage_limits
(channel, state)¶ - This function enables the limits for the maximum and minimum voltage
output that can be generated by each channel. Those values are set with the method set_voltage_limits(channel, high, low).
This function enables this setting by putting state = true and disables it by putting state = false. When enable, setting a voltage outside the permitted values will give an error (not in python, in the device)
Parameters: - channel (int) – number of channel. it can be 1 or 2 for this model
- state (logical) – True to turn on, False to turn off
-
finalize
()¶ This methods closes the visa connection
-
get_enable_output
(channel)¶ Get the status of the output. 0 is off, 1 is on.
Parameters: channel (int) – can be 1 or 2 for this model Returns: Status of the output Return type: logical
-
get_frequency
(channel)¶ This functions reads the frequency output for the channel
Parameters: channel (int) – number of channel. it can be 1 or 2 for this model Returns: Frequency value currently in the device in Hz Return type: string
-
get_state_voltage_limits
(channel)¶ This function generator can set a minimum and maximum voltage value that will not be exceeded to protect the device that is being feed.
Parameters: channel (int) – number of channel. it can be 1 or 2 for this model Returns: voltage limits Return type: string
-
get_system_error
()¶ This functions returns the error message
Returns: error message Return type: string
-
get_voltage
(channel)¶ This functions gets the voltage in the channel
Parameters: channel (int) – number of channel. it can be 1 or 2 for this model Returns: current voltage Vpp in the device Return type: string
-
get_voltage_high
(channel)¶ This functions sets the high voltage to the channel
Parameters: channel (int) – number of channel. it can be 1 or 2 for this model Returns: High voltage value Return type: string
-
get_voltage_limits
(channel)¶ Gets the set values for the voltage limits, high and low.
Parameters: channel (int) – number of channel. it can be 1 or 2 for this model Returns: array with [high_value, low_value] in volts Return type: array of strings
-
get_voltage_limits_state
(channel)¶ Checks the status of the voltage limits. It can be on or off
Parameters: channel (int) – number of channel. it can be 1 or 2 for this model Returns: voltage limit state (logical) Return type: string
-
get_voltage_low
(channel)¶ This functions sets the low voltage to the channel
Parameters: channel (int) – number of channel. it can be 1 or 2 for this model Returns: Low voltage set on the device Return type: string
-
get_voltage_offset
(channel)¶ This functions gets the DC offset voltage to the channel
Parameters: channel (int) – number of channel. it can be 1 or 2 for this model Returns: current offset in the device Return type: string
-
get_waveform
(channel)¶ Get the function set for the output. The available functions are stored at FUNCTIONS = [‘SIN’,’SQU’,’TRI’,’RAMP’,’PULS’,’PRBS’,’NOIS’,’ARB’,’DC’]
Parameters: channel (int) – number of channel. it can be 1 or 2 for this model the expected output is on of the items in FUNCTIONS Returns: type of function in use Return type: string
-
idn
()¶ Ask the device for its identification
Returns: identification of the fun gen Return type: string
-
initialize
()¶ This method opens the communication with the device.
-
query
(msg)¶ Sequential read and write :param msg: message to write to the device :type msg: string
-
read
()¶ Read buffer
-
set_frequency
(channel, freq)¶ This functions sets the frequency output for the channel
Parameters: - channel (int) – number of channel. it can be 1 or 2 for this model
- freq (float) – desired frequency in Hz
-
set_voltage
(channel, voltage)¶ This functions sets the Vpp voltage to the channel
Parameters: - channel (int) – number of channel. it can be 1 or 2 for this model
- voltage (float) – voltage value for the high voltage in volts (with sign)
-
set_voltage_high
(channel, voltage)¶ This functions sets the high voltage to the channel
Parameters: - channel (int) – number of channel. it can be 1 or 2 for this model
- voltage (float) – voltage value for the high voltage in volts (with sign)
-
set_voltage_limits
(channel, high, low)¶ Set a limit to the output values
For this function generator you can set a minimum and maximum voltage value that will not be exceeded to protect the device that is being feed.
NOTE: setting the values does not activate this feature. To enable/disable it use the function enable_voltage_limits(channel,state)
Parameters: - channel (int) – number of channel. it can be 1 or 2 for this model
- high (float) – High maximum voltage value for the output in Volts
- low (float) – High maximum voltage value for the output in VOlts
-
set_voltage_low
(channel, voltage)¶ This functions sets the low voltage (in volts) to the channel.
Parameters: - channel (int) – number of channel. it can be 1 or 2 for this model
- voltage (float) – voltage value for the low voltage in volts (with sign)
-
set_voltage_offset
(channel, voltage)¶ This functions sets the DC offset voltage to the channel
Parameters: - channel (int) – number of channel. it can be 1 or 2 for this model
- voltage (float) – voltage value for the DC offset voltage in volts (with sign)
-
set_waveform
(channel, fun)¶ Get the function set for the output. The available functions are stored at FUNCTIONS = [‘SIN’,’SQU’,’TRI’,’RAMP’,’PULS’,’PRBS’,’NOIS’,’ARB’,’DC’]
Parameters: - channel (int) – number of channel. it can be 1 or 2 for this model
- fun (string) – One of the functions defined in FUNCTIONS. Ex: ‘SIN”
-
write
(msg)¶ Write in the device buffer :param msg: message to write to the device :type msg: string
-
-
class
hyperion.controller.agilent.agilent33522A.
Agilent33522ADummy
(settings)¶ This is the dummy controller for the Agilent33522A.
The idea is to load this class instead of the real one to do testing of higher level functions without the need of the real device to be connected or working.
The logic is that this dummy device will respond as the real device would, with the correct type and size of information is expected.
This class inherits from the real device and the idea is to re-write only the init, the write and the read, so all the other functions remain the same and functioning.
The specific way to achieve this will be different for every device, so it has to be done separately.
To do so, we use a yaml file that tells the dummy class what are the properties of the device. For example, one property for the LCC25 is voltage1, which is the voltage for channel 1. Then from this you can build 2 commands: voltage1? to ask what is the value and voltage1=1 to set it to the value 1. So we build a command list using the CHAR ? and = for each of this properties.
-
load_properties
()¶ This method loads a yaml file with a dictionary with the available properties for the LCC25 and some defaults values. This dictionary is saved in properties and will be modified when a variable is writen, so the dummy device will respond with the previously set value.
-
read
()¶ Dummy read. Reads the response buffer
-
write
(msg)¶ Dummy write. It will compare the msg with the COMMANDS
Parameters: msg (str) – Message to write
-