/// <summary> /// Interface-Methode, welche das Gaspedal steuert /// </summary> /// <param name="currentRpm">aktuelle Drehzahl des Motors</param> /// <param name="targetRpm">gewünschte Drezahl des Motors, welche erreicht werden soll</param> /// <returns>vorgeschlagene Gaspedal-Stellung in Prozent (0 - 100)</returns> public double GetThrottle(double currentRpm, double targetRpm) { double nextThrottle = NextCalc(currentRpm, targetRpm); engine.Rechne(nextThrottle * 0.01); return(nextThrottle); }
static double RpmLast(double throttle, int count, EngineSimulator engine) { throttle *= 0.01; var temp = new EngineSimulator(engine); for (int i = 0; i < count; i++) { temp.Rechne(throttle); } return(temp.upmIst); }
double NextCalc(double currentRpm, double targetRpm) { var temp = new EngineSimulator(engine); for (int i = 0; i < 120; i++) { temp.Rechne(currentRpm < targetRpm ? 1.0 : 0.0); } double nextIstDrehzahl = temp.upmIst; return(nextIstDrehzahl < targetRpm ? 100 : 0); }