SBK-CSV-File

De MCHobby - Wiki
Révision datée du 6 juillet 2024 à 20:42 par Admin (discussion | contributions) (→‎CSV File content)
(diff) ← Version précédente | Voir la version actuelle (diff) | Version suivante → (diff)
Sauter à la navigation Sauter à la recherche

Forewords

When recording the sensor data, the DataLogger do store the data into a CSV file.

Unlike a computer, the microcontroler that powers the DataLogger has no concept of regional settings.

Consequently, the commonly used settings are applied when generating the CSV files and write numeric values into them.

CSV convention

The comma is used as field separator.

Numbers are written with

  • dot as decimal separator
  • Without thousand separator

Text value are double quoted

DateTime are encoded with the format "dd/mm/yyyy hh:nn:ss"

  • dd: day of the month in two positions
  • mm: month of the year in two positions
  • yyyy: year in four positions
  • hh: hour in two positions (00 to 24)
  • nn: minutes in two positions (00 to 59)
  • ss: seconds in two positions (00 to 59)

CSV Storage

CSV filename is based on its creation time:

  • yyyymmdd-hhnnss.csv (see datetime encoding here above)
  • CSV files are stored into the /data path.

CSV content

The capture below shows an example of CSV file generated by the datalogger.

"iter","datetime","Pression Atmosphérique (hectopascal)","Temperature (Celcius)"
1,01/01/2021 00:01:29, 990.92, 22.92
2,01/01/2021 00:01:30, 990.90, 22.91
3,01/01/2021 00:01:31, 990.88, 22.86
4,01/01/2021 00:01:32, 990.90, 22.85
5,01/01/2021 00:01:33, 990.88, 22.84
6,01/01/2021 00:01:34, 990.88, 22.85
7,01/01/2021 00:01:35, 990.84, 22.84
8,01/01/2021 00:01:36, 990.88, 22.83
9,01/01/2021 00:01:37, 990.87, 22.84

The first row

The first row contains the columns title.
As they are text values, each entry is double-quoted.
The title for data columns use the "long description" of data together with "unit name" (inside parenthesis).

The columns

The first column contains the "iteration" number. This number is incremented by 1 for each new data captured.

Thanks to this iteration number, it is quite easy to detect missing entries in the log file (which may happens when capturing lot of data at very high rate).

The second column contains the timing of captured data.

  • Sampling >= 1sec: contains the date and time of sampling.
  • Sampling < 1sec: contains the number of milliseconds since recording starts.

The other columns, one by captured data, contains the data with format identical to preview mode.

An example

The following capture shows the content of the CSV file configured to schedule data capture every 10 ms (over 2 sensors).

Examining the content of timing columnn reveals that effective sampling is performed every 30ms.

No record is lost because numbering into iteration column is continuous.

"iter","timing (ms)","Temperature (Celcius)","Pression Atmosphérique (hectopascal)","Temperature (Celcius)"
1,0, 20.94, 996.19, 20.14
2,29, 20.94, 996.24, 20.14
3,58, 20.94, 996.20, 20.15
4,99, 20.94, 996.23, 20.15
5,128, 20.94, 996.20, 20.15
6,158, 20.94, 996.22, 20.16
7,201, 20.94, 996.21, 20.16
8,232, 20.94, 996.16, 20.16
9,263, 20.94, 996.25, 20.16
10,293, 20.94, 996.23, 20.17
11,324, 20.94, 996.21, 20.17
12,354, 21.00, 996.25, 20.18
13,385, 21.00, 996.19, 20.18
14,415, 21.00, 996.22, 20.18
15,446, 21.00, 996.28, 20.18
16,493, 21.00, 996.26, 20.19
17,524, 21.00, 996.25, 20.18
18,554, 21.00, 996.28, 20.18
19,585, 21.00, 996.25, 20.18
20,616, 20.94, 996.22, 20.18
21,646, 20.94, 996.18, 20.19
22,677, 20.94, 996.21, 20.19

Written by Meurisse D. for MCHobby


MCHobby investit du temps et de l'argent dans la réalisation de traduction et/ou documentation. C'est un travail long et fastidieux réalisé dans l'esprit Open-Source... donc gratuit et librement accessible.
SI vous aimez nos traductions et documentations ALORS aidez nous à en produire plus en achetant vos produits chez MCHobby.