Register    Login
 
OPC Professionals
At Your Disposal
 
 
SupportOnline Forums
 

Links: Related Pages
 
Links: Related Services
 
Links: Related Support
 
Links: Related Resources
 
Online Forums

Technical support is provided through Support Forums below. Anybody can view them; you need to Register/Login to our site (see link in upper right corner) in order to Post questions. You do not have to be a licensed user.

OPC Labs team is actively monitoring the forums, and provides answers as soon as possible. For your convenience, we have also assembled a Frequently Asked Questions page.

Please do not use the Contact page for technical support.

HINT: You may use the Search feature (magnifier icon below) in the forums to locate the information you need. You can also search our entire Web site (the search box in the upper right corner of every page).

 
 
SupportSupportDiscussions (re...Discussions (re...QuickOPC-ClassicQuickOPC-ClassicQuickOPC-COM  QuickOPC-COM QuickOPC-COM and PHP [ReadMultipleItems]QuickOPC-COM and PHP [ReadMultipleItems]
Previous Previous
 
Next Next
New Post
 7/27/2010 4:11 PM
 
 Modified By OPC Labs Webmaster  on 10/3/2010 9:03:00 AM

I would like to know which type of variant does ReadMultipleItems returns to PHP?

Or it might not take the array (common) that i am sending.

Seems like I am not able to .ToString it than explode it (the same way that I use with ReadItems)

New Post
 7/28/2010 6:21 AM
 

Technically speaking, the variant on input, for arrays, should be VT_ARRAY | VT_xxxx, where VT_xxxx is an element type - the type that is accepted by a ReadItem for the same argument, or anything that can be converetd to that type. So, for example, for an input array of OPC Item IDs, the type on input should be VT_ARRAY | VT_BSTR, or convertible to it.

On ReadMultipleItems output, the type is VT_ARRAY | VT_VARIANT. The individual elements then hold interface pointers to DAVtq objects.

Each tool or language then has its own way of expressing the arrays, composing them or accessing their elements, so the above information may not be of direct use. And yes, arrays do not "per se" convert to strings. We currently do not have a specific example of how to work with arrays in PHP, but I will try to create it for you; for start, please send me (post here) your current code, so that I can investiage what is happening in there.

New Post
 7/28/2010 9:13 AM
 

This is the creation of the array... There is not much doc about the array type needed. Also, PHP support for the VARIANT type is kind of harshe...

$MultiTank = array();
foreach ($TankList as $Tank) {
$MultiTank[] = "\"R" . $Tank . "M_NIVEAU_OMRON\"";
$MultiTank[] = "\"IndMon_10_R" . $Tank . "\"";
}

$Results = OPC_TagReadMultiple($Server, 0, $MultiTank, 1);

function OPC_TagReadMultiple($OPCServer, $Source, $Tag, $ifLevel)
{
$Node = OPC_GetServer($Source);
$OPCResult = $OPCServer->ReadMultipleItemValues($Node[0], $Node[1], $Tag);

$StrResult = $OPCResult->ToString;

$ArrResult = explode(" ", $StrResult);
$ArrCount = sizeof($ArrResult);
if ($ArrCount > 3)

New Post
 7/28/2010 10:24 AM
 
 Modified By OPC Labs Technical Support  on 7/28/2010 9:32:17 PM

Here is an example that works out of the box (with our simulation server):

    $EasyDAClient = new COM("OPCLabs.EasyDAClient.5.0");
$ItemIds = new VARIANT(array("Simulation.Random", "Trends.Ramp (1 min)", "Trends.Sine (1 min)", "Simulation.Register_I4"));
$Results = $EasyDAClient->ReadMultipleItems("", "OPCLabs.KitServer", $ItemIds);
foreach ($Results as $X)
print $X->Vtq->ToString()."<br/>";

It produces following output (e.g.):

	1.25125888851588E-03 {VARTYPE(5)} @7/28/2010 6:13:40 PM; OPCQUALITY(192)
	0.667287677526474 {VARTYPE(5)} @7/28/2010 6:13:40 PM; OPCQUALITY(192)
	-0.867969703914737 {VARTYPE(5)} @7/28/2010 6:13:40 PM; OPCQUALITY(192)
	0 {VARTYPE(3)} @7/28/2010 6:13:40 PM; OPCQUALITY(192)

This is with QuickOPC-COM 5.01.274.1, and PHP 5.2.12. There may be no one-line way to convert the resulting VT_ARRAY back to normal PHP array, but accessing the elements, and the use of 'foreach', is possible, so you can always convert it to anything you like, in a loop. I have searched the Web a little and assembled a list of related links, just in case:

http://www.mail-archive.com/php-bugs@...

http://www.colorpilot.com/blog/com-ar...

http://bugs.php.net/bug.php?id=39596

http://www.phpwelt.net/handbuecher/cz...

http://www.nme.at/download/phpcon02_m...

http://osdir.com/ml/php-windows/2010-...

http://forums.devnetwork.net/viewtopi...

http://www.colorpilot.com/pdfcreatorp...

New Post
 7/28/2010 10:56 AM
 

Thank you, I appreciate!

Previous Previous
 
Next Next
SupportSupportDiscussions (re...Discussions (re...QuickOPC-ClassicQuickOPC-ClassicQuickOPC-COM  QuickOPC-COM QuickOPC-COM and PHP [ReadMultipleItems]QuickOPC-COM and PHP [ReadMultipleItems]

 
 
 
 
 

 
 
 
 
Home|Services|Products|Purchase|Downloads|Support|Resources|Company|Contact
Copyright 2007-2011 by OPC Labs Terms Of Use Privacy Statement February 5, 2012