61 lines
2.1 KiB
Matlab
61 lines
2.1 KiB
Matlab
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
|
|
|