Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
PowerTools
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
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-apps
PowerTools
Commits
ac7d73a1
Commit
ac7d73a1
authored
1 year ago
by
Zhirong Zhang
Browse files
Options
Downloads
Patches
Plain Diff
Modified tests according to the changes in FieldMeas.
parent
4b6bd78c
No related branches found
No related tags found
Loading
Checking pipeline status
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
pbv3/LinPOLMeas.cpp
+54
-14
54 additions, 14 deletions
pbv3/LinPOLMeas.cpp
with
54 additions
and
14 deletions
pbv3/LinPOLMeas.cpp
+
54
−
14
View file @
ac7d73a1
...
...
@@ -5,30 +5,36 @@
#include
<iostream>
#include
<memory>
#include
<vector>
#include
<string>
#include
<bitset>
#include
<unistd.h>
#include
<fstream>
#include
"ComIOException.h"
#include
"EndeavourComException.h"
#include
"UIOCom.h"
#include
"FieldMeas.cpp"
#include
<string>
#include
"VDDLRMeas.cpp"
#include
"NTCPBMeas.cpp"
#include
"AMACv2.h"
class
LinPOLMeas
{
public:
//default constructor
LinPOLMeas
(
AMACv2
*
amac_ptr
)
:
m_
amac_p
tr
(
amac_ptr
){
FieldMeas
VDDLR
(
"VDDLR"
,
10
,
10
,
10
);
FieldMeas
NT
D
PB
(
"
NT
D
PB
"
,
13
,
0
,
10
);
fieldArray
.
push_back
(
VDDLR
);
fieldArray
.
push_back
(
NT
D
PB
);
LinPOLMeas
(
std
::
shared_ptr
<
AMACv2
>
amac_ptr
)
:
m_
AMACP
tr
(
amac_ptr
){
auto
VDDLR1
=
std
::
make_shared
<
VDDLRMeas
>
(
amac_ptr
);
auto
NT
C
PB
1
=
std
::
make_shared
<
NT
C
PB
Meas
>
(
amac_ptr
);
field
Ptr
Array
.
push_back
(
VDDLR
1
);
field
Ptr
Array
.
push_back
(
NT
C
PB
1
);
}
~
LinPOLMeas
(){}
void
readAllReg
(){
for
(
int
i
=
0
;
i
<
fieldArray
.
size
();
++
i
){
uint
read
=
m_amac_ptr
->
read_reg
(
fieldArray
[
i
].
getAddress
()
);
field
Array
[
i
].
addValue
(
read
);
for
(
auto
fieldPtr
:
field
Ptr
Array
){
uint
read
=
fieldPtr
->
rdRawCount
(
);
field
Ptr
->
addRawCount
(
read
);
}
}
...
...
@@ -38,19 +44,53 @@ class LinPOLMeas{
while
(
i
<
N
){
readAllReg
();
usleep
(
microSec
);
// std::cout << "Finished " << i << " round!\n";
// std::cout << "Finished " << i << " round!\n";
i
++
;
storedRounds
++
;
}
}
void
writeToCSV
(
std
::
string
outFileName
){
if
(
fieldPtrArray
.
empty
()){
std
::
cout
<<
"No data to be output.
\n
"
;
return
;
}
std
::
string
outCSV
=
outFileName
+
".csv"
;
std
::
ofstream
outFile
(
outCSV
);
// Title line
for
(
int
i
=
0
;
i
<
fieldPtrArray
.
size
();
++
i
){
outFile
<<
fieldPtrArray
[
i
]
->
getName
();
if
(
i
!=
fieldPtrArray
.
size
()
-
1
)
outFile
<<
","
;
// No comma at end of line
}
outFile
<<
std
::
endl
;
for
(
int
i
=
0
;
i
<
storedRounds
;
++
i
){
for
(
int
j
=
0
;
j
<
fieldPtrArray
.
size
();
++
j
){
uint
rawCount
=
fieldPtrArray
[
j
]
->
getRawCount
()[
i
];
outFile
<<
fieldPtrArray
[
j
]
->
rdValue
(
rawCount
);
if
(
j
!=
fieldPtrArray
.
size
()
-
1
)
outFile
<<
","
;
}
outFile
<<
std
::
endl
;
}
outFile
.
close
();
std
::
cout
<<
"Measurement: "
;
for
(
auto
fieldPtr
:
fieldPtrArray
){
std
::
cout
<<
fieldPtr
->
getName
()
<<
", "
;
}
std
::
cout
<<
"have been written to "
<<
outCSV
<<
".
\n
"
;
}
void
printAllField
(){
for
(
int
i
=
0
;
i
<
fieldArray
.
size
();
++
i
){
field
Array
[
i
].
printValue
();
for
(
auto
fieldPtr
:
field
Ptr
Array
){
field
Ptr
->
printValue
();
}
}
private
:
std
::
vector
<
FieldMeas
>
fieldArray
;
AMACv2
*
m_amac_ptr
;
std
::
vector
<
std
::
shared_ptr
<
FieldMeas
>>
fieldPtrArray
;
std
::
shared_ptr
<
AMACv2
>
m_AMACPtr
;
int
storedRounds
=
0
;
};
#endif
...
...
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