Data History - Asviix/F1Manager2024Logger GitHub Wiki
The Data History
feature allows advanced users to access detailed historical telemetry data for all cars in the session. This data is stored lap-by-lap and turn-by-turn, enabling in-depth analysis of driver performance, car behavior, and session trends.
The Data History
is managed by the HistoricalData
functionality in the plugin's C# code. It stores telemetry data for each car, organized by laps and turns. This data is updated whenever a car completes a new turn or lap.
- Lap and Turn Data: Data is stored for each lap and turn, allowing precise tracking of car performance.
- Session Reset Handling: If the session resets (e.g., a new race starts), all historical data is cleared automatically.
- JSON Serialization: The data is serialized into JSON format, making it easy to parse and use programmatically.
The historical data is exposed as JSON properties in SimHub. Each car has its own history, accessible via the following format:
F1Manager.[CarName].History.Lap[LapNumber]
To access the historical data for Ferrari1
on lap 5:
let lapData = JSON.parse($prop('F1Manager.Ferrari1.History.Lap5'));
This will return a JSON object containing all telemetry data for each turn in lap 5.
Jint is a JavaScript engine integrated into SimHub that allows you to write custom scripts. You can use Jint to parse and analyze the historical data.
To get the data for turn 3 of lap 5 for Ferrari1
:
let lapData = JSON.parse($prop('F1Manager.Ferrari1.History.Lap5'));
let turn3Data = lapData.Turns[3];
return turn3Data;
To calculate the average speed for Ferrari1
on lap 5:
let lapData = JSON.parse($prop('F1Manager.Ferrari1.History.Lap5'));
let totalSpeed = 0;
let turnCount = 0;
for (let turn in lapData.Turns) {
totalSpeed += lapData.Turns[turn].telemetry.driver.car.speed;
turnCount++;
}
let averageSpeed = totalSpeed / turnCount;
return averageSpeed;
To compare the front-left tyre wear across all turns in lap 5:
let lapData = JSON.parse($prop('F1Manager.Ferrari1.History.Lap5'));
let tyreWear = [];
for (let turn in lapData.Turns) {
tyreWear.push({
turn: turn,
flWear: lapData.Turns[turn].telemetry.driver.car.tyres.wear.flDeg
});
}
return tyreWear;
- Understanding JSON Structure: The historical data is stored as a nested JSON object. Familiarity with JSON parsing is essential.
- Performance Considerations: Accessing large amounts of historical data can impact performance. Use scripts efficiently.
- Custom Analysis: You can write custom scripts to analyze trends, predict outcomes, or visualize data in dashboards.
- Maximum Laps Stored: The plugin stores data for up to 70 laps per car. Older laps are automatically removed to save memory.
- Session Reset: All historical data is cleared when a new session starts.
The Data History
feature is a powerful tool for advanced users who want to dive deep into telemetry data. By leveraging Jint and JSON parsing, you can create custom analyses and gain insights into car and driver performance. However, this feature requires a solid understanding of coding and data structures.