Port FluidSim core and scenarios to C++20
This commit is contained in:
32
include/FluidSim/Vehicle.hpp
Normal file
32
include/FluidSim/Vehicle.hpp
Normal file
@@ -0,0 +1,32 @@
|
||||
#pragma once
|
||||
|
||||
#include <array>
|
||||
|
||||
namespace fluidsim::port {
|
||||
|
||||
// Longitudinal motorcycle model and the friction clutch coupling it to the crank.
|
||||
class Vehicle {
|
||||
public:
|
||||
int current_gear{};
|
||||
std::array<float, 6> gear_ratios{4.1f, 2.7f, 2.0f, 1.55f, 1.25f, 0.98f};
|
||||
float final_drive_ratio{2.7f}, primary_reduction{1.8f};
|
||||
float clutch_input{1.0f}, clutch_capacity{80.0f}, clutch_engagement_rate{8.0f};
|
||||
float mass{160.0f}, wheel_radius{0.32f}, rotational_inertia{1.2f};
|
||||
float rolling_resistance{0.015f}, drag_coefficient{0.7f}, frontal_area{0.65f};
|
||||
float air_density{1.225f}, gravity{9.80665f};
|
||||
float speed{}, engagement{};
|
||||
|
||||
float total_gear_ratio() const;
|
||||
float kinetic_energy() const;
|
||||
float update(float engine_omega, float engine_inertia, float dt);
|
||||
void shift_up();
|
||||
void shift_down();
|
||||
void set_neutral();
|
||||
void set_first_gear();
|
||||
|
||||
private:
|
||||
float shift_cut_timer_{};
|
||||
void apply_road_resistance(float dt);
|
||||
};
|
||||
|
||||
} // namespace fluidsim::port
|
||||
Reference in New Issue
Block a user