Browse Source

QXDM Project

master
inisial M 3 years ago
commit
558398b10d
100 changed files with 25474 additions and 0 deletions
  1. 489
    0
      QXDM/Automation Samples/Analysis/CDMA/CDMAAccessProbes.js
  2. 510
    0
      QXDM/Automation Samples/Analysis/CDMA/CDMAAccessProbes.pl
  3. 502
    0
      QXDM/Automation Samples/Analysis/CDMA/CDMAForwardErasureRate.js
  4. 520
    0
      QXDM/Automation Samples/Analysis/CDMA/CDMAForwardErasureRate.pl
  5. 595
    0
      QXDM/Automation Samples/Analysis/CDMA/CDMALockedFingers.js
  6. 616
    0
      QXDM/Automation Samples/Analysis/CDMA/CDMALockedFingers.pl
  7. 502
    0
      QXDM/Automation Samples/Analysis/CDMA/CDMARLPThroughput.js
  8. 534
    0
      QXDM/Automation Samples/Analysis/CDMA/CDMARLPThroughput.pl
  9. 436
    0
      QXDM/Automation Samples/Analysis/CDMA/CDMARXPower.js
  10. 461
    0
      QXDM/Automation Samples/Analysis/CDMA/CDMARXPower.pl
  11. 450
    0
      QXDM/Automation Samples/Analysis/HDR/HDRAccessAttemptTime.js
  12. 478
    0
      QXDM/Automation Samples/Analysis/HDR/HDRAccessAttemptTime.pl
  13. 450
    0
      QXDM/Automation Samples/Analysis/HDR/HDRConnectionSetupTime.js
  14. 470
    0
      QXDM/Automation Samples/Analysis/HDR/HDRConnectionSetupTime.pl
  15. 521
    0
      QXDM/Automation Samples/Analysis/HDR/HDRLockedFingers.js
  16. 546
    0
      QXDM/Automation Samples/Analysis/HDR/HDRLockedFingers.pl
  17. 466
    0
      QXDM/Automation Samples/Analysis/HDR/HDRLoopPower.js
  18. 492
    0
      QXDM/Automation Samples/Analysis/HDR/HDRLoopPower.pl
  19. 460
    0
      QXDM/Automation Samples/Analysis/HDR/HDRRRIData.js
  20. 481
    0
      QXDM/Automation Samples/Analysis/HDR/HDRRRIData.pl
  21. 460
    0
      QXDM/Automation Samples/Analysis/HDR/HDRRXPower.js
  22. 486
    0
      QXDM/Automation Samples/Analysis/HDR/HDRRXPower.pl
  23. 466
    0
      QXDM/Automation Samples/Analysis/HDR/HDRTXPower.js
  24. 492
    0
      QXDM/Automation Samples/Analysis/HDR/HDRTXPower.pl
  25. 433
    0
      QXDM/Automation Samples/Analysis/WCDMA/HSDPACQI.js
  26. 454
    0
      QXDM/Automation Samples/Analysis/WCDMA/HSDPACQI.pl
  27. 508
    0
      QXDM/Automation Samples/Analysis/WCDMA/WCDMAEcNo.js
  28. 528
    0
      QXDM/Automation Samples/Analysis/WCDMA/WCDMAEcNo.pl
  29. 483
    0
      QXDM/Automation Samples/Analysis/WCDMA/WCDMAFingers.js
  30. 504
    0
      QXDM/Automation Samples/Analysis/WCDMA/WCDMAFingers.pl
  31. 456
    0
      QXDM/Automation Samples/Analysis/WCDMA/WCDMASoftHandovers.js
  32. 477
    0
      QXDM/Automation Samples/Analysis/WCDMA/WCDMASoftHandovers.pl
  33. 483
    0
      QXDM/Automation Samples/Analysis/WCDMA/WCDMAUERXPower.js
  34. 509
    0
      QXDM/Automation Samples/Analysis/WCDMA/WCDMAUERXPower.pl
  35. BIN
      QXDM/Automation Samples/Bluetooth.dmc
  36. 57
    0
      QXDM/Automation Samples/C#/ISFToText/ISFToText.csproj
  37. 20
    0
      QXDM/Automation Samples/C#/ISFToText/ISFToText.sln
  38. 179
    0
      QXDM/Automation Samples/C#/ISFToText/Program.cs
  39. 33
    0
      QXDM/Automation Samples/C#/ISFToText/Properties/AssemblyInfo.cs
  40. 180
    0
      QXDM/Automation Samples/C++/ISFToText/ISFToText.cpp
  41. 20
    0
      QXDM/Automation Samples/C++/ISFToText/ISFToText.sln
  42. 193
    0
      QXDM/Automation Samples/C++/ISFToText/ISFToText.vcproj
  43. 1
    0
      QXDM/Automation Samples/C++/ISFToText/Stdafx.cpp
  44. 5
    0
      QXDM/Automation Samples/C++/ISFToText/Stdafx.h
  45. 2
    0
      QXDM/Automation Samples/CGPS Extract NMEA Sentences.dmc
  46. 269
    0
      QXDM/Automation Samples/DroppedMsgs.js
  47. BIN
      QXDM/Automation Samples/Example.isf
  48. BIN
      QXDM/Automation Samples/GPSExample.isf
  49. 110
    0
      QXDM/Automation Samples/GetVersionPacket.pl
  50. 133
    0
      QXDM/Automation Samples/GetVersionPacket.wsf
  51. 351
    0
      QXDM/Automation Samples/HSScreenCapture.pl
  52. 393
    0
      QXDM/Automation Samples/HSScreenCapture.wsf
  53. 760
    0
      QXDM/Automation Samples/HelperFunctions.js
  54. 754
    0
      QXDM/Automation Samples/HelperFunctions.pm
  55. 384
    0
      QXDM/Automation Samples/ISFExtractNMEA.js
  56. 141
    0
      QXDM/Automation Samples/ISFGetConfiguredItemFields.pl
  57. 149
    0
      QXDM/Automation Samples/ISFGetConfiguredItemFields.wsf
  58. 96
    0
      QXDM/Automation Samples/ISFGetFieldCount.pl
  59. 109
    0
      QXDM/Automation Samples/ISFGetFieldCount.wsf
  60. 115
    0
      QXDM/Automation Samples/ISFGetFieldIndex.pl
  61. 131
    0
      QXDM/Automation Samples/ISFGetFieldIndex.wsf
  62. 102
    0
      QXDM/Automation Samples/ISFGetFieldIndexByID.pl
  63. 116
    0
      QXDM/Automation Samples/ISFGetFieldIndexByID.wsf
  64. 130
    0
      QXDM/Automation Samples/ISFGetFieldIndexFrom.pl
  65. 148
    0
      QXDM/Automation Samples/ISFGetFieldIndexFrom.wsf
  66. 118
    0
      QXDM/Automation Samples/ISFGetFieldIndexFromByID.pl
  67. 131
    0
      QXDM/Automation Samples/ISFGetFieldIndexFromByID.wsf
  68. 114
    0
      QXDM/Automation Samples/ISFGetFieldName.pl
  69. 130
    0
      QXDM/Automation Samples/ISFGetFieldName.wsf
  70. 104
    0
      QXDM/Automation Samples/ISFGetFieldOffset.pl
  71. 118
    0
      QXDM/Automation Samples/ISFGetFieldOffset.wsf
  72. 104
    0
      QXDM/Automation Samples/ISFGetFieldSize.pl
  73. 118
    0
      QXDM/Automation Samples/ISFGetFieldSize.wsf
  74. 102
    0
      QXDM/Automation Samples/ISFGetFieldValue.pl
  75. 116
    0
      QXDM/Automation Samples/ISFGetFieldValue.wsf
  76. 102
    0
      QXDM/Automation Samples/ISFGetFieldValueText.pl
  77. 116
    0
      QXDM/Automation Samples/ISFGetFieldValueText.wsf
  78. 120
    0
      QXDM/Automation Samples/ISFGetItemBuffer.pl
  79. 104
    0
      QXDM/Automation Samples/ISFGetItemBufferText.pl
  80. 121
    0
      QXDM/Automation Samples/ISFGetItemBufferText.wsf
  81. 100
    0
      QXDM/Automation Samples/ISFGetItemColor.pl
  82. 114
    0
      QXDM/Automation Samples/ISFGetItemColor.wsf
  83. 101
    0
      QXDM/Automation Samples/ISFGetItemDLFBuffer.pl
  84. 102
    0
      QXDM/Automation Samples/ISFGetItemFieldValue.pl
  85. 114
    0
      QXDM/Automation Samples/ISFGetItemFieldValue.wsf
  86. 102
    0
      QXDM/Automation Samples/ISFGetItemFieldValueText.pl
  87. 114
    0
      QXDM/Automation Samples/ISFGetItemFieldValueText.wsf
  88. 102
    0
      QXDM/Automation Samples/ISFGetItemFields.pl
  89. 116
    0
      QXDM/Automation Samples/ISFGetItemFields.wsf
  90. 93
    0
      QXDM/Automation Samples/ISFGetItemKeyText.pl
  91. 106
    0
      QXDM/Automation Samples/ISFGetItemKeyText.wsf
  92. 93
    0
      QXDM/Automation Samples/ISFGetItemName.pl
  93. 106
    0
      QXDM/Automation Samples/ISFGetItemName.wsf
  94. 93
    0
      QXDM/Automation Samples/ISFGetItemParsedText.pl
  95. 106
    0
      QXDM/Automation Samples/ISFGetItemParsedText.wsf
  96. 92
    0
      QXDM/Automation Samples/ISFGetItemSize.pl
  97. 104
    0
      QXDM/Automation Samples/ISFGetItemSize.wsf
  98. 93
    0
      QXDM/Automation Samples/ISFGetItemSummary.pl
  99. 106
    0
      QXDM/Automation Samples/ISFGetItemSummary.wsf
  100. 0
    0
      QXDM/Automation Samples/ISFGetItemTimestamp.pl

+ 489
- 0
QXDM/Automation Samples/Analysis/CDMA/CDMAAccessProbes.js View File

@@ -0,0 +1,489 @@
// NOTE: This script must be run from CScript in a command box,
// i.e. CScript CDMAAccessProbes.js <ISF File Name> [Excel File Name]

// This example demonstrates the usage of DM core automation
// interface and excel automation interface to plot
// CDMA access probes histogram

var MIN_COUNT = 0;
var MAX_COUNT = 10;

// Global variables
var IISF = null;
var gSamples = 0;
var gLastCount = 0;
var gProbeCount = new Array();
var gTotalProbes = 0;
var gFirstPacket = false;

// ISF/Excel fully qualified paths
var ISFAbsolutePath = "";
var XLSAbsolutePath = "";

// Process the argument - ISF file name
function ParseArguments()
{
// Assume failure
var RC = false;
var Txt = "";
var Help =
"Syntax: CScript CDMAAccessProbes.js <ISF File Name> [Excel File Name]\n"
+ "Eg: CScript CDMAAccessProbes.js \"Access Probes.isf\" \"Access Probes.xls\"\n";

// Grab the shell
var SH = new ActiveXObject( "WScript.Shell" );
if (SH == null)
{
Txt = "Unable to interact with Windows shell";
WScript.StdOut.WriteLine( Txt );

return RC;
}

var FSO = new ActiveXObject( "Scripting.FileSystemObject" );
if (FSO == null)
{
Txt = "Unable to get file system object";
WScript.StdOut.WriteLine( Txt );

return RC;
}

var Args = WScript.Arguments;
if (Args.length < 1)
{
WScript.StdOut.WriteLine( Help );

return RC;
}

var ISFFileName = WScript.Arguments( 0 );
if (ISFFileName == "")
{
Txt = "Invalid ISF file name\n\n" + Help;
WScript.StdOut.WriteLine( Txt );

return RC;
}

ISFAbsolutePath = FSO.GetAbsolutePathName( ISFFileName );
if (ISFAbsolutePath == "")
{
Txt = "Invalid ISF file name\n\n" + Help;
WScript.StdOut.WriteLine( Txt );

return RC;
}

if (Args.length == 2)
{
var XLSFileName = WScript.Arguments( 1 );
if (XLSFileName == "")
{
Txt = "Invalid Excel file name\n\n" + Help;
WScript.StdOut.WriteLine( Txt );

return RC;
}

XLSAbsolutePath = FSO.GetAbsolutePathName( XLSFileName );
if (XLSAbsolutePath == "")
{
Txt = "Invalid Excel file name\n\n" + Help;
WScript.StdOut.WriteLine( Txt );

return RC;
}
}
else
{
// Generate Excel file name from ISF file name
XLSAbsolutePath = ISFAbsolutePath + ".xls";
}

// Success
RC = true;
return RC;
}

// Initialize application
function Initialize()
{
// Assume failure
var RC = false;
var Txt = "";

// Create the item store file interface
IISF = new ActiveXObject( "DMCoreAutomation.ItemStoreFiles" );
if (IISF == null)
{
WScript.StdOut.WriteLine( "Unable to obtain ISF interface" );
return RC;
}

// Success
RC = true;
return RC;
}

// Perform analysis (obtain access probe data from ISF file)
function Analyze()
{
// Assume failure
var RC = false;
var Txt = "";

Txt = "Loading ISF file:\n" + ISFAbsolutePath;
WScript.StdOut.WriteLine( Txt );

// Load the item store file
var Handle = IISF.LoadItemStore( ISFAbsolutePath );
if (Handle == 0xFFFFFFFF)
{
Txt = "Unable to load ISF:\n" + ISFAbsolutePath;
WScript.StdOut.WriteLine( Txt );

return RC;
}

var IClient = IISF.GetClientInterface( Handle );
if (IClient == null)
{
Txt = "Unable to obtain ISF client interface";
WScript.StdOut.WriteLine( Txt );

IISF.CloseItemStore( Handle );
return RC;
}

var ClientHandle = IClient.RegisterClient( true );
if (ClientHandle == 0xFFFFFFFF)
{
Txt = "Unable to register ISF client";
WScript.StdOut.WriteLine( Txt );
IISF.CloseItemStore( Handle );
return RC;
}

var IConfig = IClient.ConfigureClient( ClientHandle );
if (IConfig == null)
{
Txt = "Unable to configure ISF client";
WScript.StdOut.WriteLine( Txt );

IClient.UnregisterClient( ClientHandle );
IISF.CloseItemStore( Handle );
return RC;
}

Txt = "Processing ISF file...";
WScript.StdOut.Write( Txt );

// Configure the client for supported log keys
IConfig.AddLog( 0x1013 );
IConfig.AddLog( 0x10BD );
IConfig.CommitConfig();

// Populate the client with all instances of supported logs
IClient.PopulateClients();

// Success/any items found?
var ItemCount = IClient.GetClientItemCount( ClientHandle );
if (ItemCount == 0)
{
Txt = "Unable to find required data for processing";
WScript.StdOut.WriteLine( Txt );

IClient.UnregisterClient( ClientHandle );
IISF.CloseItemStore( Handle );
return RC;
}

// Initialize array
for (var r = MIN_COUNT; r <= MAX_COUNT + 1; r += 1)
{
gProbeCount[r] = 0;
}

// Initialize array of log keys to field offsets
var Offsets = new Array();
Offsets["[0x1013]"] = 0;
Offsets["[0x10BD]"] = 2;

// Process all items in the client
for (var ItemIndex = 0; ItemIndex < ItemCount; ItemIndex++)
{
var Item = IClient.GetClientItem( ClientHandle, ItemIndex );
if (Item == null)
{
continue;
}

var Fields = Item.GetConfiguredItemFields( "", false, false );
if (Fields == null)
{
continue;
}

var FieldCount = Fields.GetFieldCount();
if (FieldCount < 9)
{
continue;
}

var ItemKey = Item.GetItemKeyText();

var FI = Offsets[ItemKey];
var SequenceNumber = Fields.GetFieldValue( FI );
var ProbeNumber = Fields.GetFieldValue( FI + 1 );
if (SequenceNumber == 1 && ProbeNumber == 1)
{
if (!gFirstPacket)
{
gLastCount = 1;
gFirstPacket = true;
continue;
}

gSamples++;
gTotalProbes = gLastCount;
gLastCount = 1;
}
else
{
++gLastCount;
continue;
}

if (gTotalProbes > MAX_COUNT)
{
gProbeCount[MAX_COUNT + 1] += 1;
}
else
{
gProbeCount[gTotalProbes] += 1;
}
}

// An access probe data point is generated when a new sequence is detected
// Because of this the last access probe (or sequence) is not accounted for
// The last point is generated when it is determined that the log has been processed
if (gLastCount > 0 && gFirstPacket)
{
gSamples++;

if (gTotalProbes > MAX_COUNT)
{
gProbeCount[MAX_COUNT + 1] += 1;
}
else
{
gProbeCount[gTotalProbes] += 1;
}
}

Txt = "Done";
WScript.StdOut.WriteLine( Txt );

if (gSamples == 0)
{
Txt = "Unable to find required data for processing";
WScript.StdOut.WriteLine( Txt );

return RC;
}

IClient.UnregisterClient( ClientHandle );
IISF.CloseItemStore( Handle );

RC = true;
return RC;
}

// Generate an Excel spreadsheet with the analysis results
function GenerateExcelSpreadsheet()
{
// Assume failure
var RC = false;
var Txt = "";

// Start Excel and get automation object
var XL = new ActiveXObject( "Excel.Application" );
if (XL == null)
{
Txt = "Error launching Excel";
WScript.StdOut.WriteLine( Txt );

return RC;
}

// Get a new workbook
var WB = XL.Workbooks.Add();
if (WB == null)
{
Txt = "Error interfacing to Excel";
WScript.StdOut.WriteLine( Txt );

return RC;
}

WB.title = "CDMA Access Probes";

try
{
WB.Sheets( 3 ).Delete();
WB.Sheets( 2 ).Delete();
}
catch (Err) { };

// Populate Excel workspace sheet
var Sheet = WB.ActiveSheet;
if (Sheet == null)
{
Txt = "Error interfacing to Excel";
WScript.StdOut.WriteLine( Txt );

WB.Close();
return RC;
}

Sheet.Name = "Data";

Txt = "Generating Excel spreadsheet...";
WScript.StdOut.Write( Txt );

// Populate Excel spreadsheet
RC = PopulateExcelSpreadsheet( Sheet );
if (RC == false)
{
Txt = "Error";
WScript.StdOut.WriteLine( Txt );

WB.Close();
return RC;
}

Txt = "Done";
WScript.StdOut.WriteLine( Txt );

// Save the work book file
WB.SaveAs( XLSAbsolutePath );
WB.Close();

Txt = "Excel file saved at:\n";
Txt += XLSAbsolutePath;
WScript.StdOut.WriteLine( Txt );
}

// Populate Excel spreadsheet with analysis data
function PopulateExcelSpreadsheet( Sheet )
{
// Assume failure
var RC = false;

Sheet.Cells( 1, 1 ).Value = "Total Samples";
Sheet.Cells( 1, 1 ).Font.Bold = true;
Sheet.Cells( 1, 1 ).ColumnWidth = 14;
Sheet.Cells( 1, 2 ).Value = gSamples;

Sheet.Cells( 2, 1 ).Value = "Probe Count";
Sheet.Cells( 2, 2 ).Value = "Probe Count Total";
Sheet.Cells( 2, 3 ).Value = "Probe Count %";

Sheet.Range( "A2:C2" ).Font.Bold = true;
Sheet.Range( "A2:C2" ).ColumnWidth = 18;

var Index;
var Percentage;
for (Index = MIN_COUNT; Index <= MAX_COUNT; Index++)
{
Sheet.Cells( Index + 3, 1 ).Value = Index;

Sheet.Cells( Index + 3, 2 ).Value = gProbeCount[Index];

Percentage = gProbeCount[Index] / gSamples * 100.0;
Sheet.Cells( Index + 3, 3 ).Value = Percentage;
}

var Txt = "> " + MAX_COUNT;
Sheet.Cells( Index + 3, 1 ).Value = Txt;

Sheet.Cells( Index + 3, 2 ).Value = gProbeCount[MAX_COUNT + 1];

Percentage = gProbeCount[MAX_COUNT + 1] / gSamples * 100.0;
Sheet.Cells( Index + 3, 3 ).Value = Percentage;

var Range = Sheet.Range( "C2:C14" );
if (Range == null)
{
return RC;
}

var Chart = Sheet.Parent.Charts.Add();
if (Chart == null)
{
return RC;
}

Chart.ChartWizard( Range, // Source
4, // Gallery is xlLine
null, // Format
2, // Plot by column (2)
0, // Category labels
1, // Series labels
true, // Has legend ?
"CDMA Access Probes", // Title
"Probe Count", // Category tilte
"Percentage (%)", // Value title
null ); // Extra title

// Setup a nice background
Chart.PlotArea.Fill.TwoColorGradient( 4, 1 );
Chart.PlotArea.Fill.ForeColor.SchemeColor = 37;
Chart.PlotArea.Fill.BackColor.SchemeColor = 2;

// Disable markers
Chart.SeriesCollection(1).MarkerStyle = 0; // xlNone

// XValues is X-axis label values
Range = Sheet.Range( "A3:A14" );
if (Range != null)
{
Chart.SeriesCollection(1).XValues = Range;
}

// Success!
RC = true;
return RC;
}

// Main body of script
function Execute()
{
// Parse out arguments
var RC = ParseArguments();
if (RC == false)
{
return;
}

// Initialize ISF automation interface
RC = Initialize();
if (RC == false)
{
return;
}

// Obtain access probe data from ISF file
RC = Analyze();
if (RC == false)
{
return;
}

// Generate an Excel spreadsheet with the analysis results
GenerateExcelSpreadsheet();
}

Execute();

+ 510
- 0
QXDM/Automation Samples/Analysis/CDMA/CDMAAccessProbes.pl View File

@@ -0,0 +1,510 @@
# NOTE: This script must be run with Perl in a command box,
# i.e. Perl CDMAAccessProbes.pl <ISF File Name> [Excel File Name]

# This example demonstrates the usage of DM core automation
# interface and excel automation interface to plot
# CDMA access probes histogram

use strict;
use File::Spec;
use Win32::OLE;
use File::Basename;
use Cwd 'abs_path';
use Win32::OLE::Const 'Microsoft Excel';

# Miscellaneous constants
use constant false => 0;
use constant true => 1;

use constant MIN_COUNT => 0;
use constant MAX_COUNT => 10;

# Global variables
my $IISF = 0;
my $gSamples = 0;
my $gLastCount = 0;
my @gProbeCount = [];
my $gTotalProbes = 0;
my $gFirstPacket = false;

# ISF/Excel fully qualified paths
my $ISFAbsolutePath = "";
my $XLSAbsolutePath = "";

# Get path from current script file name
sub GetPathFromScript
{
# Assume failure
my $Path = "";
my $Txt = "";

$Path = abs_path( $ENV{'PWD'} );
$Path = File::Spec->rel2abs( $Path ) ;
if (length $Path <= 0)
{
$Txt = "Unable to get folder name";
print "\n$Txt\n";
}
else
{
if (!($Path =~ /\\$/))
{
$Path .= "\\";
}
}

return $Path;
}

# Process the argument - ISF file name
sub ParseArguments
{
# Assume failure
my $RC = false;
my $Txt = "";
my $Help =
"Syntax: Perl CDMAAccessProbes.pl <ISF File Name> [Excel File Name]\n"
. "Eg: Perl CDMAAccessProbes.pl \"Access Probes.isf\" \"Access Probes.xls\"\n";

if ($#ARGV < 0)
{
print "\n$Help\n";
return $RC;
}

my $ISFFileName = $ARGV[0];
if ($ISFFileName eq "")
{
$Txt = "Invalid ISF file name\n\n" . $Help;
print "\n$Txt";

return $RC;
}

$ISFAbsolutePath = GetPathFromScript();
if ($ISFAbsolutePath eq "")
{
$Txt = "Invalid ISF file name\n\n" . $Help;
print "\n$Txt";

return $RC;
}
else
{
$ISFAbsolutePath .= $ISFFileName;
}

if ($#ARGV == 1)
{
my $XLSFileName = $ARGV[1];
if ($XLSFileName eq "")
{
$Txt = "Invalid Excel file name\n\n" . $Help;
print "\n$Txt";

return $RC;
}
else
{
if ($XLSFileName =~ /\\/)
{
print "\nhere\n";
$XLSAbsolutePath = $XLSFileName . ".xls";
}
else
{
$XLSAbsolutePath = dirname( $ISFAbsolutePath );
$XLSAbsolutePath .= "\\" . $XLSFileName . ".xls";
}
}
}
else
{
# Generate Excel file name from ISF file name
$XLSAbsolutePath = $ISFAbsolutePath . ".xls";
}

# Success
$RC = true;
return $RC;
}

# Initialize application
sub Initialize
{
# Assume failure
my $RC = false;
my $Txt = "";

# Create the item store file interface
$IISF = new Win32::OLE 'DMCoreAutomation.ItemStoreFiles';
if (!$IISF)
{
print "\nUnable to obtain ISF interface";
return $RC;
}

# Success
$RC = true;
return $RC;
}

# Perform analysis (obtain access probe data from ISF file)
sub Analyze
{
# Assume failure
my $RC = false;
my $Txt = "";

$Txt = "Loading ISF file:\n" . $ISFAbsolutePath;
print "\n$Txt";

# Load the item store file
my $Handle = $IISF->LoadItemStore( $ISFAbsolutePath );
if ($Handle == 0xFFFFFFFF)
{
$Txt = "Unable to load ISF:\n" . $ISFAbsolutePath;
print "\n$Txt\n";

return $RC;
}

my $IClient = $IISF->GetClientInterface( $Handle );
if (!$IClient)
{
$Txt = "Unable to obtain ISF client interface";
print "\n$Txt";

$IISF->CloseItemStore( $Handle );
return $RC;
}

my $ClientHandle = $IClient->RegisterClient( true );
if ($ClientHandle == 0xFFFFFFFF)
{
$Txt = "Unable to register ISF client";
print "\n$Txt";

$IISF->CloseItemStore( $Handle );
return $RC;
}

my $IConfig = $IClient->ConfigureClient( $ClientHandle );
if (!$IConfig)
{
$Txt = "Unable to configure ISF client";
print "\n$Txt";

$IClient->UnregisterClient( $ClientHandle );
$IISF->CloseItemStore( $Handle );
return $RC;
}

$Txt = "Processing ISF file...";
print "\n$Txt";

# Configure the client for supported log keys
$IConfig->AddLog( 0x1013 );
$IConfig->AddLog( 0x10BD );
$IConfig->CommitConfig();

# Populate the client with all instances of supported logs
$IClient->PopulateClients();

# Success/any items found?
my $ItemCount = $IClient->GetClientItemCount( $ClientHandle );
if ($ItemCount == 0)
{
$Txt = "Unable to find required data for processing";
print "\n$Txt";

$IClient->UnregisterClient( $ClientHandle );
$IISF->CloseItemStore( $Handle );
return $RC;
}

# Initialize array
for (my $r = MIN_COUNT; $r <= MAX_COUNT + 1; $r += 1)
{
$gProbeCount[$r] = 0;
}

# Initialize array of log keys to field offsets
my %Offsets = ();
$Offsets{"[0x1013]"} = 0;
$Offsets{"[0x10BD]"} = 2;

# Process all items in the client
for (my $ItemIndex = 0; $ItemIndex < $ItemCount; $ItemIndex++)
{
my $Item = $IClient->GetClientItem( $ClientHandle, $ItemIndex );
if (!$Item)
{
next;
}

my $Fields = $Item->GetConfiguredItemFields( "", false, false );
if (!$Fields)
{
next;
}

my $FieldCount = $Fields->GetFieldCount();
if ($FieldCount < 9)
{
next;
}

my $ItemKey = $Item->GetItemKeyText();

my $FI = $Offsets{$ItemKey};
my $SequenceNumber = $Fields->GetFieldValue( $FI );
my $ProbeNumber = $Fields->GetFieldValue( $FI + 1 );
if ($SequenceNumber == 1 && $ProbeNumber == 1)
{
if (!$gFirstPacket)
{
$gLastCount = 1;
$gFirstPacket = true;
next;
}

$gSamples++;
$gTotalProbes = $gLastCount;
$gLastCount = 1;
}
else
{
++$gLastCount;
next;
}

if ($gTotalProbes > MAX_COUNT)
{
$gProbeCount[MAX_COUNT + 1] += 1;
}
else
{
$gProbeCount[$gTotalProbes] += 1;
}
}

# An access probe data point is generated when a new sequence is detected
# Because of this the last access probe (or sequence) is not accounted for
# The last point is generated when it is determined that the log has been processed
if ($gLastCount > 0 && $gFirstPacket)
{
$gSamples++;

if ($gTotalProbes > MAX_COUNT)
{
$gProbeCount[MAX_COUNT + 1] += 1;
}
else
{
$gProbeCount[$gTotalProbes] += 1;
}
}

$Txt = "Done";
print "$Txt\n";

if ($gSamples == 0)
{
$Txt = "Unable to find required data for processing";
print "$Txt\n";

return $RC;
}

$IClient->UnregisterClient( $ClientHandle );
$IISF->CloseItemStore( $Handle );

$RC = true;
return $RC;
}

# Generate an Excel spreadsheet with the analysis results
sub GenerateExcelSpreadsheet
{
# Assume failure
my $RC = false;
my $Txt = "";

# Start Excel and get automation object
my $XL = new Win32::OLE 'Excel.Application';
if (!$XL)
{
$Txt = "Error launching Excel";
print "\n$Txt";

return $RC;
}

# Get a new workbook
my $WB = $XL->Workbooks->Add();
if (!$WB)
{
$Txt = "Error interfacing to Excel";
print "\n$Txt";

return $RC;
}

$WB->Sheets( 3 )->Delete();
$WB->Sheets( 2 )->Delete();

$WB->{title} = "CDMA Access Probes";

# Populate Excel workspace sheet
my $Sheet = $WB->ActiveSheet;
if (!$Sheet)
{
$Txt = "Error interfacing to Excel";
print "\n$Txt";

$WB->Close();
return $RC;
}

$Sheet->{Name} = "Data";

$Txt = "Generating Excel spreadsheet...";
print "$Txt";

# Populate Excel spreadsheet
$RC = PopulateExcelSpreadsheet( $Sheet );
if ($RC == false)
{
$Txt = "Error";
print "\n$Txt";

$WB->Close();
return $RC;
}

$Txt = "Done";
print "$Txt\n";

# Save the work book file
$WB->SaveAs( $XLSAbsolutePath );
$WB->Close();

$Txt = "Excel file saved at:\n";
$Txt .= $XLSAbsolutePath;
print "$Txt\n";
}

# Populate Excel spreadsheet with analysis data
sub PopulateExcelSpreadsheet
{
my $Sheet = shift;

# Assume failure
my $RC = false;

$Sheet->Cells( 1, 1 )->{Value} = "Total Samples";
$Sheet->Cells( 1, 1 )->Font->{Bold} = true;
$Sheet->Cells( 1, 1 )->{ColumnWidth} = 14;
$Sheet->Cells( 1, 2 )->{Value} = $gSamples;

$Sheet->Cells( 2, 1 )->{Value} = "Probe Count";
$Sheet->Cells( 2, 2 )->{Value} = "Probe Count Total";
$Sheet->Cells( 2, 3 )->{Value} = "Probe Count %";

$Sheet->Range( "A2:C2" )->Font->{Bold} = true;
$Sheet->Range( "A2:C2" )->{ColumnWidth} = 18;

my $Index;
my $Percentage;
for ($Index = MIN_COUNT; $Index <= MAX_COUNT; $Index++)
{
$Sheet->Cells( $Index + 3, 1 )->{Value} = $Index;

$Sheet->Cells( $Index + 3, 2 )->{Value} = $gProbeCount[$Index];

$Percentage = $gProbeCount[$Index] / $gSamples * 100.0;
$Sheet->Cells( $Index + 3, 3 )->{Value} = $Percentage;
}

my $Txt = "> " . MAX_COUNT;
$Sheet->Cells( $Index + 3, 1 )->{Value} = $Txt;

$Sheet->Cells( $Index + 3, 2 )->{Value} = $gProbeCount[MAX_COUNT + 1];

$Percentage = $gProbeCount[MAX_COUNT + 1] / $gSamples * 100.0;
$Sheet->Cells( $Index + 3, 3 )->{Value} = $Percentage;

my $Range = $Sheet->Range( "C2:C14" );
if (!$Range)
{
return $RC;
}

my $Chart = $Sheet->Parent->Charts->Add();
if (!$Chart)
{
return $RC;
}

$Chart->{ChartType} = xlLine;
$Chart->SetSourceData( $Range, xlColumns );
$Chart->Location( xlLocationAsNewSheet, "Chart" );

# Setup a nice background
$Chart->PlotArea->Fill->TwoColorGradient( 4, 1 );
$Chart->PlotArea->Fill->ForeColor->{SchemeColor} = 37;
$Chart->PlotArea->Fill->BackColor->{SchemeColor} = 2;

# Disable markers
$Chart->SeriesCollection(1)->{MarkerStyle} = xlNone;

# Set titles
$Chart->{HasTitle} = true;
$Chart->Axes( 1, 1 )->{HasTitle} = true;
$Chart->Axes( 2, 1 )->{HasTitle} = true;
$Chart->ChartTitle->Characters->{Text} = "CDMA Access Probes";
$Chart->Axes( 1, 1 )->AxisTitle->Characters->{Text} = "Probe Count";
$Chart->Axes( 2, 1 )->AxisTitle->Characters->{Text} = "Percentage (%)";

# XValues is X-axis label values
$Range = $Sheet->Range( "A3:A14" );
if ($Range)
{
$Chart->SeriesCollection(1)->{XValues} = $Range->{Value};
}

# Success!
$RC = true;
return $RC;
}

# Main body of script
sub Execute
{
# Parse out arguments
my $RC = ParseArguments();
if ($RC == false)
{
return;
}

# Initialize ISF automation interface
$RC = Initialize();
if ($RC == false)
{
return;
}

# Obtain erasure rate data from ISF file
$RC = Analyze();
if ($RC == false)
{
return;
}

# Generate an Excel spreadsheet with the analysis results
GenerateExcelSpreadsheet();
}

Execute();

+ 502
- 0
QXDM/Automation Samples/Analysis/CDMA/CDMAForwardErasureRate.js View File

@@ -0,0 +1,502 @@
// NOTE: This script must be run from CScript in a command box,
// i.e. CScript CDMAForwardErasureRate.js <ISF File Name> [Excel File Name]

// This example demonstrates the usage of DM core automation
// interface and excel automation interface to plot
// CDMA forward erasure rate histogram

var MIN_BLOCKS = 0;
var MAX_BLOCKS = 200;

// Global variables
var IISF = null;
var gSamples = 0;
var gErasures = new Array();
var gCurrentTotal = 0;
var gCurrentError = 0;

// ISF/Excel fully qualified paths
var ISFAbsolutePath = "";
var XLSAbsolutePath = "";

// Process the argument - ISF file name
function ParseArguments()
{
// Assume failure
var RC = false;
var Txt = "";
var Help =
"Syntax: CScript CDMAForwardErasureRate.js <ISF File Name> [Excel File Name]\n"
+ "Eg: CScript CDMAForwardErasureRate.js \"Markov.isf\" \"Markov.xls\"\n";

// Grab the shell
var SH = new ActiveXObject( "WScript.Shell" );
if (SH == null)
{
Txt = "Unable to interact with Windows shell";
WScript.StdOut.WriteLine( Txt );

return RC;
}

var FSO = new ActiveXObject( "Scripting.FileSystemObject" );
if (FSO == null)
{
Txt = "Unable to get file system object";
WScript.StdOut.WriteLine( Txt );

return RC;
}

var Args = WScript.Arguments;
if (Args.length < 1)
{
WScript.StdOut.WriteLine( Help );

return RC;
}

var ISFFileName = WScript.Arguments( 0 );
if (ISFFileName == "")
{
Txt = "Invalid ISF file name\n\n" + Help;
WScript.StdOut.WriteLine( Txt );

return RC;
}

ISFAbsolutePath = FSO.GetAbsolutePathName( ISFFileName );
if (ISFAbsolutePath == "")
{
Txt = "Invalid ISF file name\n\n" + Help;
WScript.StdOut.WriteLine( Txt );

return RC;
}

if (Args.length == 2)
{
var XLSFileName = WScript.Arguments( 1 );
if (XLSFileName == "")
{
Txt = "Invalid Excel file name\n\n" + Help;
WScript.StdOut.WriteLine( Txt );

return RC;
}

XLSAbsolutePath = FSO.GetAbsolutePathName( XLSFileName );
if (XLSAbsolutePath == "")
{
Txt = "Invalid Excel file name\n\n" + Help;
WScript.StdOut.WriteLine( Txt );

return RC;
}
}
else
{
// Generate Excel file name from ISF file name
XLSAbsolutePath = ISFAbsolutePath + ".xls";
}

// Success
RC = true;
return RC;
}

// Initialize application
function Initialize()
{
// Assume failure
var RC = false;
var Txt = "";

// Create the item store file interface
IISF = new ActiveXObject( "DMCoreAutomation.ItemStoreFiles" );
if (IISF == null)
{
WScript.StdOut.WriteLine( "Unable to obtain ISF interface" );
return RC;
}

// Success
RC = true;
return RC;
}

// Perform analysis (obtain erasure rate data from ISF file)
function Analyze()
{
// Assume failure
var RC = false;
var Txt = "";

Txt = "Loading ISF file:\n" + ISFAbsolutePath;
WScript.StdOut.WriteLine( Txt );

// Load the item store file
var Handle = IISF.LoadItemStore( ISFAbsolutePath );
if (Handle == 0xFFFFFFFF)
{
Txt = "Unable to load ISF:\n" + ISFAbsolutePath;
WScript.StdOut.WriteLine( Txt );

return RC;
}

var IClient = IISF.GetClientInterface( Handle );
if (IClient == null)
{
Txt = "Unable to obtain ISF client interface";
WScript.StdOut.WriteLine( Txt );

IISF.CloseItemStore( Handle );
return RC;
}

var ClientHandle = IClient.RegisterClient( true );
if (ClientHandle == 0xFFFFFFFF)
{
Txt = "Unable to register ISF client";
WScript.StdOut.WriteLine( Txt );
IISF.CloseItemStore( Handle );
return RC;
}

var IConfig = IClient.ConfigureClient( ClientHandle );
if (IConfig == null)
{
Txt = "Unable to configure ISF client";
WScript.StdOut.WriteLine( Txt );

IClient.UnregisterClient( ClientHandle );
IISF.CloseItemStore( Handle );
return RC;
}

Txt = "Processing ISF file...";
WScript.StdOut.Write( Txt );

// Configure the client for log 0x100E
IConfig.AddLog( 0x100E );
IConfig.CommitConfig();

// Populate the client with all instances of log 0x100E
IClient.PopulateClients();

// Success/any items found?
var ItemCount = IClient.GetClientItemCount( ClientHandle );
if (ItemCount == 0)
{
Txt = "Unable to find required data for processing";
WScript.StdOut.WriteLine( Txt );

IClient.UnregisterClient( ClientHandle );
IISF.CloseItemStore( Handle );
return RC;
}

// Initialize array
for (var r = MIN_BLOCKS; r <= MAX_BLOCKS; r += 2)
{
gErasures[r] = 0;
}

var MapMUX = new Array();
MapMUX[0] = 0;
MapMUX[1] = 1;
MapMUX[2] = 1;
MapMUX[3] = 1;
MapMUX[4] = 1;
MapMUX[5] = 0;
MapMUX[6] = 0;
MapMUX[7] = 0;
MapMUX[8] = 2;
MapMUX[9] = 2;
MapMUX[10] = 2;
MapMUX[11] = 2;
MapMUX[12] = 1;
MapMUX[13] = 2;
MapMUX[14] = 3;
MapMUX[15] = 0;

// Process all items in the client
for (var ItemIndex = 0; ItemIndex < ItemCount; ItemIndex++)
{
var Item = IClient.GetClientItem( ClientHandle, ItemIndex );
if (Item == null)
{
continue;
}

var Fields = Item.GetConfiguredItemFields( "", false, false );
if (Fields == null)
{
continue;
}

var FieldCount = Fields.GetFieldCount();
if (FieldCount < 1)
{
continue;
}

var FI = 0;
var NumEntries = Fields.GetFieldValue( FI++ );
for (var n = 0; n < NumEntries; n++, FI += 3)
{
var ExpectedRate = Fields.GetFieldValue( FI );
if (ExpectedRate == 0xC || ExpectedRate == 0xD || ExpectedRate == 0xF)
{
continue;
}

var MUXNumber = MapMUX[ExpectedRate];
if (MUXNumber > 2 || (ExpectedRate > 7 && MUXNumber == 0))
{
continue;
}

var ActualRate = Fields.GetFieldValue( FI + 1 );
if (MUXNumber == 2)
{
ActualRate += 16;
}

var Erased = false;
if (ActualRate == 8 || ActualRate == 9 || ActualRate == 25)
{
Erased = true;
}

if (ActualRate < 26)
{
gCurrentTotal++;

if (Erased)
{
gCurrentError++;
}
}

if (gCurrentTotal == 500)
{
gSamples++;

var PercentError = gCurrentError / gCurrentTotal * 100.0;
PercentError *= 10;
PercentError = PercentError.toFixed( 0 );
gErasures[PercentError] += 1;

gCurrentTotal = 0;
gCurrentError = 0;
}
}
}

Txt = "Done";
WScript.StdOut.WriteLine( Txt );

if (gSamples == 0)
{
Txt = "Unable to find required data for processing";
WScript.StdOut.WriteLine( Txt );

return RC;
}

IClient.UnregisterClient( ClientHandle );
IISF.CloseItemStore( Handle );

RC = true;
return RC;
}

// Generate an Excel spreadsheet with the analysis results
function GenerateExcelSpreadsheet()
{
// Assume failure
var RC = false;
var Txt = "";

// Start Excel and get automation object
var XL = new ActiveXObject( "Excel.Application" );
if (XL == null)
{
Txt = "Error launching Excel";
WScript.StdOut.WriteLine( Txt );

return RC;
}

// Get a new workbook
var WB = XL.Workbooks.Add();
if (WB == null)
{
Txt = "Error interfacing to Excel";
WScript.StdOut.WriteLine( Txt );

return RC;
}

WB.title = "CDMA Forward Erasure Rate";

try
{
WB.Sheets( 3 ).Delete();
WB.Sheets( 2 ).Delete();
}
catch (Err) { };

// Populate Excel workspace sheet
var Sheet = WB.ActiveSheet;
if (Sheet == null)
{
Txt = "Error interfacing to Excel";
WScript.StdOut.WriteLine( Txt );

WB.Close();
return RC;
}

Sheet.Name = "Data";

Txt = "Generating Excel spreadsheet...";
WScript.StdOut.Write( Txt );

// Populate Excel spreadsheet
RC = PopulateExcelSpreadsheet( Sheet );
if (RC == false)
{
Txt = "Error";
WScript.StdOut.WriteLine( Txt );

WB.Close();
return RC;
}

Txt = "Done";
WScript.StdOut.WriteLine( Txt );

// Save the work book file
WB.SaveAs( XLSAbsolutePath );
WB.Close();

Txt = "Excel file saved at:\n";
Txt += XLSAbsolutePath;
WScript.StdOut.WriteLine( Txt );
}

// Populate Excel spreadsheet with analysis data
function PopulateExcelSpreadsheet( Sheet )
{
// Assume failure
var RC = false;

Sheet.Cells( 1, 1 ).Value = "Total Samples";
Sheet.Cells( 1, 1 ).Font.Bold = true;
Sheet.Cells( 1, 1 ).ColumnWidth = 14;
Sheet.Cells( 1, 2 ).Value = gSamples;

Sheet.Cells( 2, 1 ).Value = "Blocks";
Sheet.Cells( 2, 2 ).Value = "Blocks Total";
Sheet.Cells( 2, 3 ).Value = "Blocks %";

Sheet.Range( "A2:C2" ).Font.Bold = true;
Sheet.Range( "A2:C2" ).ColumnWidth = 16;

var r;
var Index;
var e = 0.0;
var ErasureTotal = 0;
for (r = MIN_BLOCKS, Index = 0; r <= MAX_BLOCKS; r += 2, e += 0.2, Index++)
{
Sheet.Cells( Index + 3, 1 ).Value = e;

ErasureTotal += gErasures[r];
Sheet.Cells( Index + 3, 2 ).Value = gErasures[r];
}

Index = 0;
var Percentage;
for (var r = MIN_BLOCKS, Index = 0; r <= MAX_BLOCKS; r += 2, Index++)
{
Percentage = gErasures[r] / ErasureTotal * 100.0;
Sheet.Cells( Index + 3, 3 ).Value = Percentage;
}

var Range = Sheet.Range( "C2:C103" );
if (Range == null)
{
return RC;
}

var Chart = Sheet.Parent.Charts.Add();
if (Chart == null)
{
return RC;
}

Chart.ChartWizard( Range, // Source
4, // Gallery is xlLine
null, // Format
2, // Plot by column (2)
0, // Category labels
1, // Series labels
true, // Has legend ?
"CDMA Forward Erasure Rate", // Title
"Blocks", // Category tilte
"Percentage (%)", // Value title
null ); // Extra title

// Setup a nice background
Chart.PlotArea.Fill.TwoColorGradient( 4, 1 );
Chart.PlotArea.Fill.ForeColor.SchemeColor = 37;
Chart.PlotArea.Fill.BackColor.SchemeColor = 2;

// Disable markers
Chart.SeriesCollection(1).MarkerStyle = 0; // xlNone

// XValues is X-axis label values
Range = Sheet.Range( "A3:A103" );
if (Range != null)
{
Chart.SeriesCollection( 1 ).XValues = Range;
}

// Success!
RC = true;
return RC;
}

// Main body of script
function Execute()
{
// Parse out arguments
var RC = ParseArguments();
if (RC == false)
{
return;
}

// Initialize ISF automation interface
RC = Initialize();
if (RC == false)
{
return;
}

// Obtain erasure rate data from ISF file
RC = Analyze();
if (RC == false)
{
return;
}

// Generate an Excel spreadsheet with the analysis results
GenerateExcelSpreadsheet();
}

Execute();

+ 520
- 0
QXDM/Automation Samples/Analysis/CDMA/CDMAForwardErasureRate.pl View File

@@ -0,0 +1,520 @@
# NOTE: This script must be run with Perl in a command box,
# i.e. Perl CDMAForwardErasureRate.pl <ISF File Name> [Excel File Name]

# This example demonstrates the usage of DM core automation
# interface and excel automation interface to plot
# CDMA forward erasure rate histogram

use strict;
use File::Spec;
use Win32::OLE;
use File::Basename;
use Cwd 'abs_path';
use Win32::OLE::Const 'Microsoft Excel';

# Miscellaneous constants
use constant false => 0;
use constant true => 1;

use constant MIN_BLOCKS => 0;
use constant MAX_BLOCKS => 200;

# Global variables
my $IISF = 0;
my $gSamples = 0;
my @gErasures = [];
my $gCurrentTotal = 0;
my $gCurrentError = 0;

# ISF/Excel fully qualified paths
my $ISFAbsolutePath = "";
my $XLSAbsolutePath = "";

# Get path from current script file name
sub GetPathFromScript
{
# Assume failure
my $Path = "";
my $Txt = "";

$Path = abs_path( $ENV{'PWD'} );
$Path = File::Spec->rel2abs( $Path ) ;
if (length $Path <= 0)
{
$Txt = "Unable to get folder name";
print "\n$Txt\n";
}
else
{
if (!($Path =~ /\\$/))
{
$Path .= "\\";
}
}

return $Path;
}

# Process the argument - ISF file name
sub ParseArguments
{
# Assume failure
my $RC = false;
my $Txt = "";
my $Help =
"Syntax: Perl CDMAForwardErasureRate.pl <ISF File Name> [Excel File Name]\n"
. "Eg: Perl CDMAForwardErasureRate.pl \"Markov.isf\" \"Markov.xls\"\n";

if ($#ARGV < 0)
{
print "\n$Help\n";
return $RC;
}

my $ISFFileName = $ARGV[0];
if ($ISFFileName eq "")
{
$Txt = "Invalid ISF file name\n\n" . $Help;
print "\n$Txt";

return $RC;
}

$ISFAbsolutePath = GetPathFromScript();
if ($ISFAbsolutePath eq "")
{
$Txt = "Invalid ISF file name\n\n" . $Help;
print "\n$Txt";

return $RC;
}
else
{
$ISFAbsolutePath .= $ISFFileName;
}

if ($#ARGV == 1)
{
my $XLSFileName = $ARGV[1];
if ($XLSFileName eq "")
{
$Txt = "Invalid Excel file name\n\n" . $Help;
print "\n$Txt";

return $RC;
}
else
{
if ($XLSFileName =~ /\\/)
{
print "\nhere\n";
$XLSAbsolutePath = $XLSFileName . ".xls";
}
else
{
$XLSAbsolutePath = dirname( $ISFAbsolutePath );
$XLSAbsolutePath .= "\\" . $XLSFileName . ".xls";
}
}
}
else
{
# Generate Excel file name from ISF file name
$XLSAbsolutePath = $ISFAbsolutePath . ".xls";
}

# Success
$RC = true;
return $RC;
}

# Initialize application
sub Initialize
{
# Assume failure
my $RC = false;
my $Txt = "";

# Create the item store file interface
$IISF = new Win32::OLE 'DMCoreAutomation.ItemStoreFiles';
if (!$IISF)
{
print "\nUnable to obtain ISF interface";
return $RC;
}

# Success
$RC = true;
return $RC;
}

# Perform analysis (obtain erasure rate data from ISF file)
sub Analyze
{
# Assume failure
my $RC = false;
my $Txt = "";

$Txt = "Loading ISF file:\n" . $ISFAbsolutePath;
print "\n$Txt";

# Load the item store file
my $Handle = $IISF->LoadItemStore( $ISFAbsolutePath );
if ($Handle == 0xFFFFFFFF)
{
$Txt = "Unable to load ISF:\n" . $ISFAbsolutePath;
print "\n$Txt\n";

return $RC;
}

my $IClient = $IISF->GetClientInterface( $Handle );
if (!$IClient)
{
$Txt = "Unable to obtain ISF client interface";
print "\n$Txt";

$IISF->CloseItemStore( $Handle );
return $RC;
}

my $ClientHandle = $IClient->RegisterClient( true );
if ($ClientHandle == 0xFFFFFFFF)
{
$Txt = "Unable to register ISF client";
print "\n$Txt";

$IISF->CloseItemStore( $Handle );
return $RC;
}

my $IConfig = $IClient->ConfigureClient( $ClientHandle );
if (!$IConfig)
{
$Txt = "Unable to configure ISF client";
print "\n$Txt";

$IClient->UnregisterClient( $ClientHandle );
$IISF->CloseItemStore( $Handle );
return $RC;
}

$Txt = "Processing ISF file...";
print "\n$Txt";

# Configure the client for log 0x100E
$IConfig->AddLog( 0x100E );
$IConfig->CommitConfig();

# Populate the client with all instances of log 0x100E
$IClient->PopulateClients();

# Success/any items found?
my $ItemCount = $IClient->GetClientItemCount( $ClientHandle );
if ($ItemCount == 0)
{
$Txt = "Unable to find required data for processing";
print "\n$Txt";

$IClient->UnregisterClient( $ClientHandle );
$IISF->CloseItemStore( $Handle );
return $RC;
}

# Initialize array
for (my $r = MIN_BLOCKS; $r <= MAX_BLOCKS; $r += 2)
{
$gErasures[$r] = 0;
}

my @MapMUX = [];
$MapMUX[0] = 0;
$MapMUX[1] = 1;
$MapMUX[2] = 1;
$MapMUX[3] = 1;
$MapMUX[4] = 1;
$MapMUX[5] = 0;
$MapMUX[6] = 0;
$MapMUX[7] = 0;
$MapMUX[8] = 2;
$MapMUX[9] = 2;
$MapMUX[10] = 2;
$MapMUX[11] = 2;
$MapMUX[12] = 1;
$MapMUX[13] = 2;
$MapMUX[14] = 3;
$MapMUX[15] = 0;

# Process all items in the client
for (my $ItemIndex = 0; $ItemIndex < $ItemCount; $ItemIndex++)
{
my $Item = $IClient->GetClientItem( $ClientHandle, $ItemIndex );
if (!$Item)
{
next;
}

my $Fields = $Item->GetConfiguredItemFields( "", false, false );
if (!$Fields)
{
next;
}

my $FieldCount = $Fields->GetFieldCount();
if ($FieldCount < 1)
{
next;
}

my $FI = 0;
my $NumEntries = $Fields->GetFieldValue( $FI++ );
for (my $n = 0; $n < $NumEntries; $n++, $FI += 3)
{
my $ExpectedRate = $Fields->GetFieldValue( $FI );
if ($ExpectedRate == 0xC || $ExpectedRate == 0xD || $ExpectedRate == 0xF)
{
next;
}

my $MUXNumber = $MapMUX[$ExpectedRate];
if ($MUXNumber > 2 || ($ExpectedRate > 7 && $MUXNumber == 0))
{
next;
}

my $ActualRate = $Fields->GetFieldValue( $FI + 1 );
if ($MUXNumber == 2)
{
$ActualRate += 16;
}

my $Erased = false;
if ($ActualRate == 8 || $ActualRate == 9 || $ActualRate == 25)
{
$Erased = true;
}

if ($ActualRate < 26)
{
$gCurrentTotal++;

if ($Erased)
{
$gCurrentError++;
}
}

if ($gCurrentTotal == 500)
{
$gSamples++;

my $PercentError = $gCurrentError / $gCurrentTotal * 100.0;
$PercentError *= 10;
$PercentError = sprintf( "%.0f", $PercentError );
$gErasures[$PercentError] += 1;

$gCurrentTotal = 0;
$gCurrentError = 0;
}
}
}

$Txt = "Done";
print "$Txt\n";

if ($gSamples == 0)
{
$Txt = "Unable to find required data for processing";
print "$Txt\n";

return $RC;
}

$IClient->UnregisterClient( $ClientHandle );
$IISF->CloseItemStore( $Handle );

$RC = true;
return $RC;
}

# Generate an Excel spreadsheet with the analysis results
sub GenerateExcelSpreadsheet
{
# Assume failure
my $RC = false;
my $Txt = "";

# Start Excel and get automation object
my $XL = new Win32::OLE 'Excel.Application';
if (!$XL)
{
$Txt = "Error launching Excel";
print "\n$Txt";

return $RC;
}

# Get a new workbook
my $WB = $XL->Workbooks->Add();
if (!$WB)
{
$Txt = "Error interfacing to Excel";
print "\n$Txt";

return $RC;
}

$WB->Sheets( 3 )->Delete();
$WB->Sheets( 2 )->Delete();

$WB->{title} = "CDMA Forward Erasure Rate";

# Populate Excel workspace sheet
my $Sheet = $WB->ActiveSheet;
if (!$Sheet)
{
$Txt = "Error interfacing to Excel";
print "\n$Txt";

$WB->Close();
return $RC;
}

$Sheet->{Name} = "Data";

$Txt = "Generating Excel spreadsheet...";
print "$Txt";

# Populate Excel spreadsheet
$RC = PopulateExcelSpreadsheet( $Sheet );
if ($RC == false)
{
$Txt = "Error";
print "\n$Txt";

$WB->Close();
return $RC;
}

$Txt = "Done";
print "$Txt\n";

# Save the work book file
$WB->SaveAs( $XLSAbsolutePath );
$WB->Close();

$Txt = "Excel file saved at:\n";
$Txt .= $XLSAbsolutePath;
print "$Txt\n";
}

# Populate Excel spreadsheet with analysis data
sub PopulateExcelSpreadsheet
{
my $Sheet = shift;

# Assume failure
my $RC = false;

$Sheet->Cells( 1, 1 )->{Value} = "Total Samples";
$Sheet->Cells( 1, 1 )->Font->{Bold} = true;
$Sheet->Cells( 1, 1 )->{ColumnWidth} = 14;
$Sheet->Cells( 1, 2 )->{Value} = $gSamples;

$Sheet->Cells( 2, 1 )->{Value} = "Blocks";
$Sheet->Cells( 2, 2 )->{Value} = "Blocks Total";
$Sheet->Cells( 2, 3 )->{Value} = "Blocks %";

$Sheet->Range( "A2:C2" )->Font->{Bold} = true;
$Sheet->Range( "A2:C2" )->{ColumnWidth} = 16;

my $r;
my $Index;
my $e = 0.0;
my $ErasureTotal = 0;
for ($r = MIN_BLOCKS, $Index = 0; $r <= MAX_BLOCKS; $r += 2, $e += 0.2, $Index++)
{
$Sheet->Cells( $Index + 3, 1 )->{Value} = $e;

$ErasureTotal += $gErasures[$r];
$Sheet->Cells( $Index + 3, 2 )->{Value} = $gErasures[$r];
}

$Index = 0;
my $Percentage;
for ($r = MIN_BLOCKS, $Index = 0; $r <= MAX_BLOCKS; $r += 2, $Index++)
{
$Percentage = $gErasures[$r] / $ErasureTotal * 100.0;
$Sheet->Cells( $Index + 3, 3 )->{Value} = $Percentage;
}

my $Range = $Sheet->Range( "C2:C103" );
if (!$Range)
{
return $RC;
}

my $Chart = $Sheet->Parent->Charts->Add();
if (!$Chart)
{
return $RC;
}

$Chart->{ChartType} = xlLine;
$Chart->SetSourceData( $Range, xlColumns );
$Chart->Location( xlLocationAsNewSheet, "Chart" );

# Setup a nice background
$Chart->PlotArea->Fill->TwoColorGradient( 4, 1 );
$Chart->PlotArea->Fill->ForeColor->{SchemeColor} = 37;
$Chart->PlotArea->Fill->BackColor->{SchemeColor} = 2;

# Disable markers
$Chart->SeriesCollection(1)->{MarkerStyle} = xlNone;

# Set titles
$Chart->{HasTitle} = true;
$Chart->Axes( 1, 1 )->{HasTitle} = true;
$Chart->Axes( 2, 1 )->{HasTitle} = true;
$Chart->ChartTitle->Characters->{Text} = "CDMA Forward Erasure Rate";
$Chart->Axes( 1, 1 )->AxisTitle->Characters->{Text} = "Blocks";
$Chart->Axes( 2, 1 )->AxisTitle->Characters->{Text} = "Percentage (%)";

# XValues is X-axis label values
$Chart->Axes( xlCategory )->{MajorTickMark} = xlTickMarkCross;
$Chart->SeriesCollection(1)->{XValues} = "=Data!R3C1:R103C1";

# Success!
$RC = true;
return $RC;
}

# Main body of script
sub Execute
{
# Parse out arguments
my $RC = ParseArguments();
if ($RC == false)
{
return;
}

# Initialize ISF automation interface
$RC = Initialize();
if ($RC == false)
{
return;
}

# Obtain erasure rate data from ISF file
$RC = Analyze();
if ($RC == false)
{
return;
}

# Generate an Excel spreadsheet with the analysis results
GenerateExcelSpreadsheet();
}

Execute();

+ 595
- 0
QXDM/Automation Samples/Analysis/CDMA/CDMALockedFingers.js View File

@@ -0,0 +1,595 @@
// NOTE: This script must be run from CScript in a command box,
// i.e. CScript CDMALockedFingers.js <ISF File Name> [Excel File Name]

// This example demonstrates the usage of DM core automation
// interface and excel automation interface to plot
// CDMA locked fingers histogram

// Maximum number of fingers we support
var MAX_FINGERS = 6;

// Global variables
var IISF = null;
var gSamples = 0;
var gLockedGood = new Array();
var gLockedStrong = new Array();
var gLockedVeryStrong = new Array();
var gLockedFingerArray = new Array();

// ISF/Excel fully qualified paths
var ISFAbsolutePath = "";
var XLSAbsolutePath = "";

// Process the argument - ISF file name
function ParseArguments()
{
// Assume failure
var RC = false;
var Txt = "";
var Help =
"Syntax: CScript CDMALockedFingers.js <ISF File Name> [Excel File Name]\n"
+ "Eg: CScript CDMALockedFingers.js \"CDMA Finger.isf\" \"CDMA Finger.xls\"\n";

// Grab the shell
var SH = new ActiveXObject( "WScript.Shell" );
if (SH == null)
{
Txt = "Unable to interact with Windows shell";
WScript.StdOut.WriteLine( Txt );

return RC;
}

var FSO = new ActiveXObject( "Scripting.FileSystemObject" );
if (FSO == null)
{
Txt = "Unable to get file system object";
WScript.StdOut.WriteLine( Txt );

return RC;
}

var Args = WScript.Arguments;
if (Args.length < 1)
{
WScript.StdOut.WriteLine( Help );

return RC;
}

var ISFFileName = WScript.Arguments( 0 );
if (ISFFileName == "")
{
Txt = "Invalid ISF file name\n\n" + Help;
WScript.StdOut.WriteLine( Txt );

return RC;
}

ISFAbsolutePath = FSO.GetAbsolutePathName( ISFFileName );
if (ISFAbsolutePath == "")
{
Txt = "Invalid ISF file name\n\n" + Help;
WScript.StdOut.WriteLine( Txt );

return RC;
}

if (Args.length == 2)
{
var XLSFileName = WScript.Arguments( 1 );
if (XLSFileName == "")
{
Txt = "Invalid Excel file name\n\n" + Help;
WScript.StdOut.WriteLine( Txt );

return RC;
}

XLSAbsolutePath = FSO.GetAbsolutePathName( XLSFileName );
if (XLSAbsolutePath == "")
{