Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
languagepy
from __future__ import print_function
import time
import sys
# Modify the path as required
sys.path.insert(
    0, 'C:/Users/gordon.muir<user>/Documents/Calnex/Paragon-X/RemoteControl/Python/')
import paragon as p

# Connect to the instrument - modify the IP address for your instrument
p.connect("192.168.207.107", "localhost", 9000, 9990)

# Reset
# Reset the instrument so that it is in a known state
p.paragonset("Rst TRUE")

# Configure ports and reference
# This is a basic configuration - change as required
p.paragonset("Physical LineRate 1GBE")
p.paragonset("Physical RefClkSource INT")

# Configure MSE
# This is a basic configuration - change as required
p.paragonset("OperatingMode PTP")
p.paragonset("MasterSlave Enabled TRUE")
p.paragonset("MasterSlave TestConfiguration TRANSPARENT_CLOCK")
p.paragonset("MasterSlave StandardsProfile G.8275.1_PHASE_PROFILE")

# Start MSE
p.paragonset("MasterSlave Master #0 Enabled TRUE")
# The DUT may need some time to settle - change as required
time.sleep(5)

# Start the capture
p.starttimingcapture()
# Run the test for a fixed period - change as required
time.sleep(30)
p.stopcapture()

# stop MSE
p.paragonset("MasterSlave Master #0 Enabled FALSE")

# Get the results
# There are many results that can be returned by the CAT
# See the CAT Remote Control Manual for details
SLOTS = {"Sync", "'Delay Req'", "2Way"}
METRICS = {"2Way": {"TIMEERROR"},
           "Sync": {"TIMEERROR", "FWD_LATENCY", "FWD_CF_DELTA"},
           "'Delay Req'": {"TIMEERROR", "REV_LATENCY", "REV_CF_DELTA"}}
STATS = {"Mean", "Max", "Min"}

# Tell the CAT to load the latest capture
# In this case, it is from a TC measurement
p.paragonset("Cat 1588TCAccuracy")
p.paragonset("Cat Show TRUE")
# Wait until the CAT has loaded the capture
p.waitforcat()

# Loop through slots, metrics and stats
for slot in SLOTS:
    # Print a header to the console
    print("Slot: %-12s" % (slot), end='')
    for stat in STATS:
        print("%-12s" % (stat), end='')
    print("")
    # Select the slot
    p.paragonset("Cat SelectSlot " + slot)

    for metric in METRICS[slot]:
        # Enable the metric and tell the CAT to calculate the result
        # The calculate command may not be required each time round the
        # loop but this makes sure that the results are correct
        p.paragonset("Cat " + metric + " Enable TRUE")
        p.paragonset("Cat Calculate")
        # Wait until the CAT has finished calculating
        p.waitforcat()

        # Print the results for each statistic to the console
        print("%-20s" % (metric), end='')
        for stat in STATS:
            result = p.paragonget("Cat " + metric + " " + stat)
            print("%-12s" % (result), end='')
        print("")