Files
engine-sim-cpp/engine/engine.h
T
Avery Haas 1175b498b0 add to gui
2026-08-31 23:57:40 -04:00

35 lines
886 B
C++

#pragma once
// Crankshaft rotational dynamics. Placeholder physics for now —
// real combustion/friction torque modeling comes later.
class Engine {
public:
// load_torque_nm is the resistance fed back from the transmission
// (via the vehicle), opposing crank rotation.
void step(double dt, double load_torque_nm);
double rpm() const;
double torque_nm() const; // net torque produced this step
void set_throttle(double throttle);
double get_throttle();
void reset();
private:
double m_rpm = 0.0;
double m_torque_nm = 0.0;
// Fluids
double m_oil_capacity = 0.0;
double m_coolant_capacity = 0.0;
double m_oil_temp = 0.0;
double m_coolant_temp = 0.0;
// User Input
double m_throttle = 0.0;
static constexpr double kIdleRpm = 1700.0;
static constexpr double kCrankInertiaKgm2 = 0.15; // placeholder
};