YetAnotherForum
Welcome Guest Search | Active Topics | Log In | Register

PI SDK and PERL/PHP Options · View
alfredo8a
#1 Posted : Wednesday, May 04, 2011 5:15:56 PM
Rank: Newbie
Groups: Member

Joined: 4/26/2011
Posts: 1
Location: Mexico
Hi, Everybody!
I need deploy an aplicattion for

1) GET data from PI System.
2) Calculate()
3) WRITE data to PI System.

In step 1 and 2 it everething ok, I get the data and calculate new values with no problems.
But in step 3, i get an error about type mismatch.

Im using PISDK and PERL/PHP language.
My code to WRITE data in a simple form is:

PERL

use Win32::OLE;
use Win32::OLE::Variant;
use Time::HiRes qw(usleep gettimeofday);
use Data:BigGrinumper;

my $PI = Win32::OLE->new('PISDK.PISDK') or die "Error";
my $server = $PI->Servers->Item("localhost");
$server = $PI->Servers->Item("localhost");
$server->Open("localhost;UID=piuser;pwd=piuser");

$value = Variant(VT_I4, 100);
$time= Variant(VT_I4,0);
$server->PIPoints("TagToWrite")->Data->UpdateValue($value->Value,$time->Value) or die "Can't write data to PI\n";

The result of the code is:
Win32::OLE(0.1709) error 0x80020005: "Type mismatch"
in METHOD/PROPERTYGET "UpdateValue" argument 2 at ...../PERL/writepi.pl line 28
Can't write data to PI.

Does anybody have a sample of some code with the UpdateValue function?
or some experience with PISDK/PERL/PHP?
In PHP the error is like PERL, type mismatch.

Thanks in advance.

Sponsor  
 

OSIsoft vCampus is a subscription-based, online offering that consists of providing everything people need to develop applications on the PI System.
We invite you to take a "tour" of the OSIsoft Virtual Campus - also feel free to consult the FAQ  or contact OSIsoft vCampus for more details.
Shem
#2 Posted : Thursday, May 05, 2011 8:53:22 AM
Rank: Member
Groups: Member

Joined: 5/5/2011
Posts: 22
Location: Moscow
Hi!
U can use
server->PIPoints("TagToWrite")->Data->UpdateValu->ReadOnly = True
Use this before updating.
Users browsing this topic
Guest
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.