Skip to content

Commit 1f20fb7

Browse files
authored
Merge pull request #256 from alexander-lam/master
Add SOLIS realtime example
2 parents ccb549a + d338947 commit 1f20fb7

File tree

2 files changed

+48
-0
lines changed

2 files changed

+48
-0
lines changed

StkAutomation/Python/Problem_Specific/README.md

+13
Original file line numberDiff line numberDiff line change
@@ -218,3 +218,16 @@ This folder contains examples of converting NASA Earthdata HDF4 and HDF5 files i
218218
* Third-Party Libraries: numpy, pyhdf, h5py, matplotlib
219219

220220
---
221+
222+
## [solisRealtimeExample.py](solisRealtimeExample.py)
223+
224+
This script is an example of decoding a notional telemetry packet defined in the SOLIS framer format. Additionally, the script includes an example of creating a notional commanding packet defined in the SOLIS framer format. This script could be augmented with a connection to SOLIS through a TCP/IP stream to provide real-time telemetry and commanding.
225+
226+
### Dependencies
227+
228+
* Licenses: [STK Pro](https://www.ansys.com/content/dam/amp/2022/june/webpage-requests/stk-product-page/brochures/stk-pro-brochure.pdf) and [STK SOLIS] (https://www.agi.com/products/stk-solis)
229+
* Other Scripts: N/A
230+
* Scenario: N/A
231+
* Third-Party Libraries: N/A
232+
233+
---
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
from struct import Struct
2+
import binascii
3+
import struct
4+
5+
# Data is a raw packet from framer
6+
data = b'D\x16\x98\x12\x00\x00\xe8\x03\x00\x00\x00\x00\xee\xee\xee\xeeUz\x8c\xbd\x00\xda\x1b?\xc6)\x19\xbe\xcd\xacF?\xc9\xb2\xc3\xb8\x0e\xe8\xc19.\x99\x108\x00\x00\x00\x00Uz\x8c\xbd\x00\xda\x1b?\xc6)\x19\xbe\xcd\xacF?\xc9\xb2\xc3\xb8\x0e\xe8\xc19.\x99\x108\x00\x00\x00\x00\x00\x00\x00\x00\xf0?\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xf0?'
7+
8+
# The first two bytes of data represents the apid number
9+
apid_struct = Struct(f"<H")
10+
apid_num = int(apid_struct.unpack(data[0:2])[0])
11+
# apid_num = 5700
12+
print('apid num is', apid_num)
13+
14+
# The next 6 bytes represent the SCLK timestamp
15+
date_parts_struct = Struct('<IH')
16+
nowtime = date_parts_struct.unpack(data[2:8])
17+
ctime = float(nowtime[0]) + float(nowtime[1]/40000)
18+
print('sclk timestamp', ctime)
19+
20+
# The remainder of the packet is the apid data specified by the tlmdb
21+
# Channel values are in the order specified by FswTlmDetail.csv
22+
apid_data_struct = Struct('<I4x7fI7f2B6d')
23+
channel_values = apid_data_struct.unpack(data[8:])
24+
print('channel values', channel_values)
25+
26+
27+
# Command is CMD_TLM_SET_APID_FREQ - 100000 from cmd_master
28+
mnem = '100000'
29+
mnem = binascii.unhexlify(mnem)
30+
raw_command = struct.pack("<I", int.from_bytes(mnem, byteorder='big', signed=False))
31+
32+
# Now check the CmdDetail for the parameters. We have one 8 byte double and one 4 byte unsigned int for this one.
33+
raw_command += struct.pack("<dI", 1, 5700)
34+
print('raw_command', raw_command)
35+
# b'\x00\x00\x10\x00\x00\x00\x00\x00\x00\x00\xf0?D\x16\x00\x00'

0 commit comments

Comments
 (0)