Hello PI Squared Community,
I am writing an in-house application to show PI data on a web-page. I have managed to retrieve current snapshot values but I cannot work out how to retrieve archive values (e.g. the value 1 hour ago) nor can I get summary values (e.g. the average).
This is a very simple application and because it is on the control system side we don't want to have to install extras so I need a solution to work with standard php.
Any ideas on how to do this? I have tried searching and also converting vba type code to what I think is php code but I get an undefined method error.
For reference here is my code for retrieving the snapshot;
* The PI data request class
* This class performs the interface function between webserver pages and the PCN PI server.
* It contains several methods for getting data from PI.
// Set up the class properties.
protected $PIserverName = "xxxxx";
* Makes the connection to the PI ready for querying / updating by the website.
* @return void
public function __construct()
$this->comObjPi = new COM('PISDK.PISDK');
$this->PIserver = $this->comObjPi->Servers->Item($this->PIserverName);
* Disconnects the connection to the PI server.
* @return void
public function __destruct()
* Returns a simply formatted value back to the caller.
* @ return numeric
public function getPIValueSimple($PItag)
$this->PIpoint = $this->PIserver->PIPoints($PItag);
$this->PIdata = $this->PIpoint->Data->SnapShot()->Value."\n";
$this->PIdata= number_format($this->PIdata, 1, '.', '');