We have created our own driver for our our software. It creates internal tags. When it updates the value for a scaled tag the value is not been scaled.
Do we have to do this in our driver? Are we calling the wrong function when we store the value?
I assume you’re updating them through writing to them, right? And what kind of driver have you created, a custom tag provider?
If you created a bunch of memory tags in a tag provider and then were updating them through writing, the scaling wouldn’t work as you’d expect: on write, the scaling is applied in reverse to the value you’re sending it, and then applied by the tag. In other words, it thinks you’re writing a pre-scaled value.
Is the scaling defined by you when you create the tag, or by the user?
One way or another there may be a way to work around this.
Sorry for the delay, I had to look this up and make sure everything traced out correctly… You should be able to get the tag, cast it to an ExecutableTag, and call “updateCurrentValue(TagValue)”. This will pass it through the configured scalar before updating the value, and storing it to the internal db.
Doing that, you shouldn’t need to scale it yourself. If you’re curious as to why it wasn’t working though, it’s probably due to the fact that the value scalar detects the datatype of the value, and casts it back to that after scaling. You’re probably passing in some sort of int type, which is why it’s getting cut off.
Scaling is not available on Memory Tags: Memory Tags are not driven by an external source such as a PLC or SQL query, so scaling will never be applied. In these scenarios, it is recommended to scale the mechanism that is writing to the Memory Tag instead.