This sample uses the AFSDK to accomplish some common tasks with the PISystem.
Requirements
The
.NET Core CLI
is referenced in this sample, and should be installed to run the sample from the command line.
Replace the placeholders in the appsettings.placeholder.json file and rename it it to appsettings.json.
This sample is written against AF 2.10.
Setting up the environment
Clone the GitHub repository
Start PI System Explorer
File > Database
New Database
Name it: Green Power Company
Ok then close
File > import from file
Select downloaded 'AF Database - Green Power Company.xml'
Select create pi points
Import the data
Navigate to new database
Enable Analysis
Sample
This sample is based off of a PI World class and it includes projects that need to be filled out and completed pojects. The completed solutions to the skeleton projects are just one way you can accomplish the tasks set for the exercise. For instructions about what is expected to be filled go go
here
. Included in this samples are tests you can run against both the completed samples and the skeleton code to be filled in to see if your code works as expected. The tests are reasonably exact in making sure it was followed, given that timestamps and values are not predetermined.
As indicated above, there is a provided AF database, 'AF Database - Green Power Company.xml', that you need to use for this sample.
Running the Automated Test
From the command line, run:
dotnet restore
dotnet test
This runs all of the tests for all completed solutions. You can also configure this command to run a subset of the tests.
dotnet restore
dotnet test --filter Category~Solution
Depending on the exercise, the test either does a unit test or an integrated test. The unit tests make sure functions behave as expected based on expected inputs and outputs, while integrated tests make sure the whole solution and the underlying functions behave as expected when run in sequence.
For the PI System landing page
ReadMe
For the OSIsoft Samples landing page
ReadMe