Applies To:
  • CitectSCADA 1.00, 1.01, 1.10, 1.11, 1.20, 2.00, 2.01

Summary:
Question: I need to have an event based trend. How can I do this in Citect, it seems only to be able to support time based trends? 

Solution:
Citect currently only supports time based trends, however you can get realtime event based trends by writing some Cicode and maintaining the trend data yourself. The Cicode function DspTrend() allows you to draw a trend on a page. If you gather the event data via a report or Cicode task and place into an array, you can then call DspTrend to display the event based trend on the screen. If you want to store historical data, you can write the events into a database or other device.

To gather the data, use a Cicode task or report and put the data into an array. The size of the array is determined by the required number of samples. Then call the DisplayEvenTrend function on your trend page to display the event trend, and while still on the trend page call UpdateEventTrend to update the trend display:

REAL EventData[100];
INT bNewEvent;
FUNCTION GetEventData()
   WHILE TRUE DO
      IF event just happened THEN
         TableShift(EventData, 100, 1);
         EventData[99] = PLC_Data;
         bNewEvent = 1;
      END
      Sleep(10);
      ReRead(0);
   END
END

! Display the entire trend, call this function
! on entry to page
FUNCTION DisplayEventTrend()
   DspDel(40);
   FOR I = 0 to 100 DO
      DspTrend(40, 5, EventData[i]);
   END
END
! Update the trend, call this function while
! the page is displayed.

FUNCTION UpdateEventTrend()
   IF bNewEvent THEN
      DspTrend(40, 5, EventData[99]);
      bNewEvent = FALSE;
   END
END 
 


Keywords:
 

Attachments