:SYSTem SERVice MANagement CALibration Commands
This section describes commands that are used with the PathWave Calibration Advisor.
Error Messages
When using the :SYSTem:SERVice:MANagement:CALibration commands, these error messages can occur in the described special cases.
| Error # | Error string | Description of special cases |
|---|---|---|
| -200 | Execution error | This can occur when the KAC Service is still running but none of the :SYSTem:SERVice:MANagement:CALibration SCPI commands have a response.
|
| -221 | Settings conflict |
|
| -224 | Illegal parameter value |
|
| -310 | System error | Pathwave Calibration Advisor Service is not running |
Examples
calibration-advisor.py
#!python3
"""This program illustrates PathWave Calibration Advisor SCPI commands."""
# Import modules.
import pyvisa
import sys
import getpass
# Global variables.
oscilloscope_visa_address = "TCPIP0::lab-zir-p1z-2.cos.is.keysight.com::inst0::INSTR"
timeout = 20000 # 20 seconds.
def exit_program():
"""Exit program."""
# Close connection to oscilloscope.
sys.stdout.write("Closing oscilloscope connection.\n")
Infiniium.write(":SYSTem:GTLocal") # Unlock GUI.
Infiniium.clear() # Clear oscilloscope communications interface.
Infiniium.close() # Close communications interface to oscilloscope.
rm.close() # Close resource manager.
print("End of program.")
sys.exit()
def check_error_count(when):
"""Check error count."""
num_errors = int(Infiniium.query(":SYSTem:ERRor:COUNt?"))
if num_errors:
for _ in range(num_errors):
error_string = Infiniium.query(":SYSTem:ERRor:NEXT? DIAGnostic").strip()
print(f"ERROR: {error_string}")
print(f"Exited because error(s) found when: '{when}'")
exit_program()
def send_passcode():
"""Send passcode to PathWave Calibration Advisor.
1. To change any existing settings, the passcode is
needed and must be sent first.
2. The correct passcode is needed only once until the
instrument is powered off.
"""
Infiniium.write("*CLS") # Clear status and error registers.
passcode = getpass.getpass(
prompt="Enter your PathWave Calibration Advisor passcode: "
)
Infiniium.write(f':SYSTem:SERVice:MANagement:CALibration:PASScode "{passcode}"')
check_error_count("Sending passcode")
def change_calibration_interval():
"""Change the PathWave Calibration Advisor calibration interval."""
current_cal_interval = Infiniium.query(
":SYSTem:SERVice:MANagement:CALibration:INTerval:VALue?"
).strip()
print(f"Current calibration interval: '{current_cal_interval}'")
Infiniium.write(":SYSTem:SERVice:MANagement:CALibration:INTerval:VALue 12")
new_cal_interval = Infiniium.query(
":SYSTem:SERVice:MANagement:CALibration:INTerval:VALue?"
).strip()
print(f"New calibration interval: '{new_cal_interval}'")
periodic_cal_state = Infiniium.query(
":SYSTem:SERVice:MANagement:CALibration:PERiodic:ENABle?"
).strip()
print(f"Periodic calibration enable state: '{periodic_cal_state}'")
def change_calibration_interval_to_recommended():
"""Change the PathWave Calibration Advisor calibration interval
to the Keysight-recommended value.
"""
current_cal_interval_type = Infiniium.query(
":SYSTem:SERVice:MANagement:CALibration:INTerval:TYPE?"
).strip()
print(f"Current calibration interval type: '{current_cal_interval_type}'")
# Set calibration interval to Keysight-recommended:
Infiniium.write(":SYSTem:SERVice:MANagement:CALibration:INTerval:DEFault")
new_cal_interval_type = Infiniium.query(
":SYSTem:SERVice:MANagement:CALibration:INTerval:TYPE?"
).strip()
print(f"New calibration interval type: '{new_cal_interval_type}'")
new_cal_interval = Infiniium.query(
":SYSTem:SERVice:MANagement:CALibration:INTerval:VALue?"
).strip()
print(f"New calibration interval: '{new_cal_interval}'")
periodic_cal_state = Infiniium.query(
":SYSTem:SERVice:MANagement:CALibration:PERiodic:ENABle?"
).strip()
print(f"Periodic calibration enable state: '{periodic_cal_state}'")
def change_calibration_due_reminder():
"""Change the PathWave Calibration Advisor calibration due reminder."""
current_cal_due_reminder = Infiniium.query(
":SYSTem:SERVice:MANagement:CALibration:REMinder?"
).strip()
print(f"Current calibration due reminder: '{current_cal_due_reminder}'")
# Set new calibration due reminder:
Infiniium.write(":SYSTem:SERVice:MANagement:CALibration:REMinder 15")
new_cal_due_reminder = Infiniium.query(
":SYSTem:SERVice:MANagement:CALibration:REMinder?"
).strip()
print(f"New calibration due reminder: '{new_cal_due_reminder}'")
popup_notification_state = Infiniium.query(
":SYSTem:SERVice:MANagement:CALibration:NOTification:ENABle?"
).strip()
print(f"Popup notification enable state: '{popup_notification_state}'")
periodic_cal_state = Infiniium.query(
":SYSTem:SERVice:MANagement:CALibration:PERiodic:ENABle?"
).strip()
print(f"Periodic calibration enable state: '{periodic_cal_state}'")
def change_passcode():
"""Change the PathWave Calibration Advisor passcode."""
new_passcode = "Key4Cal"
Infiniium.write(
f':SYSTem:SERVice:MANagement:CALibration:PASScode:CHANge "{new_passcode}"'
)
check_error_count("Setting new passcode")
# ==========================================================
# Main program:
# ==========================================================
# Connect and initialize oscilloscope.
rm = pyvisa.ResourceManager(r"C:\Windows\System32\visa64.dll")
try:
Infiniium = rm.open_resource(oscilloscope_visa_address)
except Exception:
print(
f"Unable to connect to oscilloscope at {oscilloscope_visa_address}. Aborting program."
)
sys.exit()
Infiniium.timeout = timeout # Set global timeout.
Infiniium.clear() # Clear the instrument bus.
# Lock GUI happens automatically.
# Examples:
send_passcode()
change_calibration_interval()
change_calibration_interval_to_recommended()
change_calibration_due_reminder()
change_passcode()
# Check error count.
check_error_count("End of program")
# Exit program.
exit_program()