Applies To:
  • CitectSCADA 3.x, 4.x, 5.x

Summary:
You have a large number of variables that under normal circumstances you do not want to trend, but you want a way of trending variables when you need to debug your project / plant. 

Solution:
There are a at least two of ways of viewing a graph of data.

1. DspTrend(AN, Trend, Value1, Value2 ... Value8)

This will allow you to display the trend graph on a AN point. But you will loose the data when you change pages. To get around this limitation, you could use a WinNewAt to bring up a debug page. Then define a function as below, to be run as a page entry command using tasknew.

The page that you define needs only an Animation point that is place so that the defined trend symbol is visible. This method has an irregular CPU usage, and so solution 2 is better. For example:

FUNCTION
MY_DSP()
   INT i, R, CPU;
   STRING TEMP_NAME;
   ! load in blank records to get the trend to dsplay (see Q1863)
   FOR i = 1 to 300 DO
      DspTrend(15, 3, 0);
   END
   i=0;
   TEMP_NAME = "CPU_Usage";
   WHILE TRUE DO
      R = Rand(32000);
      CPU = StrToInt(TagRead(TEMP_NAME)) * 320;
      DspTrend(15, 3, R, 15000, i, CPU);
      i=i+100;
   Sleep(1);
   END
END

2. Define Temporary Variables and use TagRead(sTag, nOffset) in a loop

Define some temporary variables in a Disk PLC, define trend tags to watch these variables. Define Some events that use TagRead(sTag, nOffset) to copy the values to these temporary variables (with the period you need).  For example:

  • define TEMP1 .... TEMP8 as variable tags (as type REAL) - these will be trended
  • define TEMP1_NAME ... TEMP_NAME8 as variable tags (as type STRING) - these will be the names of the variables that you want to trend

The best thing would be to initialize these at startup to a variable that is always zero.

  • define DEBUG as a DIGITAL that determines if you are trending
  • define TEMP1_TRN ... TEMP8_TRN as trend tags
  • define TEMP1_EVNT ... TEMP8_EVNT as events that run on the Trend server
  • define them as PERIODIC_EVENT
  • with a period that you want to trend at
  • a trigger on DEBUG
  • and the action TEMP1 = TagRead(TEMP1_NAME)
  • when you set TEMP1_NAME to a variable Tag Name and DEBUG to TRUE, you will have a non-zero trend that you can display on your trend page. (Be careful to set each of the TEMP_NAME variables before you set DEBUG, otherwise you will get a whole heap of alarms)

This method has a very steady CPU usage, and so is the preferred solution

 

Keywords:
 

Attachments