- Thank you received: 0
Online Forums
Technical support is provided through Support Forums below. Anybody can view them; you need to Register/Login to our site (see links in upper right corner) in order to Post questions. You do not have to be a licensed user of our product.
Please read Rules for forum posts before reporting your issue or asking a question. OPC Labs team is actively monitoring the forums, and replies as soon as possible. Various technical information can also be found in our Knowledge Base. For your convenience, we have also assembled a Frequently Asked Questions page.
Do not use the Contact page for technical issues.
QuickOPC-COM and PHP [ReadMultipleItems]
Please Log in or Create an account to join the conversation.
$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()."";
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:
www.mail-archive.com/php-bugs@ ...
www.colorpilot.com/blog/com-ar ...
bugs.php.net/bug.php?id=39596
www.phpwelt.net/handbuecher/cz ...
www.nme.at/download/phpcon02_m ...
osdir.com/ml/php-windows/2010- ...
<a href=" forums.devnetwork.net/viewtopic.php?f=14&t=3599 " target="_blank" rel="nofollow"> forums.devnetwork.net/viewtopi ...
www.colorpilot.com/pdfcreatorp ...
Please Log in or Create an account to join the conversation.
$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)
Please Log in or Create an account to join the conversation.
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.
Please Log in or Create an account to join the conversation.
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)
Please Log in or Create an account to join the conversation.