What i want to do: Make Tag property dynamically change (Engineering High Limit)
Problem: I have OPC tag of an Inverter MODBUS register, which is called total yield. Total yield on linearly growing value. The register has some connection issues sometimes and gives random values (2-3 times a month), which it saves in the database (for example should log value 5000, but logs value 93732 and then goes back to 5001). I cannot add static engineering high limit because there are cases where the random value is only 3000 units higher then the value, which it should't have. (I could add static engineering limit but would have to change the limit every week).
The problem is that some perspective views depend on the differential of as-stored values (from tag-history).
I want to preserve history of the Tag, so making a new one is not a possibility (if it would take too much effort from the database overwriting side)
I was trying to think of a solution, because you can only bind parameter value to tag properties (for example: Engineering High Limit)(am i right) (which makes it unable to be dynamic)
Hack solution (want feedback, consiquences, or a better solution):
- Let's say that the original OPC Tag had name "Total_Energy"
- I will go to UDT, turn off history and change the name to "Total_Yield"
- Create a Expression Tag named "Total_Energy", turn on History and write a expression which would set the quality of the tag "bad" if it's value is higher "Todays_Start_Energy_Yield" + 1000 (as it is imnpossible to generate more then a 1000 units per day)
- Implement the changes at the same time
- Tested it out and works with Tag History and Power graph (preserving old values), however i was worried because on the main db table it generates a new Tagid for new stored values.
Right now I haven't implemented this to live plant, but tested locally. Waiting for some ideas or feedback