Changeset 10290


Ignore:
Timestamp:
04/05/11 15:06:57 (14 years ago)
Author:
ogrimm
Message:
FADctrl publishes event rate per board
Location:
fact
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • fact/FADctrl/FAD.cc

    r10262 r10290  
    627627          continue;
    628628        }
    629         PrintMessage("Last event received %s", ctime(&S.Update.tv_sec));
     629        PrintMessage("Event rate %.1f Hz     Last event received %s", S.Rate, ctime(&S.Update.tv_sec));
    630630
    631631        // Board identification
  • fact/FADctrl/FADBoard.cc

    r10279 r10290  
    2424  Port = ServerPort;
    2525  Status.Frequency = 0;
     26  Status.Rate = 0;
    2627  Status.BoardID = 0;
    2728 
     
    5152  DIM_Status = new DimService((ID.str()+"Status").c_str(), (char *) "");
    5253  DIM_ID = new DimService((ID.str()+"BoardID").c_str(), (char *) "S", NULL, 0);
     54  DIM_Rate = new DimService((ID.str()+"RateHz").c_str(), Status.Rate);
    5355  DIM_Frequency = new DimService((ID.str()+"Frequency").c_str(), Status.Frequency);
    5456  DIM_Temp = new DimService((ID.str()+"Temperature").c_str(), (char *) "F", NULL, 0);
     
    8587  delete DIM_Status;
    8688  delete DIM_ID;
     89  delete DIM_Rate;
    8790  delete DIM_Frequency;
    8891  delete DIM_Temp;
     
    347350
    348351  char Buffer[READ_BUFFER_SIZE];
    349   unsigned int Pos = 0, Temp;
     352  unsigned int Pos = 0, Count = 0;
    350353  const PEVNT_HEADER *Header = (PEVNT_HEADER *) Buffer;
    351354  ssize_t Result;
    352355  struct sockaddr_in SocketAddress;
    353356  struct BoardStatus PrevStatus;
    354   time_t LastUpdate = 0;
    355357  int Ret;
    356358
     
    415417       
    416418        // Check if buffer starts with start_package_flag, remove data if not
    417         Temp = 0;
     419        unsigned int Temp = 0;
    418420        while (ntohs(*((unsigned short *) (Buffer+Temp))) != 0xfb01 && Temp<Pos) Temp++;
    419421        if (Temp != 0) {
     
    439441                Pnt = (PCHANNEL *) ((short *) (Channel[i] + 1) + ntohs(Channel[i]->roi));
    440442          }
    441 
    442           PrevStatus = Status;
    443443
    444444          // Wait until event thread processed the previous data and lock to avoid concurrent access in GetStatus()
     
    505505          // Prepare predicate for condition variable
    506506          Continue = false;
     507          Count++;
    507508          Unlock();
    508509         
     
    511512
    512513          // Update DIM services if necessary
    513           if (time(NULL) - LastUpdate > m->EventUpdateDelay) {
    514                 LastUpdate = time(NULL);
     514          if (Status.Update.tv_sec - PrevStatus.Update.tv_sec > m->EventUpdateDelay) {
     515
     516                // Determine event rate
     517            Status.Rate =
     518           Count / (double(Status.Update.tv_sec-PrevStatus.Update.tv_sec) + (Status.Update.tv_usec-PrevStatus.Update.tv_usec)/1000000.0);
     519            Count = 0;
    515520
    516521                if (PrevStatus.Frequency != Status.Frequency) DIM_Frequency->updateService();
    517522
     523                if (PrevStatus.Rate != Status.Rate) DIM_Rate->updateService();
     524               
    518525                if (memcmp(PrevStatus.Temp, Status.Temp, sizeof(Status.Temp)) != 0) {
    519526                  DIM_Temp->updateService(Status.Temp, sizeof(Status.Temp));
     
    528535                  DIM_ID->updateService(&Status.BoardID, sizeof(Status.BoardID));
    529536                }
     537               
     538                PrevStatus = Status;
    530539          }
    531540         
  • fact/FADctrl/FADBoard.h

    r10279 r10290  
    2828        int Socket;
    2929        pthread_mutex_t Mutex;
    30         DimService *DIM_Name, *DIM_Status, *DIM_ID, *DIM_Frequency, *DIM_Temp, *DIM_ROI, *DIM_DAC;
     30        DimService *DIM_Name, *DIM_Status, *DIM_ID, *DIM_Frequency;
     31        DimService *DIM_Rate, *DIM_Temp, *DIM_ROI, *DIM_DAC;
    3132
    3233        void ReadLoop();
     
    4849          char Message[STATUS_SIZE];
    4950          struct timeval Update;
     51          float Rate;
    5052
    5153          uint32_t TriggerID;
  • fact/FADctrl/History.txt

    r10279 r10290  
    202029/3/2011       Added Status message service for each board (removed several console messages in turn)
    2121                        Limited update rate of slow control data to 1 second or interval set by 'update'
    22 1/4/2011        Added DIM frequency service                     
     221/4/2011        Added DIM frequency service
     235/4/2011        Added DIM rate service for each board           
  • fact/tools/Edd/Edd.cc

    r10280 r10290  
    483483        }
    484484
     485        Line = new EddLineDisplay(Board+"RateHz");
     486        Line->setMinimumWidth(50);
     487    Button[i/20]->Layout()->addWidget(Line, i+7, 15, 1, 1);
     488
    485489        Line = new EddLineDisplay(Board+"Status");
    486490        Line->setMaximumWidth(150);
    487     Button[i/20]->Layout()->addWidget(Line, i+7, 15, 1, 1);
     491    Button[i/20]->Layout()->addWidget(Line, i+7, 16, 1, 1);
    488492  }
    489493}
     
    801805  // Set features of main window
    802806  setStatusBar(new QStatusBar(this));
    803   setWindowTitle("Edd - Evidence Data Display");
     807  setWindowTitle("Edd - Evidence Data Display - Node: " + QString(getenv("DIM_DNS_NODE")));
    804808  setCentralWidget(TabWidget);
    805809
Note: See TracChangeset for help on using the changeset viewer.