Closed shubhamnodered closed 1 year ago
Have you checked timeout parameters and console output? Keepalive should keep subscription alive even there are no changes.
How and from where to check for timeout parameters and console output.
I don't know @mikakaraila but changes i make in my tia portal program is clearly reflected on "UA Expert client" but in case of node-red changes stops reflecting after 2-3 minutes. So i think its more to do with node-red.
Also i make changes in tia portal program in like interval of 0.5 seconds.
If you have debug on (verbose log) then you should see all paramaters on console:
I have searched in google, in how to do verbose logging debugging in node red but haven't found any. Can you tell me how to do it? Does it have to do with"node-red-debugger" module.If so, there was no option to see debug errors in console.
Look settings.js and logging & level:
// Configure the logging output logging: { // Only console logging is currently supported console: { // Level of logging to be recorded. Options are: // fatal - only those errors which make the application unusable should be recorded // error - record errors which are deemed fatal for a particular request + fatal errors // warn - record problems which are non fatal + errors + fatal errors // info - record information about the general running of the application + warn + error + fatal errors // debug - record information which is more verbose than info + info + warn + error + fatal errors // trace - record very detailed logging + debug + info + warn + error + fatal errors // off - turn off all logging (doesn't affect metrics or audit) level: "debug", // Whether or not to include metric events in the log output metrics: false, // Whether or not to include audit events in the log output audit: false } },
@mikakaraila First of all, Thanks for being beginner friendly and I've made the changes you've suggested.
Now , i have attested the images here. What i can infer from the console if i am not wrong that earlier OPCUA client node was subscribing to the value as you can see in the screenshot-2. [As changes made in OPCUA server =111 , is also subscribed by OPCUA client node in node-red]
But after certain time, OPCUA client node stops subscribing to the value[refer screenshot-3 where [As changes made in OPCUA server =333 , is failed to subscribed by OPCUA client node in node-red[I've added ? mark]]
Although client status says active subscribing[refer screenshot-3] but changes are not visible in node-red also i pointed with '?' in screenshot.
Cannot say anything... is your flow making subscription only once at start?
Do not inject it again, once is enough. It oy have multiple subscriptions for the same items it could cause strange things.
Problem is in your flow, you cannot subscribe items again and again. It is enough to inject & create subscription once!
Error in the flow! Closed.
@mikakaraila , I don't understand by your statement --> "Problem is in your flow, you cannot subscribe items again and again. It is enough to inject & create subscription once!"
Without injecting, how can i get values at output?
Changes made at OPCUA server must be injected in node-red [OPCUA client] and for injection to be automatic in production environment, i have to provide some interval in inject node. Am i wrong?
You cannot inject subscription with 5s interval, you can inject only once as flow starts. Siemens TIA will run out of resources as you inject new subscription every 5 seconds.
Are you saying like this?
YES
But if i do this, then changes will be injected only when the flow is initiated.
But if the value of tags changed in OPCUA server(TIA portal), then it won't be reported here as i have used inject once when the flow start.
Am i wrong?
Subscription works in a way that when monitored items are added then it will automatically got value update from the server as value changes.
Perhaps you should read OPC UA basics first! https://documentation.unified-automation.com/uasdkhp/1.4.1/html/_l2_ua_subscription.html
I am aware of it sir! when i deploy the flow, first subscription is working good as shown in screenshot-1.
But the problem is when i change the value at OPCUA server(TIA portal), things are not subscribing in in node-red. why?[screenshot-2]
Note: - However, with prosys OPCUA server(your example "OPCUA_Multi_SUB.json" , OPCUA client node is perfectly subscribing in nodered for subsequent changes in OPCUA server). But same subsequent changes is not subscribed from TIA portal program. why?
One error can be that you should inject one by one nodeIds into the subscription. Test first with one variable.
@mikakaraila, So whats the deal here. With one-variable, things are working with changes. But if i use two variable then unless i make changes in both the variable's value in OPCUA server, i will not be subscribed in node-red. So, i think subscription feature only respond to changes. Right?
Does it mean if i want to create array of all the variable of PLC and read value of PLC using OPCUA subscribe feature, i will not get array at debug window(to send into SQL database) unless i make changes to all variable[as subscription feature only responds to changes]?
If i have 100 variables in PLC and i made changes to 20 variable only at OPC server[PLC], then how can i create array of 100 variable[80 unchanged variable + 20 changed variable] in node-red using subscription feature?
Use function node to loop and send items into subscription.
On Thu, Jul 6, 2023, 12:09 shubhamnodered @.***> wrote:
@mikakaraila https://github.com/mikakaraila, So whats the deal here. With one-variable, things are working with changes. But if i use two variable then unless i make changes in both the variable's value in OPCUA server, i will not be subscribed in node-red. So, i think subscription feature only respond to changes. Right?
Does it mean if i want to create array of all the variable of PLC and read value of PLC using OPCUA subscribe feature, i will not get array at debug window(to send into SQL database) unless i make changes to all variable[as subscription feature only responds to changes]?
If i have 100 variables in PLC and i made changes to 20 variable only at OPC server[PLC], then how can i create array of 100 variable[80 unchanged variable + 20 changed variable] in node-red using subscription feature?
— Reply to this email directly, view it on GitHub https://github.com/mikakaraila/node-red-contrib-opcua/issues/572#issuecomment-1623275279, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABHRYDD5IQGYJOPDLNOBZY3XOZ6EBANCNFSM6AAAAAAZ3MFRHE . You are receiving this because you were mentioned.Message ID: @.***>
Based on your suggestion, i tried but it didn''t worked
msg.topic = "multiple";
msg.payload = [];
var nodes = ['ns=3;s="SQL"."H_TotDefDrum"', 'ns=3;s="SQL"."H_TotProdDrum"'];
var payload = [];
for (var i = 0; i < nodes.length; i++) {
payload.push({ "node": nodes[i], "value": msg.payload[i] });
}
msg.payload = payload;
return msg;
Node.send(msg);
Inside loop...
On Thu, Jul 6, 2023, 12:54 shubhamnodered @.***> wrote:
Based on your suggestion, i tried but it didn''t worked
`msg.topic = "multiple"; msg.payload = [];
var nodes = ['ns=3;s="SQL"."H_TotDefDrum"', 'ns=3;s="SQL"."H_TotProdDrum"']; var payload = []; for (var i = 0; i < nodes.length; i++) { payload.push({ "node": nodes[i], "value": msg.payload[i] }); } msg.payload = payload; return msg;`
— Reply to this email directly, view it on GitHub https://github.com/mikakaraila/node-red-contrib-opcua/issues/572#issuecomment-1623379912, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABHRYDB4U5VLKRCUYDDLMJDXO2DMNANCNFSM6AAAAAAZ3MFRHE . You are receiving this because you were mentioned.Message ID: @.***>
Something wrong with msg... I am on vacation and with mobile phone.
Try to learn how to use flow & messages. Look examples OPCUA-TEST-NODES.json
On Thu, Jul 6, 2023, 13:25 shubhamnodered @.***> wrote:
I can't seem to connect to node-red. Are you aware of this?
[image: image] https://user-images.githubusercontent.com/138366751/251422284-ed09c31c-2a28-45cf-9c0b-7e8e68c13c5f.png
— Reply to this email directly, view it on GitHub https://github.com/mikakaraila/node-red-contrib-opcua/issues/572#issuecomment-1623423538, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABHRYDAGU6DURORLKB53AI3XO2HDPANCNFSM6AAAAAAZ3MFRHE . You are receiving this because you were mentioned.Message ID: @.***>
OK! Enjoy :)
Here example on second tab.
Function node: var items = []; items[0] = "ns=3;i=1000"; items[1] = "ns=3;i=1001"; items[2] = "ns=3;i=1002"; items[3] = "ns=3;i=1003"; var newmsg = {}; for (var i=0; i<items.length; i++) { newmsg.topic = items[i]; node.send(newmsg); }
In my Node-red flow, i am taking data from Siemens PLC through OPC-UA node in node-red. I'm getting data perfectly for some-time(meaning whatever changes i make in Tia portal program is also shows in node-red debug window.[Refer to screenshot -1]).
But after certain time(2-3 minutes), whatever changes i make at Tia portal program does not reflected back in node-red debug window[Refer to screenshot -2]. I don't know why?
Also, OPCUA node status is also changing from "'Active subscribing' to 'keep-alive' to 'active subscribing'..........[Refer to screenshot -3]"
I am using
Those who need my-node-red flow, i have pasted it here.
[![Screenshot 1][1]][1]
[![Screenshot 2][2]][2]
[![Screenshot 3][3]][3]