M0Dark
Member
Hi,
I have a complex database in Crimson 3.0 and in one of the display pages I am trying to get a tag to show the sum of several other tags. The Tag in question here is a Float Number Tag.
7 of them are integer values sent from a modular controller, which means there is never an issue with what Crimson is seeing and it is always an integer value. I can add all of these together, multiply them by 1.0 and Crimson is happy to display the Float Value that I want to see.
My problem comes then after that I need to add a single value to this total. The source for this is a Modbus device which is addressed at Device(7).302009.Real. This device may or may not be connected and that is giving me a problem. While the device is connected I am getting a total, but with the device switched off I get a greyed out ----.
I have a flag tag which defines if this device is active or not.
I have tried to set the totalizer to use an if statement based on whether this is active or not Shortened Version down below.
Int F1:=FX1+FX2+FX3+FX4+FX5+FX6+FX7;
Float F2:=F1*1.0;
Float F3:=0;
If (FCor_Meter_Select==1)
F3:=FCor_Value;
Return F2+F3;
This doesn't work at all and the value is --- when the FCor_Meter_Select is not 1.
I have troubleshooted this as best I can and as soon as FCor_Value is null it throws the null to the return regardless of what FCor_Meter_Select is set to.
Is there a better way to do this that will not give me an error, or can I somehow set the FCor_Value tag to read 0 on error not ---?
Many thanks for your help.
I have a complex database in Crimson 3.0 and in one of the display pages I am trying to get a tag to show the sum of several other tags. The Tag in question here is a Float Number Tag.
7 of them are integer values sent from a modular controller, which means there is never an issue with what Crimson is seeing and it is always an integer value. I can add all of these together, multiply them by 1.0 and Crimson is happy to display the Float Value that I want to see.
My problem comes then after that I need to add a single value to this total. The source for this is a Modbus device which is addressed at Device(7).302009.Real. This device may or may not be connected and that is giving me a problem. While the device is connected I am getting a total, but with the device switched off I get a greyed out ----.
I have a flag tag which defines if this device is active or not.
I have tried to set the totalizer to use an if statement based on whether this is active or not Shortened Version down below.
Int F1:=FX1+FX2+FX3+FX4+FX5+FX6+FX7;
Float F2:=F1*1.0;
Float F3:=0;
If (FCor_Meter_Select==1)
F3:=FCor_Value;
Return F2+F3;
This doesn't work at all and the value is --- when the FCor_Meter_Select is not 1.
I have troubleshooted this as best I can and as soon as FCor_Value is null it throws the null to the return regardless of what FCor_Meter_Select is set to.
Is there a better way to do this that will not give me an error, or can I somehow set the FCor_Value tag to read 0 on error not ---?
Many thanks for your help.