Converts time series data into popular motorsport Data Logger formats.
This library was developed at B'Energy Racing, a Formula SAE Electric Team from the Facens University Center.
Format | Extension | Software | Support |
---|---|---|---|
Pro Tune | .dlf | Pro Tune Analyzer | Writer |
EFI Analytics ASCII | .msl | MegaLogViewer | Writer |
EFI Analytics Binary MLG (MLVLG) | .mlg | MegaLogViewer | Writer |
MoTeC CSV | .csv | MoTeC i2 | Writer |
Pi ASCII | .txt | Cosworth Pi Toolbox | Writer |
BOSCH Darab ASCII | .txt | Bosch WinDarab | Writer |
RacePak ASCII | .txt | RacePak DataLink II | Writer |
Excel CSV | .csv | Microsoft Excel | Writer |
CSV | .csv, .tsv | - | Reader/Writer |
B'Energy Meteor Log | .met | - | Reader/Writer |
JSON (raw data frames) | .json | - | Reader/Writer |
The CLI allows converting without writing a single line of code.
By default, it reads CSV files and outputs any format. The CSV file must have the first column as the timestamp in seconds. Columns can follow the format Name (unit)
or Name (unit) [key]
.
You need NodeJS (16+ is recommended) installed first. Then, run the following command:
npm install -g racing-data-converter
Run racing-data-converter --help
for a list of options.
racing-data-converter ./input.csv ./output.dlf --output-format protune
This command will convert an input CSV file named input.csv
to a Pro Tune's log file named output.dlf
.
- Create an input stream. This can be a simple passthrough stream such as
DataFrameStream
or read from aCsvReader
,MeteorReader
or aJsonReader
. - Define the list of channels that you will work with, including information such as the unit of measure.
- Create a writer. This can be a
CsvWriter
,MeteorWriter
,ExcelCsvWriter
,MslWriter
,MlgWriter
,MotecCsvWriter
,PiToolboxAsciiWriter
,ProtuneWriter
,RacePakWriter
,WinDarabWriter
or aJsonWriter
. - Create a writer stream from the writer class, receiving the input stream created earlier.
- The file is successfully converted!
npm install racing-data-converter
import { DataFrameStream, ProtuneWriter, SensorChannel } from 'racing-data-converter';
import * as fs from 'node:fs';
// Creates a plain data frame stream. This will be the input
const dataFrameStream = new DataFrameStream();
// Creates a Protune writer with two channels
const writer = new ProtuneWriter({
channels: [
{
key: SensorChannel.GPS_SPEED,
name: 'Speed',
unit: 'Km/h',
},
{
key: 'happy-sensor',
name: 'Happy Sensor',
unit: 'm',
decimalPlaces: 2,
}
]
});
// Creates a Protune stream using the data frame stream as the input
const protuneStream = writer.createStream(dataFrameStream);
// Pipes the Protune stream into the output file
protuneStream.pipe(fs.createWriteStream('sample-output.dlf'));
// Writes a few data frames
dataFrameStream.write({
channel: SensorChannel.GPS_SPEED,
value: 53,
timestamp: 10,
});
dataFrameStream.write({
channel: 'happy-sensor',
value: 3925,
timestamp: 15,
});
dataFrameStream.write({
channel: SensorChannel.GPS_SPEED,
value: 59,
timestamp: 20,
});
// Finishes writing
dataFrameStream.end();
There are more samples available.