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.
PHP opc retrieving signals
I must say that I do not understand what is actually your problem. There are many things unclear in your reports.
1. You talk about "browsing" but the supplied code has nothing to do with browsing - it does subscriptions.
2. You talk about >= 20 signals but the supplied code uses just one node.
3. The DataChangeNotification handler does not contain proper error handling. You should test whether $E->Exception is not null, and if it isn't there is an error (in which case, $E->AttributeData is always null, which is probably the case you are referring to). So, in order to figure out what the error is, in case of non-null $E->Exception, you need to examine (display, print out, log..., whatever) its properties, such as (primarily) $E->Exception->Message .
4. I do not understand what you are trying to achieve with the use of threads. Please explain. If the problem is with the capacity of the communication link, using more threads is not going to magically make the link able to transfer more data.
5. In addition, all that you threads do is that they initiating the subscriptions, on the non-isolated EasyUAClient object. The OPC UA calls will get serialized anyway, so the end effect would be the same as calling making the two subscriptions sequentially, from the main thread- which is much easier.
Regards
Please Log in or Create an account to join the conversation.
<?php
class ClientEvents
{
function DataChangeNotification($Sender, $E)
{
printf("%s\n", $E->AttributeData);
}
}
class OPCWorker extends Thread
{
public function __construct($client, $clientEvents, $signal)
{
$client->SubscribeDataChange(
'opc.tcp://opcua.demo-this.com:51210/UA/SampleServer',
'nsu=http://test.org/UA/Data/;ns=2;i='.$signal,
1000
);
}
public function run()
{
while (true) {
com_message_pump(1000);
}
}
}
$client = new \COM('OpcLabs.EasyOpc.UA.EasyUAClient');
$clientEvents = new ClientEvents();
com_event_sink($client, $clientEvents, 'DEasyUAClientEvents');
$test1 = new OPCWorker($client, $clientEvents, '10853');
$test1->start();
$test2 = new OPCWorker($client, $clientEvents, '10844');
$test2->start();
while (true) {
sleep(1);
}
Please Log in or Create an account to join the conversation.
<?php
class ClientEvents
{
function DataChangeNotification($Sender, $E)
{
printf("%s\n", $E->AttributeData);
}
}
$client = new \COM('OpcLabs.EasyOpc.UA.EasyUAClient');
$clientEvents = new ClientEvents();
com_event_sink($client, $clientEvents, 'DEasyUAClientEvents');
$client->SubscribeDataChange(
'opc.tcp://opcua.demo-this.com:51210/UA/SampleServer',
'nsu=http://test.org/UA/Data/;ns=2;i=10853',
1000
);
while (true) {
com_message_pump(1000);
}
<?php
class ClientEvents
{
function DataChangeNotification($Sender, $E)
{
printf("%s\n", $E->AttributeData);
}
}
class OPCWorker extends Thread
{
public function __construct($signal)
{
$client = new \COM('OpcLabs.EasyOpc.UA.EasyUAClient');
$clientEvents = new ClientEvents();
com_event_sink($client, $clientEvents, 'DEasyUAClientEvents');
$client->SubscribeDataChange(
'opc.tcp://opcua.demo-this.com:51210/UA/SampleServer',
'nsu=http://test.org/UA/Data/;ns=2;i='.$signal,
1000
);
}
public function run()
{
while (true) {
com_message_pump(1000);
}
}
}
$test1 = new OPCWorker('10853');
$test1->start();
$test2 = new OPCWorker('10844');
$test2->start();
while (true) {
sleep(1);
}
let me know thanks
Please Log in or Create an account to join the conversation.
Please Log in or Create an account to join the conversation.
Please Log in or Create an account to join the conversation.
Please Log in or Create an account to join the conversation.
Please Log in or Create an account to join the conversation.
Please Log in or Create an account to join the conversation.
Regards
Please Log in or Create an account to join the conversation.
prototype pcb assembly china
Please Log in or Create an account to join the conversation.