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
c5fea19a
Commit
c5fea19a
authored
10 years ago
by
kpetersn
Browse files
Options
Downloads
Patches
Plain Diff
Added support for DMOV field. Reverted change to how bit state was displayed.
parent
863d6a3f
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
+15
-3
15 additions, 3 deletions
motorHist.py
with
15 additions
and
3 deletions
motorHist.py
+
15
−
3
View file @
c5fea19a
...
...
@@ -65,7 +65,7 @@ def msta_diff(last_msta, current_msta):
bit_state
=
1
else
:
bit_state
=
0
print
"
MSTA:
\t
%s bit (0x%X) changed to
\"
%s
\"
[
%i
]
"
%
(
msta_dict
[
bit
][
0
],
bit
,
msta_dict
[
bit
][
1
][
bit_state
],
bit_state
)
print
"
MSTA:
\t
%s bit (0x%X) changed to
\"
%s
\"
(
%i
)
"
%
(
msta_dict
[
bit
][
0
],
bit
,
msta_dict
[
bit
][
1
][
bit_state
],
bit_state
)
def
mip_diff
(
last_mip
,
current_mip
):
if
last_mip
==
None
:
...
...
@@ -87,7 +87,7 @@ def mip_diff(last_mip, current_mip):
bit_state
=
1
else
:
bit_state
=
0
print
"
MIP:
\t
%s bit (0x%X) changed to
\"
%s
\"
[
%i
]
"
%
(
mip_dict
[
bit
][
0
],
bit
,
mip_dict
[
bit
][
1
][
bit_state
],
bit_state
)
print
"
MIP:
\t
%s bit (0x%X) changed to
\"
%s
\"
(
%i
)
"
%
(
mip_dict
[
bit
][
0
],
bit
,
mip_dict
[
bit
][
1
][
bit_state
],
bit_state
)
def
main
(
log_file
):
...
...
@@ -116,7 +116,7 @@ def main(log_file):
# Assume every record name is a motor, add to list if name is new
if
name
not
in
motor_dict
.
keys
():
motor_dict
[
name
]
=
{
"
MSTA
"
:
None
,
"
MIP
"
:
None
,
"
VAL
"
:
None
}
motor_dict
[
name
]
=
{
"
MSTA
"
:
None
,
"
MIP
"
:
None
,
"
VAL
"
:
None
,
"
DMOV
"
:
None
}
# Check for VAL change
if
field
==
"
VAL
"
:
...
...
@@ -130,6 +130,18 @@ def main(log_file):
motor_dict
[
name
][
"
VAL
"
]
=
current_val
print
# Check for DMOV change
if
field
==
"
DMOV
"
:
# Catch error here?
current_dmov
=
int
(
value
)
last_dmov
=
motor_dict
[
name
][
"
DMOV
"
]
if
last_dmov
==
None
:
print
"
[%s %s] %s
'
s %s field starts at %i
"
%
(
date
,
time
,
name
,
field
,
current_dmov
)
else
:
print
"
[%s %s] %s
'
s %s field changed from %i to %i
"
%
(
date
,
time
,
name
,
field
,
last_dmov
,
current_dmov
)
motor_dict
[
name
][
"
DMOV
"
]
=
current_dmov
print
# Check for MSTA change
if
field
==
"
MSTA
"
:
# Catch error here?
...
...
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