Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
M
motorHistory
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
kpetersn
motorHistory
Commits
ec4fae5d
Commit
ec4fae5d
authored
10 years ago
by
kpetersn
Browse files
Options
Downloads
Patches
Plain Diff
Implemented MIP monitoring
parent
ed646d5c
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
motorHist.py
+44
-2
44 additions, 2 deletions
motorHist.py
with
44 additions
and
2 deletions
motorHist.py
+
44
−
2
View file @
ec4fae5d
...
...
@@ -25,6 +25,24 @@ msta_dict = {1 << 0 : ("Direction", ("Negative", "Positive")),
#!print msta_dict
mip_dict
=
{
1
<<
0
:
(
"
Jog forward
"
,
(
"
Done
"
,
"
In Progress
"
)),
1
<<
1
:
(
"
Jog reverse
"
,
(
"
Done
"
,
"
In Progress
"
)),
1
<<
2
:
(
"
Post-jog backlash
"
,
(
"
Done
"
,
"
In Progress
"
)),
1
<<
3
:
(
"
Home forard
"
,
(
"
Done
"
,
"
In Progress
"
)),
1
<<
4
:
(
"
Home reverse
"
,
(
"
Done
"
,
"
In Progress
"
)),
1
<<
5
:
(
"
Move (NOT home/jog)
"
,
(
"
Done
"
,
"
In Progress
"
)),
1
<<
6
:
(
"
Retry
"
,
(
"
Done
"
,
"
In Progress
"
)),
1
<<
7
:
(
"
Load position
"
,
(
"
Done
"
,
"
In Progress
"
)),
1
<<
8
:
(
"
Backlash
"
,
(
"
Done
"
,
"
In Progress
"
)),
1
<<
9
:
(
"
Stoping
"
,
(
"
Done
"
,
"
In Progress
"
)),
1
<<
10
:
(
"
Delay request
"
,
(
"
Done
"
,
"
In Progress
"
)),
1
<<
11
:
(
"
Delay acknowledge
"
,
(
"
Done
"
,
"
In Progress
"
)),
1
<<
12
:
(
"
Jog request
"
,
(
"
Done
"
,
"
In Progress
"
)),
1
<<
13
:
(
"
Jog stopping
"
,
(
"
Done
"
,
"
In Progress
"
)),
1
<<
14
:
(
"
External move
"
,
(
"
Done
"
,
"
In Progress
"
)),
}
#!print msta_dict
motor_dict
=
{}
def
msta_diff
(
last_msta
,
current_msta
):
...
...
@@ -43,7 +61,25 @@ def msta_diff(last_msta, current_msta):
bit_state
=
1
else
:
bit_state
=
0
print
"
\t
%s bit (0x%X) changed to
\"
%s
\"
(0x%X)
"
%
(
msta_dict
[
bit
][
0
],
bit
,
msta_dict
[
bit
][
1
][
bit_state
],
bit_state
)
print
"
MSTA:
\t
%s bit (0x%X) changed to
\"
%s
\"
(0x%X)
"
%
(
msta_dict
[
bit
][
0
],
bit
,
msta_dict
[
bit
][
1
][
bit_state
],
bit_state
)
def
mip_diff
(
last_mip
,
current_mip
):
if
last_mip
==
-
1
:
print
"
\t
1st MIP, No comparison possible
"
return
current_mip
else
:
# XOR shows changed bits
changed_bits
=
last_mip
^
current_mip
# Display changes
for
index
in
range
(
15
):
bit
=
1
<<
index
if
(
bit
&
changed_bits
):
if
(
current_mip
&
bit
):
bit_state
=
1
else
:
bit_state
=
0
print
"
MIP:
\t
%s bit (0x%X) changed to
\"
%s
\"
(0x%X)
"
%
(
mip_dict
[
bit
][
0
],
bit
,
mip_dict
[
bit
][
1
][
bit_state
],
bit_state
)
def
main
(
log_file
):
...
...
@@ -76,7 +112,7 @@ def main(log_file):
# Check for MSTA change
if
field
==
"
MSTA
"
:
#
Maybe c
atch error here
#
C
atch error here
?
current_msta
=
int
(
value
)
last_msta
=
motor_dict
[
name
][
"
MSTA
"
]
print
"
[%s %s] %s
'
s %s field changed from %i (0x%X) to %i (0x%X)
"
%
(
date
,
time
,
name
,
field
,
last_msta
,
last_msta
,
current_msta
,
current_msta
)
...
...
@@ -86,7 +122,13 @@ def main(log_file):
# Check for MIP change
if
field
==
"
MIP
"
:
# Catch error here?
current_mip
=
int
(
value
)
last_mip
=
motor_dict
[
name
][
"
MIP
"
]
print
"
[%s %s] %s
'
s %s field changed from %i (0x%X) to %i (0x%X)
"
%
(
date
,
time
,
name
,
field
,
last_mip
,
last_mip
,
current_mip
,
current_mip
)
mip_diff
(
last_mip
,
current_mip
)
motor_dict
[
name
][
"
MIP
"
]
=
current_mip
print
fh
.
close
()
...
...
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