Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
labRemote
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Berkeley Lab
labRemote
Commits
ba404e3e
Commit
ba404e3e
authored
1 year ago
by
Elisabetta Pianori
Browse files
Options
Downloads
Plain Diff
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
!318
fix Fluke8842 operation
Pipeline
#7106039
passed
1 year ago
Stage: check
Stage: build
Stage: package
Stage: deploy
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/libMeter/Fluke8842.cpp
+35
-17
35 additions, 17 deletions
src/libMeter/Fluke8842.cpp
with
35 additions
and
17 deletions
src/libMeter/Fluke8842.cpp
+
35
−
17
View file @
ba404e3e
...
...
@@ -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
::
s
ize_t
pos
=
m_name
.
find
(
"Fluke"
)
;
std
::
s
tr
ing
brand
=
m_name
.
substr
(
pos
,
pos
+
5
);
std
::
string
type
=
m_name
.
substr
(
pos
+
5
,
pos
+
9
);
std
::
s
tring
idn_lower
=
idn
;
std
::
tr
ansform
(
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
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment