RedLion Crimson 3.0 (Float) Data Tag error Value

M0Dark

Member
Join Date
Dec 2020
Location
Manchester
Posts
18
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.
 
Crimson will always attempt to read all of the tags referenced in a program. It will choke when it can't access a value, even if that tag isn't needed based on the program's logic. One thing to try: In the Properties screen for your program, try turning on the "Run Anyway" checkbox.
 
There may be a work around. I guess that you are directly connecting a Tag to a Modbus value, instead add a gateway block to the Modbus device, and then transfer that to a Tag. In a test I did here with no Modbus device connected, it just treated the missing Modbus value as zero. In the manual it is under Using Communications / Adding Gateway Blocks.
 

Attachments

  • Modbus values.JPG
    Modbus values.JPG
    116.8 KB · Views: 7
Got it to work by putting a program in (just: If (FCor_Meter_Select==1) NewTag:=FCor_value else NewTag:=0), as you said with the run anyway checkbox ticked. Then used the Tag from that in all the other tags etc.
Thanks.
 

Similar Topics

Hello, I'm taking in two 16 bit ints from the field via modbus, one low order and one high order to combine into their proper 32-bit form. I've...
Replies
1
Views
1,281
Hey guys, hoping someone here could give me a little advice. I'm working with a CR1000-04000 in Crimson 3.1 and I was interested in adding the...
Replies
4
Views
124
It states WinPcap must be installed for the Emulator to function. WinPcap.org states that the technology is mature with no updates planned. Am I...
Replies
3
Views
859
Following on from another thread, I just downloaded Crimson 3.2 and it now supports CR and Graphite HMIs. Time for a 'play' :-) It seems to have...
Replies
14
Views
2,023
Action On Release command Set(ConveyorPopup,ConveyorPop_1) rejected w/ string tags. SetStringTag(index, data) wants an index. How does one pass...
Replies
8
Views
960
Back
Top Bottom