UDT vs Template Expressions

So just a performance question I want to throw out there.
We have systems built utilizing UDT tags and Templates tied to them.
For these devices, we do an expression to evaluate status of the device and return an Integer to show status of the device.

I am wondering if we are better off doing the expression in the UDT where the calc is done on the Gateway side vs doing the expression in the template where it would be done client side.

Doing it in the UDT allows us to store the value in History and easily reference it for use in the clients where we aren’t using the full template for display.

Doing it in the Template means it is only being calculated when it is being actively displayed on a client.

I’m not seeing any issues, just wondering where everyone lands on best practices on something like this.

My personal preference would be to do it in the UDT (Or, common tag structure if you’re old-school like me), for the same reasons you gave.

3 Likes

I would also imagine the impact of one or even a bunch of expression tags that are only doing an integer lookup, must be very small. So then you are separating your logic for what I imagine is very improvement to the gateways performance. Presumably you might one day write a gateway script or like you said need historian on the device status and then you would have to put it on tag UDT anyways. I don’t think you are saving much in terms of computing power by separating that out.