Applies To:
  • CitectSCADA 6.10, 7.00
  • VijeoCitect 6.10, 7.00
  • Facilities 6.10, 7.00
  • Nexa 6.10, 7.00

Summary:
Is there a way to monitor the Trend Backfill status using cicode?  

Solution:
By using the following cicode function, you can monitor the Trend backfill status

// Cicode sample file for determining backfill status TaskNew("START_BFSTATUS")
INT nStatus = 0 ;


// This function needs to be started as a tasknew by the user. Call the function once only until it terminates.

FUNCTION START_BFSTATUS()
nStatus = 1 ;      // Function called
     WHILE 1 DO
          IF (GetStatA()> 0 ) OR (GetStatB()> 0 ) THEN
               nStatus = 2 ;
          ELSE
               //Queues are detected to be empty
               IF nStatus = 2 THEN
                    // Something went into the queue and now the queue 
                    // is empty so be must have finished startup backfill.
                    //Function terminates after setting the value of nStatus to 3
                    nStatus = 3
                    RETURN
               END
          END  
     SleepMS ( 1000 );
     END
END

 

//  BFSTATUS function. This function is used to monitor the status value of Trend Backfilling. Can be linked to a Text property on a Graphics Page 
//  Returns :
//  0 – Function has not started
//  1 – Function running and waiting for BF to start
//  2 – Backfill has started
//  3 – Backfill has completed

INT FUNCTION BF_STATUS()
     RETURN nStatus;
END

//MsgRPC to the Trend Server to Get Data GapFillSentQueue
INT FUNCTION GetStatA()
INT hTrend= MsgOpen ( "TREND" , 0 , 0 , "Cluster_01" );
     IF hTrend<> -1 THEN
          RETURN ( StrToInt ( MsgRPC (hTrend, "ReadGapFillSentQueue" , "" , 0 )));
      END
     RETURN -1;  
END

//MsgRPC to the Trend Server to Get Data GapFillDelayQueue
INT FUNCTION GetStatB()
INT hTrend= MsgOpen ( "TREND" , 0 , 0 , "Cluster_01" );
     IF hTrend<> -1 THEN
          RETURN ( StrToInt ( MsgRPC (hTrend, "ReadGapFillDelayQueue" , "" , 0 )));
      END
     RETURN -1;  
END

// This function should only be called on the Trend Server.
INT FUNCTION ReadGapFillSentQueue();
     RETURN ( CitectInfo ( "Queue" , "TrnRdn.GapFillSentQue" , 0 ));
END

// This function should only be called on the Trend Server.
INT FUNCTION ReadGapFillDelayQueue();
     RETURN ( CitectInfo ( "Queue" , "TrnRdn.GapFillDelayQue" , 0 ))
END

 

Keywords: