public Engine(string name, string manufacturer, int cilinders, int displacement, Range idleRpm, Range maximumRpm, IEnumerable<EngineMode> modes, IEnumerable<EngineTorque> torqueCurve, EngineLifetime lifetime) { Lifetime = lifetime; Name = name; Manufacturer = manufacturer; Cilinders = cilinders; Displacement = displacement; IdleRpm = idleRpm; MaximumRpm = maximumRpm; Modes = modes; TorqueCurve = torqueCurve; }
public Engine(string name, string manufacturer, int cilinders, int displacement, Range idleRpm, Range maximumRpm, IEnumerable <EngineMode> modes, IEnumerable <EngineTorque> torqueCurve, EngineLifetime lifetime) { Lifetime = lifetime; Name = name; Manufacturer = manufacturer; Cilinders = cilinders; Displacement = displacement; IdleRpm = idleRpm; MaximumRpm = maximumRpm; Modes = modes; TorqueCurve = torqueCurve; }
public CarTestEngine(string name, string manufacturer, int cilinders, int displacement, Range idleRpm, Range maximumRpm, IEnumerable <EngineMode> modes, IEnumerable <EngineTorque> torqueCurve, EngineLifetime lifetime) : base(name, manufacturer, cilinders, displacement, idleRpm, maximumRpm, modes, torqueCurve, lifetime) { // FUMS }
public CarTestEngine(string name, string manufacturer, int cilinders, int displacement, Range idleRpm, Range maximumRpm, IEnumerable<EngineMode> modes, IEnumerable<EngineTorque> torqueCurve, EngineLifetime lifetime) : base(name, manufacturer, cilinders, displacement, idleRpm, maximumRpm, modes, torqueCurve, lifetime) { // FUMS }
private Engine BuildEngine(string file, string name, string manufacturer) { var idleRpm = new Range(0, 0); var maximumRpm = new Range(0, 0); var engineMode = new List <EngineMode>(); var engineTorque = new List <EngineTorque>(); // temporary helpers var lifetimeTime = new NormalDistrbution(0, 0); var lifetimeRpm = new NormalDistrbution(0, 0); var lifetimeOil = new NormalDistrbution(0, 0); var lifetimeLength = 0.0f; var engineBoostModes = 0.0f; var engineBoostScale = new Range(0, 0); var engineBoostRpm = 0.0f; var engineBoostFuel = 0.0f; var engineBoostWear = 0.0f; var engineBoostTorque = 0.0f; var engineBoostPower = 0.0f; using (var engFile = new IniReader(file, true)) { engFile.AddHandler(x => { if (x.Key == "RPMTorque") { engineTorque.Add(new EngineTorque(x.ReadAsFloat(0), x.ReadAsFloat(1), x.ReadAsFloat(2))); } if (x.Key == "IdleRPMLogic") { idleRpm = new Range(x.ReadAsFloat(0), x.ReadAsFloat(1)); } if (x.Key == "RevLimitRange") { var minRpm = x.ReadAsFloat(0); var slopeRpm = x.ReadAsFloat(1); var rpmSlopeSettings = x.ReadAsInteger(2); var maxRpm = minRpm + slopeRpm * rpmSlopeSettings; maximumRpm = new Range(minRpm, maxRpm, 0, slopeRpm); } if (x.Key == "EngineBoostRange") { engineBoostModes = x.ReadAsInteger(2); engineBoostScale = new Range(x.ReadAsFloat(0), x.ReadAsFloat(1)); } if (x.Key == "BoostEffects") { engineBoostRpm = x.ReadAsFloat(0); engineBoostFuel = x.ReadAsFloat(1); engineBoostWear = x.ReadAsFloat(2); } if (x.Key == "BoostTorque") { engineBoostTorque = x.ReadAsFloat(); } if (x.Key == "BoostPower") { engineBoostPower = x.ReadAsFloat(); } if (x.Key == "LifetimeEngineRPM") { lifetimeRpm = new NormalDistrbution(x.ReadAsFloat(0), x.ReadAsFloat(1)); } if (x.Key == "LifetimeOilTemp") { lifetimeOil = new NormalDistrbution(x.ReadAsFloat(0), x.ReadAsFloat(1)); } if (x.Key == "LifetimeAvg") { lifetimeLength = x.ReadAsFloat(); } if (x.Key == "LifetimeVar") { lifetimeTime = new NormalDistrbution(lifetimeLength, x.ReadAsFloat()); } }); engFile.Parse(); } // Combine read values: if (engineBoostModes > 0) { for (var mode = 0; mode < engineBoostModes; mode++) { var factor = engineBoostScale.Minimum + mode * engineBoostScale.Span / engineBoostModes; var rpmPlus = factor * engineBoostRpm; var fuelPlus = factor * engineBoostScale.Maximum / engineBoostModes * engineBoostFuel; var wearPlus = factor * engineBoostWear; var powerPlus = factor * engineBoostPower; var torquePlus = factor * engineBoostTorque; engineMode.Add(new EngineMode(powerPlus, torquePlus, rpmPlus, fuelPlus, wearPlus)); } } var lifetime = new EngineLifetime(lifetimeTime, lifetimeRpm, lifetimeOil); return(new Engine(name, manufacturer, 0, 0, idleRpm, maximumRpm, engineMode, engineTorque, lifetime)); }