Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
calc-stats
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
cs
util
sequencer
calc-stats
Commits
7975a23a
Commit
7975a23a
authored
3 years ago
by
Giulio Gaio
Browse files
Options
Downloads
Patches
Plain Diff
Removed polling
parent
3c0adcf2
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
src/CalcStats.py
+8
-170
8 additions, 170 deletions
src/CalcStats.py
with
8 additions
and
170 deletions
src/CalcStats.py
+
8
−
170
View file @
7975a23a
...
...
@@ -139,10 +139,16 @@ class DeviceObj:
self
.
enable_targets
=
0xffffffff
self
.
enable_states
=
0xffff
try
:
if
ERR_DBG
==
1
:
print
(
'
Connecting to
'
,
self
.
device_name
)
self
.
device
=
DeviceProxy
(
self
.
device_name
)
if
ERR_DBG
==
1
:
print
(
'
Connected to
'
,
self
.
device_name
)
self
.
device
.
set_timeout_millis
(
200
)
self
.
util
=
tango
.
Util
.
instance
()
print
(
util
.
get_host_name
())
except
DevFailed
as
df
:
if
ERR_DBG
:
print
(
'
Error initializing
'
,
self
.
device_name
,
'
/
'
,
self
.
command
)
...
...
@@ -589,167 +595,6 @@ class DeviceObj:
if
ERR_DBG
:
print
(
'
Setting sequencer error
'
,
self
.
device_name
)
#
# DeviceObj::set_polling_attribute()
#
def
set_polling_state
(
self
):
if
(
self
.
index
>=
0
):
if
self
.
polling_configured
==
False
:
self
.
polling_configured
=
True
self
.
device
.
set_timeout_millis
(
10000
)
if
selfseq_dev
.
EnablePolling
==
True
:
print
(
"
enable polling:
"
,
self
.
device_name
);
#acquisition_period = int(selfseq_dev.AcquisitionPeriod * 1000 * 10)
acquisition_period
=
int
(
0
)
# copy statistics to the sequencer
if
(
self
.
enable
==
True
):
try
:
attribute
=
self
.
prefix
()
+
'
{:03d}_AcqState
'
.
format
(
self
.
index
+
1
);
selfseq_dev
.
poll_attribute
(
attribute
,
acquisition_period
);
print
(
'
Enable poll
'
,
attribute
,
acquisition_period
);
except
:
print
(
'
Error configuring
'
,
attribute
)
try
:
attribute
=
self
.
prefix
()
+
'
{:03d}_Mean
'
.
format
(
self
.
index
+
1
);
selfseq_dev
.
poll_attribute
(
attribute
,
acquisition_period
);
print
(
'
Enable poll
'
,
attribute
,
acquisition_period
);
except
:
print
(
'
Error configuring
'
,
attribute
)
try
:
attribute
=
self
.
prefix
()
+
'
{:03d}_MinMax
'
.
format
(
self
.
index
+
1
);
selfseq_dev
.
poll_attribute
(
attribute
,
acquisition_period
);
print
(
'
Enable poll
'
,
attribute
,
acquisition_period
);
except
:
print
(
'
Error configuring
'
,
attribute
)
try
:
attribute
=
self
.
prefix
()
+
'
{:03d}_Min
'
.
format
(
self
.
index
+
1
);
selfseq_dev
.
poll_attribute
(
attribute
,
acquisition_period
);
print
(
'
Enable poll
'
,
attribute
,
acquisition_period
);
except
:
print
(
'
Error configuring
'
,
attribute
)
try
:
attribute
=
self
.
prefix
()
+
'
{:03d}_Max
'
.
format
(
self
.
index
+
1
);
selfseq_dev
.
poll_attribute
(
attribute
,
acquisition_period
);
print
(
'
Enable poll
'
,
attribute
,
acquisition_period
);
except
:
print
(
'
Error configuring
'
,
attribute
)
try
:
attribute
=
self
.
prefix
()
+
'
{:03d}_Median
'
.
format
(
self
.
index
+
1
);
selfseq_dev
.
poll_attribute
(
attribute
,
acquisition_period
);
print
(
'
Enable poll
'
,
attribute
,
acquisition_period
);
except
:
print
(
'
Error configuring
'
,
attribute
)
try
:
attribute
=
self
.
prefix
()
+
'
{:03d}_Std
'
.
format
(
self
.
index
+
1
);
selfseq_dev
.
poll_attribute
(
attribute
,
acquisition_period
);
print
(
'
Enable poll
'
,
attribute
,
acquisition_period
);
except
:
print
(
'
Error configuring
'
,
attribute
)
try
:
attribute
=
self
.
prefix
()
+
'
{:03d}_Skew
'
.
format
(
self
.
index
+
1
);
selfseq_dev
.
poll_attribute
(
attribute
,
acquisition_period
);
print
(
'
Enable poll
'
,
attribute
,
acquisition_period
);
except
:
print
(
'
Error configuring
'
,
attribute
)
try
:
attribute
=
self
.
prefix
()
+
'
{:03d}_Kurt
'
.
format
(
self
.
index
+
1
);
selfseq_dev
.
poll_attribute
(
attribute
,
acquisition_period
);
print
(
'
Enable poll
'
,
attribute
,
acquisition_period
);
except
:
print
(
'
Error configuring
'
,
attribute
)
try
:
attribute
=
self
.
prefix
()
+
'
{:03d}_ValidSamples
'
.
format
(
self
.
index
+
1
);
selfseq_dev
.
poll_attribute
(
attribute
,
acquisition_period
);
print
(
'
Enable poll
'
,
attribute
,
acquisition_period
);
except
:
print
(
'
Error configuring
'
,
attribute
)
if
self
.
tag
==
SENSOR_TAG
:
for
target
in
target_dev
:
if
(
target
.
enable
==
True
)
and
(
self
.
enable
==
True
):
if
self
.
enable_targets
&
(
1
<<
target
.
index
):
attribute
=
'
s{:03d}_t{:03d}_Corr
'
.
format
(
self
.
index
+
1
,
target
.
index
+
1
)
try
:
selfseq_dev
.
poll_attribute
(
attribute
,
acquisition_period
);
print
(
'
Enable poll
'
,
attribute
,
acquisition_period
);
except
:
print
(
'
Error configuring
'
,
attribute
)
attribute
=
'
s{:03d}_t{:03d}_CorrFiltAbs
'
.
format
(
self
.
index
+
1
,
target
.
index
+
1
)
try
:
selfseq_dev
.
poll_attribute
(
attribute
,
acquisition_period
);
print
(
'
Enable poll
'
,
attribute
,
acquisition_period
);
except
:
print
(
'
Error configuring
'
,
attribute
)
attribute
=
'
s{:03d}_t{:03d}_CorrHigh
'
.
format
(
self
.
index
+
1
,
target
.
index
+
1
)
try
:
selfseq_dev
.
poll_attribute
(
attribute
,
acquisition_period
);
print
(
'
Enable poll
'
,
attribute
,
acquisition_period
);
except
:
print
(
'
Error configuring
'
,
attribute
)
attribute
=
'
s{:03d}_t{:03d}_CorrLow
'
.
format
(
self
.
index
+
1
,
target
.
index
+
1
)
try
:
selfseq_dev
.
poll_attribute
(
attribute
,
acquisition_period
);
print
(
'
Enable poll
'
,
attribute
,
acquisition_period
);
except
:
print
(
'
Error configuring
'
,
attribute
)
attribute
=
'
s{:03d}_t{:03d}_Direction
'
.
format
(
self
.
index
+
1
,
target
.
index
+
1
)
try
:
selfseq_dev
.
poll_attribute
(
attribute
,
acquisition_period
);
print
(
'
Enable poll
'
,
attribute
,
acquisition_period
);
except
:
print
(
'
Error configuring
'
,
attribute
)
elif
self
.
tag
==
TARGET_TAG
:
for
target
in
target_dev
:
if
(
target
.
enable
==
True
)
and
(
self
.
enable
==
True
):
if
self
.
enable_targets
&
(
1
<<
target
.
index
):
attribute
=
'
t{:03d}_t{:03d}_Corr
'
.
format
(
self
.
index
+
1
,
target
.
index
+
1
)
try
:
selfseq_dev
.
poll_attribute
(
attribute
,
acquisition_period
);
print
(
'
Enable poll
'
,
attribute
,
acquisition_period
);
except
:
print
(
'
Error configuring
'
,
attribute
)
attribute
=
'
t{:03d}_t{:03d}_CorrFiltAbs
'
.
format
(
self
.
index
+
1
,
target
.
index
+
1
)
try
:
selfseq_dev
.
poll_attribute
(
attribute
,
acquisition_period
);
print
(
'
Enable poll
'
,
attribute
,
acquisition_period
);
except
:
print
(
'
Error configuring
'
,
attribute
)
attribute
=
'
t{:03d}_t{:03d}_CorrHigh
'
.
format
(
self
.
index
+
1
,
target
.
index
+
1
)
try
:
selfseq_dev
.
poll_attribute
(
attribute
,
acquisition_period
);
print
(
'
Enable poll
'
,
attribute
,
acquisition_period
);
except
:
print
(
'
Error configuring
'
,
attribute
)
attribute
=
'
t{:03d}_t{:03d}_CorrLow
'
.
format
(
self
.
index
+
1
,
target
.
index
+
1
)
try
:
selfseq_dev
.
poll_attribute
(
attribute
,
acquisition_period
);
print
(
'
Enable poll
'
,
attribute
,
acquisition_period
);
except
:
print
(
'
Error configuring
'
,
attribute
)
attribute
=
'
t{:03d}_t{:03d}_Direction
'
.
format
(
self
.
index
+
1
,
target
.
index
+
1
)
try
:
selfseq_dev
.
poll_attribute
(
attribute
,
acquisition_period
);
print
(
'
Enable poll
'
,
attribute
,
acquisition_period
);
except
:
print
(
'
Error configuring
'
,
attribute
)
if
selfseq_dev
.
DisablePolling
==
True
:
# copy statistics to the sequencer
attribute
=
self
.
prefix
()
+
'
{:03d}_AcqState
'
.
format
(
self
.
index
+
1
);
selfseq_dev
.
stop_poll_attribute
(
attribute
);
print
(
'
Disable poll
'
,
attribute
);
attribute
=
self
.
prefix
()
+
'
{:03d}_Mean
'
.
format
(
self
.
index
+
1
);
selfseq_dev
.
stop_poll_attribute
(
attribute
);
print
(
'
Disable poll
'
,
attribute
);
attribute
=
self
.
prefix
()
+
'
{:03d}_MinMax
'
.
format
(
self
.
index
+
1
);
selfseq_dev
.
stop_poll_attribute
(
attribute
);
print
(
'
Disable poll
'
,
attribute
);
attribute
=
self
.
prefix
()
+
'
{:03d}_Min
'
.
format
(
self
.
index
+
1
);
selfseq_dev
.
stop_poll_attribute
(
attribute
);
print
(
'
Disable poll
'
,
attribute
);
attribute
=
self
.
prefix
()
+
'
{:03d}_Max
'
.
format
(
self
.
index
+
1
);
selfseq_dev
.
stop_poll_attribute
(
attribute
);
print
(
'
Disable poll
'
,
attribute
);
attribute
=
self
.
prefix
()
+
'
{:03d}_Median
'
.
format
(
self
.
index
+
1
);
selfseq_dev
.
stop_poll_attribute
(
attribute
);
print
(
'
Disable poll
'
,
attribute
);
attribute
=
self
.
prefix
()
+
'
{:03d}_Std
'
.
format
(
self
.
index
+
1
);
selfseq_dev
.
stop_poll_attribute
(
attribute
);
print
(
'
Disable poll
'
,
attribute
);
attribute
=
self
.
prefix
()
+
'
{:03d}_Skew
'
.
format
(
self
.
index
+
1
);
selfseq_dev
.
stop_poll_attribute
(
attribute
);
print
(
'
Disable poll
'
,
attribute
);
attribute
=
self
.
prefix
()
+
'
{:03d}_Kurt
'
.
format
(
self
.
index
+
1
);
selfseq_dev
.
stop_poll_attribute
(
attribute
);
print
(
'
Disable poll
'
,
attribute
);
attribute
=
self
.
prefix
()
+
'
{:03d}_ValidSamples
'
.
format
(
self
.
index
+
1
);
selfseq_dev
.
stop_poll_attribute
(
attribute
);
print
(
'
Disable poll
'
,
attribute
);
if
self
.
tag
==
SENSOR_TAG
:
for
target
in
target_dev
:
attribute
=
'
s{:03d}_t{:03d}_Corr
'
.
format
(
self
.
index
+
1
,
target
.
index
+
1
)
selfseq_dev
.
stop_poll_attribute
(
attribute
);
print
(
'
Disable poll
'
,
attribute
);
attribute
=
'
s{:03d}_t{:03d}_CorrFiltAbs
'
.
format
(
self
.
index
+
1
,
target
.
index
+
1
)
selfseq_dev
.
stop_poll_attribute
(
attribute
);
print
(
'
Disable poll
'
,
attribute
);
attribute
=
'
s{:03d}_t{:03d}_CorrHigh
'
.
format
(
self
.
index
+
1
,
target
.
index
+
1
)
selfseq_dev
.
stop_poll_attribute
(
attribute
);
print
(
'
Disable poll
'
,
attribute
);
attribute
=
'
s{:03d}_t{:03d}_CorrLow
'
.
format
(
self
.
index
+
1
,
target
.
index
+
1
)
selfseq_dev
.
stop_poll_attribute
(
attribute
);
print
(
'
Disable poll
'
,
attribute
);
attribute
=
'
s{:03d}_t{:03d}_Direction
'
.
format
(
self
.
index
+
1
,
target
.
index
+
1
)
selfseq_dev
.
stop_poll_attribute
(
attribute
);
print
(
'
Disable poll
'
,
attribute
);
elif
self
.
tag
==
TARGET_TAG
:
for
target
in
target_dev
:
if
(
self
.
index
+
1
)
<
(
target
.
index
+
1
):
attribute
=
'
t{:03d}_t{:03d}_Corr
'
.
format
(
self
.
index
+
1
,
target
.
index
+
1
)
selfseq_dev
.
stop_poll_attribute
(
attribute
);
print
(
'
Disable poll
'
,
attribute
);
attribute
=
'
t{:03d}_t{:03d}_CorrFiltAbs
'
.
format
(
self
.
index
+
1
,
target
.
index
+
1
)
selfseq_dev
.
stop_poll_attribute
(
attribute
);
print
(
'
Disable poll
'
,
attribute
);
attribute
=
'
t{:03d}_t{:03d}_CorrHigh
'
.
format
(
self
.
index
+
1
,
target
.
index
+
1
)
selfseq_dev
.
stop_poll_attribute
(
attribute
);
print
(
'
Disable poll
'
,
attribute
);
attribute
=
'
t{:03d}_t{:03d}_CorrLow
'
.
format
(
self
.
index
+
1
,
target
.
index
+
1
)
selfseq_dev
.
stop_poll_attribute
(
attribute
);
print
(
'
Disable poll
'
,
attribute
);
attribute
=
'
t{:03d}_t{:03d}_Direction
'
.
format
(
self
.
index
+
1
,
target
.
index
+
1
)
selfseq_dev
.
stop_poll_attribute
(
attribute
);
print
(
'
Disable poll
'
,
attribute
);
self
.
device
.
set_timeout_millis
(
1000
)
#
# DeviceObj::filter_data()
...
...
@@ -1179,13 +1024,6 @@ while 1:
for
dev
in
target_dev
:
dev
.
filter_data
()
# for dev in sensor_dev:
# dev.set_polling_state()
# for dev in target_dev:
# dev.set_polling_state()
for
dev
in
sensor_dev
:
dev
.
process_stats
()
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
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