What is the best practice to handle the following situation:
With class-based development and generic faceplate for data arrays, I have a situation where some external references are set to #IGNORE, and the results are stored in a Floating-point array. The idea being that you don't need to make a custom faceplate based on how many array parameters you are using. Everything works fine for the parameters we are using with valid values and scales.
The unused array elements contain a value of 3.40282e+38 (due to using #IGNORE) and I am attempting to display it in the faceplate, but it randomly produces the following error in DeltaV operate: The maximum length of a string has been exceeded.
The text animation is configured as follows:
From what I can see, this is no different than out-of-the-box faceplates, etc. I'm not sure if the data type (16-bit float) has anything to do with it.
To re-iterate, this is working great as a flexible solution where the class instance can be configured with up to 50 references, and the unused references set to #IGNORE but my faceplate generates an error (randomly). I just want to apply a best practice to configure this animation not to raise an error message in Operate mode, ideally without needing to use script, etc. so if a programmer wants to use this parameter in future, they only need to configure an external reference and the associated scale parameter, and the faceplate will accommodate it.
While a number of work-arounds would work (like point to a dummy_0 parameter instead of using #IGNORE) I am interested to know if the iFix/graphics can be configured to handle this situation better.
Any suggestions? Thanks community!
Add [_NOT_CONFIG_OK_] to the end of the animation which ignores giving errors otherwise you will have to add some determination on how many you have and update the datasource animation with VB logic to keep errors from occurring.
In the animation window if you click the "..." button for the Expression Builder, then click the DeltaV Tab and then select the Help on Display Parameters you will find information on this and other data modifiers that are available.
In reply to Matt Stoner:
In reply to Dave Grubwieser:
In reply to Cedric Dawnhawk:
Hey there. You are correct , there's an OUT_1_SCALE through OUT_50_SCALE.
Here's a small snippet of my logic (not showing the array here but that is besides the point) . In a nutshell my generic faceplate wants to display, for example, OUT_50.A_CVDECPT[OUT_50_SCALE] in a datalink, and not generate an error when the value in OUT_50 is really large (since the external reference parameter it gets its value from = #IGNORE)
Here's the configuration of my datalink/animation. I've tried increasing the string length to 64 characters, and got the idea from your post to set my scale to zero decimal places.
Here's the online value and the error message that is displayed:
Maybe what I'm trying to do is a bit ridiculous, but if there was a way to avoid an error message popping up without doing any extra work, that would be super useful. Using #IGNORE as a default value for external references in class instances, and setting up a generic scaled datalink using A_DECPT[xxx] that could fail when encountering that really large value but without the pesky error popup...
Also, I did try adding [_NOT_CONFIG_OK_] and I'm still getting the string length exceeded error.
Thank you!
I experimented a bit and found that if you use the .A_CVDECPT[scale parameter] field then the system formats the number (without using scientific notation) using the number of decimal points specified by scale parameter. If the resulting string is longer than 11 characters then the “The maximum length of a string ...” error message appears. The 11 character limit includes the decimal point (if present) and a leading - sign (if present). The limit is is unrelated to any datalink settings.
As an example 10000000 formatted using 2 dp gives 10000000.00 which is just acceptable. Change the number of decimal points to 3 or make it negative and an error appears as there are now 12 characters.
So as this limit appears to be internal and 3.40282E+038 has rather more than 11 characters then I don’t think you can use the .A_CVDECPT[scale parameter] field.
If it is not essential to control the decimal points, then simply using .A_CV is a possibility. This seems to also enforce a width of about 11 characters but if the number is large or small then it automatically changes to scientific notation (eg 3.40282E+038). The accuracy of other numbers seems to be limited to a total of 7 figures eg 76.9231 or 769.231.
The other choice is using .F_CV and specifying a numeric format in the datalink that sets the number of decimal points. However unless you have an extremely large limit on the maximum character length then at some point the number won’t fit in and will be truncated at left or right, depending on the text alignment. You could suppress this by animating the datalink to only be visible for numbers up to a limit.
There is a way to format all numbers large or small in scientific notation but this doesn’t look good for small ones. eg 50 appears as 5.00e+001.