#include "engine.h" #include "iostream" void Engine::step(double dt, double load_torque_nm) { // TODO: replace with real combustion/friction torque model driven // by throttle position and crank angle. For now: seek idle rpm // and just track the applied load so downstream pieces have // something to wire against. m_rpm += (kIdleRpm - m_rpm) * dt; m_torque_nm = -load_torque_nm; } double Engine::rpm() const { return m_rpm; } double Engine::torque_nm() const { return m_torque_nm; } void Engine::set_throttle(double throttle) { m_throttle = throttle; } double Engine::get_throttle() { return m_throttle; } void Engine::reset() { m_rpm = 0; m_oil_temp = 0; m_coolant_capacity = 0; }