Typecast Integer or numeric datatype into multistate? Multistate modbus type?
-
Is there a way to typecast numeric values to multistate, or to select a multistate Modbus data type? Creating a separate meta datapoint to convert each integer type would be very tedious. I am using the Text Renderer on integer ranges, but that datapoint is still unavailable in the multistate graphics renderer.
This is the same issue asked in 2008 "multistate instead of numeric" http://mango.serotoninsoftware.com/forum/posts/list/122.page#1277.
Another solution would be to make analog integer datatypes or text rendered analog datatypes available to the multistate graphics renderer point list pulldown.
Thanks.
-
All of the same graphics are available for numeric as for multi-state. It's just that numeric assumes a uniform distribution of values to images between the provided min and max. I assume this is not the case for your purposes?
-
In my case, the integer value I read from the modbus registers determines a status or an error message. The same datapoint may indicate battery overvoltage, undervoltage, generator start, etc. These are best mapped to text messages or, in graphical form, discrete images. Consequently, a proportional image mapping based on a min-max range is not feasible; instead, I must map each discrete integer value to an image.
If there are 100 different integer values, I don't need to map them to 100 different images; I could map them instead to a few different images that indicate the category, such as battery charging, generator failed, All OK, overvoltage, etc.
I think the fastest way to enable this function is to make the multistate graphic object display display integer datapoints, rather than restricting its pick-list only to multistate points. A better long term solution is to edit the data source to indicate that the integer value read is an enumerated datatype (multistate) rather than a count or amount.
Currently, the best work around seems to be to create a meta data point to typecast the integer to a multistate at each context update, but that adds an unnecessary layer of indirection, and is tedious if there are many such datapoints.
Thanks.
-
You can use a server side script with a if statement on the graphic view to do this. Here is an example that has a data action but I think will show you what I mean. You can probably take out the onclick and use the if statements to show the image you want. I tried to past the script but the forum took out all the important parts so here it is as an attachment
Attachment: download link
-
Thanks, I'll try that script. However, it's far more tedious to edit the script than it is to just pick the values through the GUI, so in the long term it would be best to allow the multistate graphic object to display integer datapoints.