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
b4b978e2
Commit
b4b978e2
authored
Aug 12, 2021
by
Gijs Schoonderbeek
Browse files
Options
Downloads
Patches
Plain Diff
lab work in fan reading APSCT
parent
b3102a09
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
+2
-6
2 additions, 6 deletions
APSPU_I2C.py
rd_apspu.py
+29
-13
29 additions, 13 deletions
rd_apspu.py
with
31 additions
and
19 deletions
APSPU_I2C.py
+
2
−
6
View file @
b4b978e2
...
...
@@ -37,7 +37,7 @@ REG_TACH_2_LSP = 0x13
REG_TACH_3_MSP
=
0x14
REG_TACH_3_LSP
=
0x15
RUN_MONITOR
=
0x0
0
RUN_MONITOR
=
0x0
2
...
...
@@ -67,9 +67,5 @@ def calc_lin_3bytes(data,mode):
output
=
mant
*
2
**
expo
return
output
def
tach
(
tach_msb
,
tach_lsb
):
tach_pulse_per_revolution
=
2
tach
=
(
int
(
tach_msb
,
16
)
*
8
)
+
(
int
(
tach_lsb
,
16
)
/
32
)
rpm
=
60
/
(
tach
*
tach_pulse_per_revolution
)
return
rpm
This diff is collapsed.
Click to expand it.
rd_apspu.py
+
29
−
13
View file @
b4b978e2
...
...
@@ -215,22 +215,38 @@ class FanmonitorClass:
ret_ack
,
reg_before
=
self
.
fanmonitor_dev
.
read_bytes
(
REG_GLOBAL
,
1
)
self
.
fanmonitor_dev
.
write_bytes
(
REG_GLOBAL
,
RUN_MONITOR
)
ret_ack
,
reg_after
=
self
.
fanmonitor_dev
.
read_bytes
(
REG_GLOBAL
,
1
)
stri
=
"
Reg at address 0x{0} before : {1} and after
{2}
write action
"
.
format
(
REG_GLOBAL
,
reg_before
,
reg_after
)
stri
=
"
Reg at address 0x{0} before : {1} and after write action
{2}
"
.
format
(
REG_GLOBAL
,
reg_before
,
reg_after
)
print
(
stri
)
self
.
fanmonitor_dev
.
write_bytes
(
0x02
,
0x88
)
self
.
fanmonitor_dev
.
write_bytes
(
0x03
,
0x88
)
self
.
fanmonitor_dev
.
write_bytes
(
0x04
,
0x88
)
self
.
fanmonitor_dev
.
write_bytes
(
0x05
,
0x88
)
self
.
fanmonitor_dev
.
write_bytes
(
0x06
,
0xe0
)
self
.
fanmonitor_dev
.
write_bytes
(
0x07
,
0xe0
)
self
.
fanmonitor_dev
.
write_bytes
(
0x08
,
0xe0
)
self
.
fanmonitor_dev
.
write_bytes
(
0x09
,
0xe0
)
def
read_fan
(
self
,
REG_TACH_MSP
,
REG_TACH_LSP
):
#
# Function to a single fan
#
ret_ack
,
tach_msb
=
self
.
fanmonitor_dev
.
read_bytes
(
REG_TACH_MSP
,
1
)
tach_msb
=
int
(
tach_msb
,
16
)
ret_ack
,
tach_lsb
=
self
.
fanmonitor_dev
.
read_bytes
(
REG_TACH_LSP
,
1
)
tach_lsb
=
int
(
tach_lsb
,
16
)
tach
=
tach_msb
*
16
+
tach_lsb
*
8
rpm
=
(
8192
*
32
*
60
)
/
(
2
*
tach
)
stri
=
"
MSP: {0}, LSB: {1}, TACH : {2}
"
.
format
(
tach_msb
,
tach_lsb
,
tach
)
print
(
stri
)
return
rpm
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
.
append
(
tach
(
tach_msb
,
tach_lsb
))
ret_ack
,
tach_msb
=
self
.
fanmonitor_dev
.
read_bytes
(
REG_TACH_2_MSP
,
1
)
ret_ack
,
tach_lsb
=
self
.
fanmonitor_dev
.
read_bytes
(
REG_TACH_2_LSP
,
1
)
self
.
rpm
.
append
(
tach
(
tach_msb
,
tach_lsb
))
ret_ack
,
tach_msb
=
self
.
fanmonitor_dev
.
read_bytes
(
REG_TACH_3_MSP
,
1
)
ret_ack
,
tach_lsb
=
self
.
fanmonitor_dev
.
read_bytes
(
REG_TACH_3_LSP
,
1
)
self
.
rpm
.
append
(
tach
(
tach_msb
,
tach_lsb
))
# Function to read all fan's
#
self
.
rpm
.
append
(
self
.
read_fan
(
REG_TACH_1_MSP
,
REG_TACH_1_LSP
))
self
.
rpm
.
append
(
self
.
read_fan
(
REG_TACH_2_MSP
,
REG_TACH_2_LSP
))
self
.
rpm
.
append
(
self
.
read_fan
(
REG_TACH_3_MSP
,
REG_TACH_3_LSP
))
def
print_status
(
self
):
#
...
...
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