Publishing Selected Measurements to N8844A

The script in this topic, demonstrate publishing scalar measurement data to Keysight's N8844A Data Analytics Web Service Software. The measurements performed and published to the N8844A server are Jitter Mode's Output Jitter (IEEE) measurements. After running the script, open the N8844A web application on your web browser and view the measurements.

Both scripts are run in Flex Offline configuration with a simulated module configured with a PAM4 signal. You can easily modify the script to run on a DCA-X oscilloscope with a live signal.

The N8844A_publish_all.py script selects all J4U and Jrms measurements to publish, which is easy. The script selects J4u and Jrms measurements made on these specific edge transitions:

  • Rising edge from level 1 to level 3
  • Falling edge from level 3 to level 0
  • Falling edge from level 2 to level 1

This envolves locating the two-value index for each of these measurements and then using these six indexes to select the measurments to publish. The script prints on the console the value of each index as shown in this example output:

Index string for J4U R13: "4,4"
Index string for J4U F30: "2,1"
Index string for J4U F21: "3,2"
Index string for JRMS R13: "9,4"
Index string for JRMS F30: "7,1"
Index string for JRMS F21: "8,2"
Measurement indexes: "4,4,2,1,3,2,9,4,7,1,8,2"

Before running either of these scripts:

  • Display a PAM4 signal on FlexDCA. It should be the only channel that is on.
  • Connection to server must have been established at least once via FlexDCA's Repository Server dialog. This is the only method of entering the service account's password, which is remembered. Disconnect from the server before starting the program.
  • In the script, edit the N8844A_URL, USER_NAME, and DATA_SET constants for values that match your N8844A server and account. The DATA_SET constant names a targed folder on the server.

Example Script

Copy

N8844A-publish-selected.py

""" Example of publishing selected Jitter Mode's Output Jitter (IEEE)
measurements to an N8844A data analytics repository. Measurements are
selected by the location index of their values that are shown in the 
Output Jitter panel. The index is a string '<row number>,<column number>'.
Before running this script, a PAM-4 signal must be displayed on FlexDCA.
Simulated modules offer PAM-4 signals.
"""

import pyvisa as visa  # import VISA library
import time

# Measurements will be published for these waveform edges.
edge_measurements = {'J4U':['R13','F30','F21'], 'JRMS':['ALL'], 'EOJ':[]}


def display_output_jitter_measurements(flexdca):
    """ Turn on all Output Jitter measurements to ensure location index is
    available. If a measurement is not displayed in a table, it has no
    location index."""
    
    flexdca.query(':ACQuire:RUN;*OPC?')
    flexdca.query(':SYSTem:MODE JITTer;*OPC?')
    flexdca.write(':MEASure:JITTer:IEEE:STATe ON')
    flexdca.write(':MEASure:JITTer:IEEE:J4U:DISPlay ON')
    flexdca.write(':MEASure:JITTer:IEEE:JRMS:DISPlay ON')
    flexdca.write(':MEASure:JITTer:IEEE:EOJ:DISPlay ON')
    flexdca.query(':SYSTem:AUToscale;*OPC?')
    flexdca.write(':DISPlay:TSMode FSIZe')

def acq_limit_test(flexdca):
    """ Runs an acquisition limit test to ensure that the waveform 
    has enough data to make measurements on.
    """
    timeout = flexdca.timeout
    flexdca.timeout = 60000 # 60s
    flexdca.write(':ACQuire:STOP')
    flexdca.write(':ACQuire:CDISplay')
    flexdca.write(':LTESt:ACQuire:SIMage:STATe OFF') # do not save image
    flexdca.write(':LTESt:ACQuire:SWAVeform:RESet') # do not save waveforms
    flexdca.write(':LTESt:ACQuire:CTYPe:PATTerns 30')
    flexdca.write(':LTESt:ACQuire:STATe ON')
    flexdca.query(':ACQuire:RUN;*OPC?')
    flexdca.write(':LTESt:ACQuire:STATe OFF')
    flexdca.timeout = timeout

def get_measurement_locations(flexdca):
    global edge_measurements
    indexes = [] # location indexes for measurements
    for key, value in edge_measurements.items():
        for edge in value:
            flexdca.write(':MEASure:JITTer:IEEE:'+key+':ECATegory '+edge)
            s = flexdca.query(':MEASure:JITTer:IEEE:'+key+':LOCation?')
            print('Index string for '+key+' '+edge+': "' + s + '"')
            indexes.append(s)
    return ','.join(indexes)


def connect_to_repository(flexdca):
    flexdca.write(':REPository:SERVer:NAME "http://156.140.160.82:5000"')
    flexdca.write(':REPository:USER "admin@localhost"')
    flexdca.write(':REPository:MEASure:PMODe SELected')
    flexdca.write(':REPository:MEASure:PUBLish1:NAME "KBTest"')
    flexdca.query(':REPository:CONNect;*OPC?')
    if flexdca.query(':REPository:CONNect:STATe?') == 'NCON':
        print('Cannot connect to repository.')
        return False
    return True
        

def publish_to_repository(flexdca, meas_locations):
    s = ':REPository:MEASure:PAM:IEEE:SELection ' + meas_locations
    flexdca.write(s)
    print('Command sent to select measurements:\n  '+ s)
    flexdca.query(':REPository:PUBLish1;*OPC?')
    flexdca.query(':REPository:DISConnect;*OPC?')
    

rm = visa.ResourceManager()  # Create an instance of PyVISA's ResourceManager
FlexDCA=rm.open_resource('TCPIP0::localhost::hislip0,4880::INSTR')
FlexDCA.timeout = 10000 # Set connection timeout to 10s
FlexDCA.read_termination = '\n'
display_output_jitter_measurements(FlexDCA)
acq_limit_test(FlexDCA)
meas_locations = get_measurement_locations(FlexDCA)
print('Measurement indexes: "' + meas_locations + '"')
if connect_to_repository(FlexDCA):
    publish_to_repository(FlexDCA, meas_locations)
FlexDCA.write(':SYSTem:GTLocal')
time.sleep(0.5)
FlexDCA.close()
print('Connection closed.')