Please ensure Javascript is enabled for purposes of website accessibility
Powered by Zoomin Software. For more details please contactZoomin

AVEVA™ Plant SCADA

IF​.​.​. THEN ​.​.​. ELSEIF ​.​.​. ELSE ​.​.​. ENDIF and Equipment​.item Quality

IF​.​.​. THEN ​.​.​. ELSEIF ​.​.​. ELSE ​.​.​. ENDIF and Equipment​.item Quality

  • Last UpdatedJul 13, 2023
  • 1 minute read

When an equipment.item value is copied to another equipment.item of the same type, the equipment.item’s quality is also copied. This can be especially relevant when working with I/O equipment.items. For example, the following two statements copy both value and quality:

me.Attr2 = me.Attr1;

me.Attr2.value = me.Attr1.value;

If only the value needs to be copied and the equipment.item has the quality BAD, you can use a temporary variable to hold the value. For example:

Dim temp as Integer;

temp = me.Attr1;

me.Attr2 = temp;

If there is a comparison such as Attr1 <> Attr2 and one of the equipment.items has the quality BAD, then the statements within the IF control block are not executed. For example, assuming Attr1 has the quality BAD:

if me.Attr1<> me.Attr2 then

me.Attr2 = me.Attr1;

endif;

In this script, the statement me.Attr2 = me.Attr1 is not executed because Attr1 has the quality BAD and comparing a BAD quality value with a good quality value is not defined/not possible.

The recommended approach is to first verify the quality of Attr1, as shown in the following example:

if(IsBad(me.Attr1)) then

LogMessage("Attr1 quality is bad, its value is not copied to Attr2");

else

if me.Attr1<> me.Attr2 then

me.AttrA2 = me.Attr1;

endif;

endif;

An alternative method of verifying quality is to use the "==" operator:

if Me.Attr1 == TRUE then

Or, you can add the "value" property to the simplified IF THEN statement:

if Me.Attr1.value then

Using any of the above methods to verify data quality will ensure that your scripts execute correctly.

QuickScript .NET Control Structures

TitleResults for “How to create a CRG?”Also Available in