I am working on a project that will dynamically change from English <=> Metric units.
The values in the PLC will be in Metric but I want to be able to view & edit values in either units.
The best solution I have come up with:
[ul]
[li]Create a two tag folders Metric/ and English/[/li]
[li]Create a tag in each folder pointing to the same OPC tag (e.g. “Metric/temperature” and “English/temperature”) [/li]
[li]Set the scalemode on the tags in the English/ folder to linear and set the scaling factors (e.g. raw 0 - 100, scaled 32-212 for C/F temperatures or raw 0-25.4, scaled 0-1 for in/mm)[/li]
[li]Create a boolean client tag “[Client]Metric” which is true if the units are Metric, false for English[/li]
[li]Create a String type Custom Property on the Root Container called “UnitsPath” with an expression if({[Client]Metric},“Metric”,“English”)[/li]
[li]Create Numeric Text Field and set its Value to an indirect tag “{1}/temperature” and ref1 set to “Root Container.UnitsPath”[/li][/ul]
This works beautifully for OPC tags. I can toggle the “[Client]Metric” tag and my Numeric Text Field changes and is writeable. A little bit of work but no complicated scripting or expressions involved.
Now for my problem:
How do I do this for Memory Tags?
Scaling seems to have no effect on Memory Tags
I can create an expression tag that scales a memory tag but it is not writable to a memory tag (It can write to an OPC tag).
I know I can do this with event scripts but it seems to me there should be a way to do this without having to resort to scripting. (I avoid scripting if possible because the electricians who will maintain the system will be completely lost.)