Page 69 - Fister jr., Iztok, Andrej Brodnik, Matjaž Krnc and Iztok Fister (eds.). StuCoSReC. Proceedings of the 2019 6th Student Computer Science Research Conference. Koper: University of Primorska Press, 2019
P. 69
eric scenario Conditions fail Action Logger task Flash Command
Conditions match 0 001101001010101…
Conditions match Generic task
Conditions fail Location Length Binary data
Conditions match Settings Command
Conditions match
0 101101001010101…
Action Log action Enqueue Scenario ID Binary data (length of scenario data)
Log action
Time Control Command
1 0 11 0 1 0 0 1 0 1 0 1 0 1 …
Logger scenario Report scenario
Enqueue Scenario ID Notification binary data (3 bytes)
Template report
0 001101001010101…
Store to SD Report Scenario 1 data Scenario 2 data
Key-value report
0 1011010010 001101…
Scenario 1 ID Binary data
Figure 3: Timeline of an example generic task, log- 0 - Scenario data
ger, and reporter 10 - Error report (4bytes)
11 - Stream to the end of the message
2.2 Communication
Custom report
Communication size is reduced to a minimum with compres-
sion based on common-knowledge. Since the server has the 1 01101001010101…
same template, we can use that to avoid sending headers
before each data blob in some cases. The packet size, in Custom binary data
our example, the Iridium satellite network, is limited to 360
bytes from the probe and 270 bytes to the probe with charge Figure 4: Command and report encoding format
intervals of 50 bytes [2]. We use those limits to optimize ex-
penses on low-value data. has nothing to report. This method will not apply if there
are any scenarios with errors to report. If there is enough
2.2.1 Reporting space at the end of the packet, we fill the rest of the 50-byte
section with key-values, as explained in the next section.
The reporter is a special scenario, available to all tasks for
reporting purposes. Each priority level has a queue, and 2.2.3 Key-Value Reporting
repeat entries are overwritten. Scenarios send notifications
to the Reporter task using the notification variable and are The Key-Value is the most basic report used when there
saved to the queue, awaiting packet construction. At prede- are errors or unknown data type in the templated report.
fined intervals, the packet is constructed using the available The scenarios are again listed one after the other, prefixed
reports (see figure 1). Critical reports can be sent and are with the scenario key and the type of data prefix. Unlike
flushed to the modem instantly using a special flag in the the templated report, the type of data can denote if the
report command. following bytes are fixed width or if a length follows.
To save space, we encode the reports into several kinds of 2.2.4 Custom Report
formats, denoted by the first few bits in the message.
The custom report is a special report that can be only sent
2.2.2 Templated Report on demand from a scenario and has no structure beyond the
first bit. This type of report is intended for crash reports and
The primary way to report is to use the section arrangement critical errors and is not meant to be automatically handled.
on the microcontroller flash and the priority values to order
the scenarios. The first bit in the stream of each scenario 2.3 Commands
reports if the bits that follow are from the scenario. The
domain-specific language denotes the length of the data the Commands are packets sent from the server to configure or
scenario will report. If the report bit is zero, we skip to the run scenarios and to update any part of the microcontroller
next scenario with only 1 bit used to determine the scenario flash.
2.3.1 Flash Commands
StuCoSReC Proceedings of the 2019 6th Student Computer Science Research Conference 69
Koper, Slovenia, 10 October
Conditions match 0 001101001010101…
Conditions match Generic task
Conditions fail Location Length Binary data
Conditions match Settings Command
Conditions match
0 101101001010101…
Action Log action Enqueue Scenario ID Binary data (length of scenario data)
Log action
Time Control Command
1 0 11 0 1 0 0 1 0 1 0 1 0 1 …
Logger scenario Report scenario
Enqueue Scenario ID Notification binary data (3 bytes)
Template report
0 001101001010101…
Store to SD Report Scenario 1 data Scenario 2 data
Key-value report
0 1011010010 001101…
Scenario 1 ID Binary data
Figure 3: Timeline of an example generic task, log- 0 - Scenario data
ger, and reporter 10 - Error report (4bytes)
11 - Stream to the end of the message
2.2 Communication
Custom report
Communication size is reduced to a minimum with compres-
sion based on common-knowledge. Since the server has the 1 01101001010101…
same template, we can use that to avoid sending headers
before each data blob in some cases. The packet size, in Custom binary data
our example, the Iridium satellite network, is limited to 360
bytes from the probe and 270 bytes to the probe with charge Figure 4: Command and report encoding format
intervals of 50 bytes [2]. We use those limits to optimize ex-
penses on low-value data. has nothing to report. This method will not apply if there
are any scenarios with errors to report. If there is enough
2.2.1 Reporting space at the end of the packet, we fill the rest of the 50-byte
section with key-values, as explained in the next section.
The reporter is a special scenario, available to all tasks for
reporting purposes. Each priority level has a queue, and 2.2.3 Key-Value Reporting
repeat entries are overwritten. Scenarios send notifications
to the Reporter task using the notification variable and are The Key-Value is the most basic report used when there
saved to the queue, awaiting packet construction. At prede- are errors or unknown data type in the templated report.
fined intervals, the packet is constructed using the available The scenarios are again listed one after the other, prefixed
reports (see figure 1). Critical reports can be sent and are with the scenario key and the type of data prefix. Unlike
flushed to the modem instantly using a special flag in the the templated report, the type of data can denote if the
report command. following bytes are fixed width or if a length follows.
To save space, we encode the reports into several kinds of 2.2.4 Custom Report
formats, denoted by the first few bits in the message.
The custom report is a special report that can be only sent
2.2.2 Templated Report on demand from a scenario and has no structure beyond the
first bit. This type of report is intended for crash reports and
The primary way to report is to use the section arrangement critical errors and is not meant to be automatically handled.
on the microcontroller flash and the priority values to order
the scenarios. The first bit in the stream of each scenario 2.3 Commands
reports if the bits that follow are from the scenario. The
domain-specific language denotes the length of the data the Commands are packets sent from the server to configure or
scenario will report. If the report bit is zero, we skip to the run scenarios and to update any part of the microcontroller
next scenario with only 1 bit used to determine the scenario flash.
2.3.1 Flash Commands
StuCoSReC Proceedings of the 2019 6th Student Computer Science Research Conference 69
Koper, Slovenia, 10 October