Hi there,
I am pretty new in python.
I need some help from your side.
Willing to run a program like this,
I am pretty new in python.
I need some help from your side.
Willing to run a program like this,
import pyvisa # Initialize the resource manager and open the connection rm = pyvisa.ResourceManager() resource_address = "Your_VISA_Address" # Replace with your actual VISA resource address power_supply = rm.open_resource(resource_address) try: # Identify the power supply print(power_supply.query("*IDN?")) # Set parameters (example values; replace as needed) voltage = 12.0 # Volts current = 5.0 # Amperes # Configure the power supply power_supply.write(f"VOLT {voltage}") power_supply.write(f"CURR {current}") # Enable the output power_supply.write("OUTP ON") # Measure output voltage and current measured_voltage = float(power_supply.query("MEAS:VOLT?")) measured_current = float(power_supply.query("MEAS:CURR?")) # Calculate power efficiency input_power = voltage * current # Input power output_power = measured_voltage * measured_current # Output power efficiency = (output_power / input_power) * 100 print(f"Input Power: {input_power} W") print(f"Output Power: {output_power} W") print(f"Efficiency: {efficiency:.2f} %") except Exception as e: print(f"An error occurred: {e}") finally: # Turn off the output and close the connection power_supply.write("OUTP OFF") power_supply.close()Send me your comments