AnsweredAssumed Answered

PISDK with COM php.

Question asked by ggarenne on Apr 11, 2019
Latest reply on Apr 24, 2019 by ggarenne

Hello,

 

i'm working on a project and i have to call PISDK in php.

 

I want to set a value in a PiPoint but when i set it i have an error 'Parameter 0: type mismatch'

 

Here is my code:

 

$this->comObjPi = new COM('PISDK.PISDK');

 

$this->PIserver = $this->comObjPi->Servers->Item($conf['server']);

$this->PIserver->Open();

 

$this->PIpoint = $this->PIserver->PIPoints($tag);

$PIvalues = new COM('PISDK.PIValues');

$PIvalue = new COM('PISDK.PIValue');

 

try

{

    $time = $this->PIserver->ServerTime->Clone();

    $time->SetToCurrent();

    $PIvalue->TimeStamp = $time;

    $PIvalue->Value = new Variant($value, VT_R8);

    $this->PIpoint->Data->UpdateValue($PIvalue, $time);

}

catch(Exception $e)  { var_dump($e); }

 

 

Can you help me ?

 

Ok so i found that UpdateValue function need VT_VARIANT type params to be passed.

When i try to create a new variant with VT_VARIANT type, i get 'Variant type conversion failed'

 

function UpdateValue( /* VT_VARIANT [12] [in] */ $newValue, /* VT_VARIANT [12] [in] */ $TimeStamp, /* ? [29] [in] */ $MergeType, /* VT_PTR [26] [in] --> ? [29] */ &$asynchStatus ) { /* Send a single value (snapshot or archive) to PI */ }

 

 

 

Ce message a été modifié par : GEOFFREY GARENNE

Outcomes