Skip to content
Snippets Groups Projects
Commit ba404e3e authored by Elisabetta Pianori's avatar Elisabetta Pianori
Browse files

Merge branch 'ep_update_Fluke8842' into 'devel'

fix Fluke8842 operation

See merge request !318
parents 85dcdabb 413e94d0
No related branches found
No related tags found
1 merge request!318fix Fluke8842 operation
Pipeline #7106039 passed
......@@ -12,7 +12,8 @@ bool Fluke8842::ping(unsigned dev) {
std::string result = "";
if (dev == 0) {
logger(logDEBUG) << "ping the multimeter.....";
result = this->sendreceive("G8\r\n");
result = this->sendreceive("G7");
logger(logDEBUG) << "last error message in buffer :" << result;
} else {
throw std::runtime_error("Other channels not implemented! ");
}
......@@ -21,6 +22,17 @@ bool Fluke8842::ping(unsigned dev) {
std::string Fluke8842::identify() {
std::string idn = this->sendreceive("G8");
if (idn == "+1.0071E+21") {
// The version of this model at LBNL does not respond to the G8 command,
// hence hardcode model here
logger(logINFO) << "In your specific model of meter, G8 command "
"does not work, by-passing it";
// reset PS otherwise it gets stuck
this->reset();
idn = "FLUKE,8842A";
}
return idn;
}
......@@ -131,34 +143,40 @@ void Fluke8842::SetMode(enum FlukeMode mode) {
}
void Fluke8842::checkCompatibilityList() {
// get model connected to the meter
// std::string idn = this->identify();
std::string idn = "FLUKE,8842A,0,V4.0 CR LF";
std::string idn = identify();
// get list of models
std::vector<std::string> models = IMeter::getListOfModels();
logger(logWARNING) << "Get meter identification command not working. "
"Bypassing identification check.";
if (models.empty()) {
logger(logINFO) << "No model identifier implemented for this meter. No "
"check is performed.";
logger(logINFO) << "No model identifier implemented for this meter. "
"No check is performed.";
return;
}
std::size_t pos = m_name.find("Fluke");
std::string brand = m_name.substr(pos, pos + 5);
std::string type = m_name.substr(pos + 5, pos + 9);
std::string idn_lower = idn;
std::transform(idn_lower.begin(), idn_lower.end(), idn_lower.begin(),
[](unsigned char c) { return std::tolower(c); });
for (int i = 0; i < brand.length(); i++) {
brand[i] = toupper(brand[i]);
std::size_t pos = idn_lower.find("fluke");
if (pos == std::string::npos) {
logger(logERROR) << "Not a fluke meter: " << idn;
throw std::runtime_error("Not a fluke meter: " + idn);
}
std::string brand = idn_lower.substr(pos, 5);
std::string type = idn_lower.substr(pos + 6, 4);
for (const std::string& model : models) {
if (idn.find(brand) != std::string::npos &&
idn.find(type) != std::string::npos)
std::string model_lower = model;
std::transform(model_lower.begin(), model_lower.end(),
model_lower.begin(),
[](unsigned char c) { return std::tolower(c); });
if (model_lower.find(brand) != std::string::npos &&
model_lower.find(type) != std::string::npos)
return;
}
logger(logERROR) << "Unknown meter: " << idn;
logger(logERROR) << "Unknown meter: " << idn;
throw std::runtime_error("Unknown meter: " + idn);
}
\ No newline at end of file
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment