FORUM CTRLX AUTOMATION
ctrlX World Partner Apps for ctrlX AUTOMATION
11-13-2023 09:02 AM
Hi.
To limit tags used by VIUS, I want to use DWORD for bit actions like JOG, ENABLE, STOP etc.
It is possible but works strange.
If I connect button action to bit of DWORD and pressing/releasing long bit is set and reset correctly.
But if I pressed it only for short time bit is set but not reset.
I've attached short video presenting this problem.
Do you know solution to this???
11-13-2023 09:49 AM
Moved to corresponding forum "Smart HMI - WebIQ Designer and Server".
Could you have a look to topic "Bit access read/write from button"?
11-17-2023 09:30 AM
Can you please provide the following information:
11-17-2023 09:49 AM
Can you please explain how you are writing the value when clicking on a button? Are you using a UI Action for that? A standard one or a custom one?
Please also open the browser console by pressing F12 - is there an error shown in that case?
11-17-2023 10:46 AM
Hi, here are answers:
11-17-2023 10:59 AM
Hi,
I don't use UI Action:
After pressing F12, I don't see any error regarding OPC_UA read/write:
11-17-2023 11:31 AM
Please check the console tab, "issues" are browser recommendations only, not JavaScript console output:
At least two errors have been logged on the console:
OPC UA does not allow the user to access a bit of a word directly. The OPC UA specification (OPC 10000-3 - UA Specification Part 3 - Address Space Model 1.05.01) does not specify this as a standard data type.
As such you can only write bytes, not bits, with OPC UA. This also means that you might inadvertently overwrite other bits as well as you can only write bytes. As such for this specific purpose a method is available that will try to set the value correctly by verifying if the local value might have been changed on the server before writing it:
https://www.smart-hmi.com/user/download/deliver/docs/documentation-webiq-visuals-reference-2.15-ee64...
This might not be the cause of the issue here, but in general you should always use this function when writing bits if you want to ensure data integrity through a custom UI Action for example.
In this case the simple reason might be that if the "mouseup" event is fired, the answer from your PLC regarding the previous write for the "mousedown" action has not yet been received. OPC-UA is a networked system and things happen asynchronously.
The easiest solution here would be to simply use standard data types (i.e. bytes) and not bits as this can always cause issues because if the OPC-UA client can only send bytes and not bits other bits that might have changed between the client reading the byte, manipulating it and then sending it back might have been changed on the server already. If you really need this you can use the compareExchange function. If it is possible to use bytes you should use bytes.
This is not a limitation of WebIQ, but how OPC UA works as it does not provide direct access to bits.
11-20-2023 10:58 AM
I can reproduce the problem with an new project (independet if the item is connected to a PLC variable or not). In my option it is a different implementation for the option "Write on/off values when pressed/released" for bit and non bit access.
I have the same behaviour in the attached workaround when the function writeValue() is call without { skipSameValueCheck: true }
The attached project contains
@webiq-sk Please check the implementation for bit access in this function
11-20-2023 12:24 PM
This issue cannot be fixed with any JavaScript code as it is a frontend-agnostic issue. As pointed out is is because OPC-UA does not provide bit access so you can only set bytes. However, certain bits can have changed after you read them before sending it back so you potentially overwrite bits you don't want to set.
For this, the compareExchange method has been created which aims to workaround this.
The UI actions won't help, because they cannot prevent a data package on the way from the OPC-UA server to WebIQ to the browser from being sped up.
Also, the UI Actions use im.setValue which you can only use for virtual items as it will only change the value locally, not on the server. For that, you always have to use writeDirect and readDirect.