Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
CCS
Manage
Activity
Members
Plan
Wiki
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Package registry
Model registry
Operate
Terraform modules
Analyze
Contributor 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
Marko Mecina
CCS
Commits
ec50d797
"dartwrf/assimilate.py" did not exist on "a54a65f77c389209c8284374ea51e5a5374ea7c8"
Commit
ec50d797
authored
3 years ago
by
Marko Mecina
Browse files
Options
Downloads
Patches
Plain Diff
minor revision of packet configs
parent
936cd7cd
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
Ccs/packet_config_CHEOPS.py
+23
-11
23 additions, 11 deletions
Ccs/packet_config_CHEOPS.py
Ccs/packet_config_SMILE.py
+5
-5
5 additions, 5 deletions
Ccs/packet_config_SMILE.py
with
28 additions
and
16 deletions
Ccs/packet_config_CHEOPS.py
+
23
−
11
View file @
ec50d797
...
@@ -61,19 +61,24 @@ TC_SECONDARY_HEADER = [
...
@@ -61,19 +61,24 @@ TC_SECONDARY_HEADER = [
(
"
SERV_SUB_TYPE
"
,
ctypes
.
c_uint8
,
8
),
(
"
SERV_SUB_TYPE
"
,
ctypes
.
c_uint8
,
8
),
(
"
SOURCE_ID
"
,
ctypes
.
c_uint8
,
8
)
(
"
SOURCE_ID
"
,
ctypes
.
c_uint8
,
8
)
]
]
# [Format of time Packet, Amount of Bytes in Time Packet, Factor for Finetime
# [Format of time Packet, Amount of Bytes in Time Packet, Factor for Finetime
, length of extra sync flag
timepack
=
[
ptt
[
9
][
17
],
6
,
2
**
15
]
timepack
=
[
ptt
[
9
][
17
],
6
,
2
**
15
,
0
]
CUC_EPOCH
=
datetime
.
datetime
(
2000
,
1
,
1
,
0
,
0
,
0
,
0
,
tzinfo
=
datetime
.
timezone
.
utc
)
CUC_EPOCH
=
datetime
.
datetime
(
2000
,
1
,
1
,
0
,
0
,
0
,
0
,
tzinfo
=
datetime
.
timezone
.
utc
)
def
timecal
(
data
,
string
=
False
):
def
timecal
(
data
,
string
=
False
):
if
not
isinstance
(
data
,
bytes
):
if
not
isinstance
(
data
,
bytes
):
try
:
try
:
return
data
[
0
]
return
data
[
0
]
except
:
except
(
IndexError
,
TypeError
)
:
return
data
return
data
if
len
(
data
)
!=
timepack
[
1
]:
raise
ValueError
(
'
Wrong length of time stamp data ({} bytes)
'
.
format
(
len
(
data
)))
data
=
int
.
from_bytes
(
data
,
'
big
'
)
data
=
int
.
from_bytes
(
data
,
'
big
'
)
coarse
=
data
>>
16
coarse
=
data
>>
16
fine
=
((
data
&
0xffff
)
>>
1
)
/
2
**
15
fine
=
((
data
&
0xffff
)
>>
1
)
/
timepack
[
2
]
if
string
:
if
string
:
sync
=
[
'
U
'
,
'
S
'
][
data
&
1
]
sync
=
[
'
U
'
,
'
S
'
][
data
&
1
]
return
'
{:.6f}{}
'
.
format
(
coarse
+
fine
,
sync
)
return
'
{:.6f}{}
'
.
format
(
coarse
+
fine
,
sync
)
...
@@ -84,11 +89,11 @@ def timecal(data, string=False):
...
@@ -84,11 +89,11 @@ def timecal(data, string=False):
def
calc_timestamp
(
time
,
sync
=
0
):
def
calc_timestamp
(
time
,
sync
=
0
):
if
isinstance
(
time
,
(
float
,
int
)):
if
isinstance
(
time
,
(
float
,
int
)):
ctime
=
int
(
time
)
ctime
=
int
(
time
)
ftime
=
int
(
time
%
1
*
2
**
15
)
ftime
=
round
(
time
%
1
*
timepack
[
2
]
)
elif
isinstance
(
time
,
str
):
elif
isinstance
(
time
,
str
):
t
=
float
(
time
[:
-
1
])
t
=
float
(
time
[:
-
1
])
ctime
=
int
(
t
)
ctime
=
int
(
t
)
ftime
=
int
(
t
%
1
*
2
**
15
)
ftime
=
round
(
t
%
1
*
timepack
[
2
]
)
sync
=
1
if
time
[
-
1
].
upper
()
==
'
S
'
else
0
sync
=
1
if
time
[
-
1
].
upper
()
==
'
S
'
else
0
elif
isinstance
(
time
,
bytes
):
elif
isinstance
(
time
,
bytes
):
ctime
=
int
.
from_bytes
(
time
[:
4
],
'
big
'
)
ctime
=
int
.
from_bytes
(
time
[:
4
],
'
big
'
)
...
@@ -98,11 +103,9 @@ def calc_timestamp(time, sync=0):
...
@@ -98,11 +103,9 @@ def calc_timestamp(time, sync=0):
return
ctime
,
ftime
,
sync
return
ctime
,
ftime
,
sync
# P_HEADER_LEN = sum([x[2] for x in PRIMARY_HEADER]) // 8
PEC_LEN
=
2
# in byte
# TM_HEADER_LEN = sum([x[2] for x in PRIMARY_HEADER + TM_SECONDARY_HEADER]) // 8
P_HEADER_LEN
=
sum
([
x
[
2
]
for
x
in
PRIMARY_HEADER
])
//
8
# TC_HEADER_LEN = sum([x[2] for x in PRIMARY_HEADER + TC_SECONDARY_HEADER]) // 8
TM_HEADER_LEN
=
sum
([
x
[
2
]
for
x
in
PRIMARY_HEADER
+
TM_SECONDARY_HEADER
])
//
8
TC_HEADER_LEN
=
sum
([
x
[
2
]
for
x
in
PRIMARY_HEADER
+
TC_SECONDARY_HEADER
])
//
8
class
PHeaderBits
(
ctypes
.
BigEndianStructure
):
class
PHeaderBits
(
ctypes
.
BigEndianStructure
):
...
@@ -110,6 +113,9 @@ class PHeaderBits(ctypes.BigEndianStructure):
...
@@ -110,6 +113,9 @@ class PHeaderBits(ctypes.BigEndianStructure):
_fields_
=
[(
label
,
ctype
,
bits
)
for
label
,
ctype
,
bits
in
PRIMARY_HEADER
]
_fields_
=
[(
label
,
ctype
,
bits
)
for
label
,
ctype
,
bits
in
PRIMARY_HEADER
]
P_HEADER_LEN
=
ctypes
.
sizeof
(
PHeaderBits
)
class
PHeader
(
ctypes
.
Union
):
class
PHeader
(
ctypes
.
Union
):
_pack_
=
1
_pack_
=
1
_fields_
=
[
_fields_
=
[
...
@@ -123,6 +129,9 @@ class TMHeaderBits(ctypes.BigEndianStructure):
...
@@ -123,6 +129,9 @@ class TMHeaderBits(ctypes.BigEndianStructure):
_fields_
=
[(
label
,
ctype
,
bits
)
for
label
,
ctype
,
bits
in
PRIMARY_HEADER
+
TM_SECONDARY_HEADER
]
_fields_
=
[(
label
,
ctype
,
bits
)
for
label
,
ctype
,
bits
in
PRIMARY_HEADER
+
TM_SECONDARY_HEADER
]
TM_HEADER_LEN
=
ctypes
.
sizeof
(
TMHeaderBits
)
class
TMHeader
(
ctypes
.
Union
):
class
TMHeader
(
ctypes
.
Union
):
_pack_
=
1
_pack_
=
1
_fields_
=
[
_fields_
=
[
...
@@ -136,6 +145,9 @@ class TCHeaderBits(ctypes.BigEndianStructure):
...
@@ -136,6 +145,9 @@ class TCHeaderBits(ctypes.BigEndianStructure):
_fields_
=
[(
label
,
ctype
,
bits
)
for
label
,
ctype
,
bits
in
PRIMARY_HEADER
+
TC_SECONDARY_HEADER
]
_fields_
=
[(
label
,
ctype
,
bits
)
for
label
,
ctype
,
bits
in
PRIMARY_HEADER
+
TC_SECONDARY_HEADER
]
TC_HEADER_LEN
=
ctypes
.
sizeof
(
TCHeaderBits
)
class
TCHeader
(
ctypes
.
Union
):
class
TCHeader
(
ctypes
.
Union
):
_pack_
=
1
_pack_
=
1
_fields_
=
[
_fields_
=
[
...
...
This diff is collapsed.
Click to expand it.
Ccs/packet_config_SMILE.py
+
5
−
5
View file @
ec50d797
...
@@ -66,8 +66,8 @@ TC_SECONDARY_HEADER = [
...
@@ -66,8 +66,8 @@ TC_SECONDARY_HEADER = [
(
"
SOURCE_ID
"
,
ctypes
.
c_uint8
,
8
)
(
"
SOURCE_ID
"
,
ctypes
.
c_uint8
,
8
)
]
]
# [format of time stamp, amount of bytes of time stamp includig sync byte(s), fine time resolution, length of sync flag]
# [format of time stamp, amount of bytes of time stamp includi
n
g sync byte(s), fine time resolution, length of sync flag]
timepack
=
[
ptt
[
9
][
18
],
8
,
1
0
**
6
,
1
]
timepack
=
[
ptt
[
9
][
18
],
8
,
1
e
6
,
1
]
CUC_EPOCH
=
datetime
.
datetime
(
2018
,
1
,
1
,
0
,
0
,
0
,
0
,
tzinfo
=
datetime
.
timezone
.
utc
)
CUC_EPOCH
=
datetime
.
datetime
(
2018
,
1
,
1
,
0
,
0
,
0
,
0
,
tzinfo
=
datetime
.
timezone
.
utc
)
...
@@ -109,15 +109,15 @@ def timecal(data, string=False):
...
@@ -109,15 +109,15 @@ def timecal(data, string=False):
def
calc_timestamp
(
time
,
sync
=
0
,
return_bytes
=
False
):
def
calc_timestamp
(
time
,
sync
=
0
,
return_bytes
=
False
):
if
isinstance
(
time
,
(
float
,
int
)):
if
isinstance
(
time
,
(
float
,
int
)):
ctime
=
int
(
time
)
ctime
=
int
(
time
)
ftime
=
round
(
time
%
1
*
1e6
)
ftime
=
round
(
time
%
1
*
timepack
[
2
]
)
elif
isinstance
(
time
,
str
):
elif
isinstance
(
time
,
str
):
if
time
[:
-
1
]
in
[
'
U
'
,
'
S
'
]:
if
time
[:
-
1
]
in
[
'
U
'
,
'
S
'
]:
t
=
float
(
time
[:
-
1
])
t
=
float
(
time
[:
-
1
])
else
:
else
:
t
=
time
t
=
float
(
time
)
ctime
=
int
(
t
)
ctime
=
int
(
t
)
ftime
=
round
(
t
%
1
*
1e6
)
ftime
=
round
(
t
%
1
*
timepack
[
2
]
)
sync
=
0b101
if
time
[
-
1
].
upper
()
==
'
S
'
else
0
sync
=
0b101
if
time
[
-
1
].
upper
()
==
'
S
'
else
0
elif
isinstance
(
time
,
bytes
):
elif
isinstance
(
time
,
bytes
):
...
...
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