Applies To:
  • CitectSCADA 1.x 2.x 3.x 4.x

Summary:
If you have had a lot of experience with reports which are triggered by an event in the PLC you may at some stage been bitten by the inherent problem associated with polling for the status of the bit. Citect will run a report when it sees the trigger going from FALSE to TRUE, the problem arises when the trigger goes TRUE - FALSE - TRUE quick enough so that Citect never detects the FALSE state, in this case if your report code also resets the trigger then the report will never run again unless Citect is restarted. See also Q1058 

Solution:
A solution to this may be to use an incrementing register instead, if Citect sees that the register has incremented then it will run the report or event. Following is some Cicode to achieve this.

INT
FUNCTION
OnChange(INT nNew, INT nOld, STRING sName)
   INT bChanged;
   IF nNew <> nOld THEN
      bChanged = TRUE;
   ELSE
      bChanged = FALSE;
   END
   TagWrite(sName, nNew);
   return bChanged;
END
Report Trigger: OnChange(PLC_TAG, PLC_TAG_OLD, "PLC_TAG_OLD");

PLC_TAG is from the real PLC, PLC_TAG_OLD may be a disk PLC tag. This expression can be simplified by using a label.

If you really like this solution the let us know and it may become a standard feature.

 

Keywords:
 

Attachments