Toggle Bool in UDT switches back


I set up some UDT's with dervived tags from the JSON Source.
When using indirect bindings with bidirectional enabled in a popup, i'm running into issues:

When I toggle a bit in the udt to true via for example a Toggleswitch, the value doesnt always get written and it resets to the old value.
I have tried by changing the tag group settings for both the derived and the source tag with optimistic write, read after write etc.

What could I be doing wrong?
In some instances the value even keeps switching true/false for a few cycles.
How do i stop this? The PLC doesn't write any values to those items.

How are you writing to the tags? If it's with a script please provide the script in preformatted text and where the script is located. If it's with a binding, what kind of binding.

Ignition Version, Vision or Perspective?

This is the issue. Every time you write to any of these derived tags, Ignition has to write the whole structure to the PLC. (Because that is all it knows about.)

Optimistic writes helps when a single write request contains many elements of the same UDT (multiple elements in .writeBlocking, or multiple writes back to back), as it briefly pauses to assemble all into a single UDT write.

Random writes from bidirectional bindings will each trigger a complete UDT write, which can pile up in the comms. Your UI elements should have their own OPC items that work directly with the PLC's inner elements. If they can.

1 Like

Make sure the Tag Group these tags belong to has Optimistic Writes enabled.

I believe the reason is that my analog value is updating every PLC Cycle and therefore there are alot of updates to the JSON -> Interfering with the writes
Would it be better to have multiple JSON's? Now I have Commands, Status, Settings in one JSON.
Would it be better to split it into 3 JSON's for one UDT or to have each individual tag with an OPC connection -> You can disable the ones you dont need in HMI.

Do you mean for the entire UDT or for the Derived tags (JSON get & Set) or for the Source?
I tried various combinations but I can't get it to consistantly work. In some occasions the bit keeps toggling for a few times. Especially if you click 2 toggles fast from the same JSON.

Part of the reason is probably because the PLC keeps updating the value of the analog input so the whole JSON gets updated => Writing is not always succesfull.

Is it not done to make a JSON for Statusses and Commands?
Should I split it up and make a Source for the Write+read parts of the UDT and a JSON for the readonly (Status) parts?
Or would it be even better to have individual connections for the Write + read parts and only a JSON for the read only parts?

I managed to get it working but still one more question:

My UDT has members who utilize JSON Set/Get with 1 Source.
The Source (OPC connection) has a tag group with Direct (Rate 1000) with data mode subscribed and optimistic writes.

On the popup I put all the commands on a custom property with an indirect tag binding with bidirectional on.
The items (button, checkbox, slider) are connected with a property binding with bidirectional enabled.
Now the problem is that when you for example toggle a Checkbox it will go 'ON' and then 'OFF' and then 'ON' again. You can see the same when looking at the tags in the tag browser, in the PLC it goes ON and stays on.

If I enable the check 'Allow Back-fill Data' on the Tag Provider in the gateway then it does not happen but the rest of the visual connections take a while to update after it.

For example toggle button for Manual & Auto => Colour change from green to yellow is very delayed when compared to not checking it.