added table entries from the default configuration file provided by LMU
This commit is contained in:
125
src/main.c
125
src/main.c
@@ -1,5 +1,4 @@
|
|||||||
#include <duckdb.h>
|
#include <duckdb.h>
|
||||||
#include <math.h>
|
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
@@ -25,6 +24,119 @@ int main(int argc, char** argv){
|
|||||||
exit(3);
|
exit(3);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const char *channel_tables[] = {"Ambient Temperature",
|
||||||
|
"Brake Pos",
|
||||||
|
"Brake Pos Unfiltered",
|
||||||
|
"Brake Thickness",
|
||||||
|
"Brakes Air Temp",
|
||||||
|
"Brakes Force",
|
||||||
|
"Brakes Temp",
|
||||||
|
"Clutch Pos",
|
||||||
|
"Clutch Pos Unfiltered",
|
||||||
|
"Clutch RPM",
|
||||||
|
"Drag",
|
||||||
|
"Engine Oil Temp",
|
||||||
|
"Engine RPM",
|
||||||
|
"Engine Water Temp",
|
||||||
|
"FFB Output",
|
||||||
|
"Front3rdDeflection",
|
||||||
|
"FrontDownForce",
|
||||||
|
"FrontRideHeight",
|
||||||
|
"FrontWingHeight",
|
||||||
|
"Fuel Level",
|
||||||
|
"G Force Lat",
|
||||||
|
"G Force Long",
|
||||||
|
"G Force Vert",
|
||||||
|
"GPS Latitude",
|
||||||
|
"GPS Longitude",
|
||||||
|
"GPS Speed",
|
||||||
|
"GPS Time",
|
||||||
|
"Ground Speed",
|
||||||
|
"Lap Dist",
|
||||||
|
"Lateral Acceleration",
|
||||||
|
"Longitudinal Acceleration",
|
||||||
|
"OverheatingState",
|
||||||
|
"Path Lateral",
|
||||||
|
"ReadDownForce",
|
||||||
|
"Rear3rdDeflection",
|
||||||
|
"RearRideHeight",
|
||||||
|
"Regen Rate",
|
||||||
|
"RideHeights",
|
||||||
|
"SoC",
|
||||||
|
"Steered Angle",
|
||||||
|
"Steering Pos",
|
||||||
|
"Steering Pos Unfiltered",
|
||||||
|
"Steering Shaft Torque",
|
||||||
|
"Susp Pos",
|
||||||
|
"Throttle Pos",
|
||||||
|
"Throttle Pos Unfiltered",
|
||||||
|
"Time Behind Next",
|
||||||
|
"Total Dist",
|
||||||
|
"Track Edge",
|
||||||
|
"Track Temperature",
|
||||||
|
"Turbo Boost Pressure",
|
||||||
|
"Tyres Wear",
|
||||||
|
"TyresCarcassTemp",
|
||||||
|
"TyresPressure",
|
||||||
|
"TyresRimTemp",
|
||||||
|
"TyresRubberTemp",
|
||||||
|
"TyresTempCentre",
|
||||||
|
"TyresTempLeft",
|
||||||
|
"TyresTempRight",
|
||||||
|
"Virtual Energy",
|
||||||
|
"Wheel Speed",
|
||||||
|
"Wind Heading",
|
||||||
|
"Wind Speed",
|
||||||
|
"Yaw Rate"};
|
||||||
|
|
||||||
|
const int channel_table_count =
|
||||||
|
sizeof(channel_tables) / sizeof(channel_tables[0]);
|
||||||
|
|
||||||
|
const char *event_tables[] = {"ABS",
|
||||||
|
"ABSLevel",
|
||||||
|
"AntiStall Activated",
|
||||||
|
"Best LapTime",
|
||||||
|
"Best Sector1",
|
||||||
|
"Best Sector2",
|
||||||
|
"Brake Bias Rear",
|
||||||
|
"Brake Migration",
|
||||||
|
"CloudDarkness",
|
||||||
|
"Current LapTime",
|
||||||
|
"Current Sector",
|
||||||
|
"Current Sector1",
|
||||||
|
"Current Sector2",
|
||||||
|
"Engine Max RPM",
|
||||||
|
"Finish Status",
|
||||||
|
"FrontFlapActivated",
|
||||||
|
"FuelMixtureMap",
|
||||||
|
"Gear",
|
||||||
|
"Headlights State",
|
||||||
|
"In Pits",
|
||||||
|
"Lap",
|
||||||
|
"Lap Time",
|
||||||
|
"Last Sector1",
|
||||||
|
"Last Sector2",
|
||||||
|
"LastImpactMagnitude",
|
||||||
|
"LaunchControlActive",
|
||||||
|
"Minimum Path Wetness",
|
||||||
|
"OffpathWetness",
|
||||||
|
"RearFlapActivated",
|
||||||
|
"RearFlapLegalStatus",
|
||||||
|
"Sector1 Flag",
|
||||||
|
"Sector2 Flag",
|
||||||
|
"Sector3 Flag",
|
||||||
|
"Speed Limiter",
|
||||||
|
"SurfaceTypes",
|
||||||
|
"TC",
|
||||||
|
"TCCut",
|
||||||
|
"TCLevel",
|
||||||
|
"TCSlipAngle",
|
||||||
|
"TyresCompound",
|
||||||
|
"WheelsDetached",
|
||||||
|
"Yellow Flag State"};
|
||||||
|
|
||||||
|
const int event_table_count =
|
||||||
|
sizeof(event_tables) / sizeof(event_tables[0]);
|
||||||
|
|
||||||
// Test query
|
// Test query
|
||||||
duckdb_result result;
|
duckdb_result result;
|
||||||
@@ -41,15 +153,16 @@ int main(int argc, char** argv){
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
idx_t row_count = duckdb_data_chunk_get_size(data_chunk); //number of rows from the data chunk
|
idx_t row_count = duckdb_data_chunk_get_size(
|
||||||
|
data_chunk); // number of rows from the data chunk
|
||||||
|
number_of_data_points += row_count;
|
||||||
|
|
||||||
// first column
|
// first column
|
||||||
duckdb_vector col1 = duckdb_data_chunk_get_vector(data_chunk, 0);
|
duckdb_vector col1 = duckdb_data_chunk_get_vector(data_chunk, 0);
|
||||||
float_t *col1_data = (float_t *) duckdb_vector_get_data(col1);
|
float *col1_data = (float *)duckdb_vector_get_data(col1);
|
||||||
uint64_t *col1_validity = duckdb_vector_get_validity(col1);
|
uint64_t *col1_validity = duckdb_vector_get_validity(col1);
|
||||||
|
|
||||||
for (idx_t row = 0; row < row_count; row++) {
|
for (idx_t row = 0; row < row_count; row++) {
|
||||||
number_of_data_points++;
|
|
||||||
if (duckdb_validity_row_is_valid(col1_validity, row)) {
|
if (duckdb_validity_row_is_valid(col1_validity, row)) {
|
||||||
printf("%f, ", col1_data[row]);
|
printf("%f, ", col1_data[row]);
|
||||||
} else {
|
} else {
|
||||||
@@ -60,7 +173,8 @@ int main(int argc, char** argv){
|
|||||||
duckdb_destroy_data_chunk(&data_chunk);
|
duckdb_destroy_data_chunk(&data_chunk);
|
||||||
}
|
}
|
||||||
|
|
||||||
printf("\nNumber of iterations: %d, number of data points: %d\n", iterations, number_of_data_points);
|
printf("\nNumber of iterations: %d, number of data points: %d\n",
|
||||||
|
iterations, number_of_data_points);
|
||||||
|
|
||||||
printf("Shutting down HardCompound!\n");
|
printf("Shutting down HardCompound!\n");
|
||||||
|
|
||||||
@@ -71,6 +185,5 @@ int main(int argc, char** argv){
|
|||||||
duckdb_disconnect(&conn);
|
duckdb_disconnect(&conn);
|
||||||
duckdb_close(&db);
|
duckdb_close(&db);
|
||||||
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user