Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
P
python_test_scripts
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Jira
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
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
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
LOFAR2.0
python_test_scripts
Commits
c598bda2
Commit
c598bda2
authored
Dec 7, 2022
by
Gijs Schoonderbeek
Browse files
Options
Downloads
Patches
Plain Diff
Double check on hardware
parent
40cf81b4
No related branches found
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
apspu_lib.py
+31
-7
31 additions, 7 deletions
apspu_lib.py
production_apspu.py
+5
-7
5 additions, 7 deletions
production_apspu.py
with
36 additions
and
14 deletions
apspu_lib.py
+
31
−
7
View file @
c598bda2
...
@@ -72,12 +72,18 @@ class ApspuClass:
...
@@ -72,12 +72,18 @@ class ApspuClass:
print
(
"
---------
\n
Program Pols
\n
---------
"
)
print
(
"
---------
\n
Program Pols
\n
---------
"
)
for
pol
in
self
.
pols
:
for
pol
in
self
.
pols
:
pol
.
set_vout_pol
(
VOUT_POLS
[
pol
.
name
])
pol
.
set_vout_pol
(
VOUT_POLS
[
pol
.
name
])
vout
=
pol
.
read_vout_set
()
if
not
(
0.9
*
VOUT_POLS
[
pol
.
name
]
<
vout
<
1.1
*
VOUT_POLS
[
pol
.
name
]):
print
(
f
"
POL
{
pol
.
name
:
10
}
Error setting Vout,
"
f
"
set to
{
VOUT_POLS
[
pol
.
name
]
}
read back
{
vout
}
"
)
exit
()
pol
.
set_vout_ov_limit_pol
(
1.2
*
VOUT_POLS
[
pol
.
name
])
pol
.
set_vout_ov_limit_pol
(
1.2
*
VOUT_POLS
[
pol
.
name
])
ov_out
=
pol
.
read_ov_limit
()
if
not
(
1.1
*
VOUT_POLS
[
pol
.
name
]
<
ov_out
<
1.3
*
VOUT_POLS
[
pol
.
name
]):
print
(
f
"
POL
{
pol
.
name
:
10
}
Error setting output overvoltage
"
f
"
set
{
1.2
*
VOUT_POLS
[
pol
.
name
]
}
read back
{
ov_out
}
"
)
exit
()
pol
.
set_on_off_config
()
pol
.
set_on_off_config
()
if
DEBUG
:
pol
.
read_vout_set
()
pol
.
read_ov_limit
()
pol
.
read_uv_limit
()
pol
.
write_to_nvm
()
pol
.
write_to_nvm
()
print
(
"
Done
"
)
print
(
"
Done
"
)
...
@@ -92,6 +98,7 @@ class ApspuClass:
...
@@ -92,6 +98,7 @@ class ApspuClass:
for
pol
in
self
.
pols
:
for
pol
in
self
.
pols
:
check_ok
=
check_ok
&
pol
.
check_pol
()
check_ok
=
check_ok
&
pol
.
check_pol
()
check_ok
=
check_ok
&
self
.
fans
.
check_fans
()
check_ok
=
check_ok
&
self
.
fans
.
check_fans
()
check_ok
=
check_ok
&
self
.
eeprom
.
wr_rd_eeprom
(
value
=
"
PROD_CHECK
"
,
address
=
0x30
)
if
check_ok
:
if
check_ok
:
print
(
"
APSPU OK
"
)
print
(
"
APSPU OK
"
)
else
:
else
:
...
@@ -173,7 +180,10 @@ class EepromClass:
...
@@ -173,7 +180,10 @@ class EepromClass:
ret_value
=
self
.
read_eeprom
(
address
=
0
,
nof_bytes
=
len
(
value
))
ret_value
=
self
.
read_eeprom
(
address
=
0
,
nof_bytes
=
len
(
value
))
stri
=
"
Wrote to EEPROM register 0x{2:x} : {0}, Read from EEPROM: {1}
"
.
format
(
value
,
ret_value
,
address
)
stri
=
"
Wrote to EEPROM register 0x{2:x} : {0}, Read from EEPROM: {1}
"
.
format
(
value
,
ret_value
,
address
)
print
(
stri
)
print
(
stri
)
if
ret_value
==
value
:
return
True
return
True
else
:
return
False
class
PolClass
:
class
PolClass
:
...
@@ -305,6 +315,9 @@ class PolClass:
...
@@ -305,6 +315,9 @@ class PolClass:
#
#
if
self
.
status
:
if
self
.
status
:
ret_ack
,
raw_value
=
self
.
pol_dev
.
read_bytes
(
LP_VIN
,
2
)
ret_ack
,
raw_value
=
self
.
pol_dev
.
read_bytes
(
LP_VIN
,
2
)
if
not
ret_ack
:
self
.
iout
=
999
return
False
if
len
(
raw_value
)
<
4
:
if
len
(
raw_value
)
<
4
:
raw_value
=
'
0
'
+
raw_value
raw_value
=
'
0
'
+
raw_value
ret_value
=
[]
ret_value
=
[]
...
@@ -312,6 +325,7 @@ class PolClass:
...
@@ -312,6 +325,7 @@ class PolClass:
ret_value
.
append
(
int
(
raw_value
[
2
:],
16
))
ret_value
.
append
(
int
(
raw_value
[
2
:],
16
))
output_value
=
calc_lin_2bytes
(
ret_value
)
output_value
=
calc_lin_2bytes
(
ret_value
)
self
.
vin
=
output_value
self
.
vin
=
output_value
return
True
def
read_vout
(
self
):
def
read_vout
(
self
):
#
#
...
@@ -319,7 +333,13 @@ class PolClass:
...
@@ -319,7 +333,13 @@ class PolClass:
#
#
if
self
.
status
:
if
self
.
status
:
ret_ack
,
vout_mod
=
self
.
pol_dev
.
read_bytes
(
LP_VOUT_MODE
,
1
)
ret_ack
,
vout_mod
=
self
.
pol_dev
.
read_bytes
(
LP_VOUT_MODE
,
1
)
if
not
ret_ack
:
self
.
vout
=
999
return
False
ret_ack
,
raw_value
=
self
.
pol_dev
.
read_bytes
(
LP_VOUT
,
2
)
ret_ack
,
raw_value
=
self
.
pol_dev
.
read_bytes
(
LP_VOUT
,
2
)
if
not
ret_ack
:
self
.
vout
=
999
return
False
vout_mod
=
int
(
vout_mod
,
16
)
vout_mod
=
int
(
vout_mod
,
16
)
ret_value
=
[]
ret_value
=
[]
ret_value
.
append
(
int
(
raw_value
[:
2
],
16
))
ret_value
.
append
(
int
(
raw_value
[:
2
],
16
))
...
@@ -328,8 +348,10 @@ class PolClass:
...
@@ -328,8 +348,10 @@ class PolClass:
except
:
except
:
ret_value
.
append
(
0
)
ret_value
.
append
(
0
)
self
.
vout
=
calc_lin_3bytes
(
ret_value
,
[
vout_mod
])
self
.
vout
=
calc_lin_3bytes
(
ret_value
,
[
vout_mod
])
return
True
else
:
else
:
self
.
vout
=
999
self
.
vout
=
999
return
False
def
read_ov_limit
(
self
):
def
read_ov_limit
(
self
):
#
#
...
@@ -346,6 +368,7 @@ class PolClass:
...
@@ -346,6 +368,7 @@ class PolClass:
ret_value
=
int
(
raw_value
[
2
:],
16
)
*
2
**
8
ret_value
=
int
(
raw_value
[
2
:],
16
)
*
2
**
8
ret_value
+=
int
(
raw_value
[:
2
],
16
)
ret_value
+=
int
(
raw_value
[:
2
],
16
)
output_value
=
ret_value
*
2
**-
11
output_value
=
ret_value
*
2
**-
11
if
DEBUG
:
print
(
f
"
Output OV limit is set to: =
{
output_value
:
5.2
f
}
V using hex value
{
raw_value
}
"
)
print
(
f
"
Output OV limit is set to: =
{
output_value
:
5.2
f
}
V using hex value
{
raw_value
}
"
)
return
output_value
return
output_value
...
@@ -363,6 +386,7 @@ class PolClass:
...
@@ -363,6 +386,7 @@ class PolClass:
ret_value
=
int
(
raw_value
[
2
:],
16
)
*
2
**
8
ret_value
=
int
(
raw_value
[
2
:],
16
)
*
2
**
8
ret_value
+=
int
(
raw_value
[:
2
],
16
)
ret_value
+=
int
(
raw_value
[:
2
],
16
)
output_value
=
ret_value
*
2
**-
11
output_value
=
ret_value
*
2
**-
11
if
DEBUG
:
print
(
f
"
Output UV limit is set to: =
{
output_value
:
5.2
f
}
V using hex value
{
raw_value
}
"
)
print
(
f
"
Output UV limit is set to: =
{
output_value
:
5.2
f
}
V using hex value
{
raw_value
}
"
)
return
output_value
return
output_value
else
:
else
:
...
...
This diff is collapsed.
Click to expand it.
production_apspu.py
+
5
−
7
View file @
c598bda2
...
@@ -38,12 +38,10 @@ sleep(5) # Wait for outputs to be stable on
...
@@ -38,12 +38,10 @@ sleep(5) # Wait for outputs to be stable on
apspu
.
read_all
()
apspu
.
read_all
()
apspu
.
print_status
()
apspu
.
print_status
()
if
apspu
.
check_apspu
():
if
apspu
.
check_apspu
():
apspu
.
apspu_on_off
(
False
)
sleep
(
10
)
apspu
.
read_all
()
apspu
.
print_status
()
apspu
.
apspu_on_off
(
True
)
apspu_id
=
"
APSPU-
"
+
sys
.
argv
[
1
]
apspu_id
=
"
APSPU-
"
+
sys
.
argv
[
1
]
serial
=
sys
.
argv
[
2
]
serial
=
sys
.
argv
[
2
]
apspu
.
eeprom
.
wr_rd_eeprom
(
apspu_id
,
address
=
0
)
rw_ok
=
apspu
.
eeprom
.
wr_rd_eeprom
(
apspu_id
,
address
=
0
)
apspu
.
eeprom
.
wr_rd_eeprom
(
serial
,
address
=
0x20
)
if
rw_ok
:
rw_ok
=
apspu
.
eeprom
.
wr_rd_eeprom
(
serial
,
address
=
0x20
)
if
not
rw_ok
:
print
(
"
EEPROM Error
"
)
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