Version: 1.3.3

Overview

The PofHistorianService runs as a Windows service that communicates with the client to get the SCADA history data from the history data file. The server is built using .NET and can run only on Windows. When reading from the history data file, the service will create the index file if it does not exist.

Technologies Used#

The PofHistorianService is written in C# and targets .NET Framework 4.5.1.

Dependencies#

  • .NET Framework 4.5.1.
  • Windows 7 operating system with SP 1 or above.

Installation Instructions#

  • Login to the Windows machine in which PofHistorianService needs to be installed.
  • Create a folder PofHistorianService, (For example: C:\PofHistorianService). You can create other folder name if you wish.
  • Copy all the PofHistorianService binaries from the .zip file of the release to this folder.
  • Change the config file to make sure it is correct in the running environment.
  • Make sure you have administrator privileges.
  • Navigate to C:\PofHistorianService
  • Run the command .\pof-historian-api.exe install
  • You should get the installed successfully message.
  • The PofHistorianService windows service is installed at this point.
  • Go to the Services console in Windows.
  • Make sure the service is running. If not, start it.
  • Check the properties of the service to ensure that it is configured to start automatically.

Uninstallation Instructions#

  • Login to the Windows machine in which PofHistorianService is installed.
  • Make sure you have administrator privileges.
  • Navigate to C:\PofHistorianService.
  • Run the command .\pof-historian-api.exe uninstall
  • You should get an uninstall successful message.

Run in Console#

The service can also be run as a console app without installing the service. When debugging the service or testing, you may need to simply run the service as a console app.

  • Navigate to C:\PofHistorianService
  • Right click the app file “pof-historian-api.exe”, select “Run as administrator”.

Running in Console

Configuration#

  • Navigate to C:\PofHistorianService.
  • Open the file pof-historian-api.exe.config in the text editor of choice.
  • Update the configuration items as specified below, save and close the file. Restart the service for the new configuration to take effect.
KeyDescription
ServicePortService port number
ServerBaseUrlBase server URL that will be used by the client to send http requests e.g. https://+:.
LogFileRelativePathPath of the log files relative to the deployment directory. A path of Logs\ will create the log file in C:\PofHistorianService\Logs if the deployment directory is C:\PofHistorianService. Log file is created in text format and the rolling interval is set to a day.
LocalRequestOnlyThe flag to set if only the local requests are valid.
FileLocationThe folder name to contain the data file and index file, including the path name.
FileLocationSecondThe second folder name to contain the data file and index file, including the path name.
ConfigSqliteConnection string. Specify the connection string for the config database in SQLITE
Sample content#
<?xml version="1.0" encoding="utf-8"?>
<configuration>
...
...
...
<appSettings>
<add key="ServicePort" value="8888" />
<add key="ServerBaseUrl" value="http://+:" />
<add key="LogFileRelativePath" value="Logs\" />
<add key="LocalRequestOnly" value="false" />
<add key="FileLocation" value="D:\sincal-get-scada\file" />
<add key="FileLocationSecond" value="D:\sincal-get-scada\altfile" />
</appSettings>
<connectionStrings>
<add name="ConfigSqlite" connectionString="Data Source=.\config\config.sqlite" />
</connectionStrings>
...
...
...
</configuration>

SQLITE Database Configuration#

The SQLITE configuration can be found in the config.sqlite file within the tblNameMapping table.

tblNameMapping#

Holds the mapping between feeder name and alias/attribute.

Column NameDescription
NameFeeder name for the service API input parameter
PhasePhase information of the measurement
NomPowerFactPower factor to calculate the power via formula: P = √3 × pf × I × V
NomBusVoltsBus voltage to calculate the power via formula: P = √3 × pf × I × V
MeasuringMeasurement type
AliasMeasurement alias
AttributeMeasurement attribute name
AltAliasAlternative alias for the measurement.
AltAttributeAlternative attribute name for the measurement
Sample content#

Running in Console

note
  1. When getting power data, if alias with measuring “MW” does not exist as SCADA value, we will calculate it using the current value with measuring “AMPS” with the formula: P = √3 × pf × I × V
  2. When the first alias can not be found in the data file, the alternative alias will be used to get the data.