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
961a5740
Commit
961a5740
authored
Aug 3, 2021
by
Gijs Schoonderbeek
Browse files
Options
Downloads
Patches
Plain Diff
Added first step in fan monitoring.
parent
79f8fefe
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_I2C.py
+21
-1
21 additions, 1 deletion
APSPU_I2C.py
rd_apspu.py
+46
-0
46 additions, 0 deletions
rd_apspu.py
with
67 additions
and
1 deletion
APSPU_I2C.py
+
21
−
1
View file @
961a5740
...
...
@@ -24,6 +24,21 @@ LP_IOUT = 0x8C
###################################
EEPROM
=
0x50
###################################
# FAN speed
###################################
MAX6620
=
0x52
REG_GLOBAL
=
0x00
REG_TACH_1_MSP
=
0x10
REG_TACH_1_LSP
=
0x11
REG_TACH_2_MSP
=
0x12
REG_TACH_2_LSP
=
0x13
REG_TACH_3_MSP
=
0x14
REG_TACH_3_LSP
=
0x15
RUN_MONITOR
=
0x80
######################
...
...
@@ -46,4 +61,9 @@ def calc_lin_3bytes(data,mode):
expo
=
expo
-
2
**
5
output
=
(
data
[
1
]
*
256
+
data
[
0
])
*
2
**
expo
return
output
def
tach
(
tach_msb
,
tach_lsb
):
tach_pulse_per_revolution
=
2
tach
=
(
tach_msb
*
8
)
+
(
tach_lsb
/
32
)
rpm
=
60
/
(
tach
*
tach_pulse_per_revolution
)
return
rpm
This diff is collapsed.
Click to expand it.
rd_apspu.py
+
46
−
0
View file @
961a5740
...
...
@@ -42,6 +42,8 @@ class ApspuClass:
self
.
pols
.
append
(
PolClass
(
pol
))
self
.
dev_i2c_eeprom
=
I2C
(
EEPROM
)
self
.
dev_i2c_eeprom
.
bus_nr
=
I2CBUSNR
self
.
fanmonitoring
=
[]
self
.
fanmonitoring
.
append
(
FanmonitorClass
)
def
write_eeprom
(
self
,
data
=
0x01
):
#
...
...
@@ -87,6 +89,7 @@ class ApspuClass:
for
pol
in
self
.
pols
:
pol
.
read_all
()
return
True
self
.
fanmonitoring
.
read_all
()
def
print_status
(
self
):
#
...
...
@@ -97,6 +100,7 @@ class ApspuClass:
pol
.
print_status
()
self
.
wr_rd_eeprom
()
return
True
self
.
fanmonitoring
.
print_status
()
...
...
@@ -184,6 +188,48 @@ class PolClass:
stri
+=
"
temperature :{0: <5.2f} Deg C
"
.
format
(
self
.
temp
)
print
(
stri
)
class
FanmonitorClass
:
#
# Class to read all monitoring points Point of Load DC/DC converter
#
def
__init__
(
self
,
name
):
#
# All monitoring points Point of Load DC/DC converter
#
self
.
rpm
=
-
1
self
.
fanmonitor_dev
=
I2C
(
MAX6620
)
self
.
fanmonitor_dev
.
bus_nr
=
I2CBUSNR
ret_ack
,
ret_value
=
self
.
fanmonitor_dev
.
read_bytes
(
1
)
if
ret_ack
<
1
:
stri
=
"
Device {0} at address 0x{1:X} not found
"
.
format
(
"
max6620
"
,
MAX6620
)
print
(
stri
)
self
.
status
=
False
else
:
self
.
status
=
True
def
set_active
(
self
):
#
# Function to activate monitoring
#
self
.
fanmonitor_dev
.
write_bytes
(
REG_GLOBAL
,
RUN_MONITOR
)
def
read_all
(
self
):
#
# Function to read speed
#
ret_ack
,
tach_msb
=
self
.
fanmonitor_dev
.
read_bytes
(
REG_TACH_1_MSP
,
1
)
ret_ack
,
tach_lsb
=
self
.
fanmonitor_dev
.
read_bytes
(
REG_TACH_1_LSP
,
1
)
self
.
rpm
=
tach
(
tach_msb
,
tach_lsb
)
def
print_status
(
self
):
#
# Function to dump all monitoring points of the Point of Load DC/DC converter on the screen
#
if
self
.
status
:
stri
=
"
FAN
"
stri
+=
"
Speed :{0: <5.2f} V
"
.
format
(
self
.
rpm
)
print
(
stri
)
def
main
():
#
...
...
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