Commit c8dd42c4 authored by Georg Auzinger's avatar Georg Auzinger
Browse files

some makefile tweaks and an update to integratedtester

parent b0bda493
......@@ -23,7 +23,7 @@ else
endif
ifneq ("$(wildcard $(USBINSTDIR))","")
DEPENDENCIES := ../Ph2_USBInstDriver $(DEPENDENCIES)
#DEPENDENCIES := ../Ph2_USBInstDriver $(DEPENDENCIES)
USBINSTINSTALLED = yes
USBINSTINSTRUCTIONS =
else
......
......@@ -8,3 +8,4 @@ pulseshape
cmtest
commission
fpgaconfig
integratedtester
......@@ -100,7 +100,7 @@ print:
@echo 'Amc13 SW installed:' $(AMC13INSTALLED)
@echo 'Antenna installed:' $(ANTENNAINSTALLED)
@echo 'Ph2_USBInstDriver installed:' $(USBINSTLIBINSTALLED)
@echo 'ZXMQ installed:' $(ZMQINSTALLED)
@echo 'ZeroMQ installed:' $(ZMQINSTALLED)
@echo '****************************'
integratedtester: integratedtester.cc
......
......@@ -32,11 +32,11 @@
// #endif
#ifdef __ZMQ__
#include "../../Ph2_USBInstDriver/Utils/zmqutils.h"
#include "../Utils/AppLock.cc"
#include "../../Ph2_USBInstDriver/HMP4040/HMP4040Controller.h"
#include "../../Ph2_USBInstDriver/HMP4040/HMP4040Client.h"
using namespace Ph2_UsbInst;
#include "../../Ph2_USBInstDriver/Utils/zmqutils.h"
#include "../Utils/AppLock.cc"
#include "../../Ph2_USBInstDriver/HMP4040/HMP4040Controller.h"
#include "../../Ph2_USBInstDriver/HMP4040/HMP4040Client.h"
using namespace Ph2_UsbInst;
#endif
using namespace Ph2_HwDescription;
......@@ -48,16 +48,16 @@ INITIALIZE_EASYLOGGINGPP
// need this to reset terminal output
const std::string rst("\033[0m");
const std::string rst ("\033[0m");
// Typedefs for Containers
typedef std::map<std::string, double> HMP4040_currents;
typedef std::map<double, std::string> HMP4040_voltages;
typedef std::pair< time_t , HMP4040_currents> HMP4040_measurement;
typedef std::pair< time_t , HMP4040_currents> HMP4040_measurement;
// generic tokenize string function - blatantly copied from G.Auzinger
std::vector<std::string> tokenize_input( std::string& cInput , const char* cSeperator)
std::vector<std::string> tokenize_input ( std::string& cInput , const char* cSeperator)
{
std::vector<std::string> cOutput;
......@@ -69,234 +69,249 @@ std::vector<std::string> tokenize_input( std::string& cInput , const char* cSepe
return cOutput;
}
// function to return home directory
// function to return home directory
std::string getHomeDirectory()
{
char buffer[256];
std::string currentDir = getcwd(buffer, sizeof(buffer));
std::vector<std::string> directories = tokenize_input( currentDir , "/");
std::string currentDir = getcwd (buffer, sizeof (buffer) );
std::vector<std::string> directories = tokenize_input ( currentDir , "/");
std::string homeDir = "/" + directories[0] + "/" + directories[1];
return homeDir;
}
// function to create bash script which launches the HMP4040 server in a tmux session called HMP4040_Server
void create_HMP4040server_tmuxSession(std::string pHostname = "localhost" , int pZmqPortNumber = 8081 , int pHttpPortNumber=8080 , int pMeasureInterval_s = 2 )
void create_HMP4040server_tmuxSession (std::string pHostname = "localhost" , int pZmqPortNumber = 8081 , int pHttpPortNumber = 8080 , int pMeasureInterval_s = 2 )
{
char buffer[256];
std::string currentDir = getcwd(buffer, sizeof(buffer));
std::string currentDir = getcwd (buffer, sizeof (buffer) );
std::string baseDirectory = getHomeDirectory() + "/Ph2_USBInstDriver";
// create bash script to launch HMP4040 sessions
sprintf(buffer, "%s/start_HMP4040.sh",baseDirectory.c_str() );
ofstream starterScript( buffer );
// create bash script to launch HMP4040 sessions
sprintf (buffer, "%s/start_HMP4040.sh", baseDirectory.c_str() );
ofstream starterScript ( buffer );
starterScript << "#!/bin/bash" << std::endl;
// check if the tmux session with the name HMP4040_Server already exists... if it doesn't create one with that name.
starterScript << "SESSION_NAME=HMP4040_Server" << std::endl << std::endl ;
starterScript << "tmux list-session 2>&1 | grep -q \"^$SESSION_NAME\" || tmux new-session -s $SESSION_NAME -d" << std::endl;
starterScript << "SESSION_NAME=HMP4040_Server" << std::endl << std::endl ;
starterScript << "tmux list-session 2>&1 | grep -q \"^$SESSION_NAME\" || tmux new-session -s $SESSION_NAME -d" << std::endl;
// send chdir via tmux session
sprintf(buffer, "tmux send-keys -t $SESSION_NAME \"cd %s\" Enter" , baseDirectory.c_str() );
starterScript << buffer << std::endl << std::endl;
sprintf (buffer, "tmux send-keys -t $SESSION_NAME \"cd %s\" Enter" , baseDirectory.c_str() );
starterScript << buffer << std::endl << std::endl;
// set-up environment for Ph2_USB_InstDriver
starterScript << "tmux send-keys -t $SESSION_NAME \". ./setup.sh\" Enter" << std::endl;
// launch HMP4040 server
sprintf(buffer, "tmux send-keys -t $SESSION_NAME \"lvSupervisor -r %d -p %d -i %d\" Enter" , pZmqPortNumber, pHttpPortNumber , pMeasureInterval_s ) ;
starterScript << buffer << std::endl;
starterScript << "tmux send-keys -t $SESSION_NAME \". ./setup.sh\" Enter" << std::endl;
// launch HMP4040 server
sprintf (buffer, "tmux send-keys -t $SESSION_NAME \"lvSupervisor -r %d -p %d -i %d\" Enter" , pZmqPortNumber, pHttpPortNumber , pMeasureInterval_s ) ;
starterScript << buffer << std::endl;
starterScript.close();
}
// check if the HMP4040 server has been launched
// check if the HMP4040 server has been launched
// if not launch it in a tmux session using a bask script created by create_HMP4040server_tmuxSession
int launch_HMP4040server( std::string pHostname = "localhost" , int pZmqPortNumber = 8081 , int pHttpPortNumber=8080, int pMeasureInterval_s = 2 )
int launch_HMP4040server ( std::string pHostname = "localhost" , int pZmqPortNumber = 8081 , int pHttpPortNumber = 8080, int pMeasureInterval_s = 2 )
{
#ifdef __ZMQ__
LOG (INFO) << "Check if HMP4040 server is not launched and if so launch it." ;
char buffer[256];
std::string currentDir = getcwd(buffer, sizeof(buffer));
std::string baseDirectory = getHomeDirectory() + "/Ph2_USBInstDriver";
// first check if process if running
//before I do anything else, try to find an existing lock and if so, terminate
std::stringstream cMessage;
cMessage << "THttpServer port: " << std::to_string (pHttpPortNumber) << " ZMQ port: " << pZmqPortNumber << std::endl;
AppLock* cLock = new AppLock ("/tmp/lvSupervisor.lock", cMessage.str() );
// server already running
if (cLock->getLockDescriptor() < 0)
{
//might as well retreive the info before quitting!
std::string cInfo = cLock->get_info();
LOG (INFO) << "Retreived the following parameters from the info file: " << cInfo;
LOG (INFO) << "HMP4040 server already running .... so do nothing!";
delete cLock;
exit (0);
}
else
{
// have to do this here because actually lvSupervisor attempts to access the LOCK file as well...
delete cLock;
LOG (INFO) << "HMP4040 server not running .... so try and launch it.";
// launch the server in the background with nohup... probably not the smartest way of doing this but the only way I know how without using screen/tmux
// // sprintf(cmd, "nohup bin/lvSupervisor -r %d -p %d -i %d 0< /dev/null", pZmqPortNumber, pHttpPortNumber, cMeasureInterval_s);
// nohup has a problem that i cannot seem to make it ignore std_in ... which seems to cause the server to crash/time-out ...
// so do this with tmux instead
create_HMP4040server_tmuxSession(pHostname , pZmqPortNumber, pHttpPortNumber, pMeasureInterval_s );
char cmd[120];
sprintf(cmd , ". %s/start_HMP4040.sh" , baseDirectory.c_str() );
system(cmd);
// start monitoring the voltages and currents on the HMP4040
HMP4040Client* cClient = new HMP4040Client (pHostname, pZmqPortNumber);
cClient->StartMonitoring();
std::this_thread::sleep_for (std::chrono::seconds (pMeasureInterval_s*2) );
delete cClient;
}
#ifdef __ZMQ__
LOG (INFO) << "Check if HMP4040 server is not launched and if so launch it." ;
char buffer[256];
std::string currentDir = getcwd (buffer, sizeof (buffer) );
std::string baseDirectory = getHomeDirectory() + "/Ph2_USBInstDriver";
/*if(0 == system("pidof -x lvSupervisor > /dev/null")) //lvSupervisor is running.
{
LOG (INFO) << "HMP4040 server already running .... so do nothing!";
}
else //vSupervisor is not running.
{
char cmd[120];
//LOG (DEBUG) << "Current working directory is : " << cmd ;
LOG (INFO) << "HMP4040 server not running .... so try and launch it.";
// launch the server in the background with nohup... probably not the smartest way of doing this but the only way I know how without using screen/tmux
// // sprintf(cmd, "nohup bin/lvSupervisor -r %d -p %d -i %d 0< /dev/null", pZmqPortNumber, pHttpPortNumber, cMeasureInterval_s);
// system(cmd);
// nohup has a problem that i cannot seem to make it ignore std_in ... which seems to cause the server to crash/time-out ...
// so do this with tmux instead
create_HMP4040server_tmuxSession(pHostname , pZmqPortNumber, pHttpPortNumber, pMeasureInterval_s );
sprintf(cmd , ". %s/start_HMP4040.sh" , baseDirectory.c_str() );
system(cmd);
// start monitoring the voltages and currents on the HMP4040
HMP4040Client* cClient = new HMP4040Client (pHostname, pZmqPortNumber);
cClient->StartMonitoring();
std::this_thread::sleep_for (std::chrono::seconds (pMeasureInterval_s*2) );
delete cClient;
}*/
#endif
// first check if process if running
//before I do anything else, try to find an existing lock and if so, terminate
AppLock* cLock = new AppLock ("/tmp/lvSupervisor.lock" );
// server already running
if (cLock->getLockDescriptor() < 0)
{
//might as well retreive the info before quitting!
std::string cInfo = cLock->get_info();
LOG (INFO) << "Retreived the following parameters from the info file: " << cInfo;
LOG (INFO) << "HMP4040 server already running .... so do nothing!";
delete cLock;
//TODO: tokenize the cInfo string to recover the port numbers so the client can be smart enough to connect to the correct port!
//TODO: maybe pass the ports as references so they can be passed on in main()?
//exit (0);
}
else
{
// have to do this here because actually lvSupervisor attempts to access the LOCK file as well...
delete cLock;
LOG (INFO) << "HMP4040 server not running .... so try and launch it.";
// launch the server in the background with nohup... probably not the smartest way of doing this but the only way I know how without using screen/tmux
// // sprintf(cmd, "nohup bin/lvSupervisor -r %d -p %d -i %d 0< /dev/null", pZmqPortNumber, pHttpPortNumber, cMeasureInterval_s);
// nohup has a problem that i cannot seem to make it ignore std_in ... which seems to cause the server to crash/time-out ...
// so do this with tmux instead
create_HMP4040server_tmuxSession (pHostname , pZmqPortNumber, pHttpPortNumber, pMeasureInterval_s );
char cmd[120];
sprintf (cmd , ". %s/start_HMP4040.sh" , baseDirectory.c_str() );
system (cmd);
// start monitoring the voltages and currents on the HMP4040
HMP4040Client* cClient = new HMP4040Client (pHostname, pZmqPortNumber);
cClient->StartMonitoring();
std::this_thread::sleep_for (std::chrono::seconds (pMeasureInterval_s * 2) );
delete cClient;
}
/*if(0 == system("pidof -x lvSupervisor > /dev/null")) //lvSupervisor is running.
{
LOG (INFO) << "HMP4040 server already running .... so do nothing!";
}
else //vSupervisor is not running.
{
char cmd[120];
//LOG (DEBUG) << "Current working directory is : " << cmd ;
LOG (INFO) << "HMP4040 server not running .... so try and launch it.";
// launch the server in the background with nohup... probably not the smartest way of doing this but the only way I know how without using screen/tmux
// // sprintf(cmd, "nohup bin/lvSupervisor -r %d -p %d -i %d 0< /dev/null", pZmqPortNumber, pHttpPortNumber, cMeasureInterval_s);
// system(cmd);
// nohup has a problem that i cannot seem to make it ignore std_in ... which seems to cause the server to crash/time-out ...
// so do this with tmux instead
create_HMP4040server_tmuxSession(pHostname , pZmqPortNumber, pHttpPortNumber, pMeasureInterval_s );
sprintf(cmd , ". %s/start_HMP4040.sh" , baseDirectory.c_str() );
system(cmd);
// start monitoring the voltages and currents on the HMP4040
HMP4040Client* cClient = new HMP4040Client (pHostname, pZmqPortNumber);
cClient->StartMonitoring();
std::this_thread::sleep_for (std::chrono::seconds (pMeasureInterval_s*2) );
delete cClient;
}*/
#endif
return 0;
}
// check that the currents drawn on the low voltage lines of the hybrid are within the "normal" range
HMP4040_measurement get_HMP4040currents( std::string pHostname = "localhost" , int pZmqPortNumber = 8081 , int pHttpPortNumber=8080 )
HMP4040_measurement get_HMP4040currents ( std::string pHostname = "localhost" , int pZmqPortNumber = 8081 , int pHttpPortNumber = 8080 )
{
HMP4040_measurement cMeasurement;
HMP4040_currents cCurrents ;
HMP4040_voltages cVoltages = { {5.0,"pLVDS"} , {5.0,"nLVDS"} , {3.3,"VREG"} , {1.2,"CBC"}};
HMP4040_measurement cMeasurement;
HMP4040_currents cCurrents ;
HMP4040_voltages cVoltages = { {5.0, "pLVDS"} , {5.0, "nLVDS"} , {3.3, "VREG"} , {1.2, "CBC"}};
#ifdef __ZMQ__
HMP4040Client* cClient = new HMP4040Client (pHostname, pZmqPortNumber);
int iterations = 0 ;
// get the latest reading from the logged using the HMP4040 monitoring function.
cClient->GetLatestReadValues();
MeasurementValues cValues = cClient->fValues;
cMeasurement.first = cValues.fTimestamp;
for( int i = 0 ; i < 4 ; i+=1 )
{
auto search = cVoltages.find(cValues.fVoltages.at (i));
if(search != cVoltages.end()) {
cCurrents.insert(std::pair<std::string,double>(search->second , cValues.fCurrents.at(i)*1e3 ));
}
}
cMeasurement.second = cCurrents;
delete cClient;
#endif
#ifdef __ZMQ__
HMP4040Client* cClient = new HMP4040Client (pHostname, pZmqPortNumber);
int iterations = 0 ;
// get the latest reading from the logged using the HMP4040 monitoring function.
cClient->GetLatestReadValues();
MeasurementValues cValues = cClient->fValues;
cMeasurement.first = cValues.fTimestamp;
for ( int i = 0 ; i < 4 ; i += 1 )
{
auto search = cVoltages.find (cValues.fVoltages.at (i) );
if (search != cVoltages.end() )
cCurrents.insert (std::pair<std::string, double> (search->second , cValues.fCurrents.at (i) * 1e3 ) );
}
cMeasurement.second = cCurrents;
delete cClient;
#endif
return cMeasurement;
}
bool check_CurrentConsumption(Tool pTool , int pNCBCs = 2 , std::string pHostname = "localhost" , int pZmqPortNumber = 8081 , int pHttpPortNumber=8080 , int pMeasureInterval_s = 2 )
bool check_CurrentConsumption (Tool pTool , int pNCBCs = 2 , std::string pHostname = "localhost" , int pZmqPortNumber = 8081 , int pHttpPortNumber = 8080 , int pMeasureInterval_s = 2 )
{
double vLVDS = 5.0 ;
double vRegulator = 3.3 ;
double vCBC = 1.2 ;
//nominal currents for the 4 different low voltage lines on the hybrid : all in mA
//nominal current drawn by one CBC
double ncCBC = 60;
HMP4040_currents cCurrentLimits = { {"pLVDS",14.0} , {"nLVDS",14.0} , {"VREG",160.0} , {"CBC",ncCBC*pNCBCs}};
double vLVDS = 5.0 ;
double vRegulator = 3.3 ;
double vCBC = 1.2 ;
//nominal currents for the 4 different low voltage lines on the hybrid : all in mA
//nominal current drawn by one CBC
double ncCBC = 60;
HMP4040_currents cCurrentLimits = { {"pLVDS", 14.0} , {"nLVDS", 14.0} , {"VREG", 160.0} , {"CBC", ncCBC * pNCBCs}};
std::vector<std::string> cChannelNames = { "pLVDS" , "nLVDS" , "VREG" , "CBC"};
int chkLVDS=0;
int chkRegulator=0;
int chkCBC=0;
int chkCurrent = 0;
int cNumReads = 3;
#ifdef __ZMQ__
std::string message;
int iterations = 0 ;
// get the latest reading from the logged using the HMP4040 monitoring function.
HMP4040_measurement cMeasurement = get_HMP4040currents( pHostname , pZmqPortNumber, pHttpPortNumber );
time_t cTimeStamp = cMeasurement.first;
HMP4040_currents cCurrentsMeasured = cMeasurement.second;
int cNumTimes_limitReached = 0 ;
do
int chkLVDS = 0;
int chkRegulator = 0;
int chkCBC = 0;
int chkCurrent = 0;
int cNumReads = 3;
#ifdef __ZMQ__
std::string message;
int iterations = 0 ;
// get the latest reading from the logged using the HMP4040 monitoring function.
HMP4040_measurement cMeasurement = get_HMP4040currents ( pHostname , pZmqPortNumber, pHttpPortNumber );
time_t cTimeStamp = cMeasurement.first;
HMP4040_currents cCurrentsMeasured = cMeasurement.second;
int cNumTimes_limitReached = 0 ;
do
{
message = "";
bool limitReached = false ;
for (auto channelName : cChannelNames )
{
message = "";
bool limitReached = false ;
for (auto channelName : cChannelNames )
//auto cCurrentMeasurement = cCurrentLimits.at("pLVDS");
auto srch_cLimits = cCurrentLimits.find (channelName);
if (srch_cLimits != cCurrentLimits.end() )
{
//auto cCurrentMeasurement = cCurrentLimits.at("pLVDS");
auto srch_cLimits = cCurrentLimits.find(channelName);
if(srch_cLimits != cCurrentLimits.end())
auto srch_cMeasurements = cCurrentsMeasured.find (channelName);
if ( srch_cMeasurements != cCurrentsMeasured.end() )
{
auto srch_cMeasurements = cCurrentsMeasured.find(channelName);
if( srch_cMeasurements != cCurrentsMeasured.end() )
{
double deviationFromNominalValue = std::fabs(srch_cLimits->second - srch_cMeasurements->second)/srch_cLimits->second ;
limitReached = ( deviationFromNominalValue > 0.33 ) ? true : false ;
char buffer[120];
sprintf(buffer, "# Current measured on %s = %.3f mA.\n" , (srch_cMeasurements->first).c_str() , (double)(srch_cMeasurements->second) );
message += buffer;
//LOG (INFO) << srch_cLimits->first << " : " << srch_cLimits->second ;
//LOG (INFO) << srch_cMeasurements->first << " : " << srch_cMeasurements->second;
}
double deviationFromNominalValue = std::fabs (srch_cLimits->second - srch_cMeasurements->second) / srch_cLimits->second ;
limitReached = ( deviationFromNominalValue > 0.33 ) ? true : false ;
char buffer[120];
sprintf (buffer, "# Current measured on %s = %.3f mA.\n" , (srch_cMeasurements->first).c_str() , (double) (srch_cMeasurements->second) );
message += buffer;
//LOG (INFO) << srch_cLimits->first << " : " << srch_cLimits->second ;
//LOG (INFO) << srch_cMeasurements->first << " : " << srch_cMeasurements->second;
}
}
// wait for 5s before checking for a new value
std::this_thread::sleep_for (std::chrono::seconds (pMeasureInterval_s*2) );
// check for a new value
cMeasurement = get_HMP4040currents( pHostname , pZmqPortNumber, pHttpPortNumber );
cCurrentsMeasured = cMeasurement.second;
if( cTimeStamp < cMeasurement.first) iterations++;
cTimeStamp = cMeasurement.first;
if( limitReached){ cNumTimes_limitReached++; LOG (INFO) << BOLDRED << "Nominal current consumption limits exceeded!!" << rst ; }
}while( iterations < cNumReads);
message += "#";
pTool.AmmendReport(message);
return ( cNumTimes_limitReached >= 2 ) ? false : true ;
#else
return true;
#endif
}
// wait for 5s before checking for a new value
std::this_thread::sleep_for (std::chrono::seconds (pMeasureInterval_s * 2) );
// check for a new value
cMeasurement = get_HMP4040currents ( pHostname , pZmqPortNumber, pHttpPortNumber );
cCurrentsMeasured = cMeasurement.second;
if ( cTimeStamp < cMeasurement.first) iterations++;
cTimeStamp = cMeasurement.first;
if ( limitReached)
{
cNumTimes_limitReached++;
LOG (INFO) << BOLDRED << "Nominal current consumption limits exceeded!!" << rst ;
}
}
while ( iterations < cNumReads);
message += "#";
pTool.AmmendReport (message);
return ( cNumTimes_limitReached >= 2 ) ? false : true ;
#else
return true;
#endif
}
// check that the CBC registers can be written
// tool tries to write 2 bit patterns (0xAA , 0x55) to the CBCs and checks how many write operations have failed
bool check_Registers(Tool pTool)
// check that the CBC registers can be written
// tool tries to write 2 bit patterns (0xAA , 0x55) to the CBCs and checks how many write operations have failed
bool check_Registers (Tool pTool)
{
// first check that the registers could be read/written to correctly
// first check that the registers could be read/written to correctly
RegisterTester cRegisterTester;
cRegisterTester.Inherit (&pTool);
LOG(INFO) << "Running registers testing tool ... ";
LOG (INFO) << "Running registers testing tool ... ";
cRegisterTester.TestRegisters();
cRegisterTester.PrintTestReport();
// once we've finished checking the registers reload the default values into the CBCs
cRegisterTester.ReconfigureRegisters();
// this was here to check that the reconfiguration worked...
//cRegisterTester.dumpConfigFiles();
//cRegisterTester.dumpConfigFiles();
//and now get the results (pass/fail) of the register test
bool cRegTest = cRegisterTester.PassedTest();
std::string line = cRegTest ? ("# Register test passed.") : ("# Register test failed : " + std::to_string(cRegisterTester.GetNumFails()) + " registers could not be written to.") ;
cRegisterTester.AmmendReport( line );
std::string line = cRegTest ? ("# Register test passed.") : ("# Register test failed : " + std::to_string (cRegisterTester.GetNumFails() ) + " registers could not be written to.") ;
cRegisterTester.AmmendReport ( line );
return cRegTest;
}
// perform the CBC Vplus, Voffset calibration
void perform_Calibration(Tool pTool)
// perform the CBC Vplus, Voffset calibration
void perform_Calibration (Tool pTool)
{
Calibration cCalibration;
cCalibration.Inherit (&pTool);
......@@ -307,83 +322,83 @@ void perform_Calibration(Tool pTool)
cCalibration.SaveResults();
cCalibration.dumpConfigFiles();
}
// find the shorts on the DUT
bool check_Shorts(Tool pTool , std::string pHWFile , uint32_t cMaxNumShorts)
// find the shorts on the DUT
bool check_Shorts (Tool pTool , std::string pHWFile , uint32_t cMaxNumShorts)
{
ShortFinder cShortFinder;
ShortFinder cShortFinder;
cShortFinder.Inherit (&pTool);
cShortFinder.ConfigureHw();
//reload the calibration values for the CBCs
//cShortFinder.ReconfigureRegisters();
// I don't think this is neccesary ... but here for now
cShortFinder.ConfigureVcth(0x78);
cShortFinder.ConfigureVcth (0x78);
cShortFinder.Initialize();
cShortFinder.FindShorts();
cShortFinder.SaveResults();
uint32_t cNShorts = cShortFinder.GetNShorts() ;
uint32_t cNShorts = cShortFinder.GetNShorts() ;
char line[120];
sprintf(line, "# %d shorts found on hybrid = %d" , cNShorts );
cShortFinder.AmmendReport(line);
cShortFinder.AmmendReport( ( cNShorts <= cMaxNumShorts) ? ("# Shorts test passed.") : ("# Shorts test failed.") );
sprintf (line, "# %d shorts found on hybrid = %d" , cNShorts );
cShortFinder.AmmendReport (line);
cShortFinder.AmmendReport ( ( cNShorts <= cMaxNumShorts) ? ("# Shorts test passed.") : ("# Shorts test failed.") );
LOG (INFO) << GREEN << "\t\t" + std::to_string(cNShorts) + " shorts found on hybrid." << rst ;
LOG (INFO) << GREEN << "\t\t" + std::to_string (cNShorts) + " shorts found on hybrid." << rst ;
return ( cNShorts <= cMaxNumShorts) ? true : false;
}
// measure the occupancy on the TOP/BOTTOM pads of the DUT
void perform_OccupancyMeasurment(Tool pTool , std::string pHWFile )
// measure the occupancy on the TOP/BOTTOM pads of the DUT
void perform_OccupancyMeasurment (Tool pTool , std::string pHWFile )
{
LOG (INFO) << "Starting noise occupancy test." ;
LOG (INFO) << "Starting noise occupancy test." ;
HybridTester cHybridTester;
cHybridTester.Inherit (&pTool);
cHybridTester.ConfigureHw();
cHybridTester.Initialize();
// re-configure CBC regsiters with values from the calibration
// re-configure CBC regsiters with values from the calibration
//cHybridTester.ReconfigureCBCRegisters();
// I don't think this is neccesary ... but here for now
cHybridTester.ConfigureVcth(0x78);
cHybridTester.ConfigureVcth (0x78);
// measure occupancy
// measure occupancy
cHybridTester.Measure();
// display noisy/dead channels
cHybridTester.DisplayNoisyChannels();
cHybridTester.DisplayDeadChannels();
// save results
// save results
cHybridTester.SaveResults();
char line[120];
sprintf(line, "# Top Pad Occupancy = %.2f ± %.3f" , cHybridTester.GetMeanOccupancyTop() , cHybridTester.GetRMSOccupancyTop() );
cHybridTester.AmmendReport(line);
sprintf(line, "# Bottom Pad Occupancy = %.2f ± %.3f" , cHybridTester.GetMeanOccupancyBottom() , cHybridTester.GetRMSOccupancyBottom() );
cHybridTester.AmmendReport(line);
sprintf (line, "# Top Pad Occupancy = %.2f ± %.3f" , cHybridTester.GetMeanOccupancyTop() , cHybridTester.GetRMSOccupancyTop() );
cHybridTester.AmmendReport (line);
sprintf (line, "# Bottom Pad Occupancy = %.2f ± %.3f" , cHybridTester.GetMeanOccupancyBottom() , cHybridTester.GetRMSOccupancyBottom() );
cHybridTester.AmmendReport (line);
// measure pedestal
}
void perform_AntennaOccupancyMeasurement(Tool pTool , std::string pHWFile )
void perform_AntennaOccupancyMeasurement (Tool pTool , std::string pHWFile )
{
LOG (INFO) << "Starting occupancy measurement using the antenna." ;
LOG (INFO) << "Starting occupancy measurement using the antenna." ;
std::stringstream outp;
AntennaTester cAntennaTester;
cAntennaTester.Inherit (&pTool);
cAntennaTester.ConfigureHw(outp);
cAntennaTester.ConfigureHw (outp);
LOG (INFO) << outp.str();
cAntennaTester.Initialize();
// re-configure CBC regsiters with values from the calibration
// re-configure CBC regsiters with values from the calibration
//cAntennaTester.ReconfigureCBCRegisters();
cAntennaTester.ConfigureVcth(0x78);
cAntennaTester.ConfigureVcth (0x78);
// measure occupancy
// measure occupancy
cAntennaTester.Measure();
// save results