I am developing a UDT for a weigh scale that reports its units as an integer. So there is an OPC tag called ReportedUnits
which is an integer, interpreted as follows:
0 = g
1 = kg
2 = t
I have an expression tag simply called Units
that converts this integer into the relevant string:
switch({[.]ReportedUnits, 0, 1, 2, "g","kg","t","")
I would then like to bind this “Units” tag to the EngUnit parameter of all other weight-related values within my UDT, so that any time I see a weight, it’s shown with the units that the weigh scale is actually using. However, as I understand it, I can’t directly bind a UDT member parameter to another UDT tag value (please correct me if this is possible as it will solve my problem in a far easier way).
I know that I can bind a UDT member parameter to a UDT parent parameter, so if I had a UDT parameter “Units”, I can easily bind all my weight value EngUnit to that. But then, I just need to make sure that the UDT parameter updates if my weigh scale units change.
I found another thread that mentioned I can write to a UDT parameter, but did not specify how. I assume I need to use system.tag.writeBlocking
but I can’t work out what my path would be. Can anyone help me out with the path (or an easier way to achieve my end goal)?