AnsweredAssumed Answered

Configuring PMAR via SCPI (PMAR is USB sensor)

Question asked by andyTPE on Oct 12, 2010
Latest reply on Oct 13, 2010 by acannon
I am having problems getting a USB power sensor configured as a PMAR via SCPI.  A code snippet (written in Python) isshown below to illustrate the problem.  I can send every command in the script and query for syntax errors (No error returned).  However, whenever I try to enable the PMAR I get the error return: +1146,"Specified external PMAR was not found."  Either I am missing a critical step in the configuration or I believe that there may be a problem with the ioconfig command (since if I look at the external device config GUI after trying to set up the PMAR, the Interface field is blank).....  Thank you for your help....  Andy

# ------------------------------------------------------------------------------
# File:     pna_ConfPMAR_1
# Author:   AMS
# Rev:      1-00
# Date:     10/11/10
# Notes:
# 1. Code snippet to add a power meter as an PMAR (receiver channel)
# 2. Currently does not work - throws an error when try to enable external power meter
#
# History:
# 1-00  10/11/10     Initial release
#
# ------------------------------------------------------------------------------

# ------------------------------------------------------------------------------
# Initialize
# ------------------------------------------------------------------------------
from visa import *

pna=instrument('TCPIP0::10.0.0.3::5025::SOCKET')
pna.timeout=5
pna.term_chars='\n'

pna.write('*rst;*cls;*wai')

print 'PNA IDN return:\t' , pna.ask('*idn?')



# ------------------------------------------------------------------------------
# Add new power meter as PMAR
# ------------------------------------------------------------------------------
print ''
print 'Adding power meter...'
print '---------------------'

# Get ID string of USB power meter connected to PNA
# Note that currently connected power meter is:
# "Agilent Technologies,U2002A,MY50000220"
pMeterList=pna.ask('syst:comm:usb:pmet:cat?')
print 'PNA USB Pmtr:\t' , pMeterList

# ADD NEW POWER METER AS PMAR
# Add new device with name 'newmpar1'
pna.write("Syst:conf:edev:add \'newpmar1\'")
# Specify device type as Power Meter
pna.write("Syst:conf:edev:dtype \'newpmar1\', \'Power Meter\'")
# Specify device driver
pna.write('SYST:CONF:EDEV:DRIV \'newpmar1\' , \'AGPM\'')

# Error check at this point
print 'Initial config:\t' , pna.ask('syst:err?')

# Specify IO config
# Could use the identification returned by 'syst:comm;usb:pmet:cat?
# pna.write("Syst:conf:edev:ioconfig \'newpmar1\', " + pMeterList)
# but this does not seem to work

# Instead try forcing ioconfig as full USB IDstring
pna.write("Syst:conf:edev:ioconfig \'newpmar1\', " +'\'USB0::2391::11288::MY50000220::0::INSTR\'')

# Sanity check to determine what the PNA thinks has been configured for the IO
print 'IOconfig:\t' , pna.ask('syst:conf:edev:ioconfig? \'newpmar1\'')
# Returned value is "USB0::2391::11288::MY50000220::0::INSTR"

# Specify sensor
pna.write("Syst:conf:edev:pmar:sens \'newpmar1\', 1")
# Specfiy max num readings
pna.write("Syst:conf:edev:pmar:read:count \'newpmar1\', 20")
# Specify tolerance
pna.write("Syst:conf:edev:pmar:read:ntolerance \'newpmar1\', 0.05")
# Set min frequency
pna.write("Syst:conf:edev:pmar:fmin \'newpmar1\', 10e6")
# Set max frequency
pna.write("Syst:conf:edev:pmar:fmax \'newpmar1\', 100e9")
# Turn off frequency checking
pna.write("Syst:conf:edev:pmar:flim \'newpmar1\', 0")


# Enable the IO
pna.write("Syst:conf:edev:ioen \'newpmar1\', 1;*wai")
# Run check at this point
print 'PMAR IOenabled:\t', pna.ask('syst:err?')

# Activate and enable the PMAR external device
pna.write("syst:conf:edev:stat \'newpmar1\', 1")
# Check for errors
print 'PMAR Configured:\t', pna.ask('syst:err?')
# Error return is: +1146,"Specified external PMAR was not found."  

Outcomes