diff --git a/luftwiderstand.py b/luftwiderstand.py index b85a72b..8c34a27 100644 --- a/luftwiderstand.py +++ b/luftwiderstand.py @@ -78,8 +78,8 @@ def main() -> None: plot.plot(vel_list, y_fd) - plot.title("Windwiderstand vs Geschwindigkeit") - plot.ylabel("Windwiderstand [%]") + plot.title("Luftwiderstand vs Geschwindigkeit") + plot.ylabel("Luftwiderstand [%]") plot.xlabel("Geschwindigkeit [km/h]") plot.legend(temps_list_leg) plot.grid() @@ -101,25 +101,44 @@ def main() -> None: plot.plot(vel_list, y_fd) - plot.ylabel("Windwiderstand ID.3 [%]") + plot.ylabel("Luftwiderstand ID.3 [%]") plot.xlabel("Geschwindigkeit [km/h]") - plot.title("Windwiderstand vs Geschwindigkeit") + plot.title(f"Windwiderstand vs Geschwindigkeit, Temperature {temp}°C") plot.legend(car_list_leg) plot.grid() - plot.figure() y_fd = [] + y_pwr = [] + y_energy = [] for vel_kmh in vel_list: fd_t = fd(rho_t, vel_kmh, c_val_id3, area_id3) y_fd.append(fd_t) + y_pwr.append(fd_t*vel_kmh/1000/3.6) + y_energy.append(fd_t*vel_kmh/1000/3.6*100/vel_kmh) - plot.plot(vel_list, y_fd) + fig, ax1 = plot.subplots() + ax1.plot(vel_list, y_fd) + ax1.set_ylabel("Luftwiderstand [N]") + ax1.set_xlabel("Geschwindigkeit [km/h]") + ax1.set_title(f"Luftwiderstand vs Geschwindigkeit, Temperature {temp}°C") + ax1.legend(car_list_leg) + ax2 = ax1.twinx() + ax2.set_ylabel("Antriebsleistung [kw]", color='tab:red') + ax2.plot(vel_list, y_pwr, color='tab:red') + ax2.tick_params(axis='y', labelcolor='tab:red') + ax1.grid() - plot.ylabel("Windwiderstand [N]") - plot.xlabel("Geschwindigkeit [km/h]") - plot.title("Windwiderstand vs Geschwindigkeit") - plot.legend(car_list_leg) - plot.grid() + fig, ax1 = plot.subplots() + ax1.plot(vel_list, y_fd) + ax1.set_ylabel("Luftwiderstand [N]") + ax1.set_xlabel("Geschwindigkeit [km/h]") + ax1.set_title(f"Luftwiderstand vs Geschwindigkeit, Temperature {temp}°C") + ax1.legend(car_list_leg) + ax2 = ax1.twinx() + ax2.set_ylabel("Antriebsenergie [kwh]", color='tab:red') + ax2.plot(vel_list, y_energy, color='tab:red') + ax2.tick_params(axis='y', labelcolor='tab:red') + ax1.grid() plot.show() if __name__ == '__main__':