Asle Frantzen

Start ProcessBook with different update frequencies

Blog Post created by Asle Frantzen Champion on Aug 1, 2014

Long time since since my last blog post, so I thought I'd share this little system integration trick I had to do for a customer in the T&D industry.

 

Different departments use ProcessBook for different content. The operation center is interested in fast flowing / high resolution data, such as PMU/synchro phasors, while the maintenance dept. is more interested in long term analysis for individual assets, or the whole fleet of assets. Some of the more intense PB display applications for the maintenance dept. take 20-30 seconds to load, as an example.

 

As a result we've ended up with setting up their ProcessBook installations with different data update frequencies. As you might already know, this is done by editing the Procbook.ini file in the PIPC\DAT folder - adding the following lines to the bottom of the file (number in milliseconds):

 
[Data Manager]
Timer=10000

Now our customer has asked that we merge their different ProcessBook displays and AF databases into one package. Ideally we would like to set the refresh rate for each display independently, but unfortunately that isn't possible. Instead I created two shortcuts to start ProcessBook with different update frequencies, and basically change between two Procbook.ini files containing different settings every time the program is started. Here's what I did:

  1. I didn't want to work directly in the PIPC\DAT folder, as I believe that'll require elevated permissions every time you "start" ProcessBook. Instead I looked at the current user's AppData folder, where I know a copy of Procbook.ini is placed the first time a user starts ProcessBook after installation. Here I made two copies of Procbook.ini with different names, and different configurations. For this example I use 10 and 20 seconds as update frequencies. I start with "Procbook.ini" and "Procbook_10sec.ini".
     
  2. The next step was to create a PowerShell script to do the swap between the two files, and then start ProcessBook.exe. Here's the script, which takes a parameter to determine if you want 10 or 20 seconds:
     
    param([Int32]$Seconds=10)
    $pbIni = $env:APPDATA + '\PISystem\PI-ProcessBook\en\ProcBook.ini'
    $pb20sec = $env:APPDATA + '\PISystem\PI-ProcessBook\en\ProcBook_20sec.ini'
    $pb10sec = $env:APPDATA + '\PISystem\PI-ProcessBook\en\ProcBook_10sec.ini'
    
    If ($Seconds -eq 10) 
    {
         Rename-Item $pbIni ProcBook_20sec.ini
         Rename-Item $pb10sec ProcBook.ini
    }
    Else
    {
         Rename-Item $pbIni ProcBook_10sec.ini
         Rename-Item $pb20sec ProcBook.ini
    }
    
    $path = $env:PIHOME + '\Procbook\Procbook.exe'
    & $path
    

    The script loads with the parameter "Seconds" = 10 as default.

  3. If you havent run PowerShell scripts in your computer before, you need to set the execution policy to be allowed to execute them. Run this in an elevated PowerShell prompt (Scope = LocalMachine means all users, or alternatively CurrentUser if you only want your own account to be allowed):
    Set-ExecutionPolicy RemoteSigned -Scope LocalMachine
    

     
  4. Next step is to create two shortcuts on your desktop. Since PowerShell scripts cannot be executed by double clicking them we need to work around it. The paths for the two shortcuts should be:
    C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -command "& 'C:\Path\To\Your\Script\script.ps1' -Seconds 10"
    
    C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -command "& 'C:\Path\To\Your\Script\script.ps1' -Seconds 20"
    

     
  5. The last step is just for looks, but make sure you configure the shortcuts to have the same icon as ProcessBook.exe. Go into the properties of the shortcut, click "Change icon" and browse your way into the PIPC\Procbook folder to select ProcessBook.exe.

     4747.shortcuts.jpg

 

 

Now you'll have two shortcuts on your desktop where you can quickly select between the two different data update frequencies. Might not be necessary for most users, but there are always someone who might find it useful!

Outcomes