Files
engine-sim-cpp/engine/simulation.cpp
T
Avery Haas 120e4f505f init commit
2026-08-28 22:38:58 -04:00

20 lines
837 B
C++

#include "simulation.h"
void Simulation::step(double dt) {
// 1. What load is the drivetrain currently reflecting back onto the crank?
// TODO: this should come from a proper torque-balance solve; for now
// the engine ignores it (see Engine::step's placeholder body).
double load_torque_nm = 0.0;
m_engine.step(dt, load_torque_nm);
// 2. Engine torque flows down through the transmission to the wheels.
double wheel_torque_nm = m_transmission.output_torque_nm(m_engine.torque_nm());
// 3. Wheel torque accelerates the vehicle.
m_vehicle.step(dt, wheel_torque_nm);
// 4. Resulting wheel speed reflects back up through the transmission —
// next tick's load_torque_nm calculation (once real) will use this.
(void)m_transmission.reflected_engine_rpm(m_vehicle.wheel_rpm());
}