Add turbocharged twin scenario and cross-platform test harness
This commit is contained in:
22
include/FluidSim/MotorcycleTest.hpp
Normal file
22
include/FluidSim/MotorcycleTest.hpp
Normal file
@@ -0,0 +1,22 @@
|
||||
#pragma once
|
||||
|
||||
#include "FluidSim/Engine.hpp"
|
||||
#include "FluidSim/Vehicle.hpp"
|
||||
#include <algorithm>
|
||||
|
||||
namespace fluidsim::port {
|
||||
// Shared longitudinal load and clutch integration for motorcycle/car presets.
|
||||
class MotorcycleTest {
|
||||
public:
|
||||
Vehicle vehicle{};
|
||||
float load{}, clutch{1.0f};
|
||||
|
||||
protected:
|
||||
void step_motorcycle(Crankshaft& crank, float dt, float maximum_load_torque) {
|
||||
crank.load_torque = std::clamp(load, 0.0f, 1.0f) * maximum_load_torque;
|
||||
vehicle.clutch_input = std::clamp(clutch, 0.0f, 1.0f);
|
||||
crank.step(dt);
|
||||
crank.drivetrain_torque = vehicle.update(crank.omega, crank.inertia, dt);
|
||||
}
|
||||
};
|
||||
} // namespace fluidsim::port
|
||||
Reference in New Issue
Block a user