Printer FriendlyEmail Article Link

How to display PRBS Error counters on the screen and in real-time using the Exported Spirent Test Center Tcl scripts?

Answer

 

Since, the exported script run based on the way the command sequencer configured. Please follow the steps to modify the script to meet above requirement
 
1.      Edit the <scriptName>_logic.tcl
2.      Modify the procedure run () where the sequencer executed to run the configuration
a.       Subscribe to analyzerportresults (if you have selected port results, then this may automatically subscribed by the application) as shown below
 
# Subscribe to results for result query Spirent-0002-analyzerportresults
set hPortResults [stc::subscribe -parent [lindex [stc::get system1 -children-Project] 0] \
        -resultParent " [lindex [stc::get system1 -children-Project] 0] " \
        -configType analyzer \
        -resultType analyzerportresults \
        -filterList "" ]
 
b.      Add a while loop and
                                                              i.      Sequencer start
                                                            ii.      Display the required counts inside the loop as shown in the below example
 
Also please see the attachment for complete script
 
   proc run {} {
     # Subscribe to results for result query Spirent-0002-analyzerportresults
     set hPortResults [stc::subscribe -parent [lindex [stc::get system1 -children-Project] 0] \
        -resultParent " [lindex [stc::get system1 -children-Project] 0] " \
        -configType analyzer \
        -resultType analyzerportresults \
        -filterList "" ]
 
    # Start the sequencer
    #stc::perform sequencerStart
 
    # Wait for sequencer to finish
    #stc::waituntilcomplete
    set seq [lindex [stc::get system1 -children-sequencer] 0] ;# get the sequencer handle
    stc::perform sequencerStart
 
    while {[stc::get $seq -state] != "IDLE"} {
        #puts "Current state: [stc::get $seq -state] Current command: [stc::get $seq -currentCommand]"
         foreach hPrbsResults [stc::get $hPortResults -ResultHandleList] {
            # Place the results into an array for easy access. 
            array set aPrbs [stc::get $hPrbsResults]
            puts "PrbsBitErrorCount: $aPrbs(-PrbsBitErrorCount)\t PrbsBitErrorRate $aPrbs(-PrbsBitErrorRate)\
                    \t PrbsBitErrorRatio $aPrbs(-PrbsBitErrorRatio)\t PrbsErrorFrameCount $aPrbs(-PrbsErrorFrameCount)\
                    \t PrbsErrorFrameRate $aPrbs(-PrbsErrorFrameRate)\tPrbsFillOctetCount $aPrbs(-PrbsFillOctetCount)\
                    \t PrbsFillOctetRate $aPrbs(-PrbsFillOctetRate)"
                puts "\n\n\n"
         }
         stc::sleep 1
        if {[stc::get $seq -state] == "PAUSE"} {
            puts "Current state: [stc::get $seq -state] Current command: [stc::get $seq -currentCommand]"
            break
         }
   }
  
   if {[stc::get $seq -state] == "IDLE"} {
           puts "Sequencer is stopped!"
     }
 
    # check the sequencer status and test state
    set sqrHandle [stc::get System1 -Children-Sequencer]
    set sqrStatus [stc::get $sqrHandle -Status]
    set sqrTestState [stc::get $sqrHandle -TestState]
    if { $sqrStatus eq "" } {
        return $sqrTestState
       } else {
        return $sqrStatus
    }
 
} // end of procedure run
 
 
 
You may able to display other Real time counters as shown in the sample
Attachments
Attachment

Attachment


Product : L2-3,Automation,Spirent TestCenter