from pyvirtualbench import PyVirtualBench, PyVirtualBenchException # This examples demonstrates how to make measurements using the Power # Supply (PS) on a VirtualBench. try: # Power Supply Configuration channel = "ps/+25V" voltage_level = 1.0 current_limit = 0.5 # You will probably need to replace "myVirtualBench" with the name of your device. # By default, the device name is the model number and serial number separated by a hyphen; e.g., "VB8012-309738A". # You can see the device's name in the VirtualBench Application under File->About virtualbench = PyVirtualBench('myVirtualBench') ps = virtualbench.acquire_power_supply() ps.configure_voltage_output(channel, voltage_level, current_limit) ps.enable_all_outputs(True) for i in range(10): voltage_measurement, current_measurement, ps_state = ps.read_output(channel) print("Measurement [%d]: %f V\t%f A\t(%s)" % (i, voltage_measurement, current_measurement, str(ps_state))) ps.release() except PyVirtualBenchException as e: print("Error/Warning %d occurred\n%s" % (e.status, e)) finally: virtualbench.release()