30 lines
896 B
Python
Executable File
30 lines
896 B
Python
Executable File
# -*- coding: utf-8 -*-
|
|
"""
|
|
Created on Mon Oct 10 15:39:12 2022
|
|
|
|
@author: gac-x01dc
|
|
"""
|
|
|
|
# Program containing functions with commands for SIM928 voltage source
|
|
|
|
# Turns source on/off
|
|
def V_source_state(on_off = 'off'):
|
|
command = 'EXON ' + on_off
|
|
return(command)
|
|
|
|
# Set voltage of SIM928
|
|
def set_voltage(V_value=1e-3):
|
|
if abs(V_value) < 1e-3:
|
|
print ('\nVoltage too low (<|3 mV|), it is set to 0 mV')
|
|
V_value = 0
|
|
elif abs(V_value) > 39:
|
|
print ('\nVoltage setting too high (>39V), it is set to 39V')
|
|
V_value = 40e-3
|
|
V_value = round(V_value,3) # rounding to mV, otherwise the source does not set the voltage because it lacks the precision
|
|
command = 'VOLT ' + str(V_value) # set voltage
|
|
return(command)
|
|
|
|
# Read voltage set by voltage source
|
|
def read_voltage():
|
|
command = 'VOLT?'
|
|
return(command) |