use strict; use File::Spec; use Win32::OLE; use File::Basename; use Cwd 'abs_path'; use Win32::OLE::Const 'Microsoft Excel'; # Global variables my $IISF = 0; ############################ Get path from current script file name ############################ sub GetPathFromScript { return $Path; } ############################ Process the argument - ISF file name ############################ sub ParseArguments { } ############################ Initialize application ############################ sub Initialize { } ############################ Perform analysis (obtain cell energy data (Ec/Io) from ISF file) ############################ sub Analyze { # Number of specified tasks ==> For the same laps of Time, there are different Tasks corresponding to the measurements of different #neighbouring cells my $TasksCount = $Fields->GetFieldValue( 1 ); if ($TasksCount <= 0) { next; } my $FieldCount = $Fields->GetFieldCount(); if ($FieldCount < 2 + ($TasksCount * 19)) { next; } my $BestAll = -1000.0; my $BestCamped = -1000.0; # Process each task computing combined energy my $FI = 2; my $FO = $TasksCount * 10; for (my $t = 0; $t < $TasksCount; $t++, $FI += 10, $FO += 9) { my $CellSet = $Fields->GetFieldValue( $FI + 5 ); my $N = $Fields->GetFieldValue( $FI ); my $M = $Fields->GetFieldValue( $FI + 1 ); if ($N == 0 || $M == 0) { next; } my $Sum = $Fields->GetFieldValue( $FO + 6 ); $Sum += $Fields->GetFieldValue( $FO + 7 ); $Sum += $Fields->GetFieldValue( $FO + 8 ); $Sum += $Fields->GetFieldValue( $FO + 9 ); my $Num = $Sum - (0.1406 * $M * $N); my $Den = 0.1406 * $M * $N * $N; my $Tmp = $Num / $Den; if ($Tmp <= 0) { next; } my $Energy = 10.0 * (log( $Tmp ) / log(10.0)); # Camped? if ($CellSet == 0) { if ($Energy > $BestCamped) { $BestCamped = $Energy; # print "CellCamped, $BestCamped\n"; } } $IClient->UnregisterClient( $ClientHandle ); $IISF->CloseItemStore( $Handle ); $RC = true; return $RC; } ############################ Generate an Excel spreadsheet with the analysis results ############################ sub GenerateExcelSpreadsheet { } ############################ Populate Excel spreadsheet with analysis data ############################ sub PopulateExcelSpreadsheet { my $Sheet = shift; # Assume failure my $RC = false; $Sheet->Cells( 1, 1 )->{Value} = "Time"; $Sheet->Cells( 1, 1 )->Font->{Bold} = true; $Sheet->Cells( 1, 2 )->{Value} = "Energy"; $Sheet->Cells( 1, 2 )->Font->{Bold} = true; $Sheet->Cells( 2, 2 )->{Value} = $BestCamped; }