Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
T
tango
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Jira issues
Open 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
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
LOFAR2.0
tango
Commits
b2b7f3be
Commit
b2b7f3be
authored
3 years ago
by
Taya Snijder
Browse files
Options
Downloads
Patches
Plain Diff
processed review feedback
parent
2ce885bf
Branches
Branches containing commit
Tags
Tags containing commit
1 merge request
!50
Resolve L2SS-188 "2021 05 27 branched from master udp recv sst client"
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
devices/Statistics.py
+4
-4
4 additions, 4 deletions
devices/Statistics.py
devices/clients/sst_client.py
+7
-7
7 additions, 7 deletions
devices/clients/sst_client.py
devices/udp_simulator.py
+4
-4
4 additions, 4 deletions
devices/udp_simulator.py
with
15 additions
and
15 deletions
devices/Statistics.py
+
4
−
4
View file @
b2b7f3be
...
...
@@ -36,7 +36,7 @@ class SST(hardware_device):
# -----------------
SST_Port
=
device_property
(
dtype
=
'
DevU
Long
'
,
dtype
=
'
DevU
Short
'
,
mandatory
=
True
)
...
...
@@ -45,8 +45,8 @@ class SST(hardware_device):
# ----------
# --------
packet_count_R
=
attribute_wrapper
(
comms_annotation
=
{
"
parameter
"
:
"
packet_count
"
},
datatype
=
numpy
.
int64
)
timestamp_R
=
attribute_wrapper
(
comms_annotation
=
{
"
parameter
"
:
"
timestamp
"
},
datatype
=
numpy
.
int64
)
packet_count_R
=
attribute_wrapper
(
comms_annotation
=
{
"
parameter
"
:
"
packet_count
_R
"
},
datatype
=
numpy
.
int64
)
last_packet_
timestamp_R
=
attribute_wrapper
(
comms_annotation
=
{
"
parameter
"
:
"
last_packet_
timestamp
_R
"
},
datatype
=
numpy
.
int64
)
# --------
# overloaded functions
...
...
@@ -73,7 +73,7 @@ class SST(hardware_device):
except
Exception
as
e
:
# use the pass function instead of setting read/write fails
i
.
set_pass_func
()
self
.
warn_stream
(
"
error while setting the sst attribute {} read/write function. {}
"
.
format
(
i
,
e
))
self
.
warn_stream
(
"
error while setting the sst attribute {} read/write function. {}
. using pass function instead
"
.
format
(
i
,
e
))
pass
self
.
sst_client
.
start
()
...
...
This diff is collapsed.
Click to expand it.
devices/clients/sst_client.py
+
7
−
7
View file @
b2b7f3be
...
...
@@ -153,8 +153,8 @@ class SST(Thread):
self
.
last_packet
=
None
self
.
parameters
=
{
"
packet_count
"
:
numpy
.
int64
(
0
),
"
timestamp
"
:
numpy
.
int64
(
0
)
"
packet_count
_R
"
:
numpy
.
int64
(
0
),
"
last_packet_
timestamp
_R
"
:
numpy
.
int64
(
0
)
}
super
().
__init__
()
...
...
@@ -166,17 +166,17 @@ class SST(Thread):
while
True
:
if
len
(
self
.
deque
)
>
0
:
packet
=
self
.
deque
.
pop
()
packet
=
self
.
deque
.
pop
left
()
# if packet is None:
# break
self
.
decode
(
packet
)
self
.
process_packet
(
packet
)
def
__del__
(
self
):
self
.
deque
.
appendleft
(
None
)
self
.
join
()
def
decode
(
self
,
packet
):
self
.
parameters
[
"
packet_count
"
]
=
self
.
parameters
[
"
packet_count
"
]
+
numpy
.
int64
(
1
)
self
.
parameters
[
"
timestamp
"
]
=
numpy
.
int64
(
int
(
time
.
time
()))
def
process_packet
(
self
,
packet
):
self
.
parameters
[
"
packet_count
_R
"
]
+=
1
self
.
parameters
[
"
last_packet_
timestamp
_R
"
]
=
numpy
.
int64
(
int
(
time
.
time
()))
This diff is collapsed.
Click to expand it.
devices/udp_simulator.py
+
4
−
4
View file @
b2b7f3be
...
...
@@ -9,14 +9,14 @@ MESSAGE = "{}".format(i)
print
(
"
UDP target IP: %s
"
%
UDP_IP
)
print
(
"
UDP target port: %s
"
%
UDP_PORT
)
print
(
"
message: %s
"
%
MESSAGE
)
sock
=
socket
.
socket
(
socket
.
AF_INET
,
# Internet
socket
.
SOCK_DGRAM
)
# UDP
sock
=
socket
.
socket
(
socket
.
AF_INET
,
socket
.
SOCK_DGRAM
)
# create UDP socket
while
True
:
sock
.
sendto
(
bytes
(
MESSAGE
,
"
utf-8
"
),
(
UDP_IP
,
UDP_PORT
))
i
+=
1
MESSAGE
=
"
{}
"
.
format
(
i
)
#sleep for an arbitrary amount of time. Currently 0.2 settings for visual testing.
time
.
sleep
(
0.2
)
# time.sleep(0.1)
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