Files
MatLabPlotter/season/FT24/plot_settings/plot_powertrain.m
2025-08-22 17:39:32 +02:00

49 lines
1.5 KiB
Matlab

function [outputArg] = plot_powertrain(panel, pltData, tr)
% 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]")
plot(ax1,pltData.xAxis(tr,:),pltData.speed_kph(tr,:))
% plot 2: power [kW]
ax2 = nexttile(tl);
hold(ax2, "on")
grid(ax2, "on")
title(ax2, "Power [kW]")
plot(ax2,pltData.xAxis(tr,:),pltData.ams_ptot(tr,:))
% plot 3: Inverter Temps [°C]
ax3 = nexttile(tl);
hold(ax3, "on")
grid(ax3, "on")
title(ax3, "Inverter Temp [°C]")
plot(ax3,pltData.xAxis(tr,:),pltData.invL_temp(tr,:))
plot(ax3,pltData.xAxis(tr,:),pltData.invR_temp(tr,:))
legend(ax3, "Left", "Right")
% plot 4: Motor Temps
ax4 = nexttile(tl);
hold(ax4, "on")
grid(ax4, "on")
title(ax4, "Motor Temp [°C]")
plot(ax4,pltData.xAxis(tr,:),pltData.motL_temp(tr,:))
plot(ax4,pltData.xAxis(tr,:),pltData.motR_temp(tr,:))
legend(ax4, "Left", "Right")
% plot 5: Motor velocities
ax5 = nexttile(tl);
hold(ax5, "on")
grid(ax5, "on")
title(ax5, "Motor Velocities [1/min]")
plot(ax5,pltData.xAxis(tr,:),pltData.motL_vel_rpm(tr,:))
plot(ax5,pltData.xAxis(tr,:),pltData.motR_vel_rpm(tr,:))
legend(ax5, "Left", "Right")
% link all x axes
linkaxes([ax1, ax2, ax3, ax4, ax5],"x")
% return null (not relevant for plots!)
outputArg = [];
end