Update: added plot_settings, integrated loadvector, added folders/files for future season preset selection

This commit is contained in:
2025-05-26 18:13:34 +02:00
parent 1e9dcbe19d
commit 7cdc35c90c
58 changed files with 2175 additions and 168 deletions

View File

@ -0,0 +1,43 @@
function [outputArg] = plot_accumulator(panel, selected_laps, pltData)
% create tiledlayout (R2023a and newer)
tl = tiledlayout(panel,"vertical");
% plot 1: speed [km/h]
ax1 = nexttile(tl);
hold(ax1, "on")
grid(ax1, "on")
title(ax1, "Speed [km/h]")
for i = 1:length(selected_laps)
plot(ax1,pltData(selected_laps(i)).xAxis, pltData(selected_laps(i)).speed_kph)
end
% plot 2: power [kW]
ax2 = nexttile(tl);
hold(ax2, "on")
grid(ax2, "on")
title(ax2, "Power [kW]")
for i = 1:length(selected_laps)
plot(ax2,pltData(selected_laps(i)).xAxis, pltData(selected_laps(i)).ams_ptot)
end
% plot 3: Max Cell Temp [°C]
ax3 = nexttile(tl);
hold(ax3, "on")
grid(ax3, "on")
title(ax3, "Max Cell Temp [°C]")
for i = 1:length(selected_laps)
plot(ax3,pltData(selected_laps(i)).xAxis, pltData(selected_laps(i)).ams_tmax)
end
% plot 4: State of charge [%]
ax4 = nexttile(tl);
hold(ax4, "on")
grid(ax4, "on")
title(ax4, "SOC")
for i = 1:length(selected_laps)
plot(ax4,pltData(selected_laps(i)).xAxis, pltData(selected_laps(i)).ams_soc)
end
% link all x axes
linkaxes([ax1, ax2, ax3, ax4],"x")
% return null (not relevant for plots!)
outputArg = [];
end

View File

@ -0,0 +1,59 @@
function [outputArg] = plot_brakes(panel, selected_laps, pltData)
% create tiledlayout (R2023a and newer)
tl = tiledlayout(panel,"vertical");
% plot 1: speed
ax1 = nexttile(tl);
hold(ax1, "on")
grid(ax1, "on")
title(ax1, "Speed [km/h]")
for i = 1:length(selected_laps)
plot(ax1,pltData(selected_laps(i)).xAxis, pltData(selected_laps(i)).speed_kph)
end
% plot 2: brake pressure front/rear [bar]
ax2 = nexttile(tl);
hold(ax2, "on")
grid(ax2, "on")
title(ax2, "Brake Pressure F/R [bar]")
for i = 1:length(selected_laps)
plot(ax2,pltData(selected_laps(i)).xAxis, pltData(selected_laps(i)).brakePFront_bar)
plot(ax2,pltData(selected_laps(i)).xAxis, pltData(selected_laps(i)).brakePRear_bar)
end
legend(ax2, "Front", "Rear")
% plot 3: longitudinal acceleration [g]
ax3 = nexttile(tl);
hold(ax3, "on")
grid(ax3, "on")
title(ax3, "Long Acc [g]")
for i = 1:length(selected_laps)
plot(ax3,pltData(selected_laps(i)).xAxis, pltData(selected_laps(i)).acc_long_g)
end
% plot 4: Brake Temp [°C]
ax4 = nexttile(tl);
hold(ax4, "on")
grid(ax4, "on")
title(ax4, "Brake Temp [°C]")
for i = 1:length(selected_laps)
plot(ax4,pltData(selected_laps(i)).xAxis, pltData(selected_laps(i)).brakeTFrontLeft_degC)
plot(ax4,pltData(selected_laps(i)).xAxis, pltData(selected_laps(i)).brakeTFrontRight_degC)
plot(ax4,pltData(selected_laps(i)).xAxis, pltData(selected_laps(i)).brakeTRearLeft_degC)
plot(ax4,pltData(selected_laps(i)).xAxis, pltData(selected_laps(i)).brakeTRearRight_degC)
end
legend(ax4, "FL", "FR", "RL", "RR")
% plot 5: brake bias [%]
ax5 = nexttile(tl);
hold(ax5, "on")
grid(ax5, "on")
title(ax5, "Brake Bias [%]")
for i = 1:length(selected_laps)
plot(ax5,pltData(selected_laps(i)).xAxis, pltData(selected_laps(i)).brakeBias_perc)
end
% link all x axes
linkaxes([ax1, ax2, ax3, ax4, ax5],"x")
% return null (not relevant for plots!)
outputArg = [];
end

View File

@ -0,0 +1,43 @@
function [outputArg] = plot_driver_braking(panel, selected_laps, pltData)
% create tiledlayout (R2023a and newer)
tl = tiledlayout(panel,"vertical");
% plot 1: speed
ax1 = nexttile(tl);
hold(ax1, "on")
grid(ax1, "on")
title(ax1, "Speed [km/h]")
for i = 1:length(selected_laps)
plot(ax1,pltData(selected_laps(i)).xAxis, pltData(selected_laps(i)).speed_kph)
end
% plot 2: accelerator pedal position [%]
ax2 = nexttile(tl);
hold(ax2, "on")
grid(ax2, "on")
title(ax2, "APP [%]")
for i = 1:length(selected_laps)
plot(ax2,pltData(selected_laps(i)).xAxis, pltData(selected_laps(i)).app_percent)
end
% plot 3: brake pressure front [bar]
ax3 = nexttile(tl);
hold(ax3, "on")
grid(ax3, "on")
title(ax3, "Brake Pressure Front [bar]")
for i = 1:length(selected_laps)
plot(ax3,pltData(selected_laps(i)).xAxis, pltData(selected_laps(i)).brakePFront_bar)
end
% plot 4: longitudinal acceleration [g]
ax4 = nexttile(tl);
hold(ax4, "on")
grid(ax4, "on")
title(ax4, "Long Acc [g]")
for i = 1:length(selected_laps)
plot(ax4,pltData(selected_laps(i)).xAxis, pltData(selected_laps(i)).acc_long_g)
end
% link all x axes
linkaxes([ax1, ax2, ax3, ax4],"x")
% return null (not relevant for plots!)
outputArg = [];
end

View File

@ -0,0 +1,43 @@
function [outputArg] = plot_driver_general(panel, selected_laps, pltData)
% create tiledlayout (R2023a and newer)
tl = tiledlayout(panel,"vertical");
% plot 1: speed
ax1 = nexttile(tl);
hold(ax1, "on")
grid(ax1, "on")
title(ax1, "Speed [km/h]")
for i = 1:length(selected_laps)
plot(ax1,pltData(selected_laps(i)).xAxis, pltData(selected_laps(i)).speed_kph)
end
% plot 2: accelerator pedal position [%]
ax2 = nexttile(tl);
hold(ax2, "on")
grid(ax2, "on")
title(ax2, "APP [%]")
for i = 1:length(selected_laps)
plot(ax2,pltData(selected_laps(i)).xAxis, pltData(selected_laps(i)).app_percent)
end
% plot 3: brake pressure front [bar]
ax3 = nexttile(tl);
hold(ax3, "on")
grid(ax3, "on")
title(ax3, "Brake Pressure Front [bar]")
for i = 1:length(selected_laps)
plot(ax3,pltData(selected_laps(i)).xAxis, pltData(selected_laps(i)).brakePFront_bar)
end
% plot 4: steering angle [°]
ax4 = nexttile(tl);
hold(ax4, "on")
grid(ax4, "on")
title(ax4, "Steering Angle [°]")
for i = 1:length(selected_laps)
plot(ax4,pltData(selected_laps(i)).xAxis, pltData(selected_laps(i)).steering_deg)
end
% link all x axes
linkaxes([ax1, ax2, ax3, ax4],"x")
% return null (not relevant for plots!)
outputArg = [];
end

View File

@ -0,0 +1,46 @@
function [outputArg] = plot_driver_statistics(panel, selected_laps, pltData)
% create tiledlayout (R2023a and newer)
tl = tiledlayout(panel,"vertical");
% plot 1: speed
ax1 = nexttile(tl);
hold(ax1, "on")
grid(ax1, "on")
title(ax1, "speed [km/h]")
for i = 1:length(selected_laps)
plot(ax1,pltData(selected_laps(i)).xAxis,pltData(selected_laps(i)).speed_kph)
end
% plot 2: accelerator pedal position [%]
ax2 = nexttile(tl);
hold(ax2, "on")
grid(ax2, "on")
title(ax2, "APP [%]")
for i = 1:length(selected_laps)
plot(ax2,pltData(selected_laps(i)).xAxis,pltData(selected_laps(i)).app_percent)
end
linkaxes([ax1, ax2],"x")
% plot 3: accelerator pedal position histogram
ax3 = nexttile(tl);
hold(ax3, "on")
grid(ax3, "on")
title(ax3, "APP distribution")
ylabel(ax3, "\sigma [%]")
xlabel(ax3, "APP [%]")
for i = 1:length(selected_laps)
histogram(ax3,pltData(selected_laps(i)).app_percent,"Normalization","percentage")
end
% plot 4: brake pressure histogram
ax4 = nexttile(tl);
hold(ax4, "on")
grid(ax4, "on")
title(ax4, "BrakeP distribution")
ylabel(ax4, "\sigma [%]")
xlabel(ax4, "Brake Pressure Front [bar]")
for i = 1:length(selected_laps)
histogram(ax4,pltData(selected_laps(i)).brakePFront_bar,"Normalization","percentage")
end
% return null (not relevant for plots!)
outputArg = [];
end

View File

@ -0,0 +1,42 @@
function [outputArg] = plot_driver_steering(panel, selected_laps, pltData)
% create tiledlayout (R2023a and newer)
tl = tiledlayout(panel,"vertical");
% plot 1: speed
ax1 = nexttile(tl);
hold(ax1, "on")
grid(ax1, "on")
title(ax1, "Speed [km/h]")
for i = 1:length(selected_laps)
plot(ax1,pltData(selected_laps(i)).xAxis, pltData(selected_laps(i)).speed_kph)
end
% plot 2: steering angle [°]
ax2 = nexttile(tl);
hold(ax2, "on")
grid(ax2, "on")
title(ax2, "Steering Angle [°]")
for i = 1:length(selected_laps)
plot(ax2,pltData(selected_laps(i)).xAxis, pltData(selected_laps(i)).steering_deg)
end
% plot 3: oversteer
ax3 = nexttile(tl);
hold(ax3, "on")
grid(ax3, "on")
title(ax3, "Oversteer")
% TODO!!
% plot 4: lateral acceleration [g]
ax4 = nexttile(tl);
hold(ax4, "on")
grid(ax4, "on")
title(ax4, "Lateral Acc [g]")
for i = 1:length(selected_laps)
plot(ax4,pltData(selected_laps(i)).xAxis, pltData(selected_laps(i)).acc_lat_g)
end
% link all x axes
linkaxes([ax1, ax2, ax3, ax4],"x")
% return null (not relevant for plots!)
outputArg = [];
end

View File

@ -0,0 +1,60 @@
function [outputArg] = plot_inverter(panel, selected_laps, pltData)
% create tiledlayout (R2023a and newer)
tl = tiledlayout(panel,"vertical");
% plot 1: speed [km/h]
ax1 = nexttile(tl);
hold(ax1, "on")
grid(ax1, "on")
title(ax1, "Speed [km/h]")
for i = 1:length(selected_laps)
plot(ax1,pltData(selected_laps(i)).xAxis, pltData(selected_laps(i)).speed_kph)
end
% plot 2: Inverter Temps [°C]
ax2 = nexttile(tl);
hold(ax2, "on")
grid(ax2, "on")
title(ax2, "Inverter Temp [°C]")
for i = 1:length(selected_laps)
plot(ax2,pltData(selected_laps(i)).xAxis, pltData(selected_laps(i)).invL_temp)
plot(ax2,pltData(selected_laps(i)).xAxis, pltData(selected_laps(i)).invR_temp)
end
legend(ax2, "Left", "Right")
% plot 3: Torque request / actual inverter left
ax3 = nexttile(tl);
hold(ax3, "on")
grid(ax3, "on")
title(ax3, "Left Torque")
for i = 1:length(selected_laps)
plot(ax3,pltData(selected_laps(i)).xAxis, pltData(selected_laps(i)).invL_torqueDemand)
plot(ax3,pltData(selected_laps(i)).xAxis, pltData(selected_laps(i)).invL_torqueActual)
end
legend(ax3, "Demand", "Actual")
% plot 4: Torque request / actual inverter right
ax4 = nexttile(tl);
hold(ax4, "on")
grid(ax4, "on")
title(ax4, "Right Torque")
for i = 1:length(selected_laps)
plot(ax4,pltData(selected_laps(i)).xAxis, pltData(selected_laps(i)).invR_torqueDemand)
plot(ax4,pltData(selected_laps(i)).xAxis, pltData(selected_laps(i)).invR_torqueActual)
end
legend(ax4, "Demand", "Actual")
% plot 5: Motor velocities
ax5 = nexttile(tl);
hold(ax5, "on")
grid(ax5, "on")
title(ax5, "Motor Velocities [1/min]")
for i = 1:length(selected_laps)
plot(ax5,pltData(selected_laps(i)).xAxis, pltData(selected_laps(i)).motL_vel_rpm)
plot(ax5,pltData(selected_laps(i)).xAxis, pltData(selected_laps(i)).motR_vel_rpm)
end
legend(ax5, "Left", "Right")
% link all x axes
linkaxes([ax1, ax2, ax3, ax4, ax5],"x")
% return null (not relevant for plots!)
outputArg = [];
end

View File

@ -0,0 +1,58 @@
function [outputArg] = plot_powertrain(panel, selected_laps, pltData)
% create tiledlayout (R2023a and newer)
tl = tiledlayout(panel,"vertical");
% plot 1: speed [km/h]
ax1 = nexttile(tl);
hold(ax1, "on")
grid(ax1, "on")
title(ax1, "Speed [km/h]")
for i = 1:length(selected_laps)
plot(ax1,pltData(selected_laps(i)).xAxis, pltData(selected_laps(i)).speed_kph)
end
% plot 2: power [kW]
ax2 = nexttile(tl);
hold(ax2, "on")
grid(ax2, "on")
title(ax2, "Power [kW]")
for i = 1:length(selected_laps)
plot(ax2,pltData(selected_laps(i)).xAxis, pltData(selected_laps(i)).ams_ptot)
end
% plot 3: Inverter Temps [°C]
ax3 = nexttile(tl);
hold(ax3, "on")
grid(ax3, "on")
title(ax3, "Inverter Temp [°C]")
for i = 1:length(selected_laps)
plot(ax3,pltData(selected_laps(i)).xAxis, pltData(selected_laps(i)).invL_temp)
plot(ax3,pltData(selected_laps(i)).xAxis, pltData(selected_laps(i)).invR_temp)
end
legend(ax3, "Left", "Right")
% plot 4: Motor Temps
ax4 = nexttile(tl);
hold(ax4, "on")
grid(ax4, "on")
title(ax4, "Motor Temp [°C]")
for i = 1:length(selected_laps)
plot(ax4,pltData(selected_laps(i)).xAxis, pltData(selected_laps(i)).motL_temp)
plot(ax4,pltData(selected_laps(i)).xAxis, pltData(selected_laps(i)).motR_temp)
end
legend(ax4, "Left", "Right")
% plot 5: Motor velocities
ax5 = nexttile(tl);
hold(ax5, "on")
grid(ax5, "on")
title(ax5, "Motor Velocities [1/min]")
for i = 1:length(selected_laps)
plot(ax5,pltData(selected_laps(i)).xAxis, pltData(selected_laps(i)).motL_vel_rpm)
plot(ax5,pltData(selected_laps(i)).xAxis, pltData(selected_laps(i)).motR_vel_rpm)
end
legend(ax5, "Left", "Right")
% link all x axes
linkaxes([ax1, ax2, ax3, ax4, ax5],"x")
% return null (not relevant for plots!)
outputArg = [];
end

View File

@ -0,0 +1,41 @@
function [outputArg] = plot_suspension_histogram(panel, selected_laps, pltData)
% create tiledlayout (R2023a and newer)
tl = tiledlayout(panel,"vertical");
% plot 1: position heave front [mm/s]
ax1 = nexttile(tl);
hold(ax1, "on")
grid(ax1, "on")
title(ax1, "Heave Front [mm/s]")
for i = 1:length(selected_laps)
histogram(ax1, pltData(selected_laps(i)).velocityHeaveFront_mmps,"Normalization","percentage")
end
% plot 2: position roll front [mm/s]
ax2 = nexttile(tl);
hold(ax2, "on")
grid(ax2, "on")
title(ax2, "Roll Front [mm/s]")
for i = 1:length(selected_laps)
histogram(ax2, pltData(selected_laps(i)).velocityHeaveFront_mmps,"Normalization","percentage")
end
% plot 3: position heave front [mm/s]
ax3 = nexttile(tl);
hold(ax3, "on")
grid(ax3, "on")
title(ax3, "Heave Rear [mm/s]")
for i = 1:length(selected_laps)
histogram(ax3, pltData(selected_laps(i)).velocityHeaveFront_mmps,"Normalization","percentage")
end
% plot 4: position roll front [mm/s]
ax4 = nexttile(tl);
hold(ax4, "on")
grid(ax4, "on")
title(ax4, "Roll Rear [mm/s]")
for i = 1:length(selected_laps)
histogram(ax4, pltData(selected_laps(i)).velocityHeaveFront_mmps,"Normalization","percentage")
end
linkaxes([ax1, ax2, ax3, ax4],"x")
% return null (not relevant for plots!)
outputArg = [];
end

View File

@ -0,0 +1,41 @@
function [outputArg] = plot_suspension_positions(panel, selected_laps, pltData)
% create tiledlayout (R2023a and newer)
tl = tiledlayout(panel,"vertical");
% plot 1: position heave front [mm]
ax1 = nexttile(tl);
hold(ax1, "on")
grid(ax1, "on")
title(ax1, "Heave Front [mm]")
for i = 1:length(selected_laps)
plot(ax1, pltData(selected_laps(i)).xAxis, pltData(selected_laps(i)).damperHeaveFront_mm)
end
% plot 2: position roll front [mm]
ax2 = nexttile(tl);
hold(ax2, "on")
grid(ax2, "on")
title(ax2, "Roll Front [mm]")
for i = 1:length(selected_laps)
plot(ax2, pltData(selected_laps(i)).xAxis, pltData(selected_laps(i)).damperRollFront_mm)
end
% plot 3: position heave front [mm]
ax3 = nexttile(tl);
hold(ax3, "on")
grid(ax3, "on")
title(ax3, "Heave Rear [mm]")
for i = 1:length(selected_laps)
plot(ax3, pltData(selected_laps(i)).xAxis, pltData(selected_laps(i)).damperHeaveRear_mm)
end
% plot 4: position roll front [mm]
ax4 = nexttile(tl);
hold(ax4, "on")
grid(ax4, "on")
title(ax4, "Roll Rear [mm]")
for i = 1:length(selected_laps)
plot(ax4, pltData(selected_laps(i)).xAxis, pltData(selected_laps(i)).damperRollRear_mm)
end
linkaxes([ax1, ax2, ax3, ax4],"x")
% return null (not relevant for plots!)
outputArg = [];
end

View File

@ -0,0 +1,41 @@
function [outputArg] = plot_suspension_velocities(panel, selected_laps, pltData)
% create tiledlayout (R2023a and newer)
tl = tiledlayout(panel,"vertical");
% plot 1: velocity heave front [mm/s]
ax1 = nexttile(tl);
hold(ax1, "on")
grid(ax1, "on")
title(ax1, "Heave Front [mm/s]")
for i = 1:length(selected_laps)
plot(ax1, pltData(selected_laps(i)).xAxis, pltData(selected_laps(i)).velocityHeaveFront_mmps)
end
% plot 2: velocity roll front [mm/s]
ax2 = nexttile(tl);
hold(ax2, "on")
grid(ax2, "on")
title(ax2, "Roll Front [mm/s]")
for i = 1:length(selected_laps)
plot(ax2, pltData(selected_laps(i)).xAxis, pltData(selected_laps(i)).velocityRollFront_mmps)
end
% plot 3: velocity heave front [mm/s]
ax3 = nexttile(tl);
hold(ax3, "on")
grid(ax3, "on")
title(ax3, "Heave Rear [mm/s]")
for i = 1:length(selected_laps)
plot(ax3, pltData(selected_laps(i)).xAxis, pltData(selected_laps(i)).velocityHeaveRear_mmps)
end
% plot 4: velocity roll front [mm/s]
ax4 = nexttile(tl);
hold(ax4, "on")
grid(ax4, "on")
title(ax4, "Roll Rear [mm/s]")
for i = 1:length(selected_laps)
plot(ax4, pltData(selected_laps(i)).xAxis, pltData(selected_laps(i)).velocityRollRear_mmps)
end
linkaxes([ax1, ax2, ax3, ax4],"x")
% return null (not relevant for plots!)
outputArg = [];
end

View File

@ -0,0 +1,24 @@
function [outputArg] = plot_tires_firctionCircle(panel, selected_laps, pltData)
% create tiledlayout (R2023a and newer)
tl = tiledlayout(panel,"flow");
ax1 = nexttile(tl);
hold(ax1, "on")
grid(ax1, "on")
title(ax1, "Friction Circle")
ylabel(ax1, "Longitudinal Acc [g]")
xlabel(ax1, "Lateral Acc [g]")
colors = colororder(ax1);
for i = 1:length(selected_laps)
plot(ax1,pltData(selected_laps(i)).acc_lat_g, ...
pltData(selected_laps(i)).acc_long_g,"Color",colors(i,:))
K = convhull(pltData(selected_laps(i)).acc_lat_g, pltData(selected_laps(i)).acc_long_g);
plot(ax1,pltData(selected_laps(i)).acc_lat_g(K), ...
pltData(selected_laps(i)).acc_long_g(K),"Color",colors(i,:),"LineStyle","--","LineWidth",2)
end
% return null (not relevant for plots!)
outputArg = [];
end

View File

@ -0,0 +1,21 @@
function [sidebarLabel] = sidebar_stats(pltData)
%SIDEBAR_STATS Summary of this function goes here
% Detailed explanation goes here
sidebarLabel = sprintf(...
"Statistics:\nEnergy\n Used: %.2f kWh\n" + ...
" Regen: %.2f kWh\n" + ...
" Total: %.2f kWh\n" + ...
"\nPower\n Peak: %.1f kW\n" + ...
" Peak (mean): %1.f kW\n" + ...
"\nDistance: %.2f km\n" + ...
"\nTopspeed: %.1f km/h\n", ...
pltData.energy_used_kwh, ...
pltData.energy_regen_kwh, ...
pltData.energy_kwh, ...
pltData.peakPower_kw, ...
pltData.peakPowerMean_kw, ...
pltData.distanceTotal_km, ...
pltData.maxSpeed_kph ...
);
end