public dlGearboxShifterTable() { var myEngine = new Ets2Drivetrain(); Main.Load(myEngine, "Settings/Drivetrain/eurotrucks2.iveco.hiway.ini"); activeConfiguration = Main.Running ? Main.Transmission.configuration : new ShifterTableConfiguration(ShifterTableConfigurationDefault.Efficiency, myEngine, 19, 25000); string headline = "RPM"; for (int k = 0; k <= 10; k++) headline = headline + ",Ratio " + k; //",Fuel " + k + ",Power " + k + headline = headline + "\r\n"; List<string> fuelStats = new List<string>(); for(float rpm = 0; rpm < 2500; rpm+=100) { string l = rpm + ""; for (int load = 0; load <= 10; load++) { float throttle = load/20.0f; var fuelConsumption = activeConfiguration.Drivetrain.CalculateFuelConsumption(rpm, throttle); var power = activeConfiguration.Drivetrain.CalculatePower(rpm, throttle); var fuel2 = (power / fuelConsumption) / rpm; //"," + fuelConsumption + "," + power + l = l + "," +fuel2; } fuelStats.Add(l); } File.WriteAllText("./fuelstats.csv", headline+ string.Join("\r\n", fuelStats)); // // sim // this.sim = new ucGearboxShifterGraph(this.activeConfiguration); this.sim.Location = new System.Drawing.Point(12, 283); this.sim.Name = "sim"; this.sim.Size = new System.Drawing.Size(854, 224); this.sim.TabIndex = 2; this.Controls.Add(this.sim); SizeChanged += new EventHandler(dlGearboxShifterTable_SizeChanged); InitializeComponent(); LoadTable(); shifterTable.SelectionChanged += new EventHandler(shifterTable_SelectionChanged); dataGridOverheadR = this.Width - this.shifterTable.Width; dataGridOverheadB = this.sim.Location.Y - shifterTable.Location.Y - shifterTable.Height; simGraphOverheadB = this.Height - this.sim.Height; }
public SimulationEnvironment() { drivetrain = new Ets2Drivetrain(); Main.Load(drivetrain, "Settings/Drivetrain/eurotrucks2.scania.g7ld6x2.ini"); shifter = new ShifterTableConfiguration(ShifterTableConfigurationDefault.Performance, drivetrain, 1, 0); Speed = 30/3.6; StringBuilder sim = new StringBuilder(); for (int k = 0; k < 10000; k++) { Tick(); sim.AppendLine(k + "," + Speed); } File.WriteAllText("./sim.csv", sim.ToString()); }
public Transmission() { configuration = new ShifterTableConfiguration(ShifterTableConfigurationDefault.PeakRpm, Main.Drivetrain, 20, 0); LoadShiftPattern("up_1thr", "normal"); LoadShiftPattern("up_0thr", "normal"); LoadShiftPattern("down_1thr", "normal"); LoadShiftPattern("down_0thr", "normal"); // Add power shift pattern var powerShiftPattern = new ShiftPattern(); powerShiftPattern.Frames.Add(new ShiftPatternFrame(0, 1, false, false, true)); powerShiftPattern.Frames.Add(new ShiftPatternFrame(0, 1, false, false, false)); powerShiftPattern.Frames.Add(new ShiftPatternFrame(0, 1, false, false, true)); powerShiftPattern.Frames.Add(new ShiftPatternFrame(1, 0.5, true, false, true)); powerShiftPattern.Frames.Add(new ShiftPatternFrame(1, 0.5, true, false, true)); ShiftPatterns.Add("PowerShift", powerShiftPattern); // Initialize all shfiting stuff. Shift(0, 1, "up_1thr"); Enabled = true; IsShifting = false; }
public void ResetParameters() { configuration = new ShifterTableConfiguration(ShifterTableConfigurationDefault.PeakRpm, Main.Drivetrain, 10, 0); if (Main.Data.Active.Application == "TestDrive2") LoadShiftPattern("up_1thr", "fast"); else LoadShiftPattern("up_1thr", "normal"); EnableSportShiftdown = false; PowerShift = false; }
public void RecalcTable() { configuration = new ShifterTableConfiguration(configuration.Mode, Main.Drivetrain, configuration.SpdPerGear, configuration.Mass); }
public void ApplyParameter(IniValueObject obj) { switch(obj.Key) { case "ShiftDeadSpeed": ShiftDeadSpeed = obj.ReadAsInteger(); break; case "ShiftDeadTime": ShiftDeadTime = obj.ReadAsInteger(); break; case "GenerateSpeedHoldoff": speedHoldoff = obj.ReadAsInteger(); break; case "EnableSportShiftdown": EnableSportShiftdown = obj.ReadAsInteger() == 1; break; case "KickdownEnable": KickdownEnable = obj.ReadAsString() == "1"; break; case "KickdownTimeout": KickdownTimeout = obj.ReadAsDouble(); break; case "KickdownSpeedReset": KickdownSpeedReset = obj.ReadAsDouble(); break; case "KickdownPowerReset": KickdownPowerReset = obj.ReadAsDouble(); break; case "KickdownRpmReset": KickdownRpmReset = obj.ReadAsDouble(); break; case "PowerShift": PowerShift = obj.ReadAsInteger() == 1; break; case "Generate": var def = ShifterTableConfigurationDefault.PeakRpm; GeneratedShiftTable = obj.ReadAsString(); switch (GeneratedShiftTable) { case "Economy": def = ShifterTableConfigurationDefault.Economy; break; case "Efficiency": def = ShifterTableConfigurationDefault.Efficiency; break; case "Efficiency2": def = ShifterTableConfigurationDefault.PowerEfficiency; break; case "Opa": def = ShifterTableConfigurationDefault.AlsEenOpa; break; case "PeakRpm": def = ShifterTableConfigurationDefault.PeakRpm; break; case "Performance": def = ShifterTableConfigurationDefault.Performance; break; case "Henk": def = ShifterTableConfigurationDefault.Henk; break; } configuration = new ShifterTableConfiguration(def, Main.Drivetrain, speedHoldoff, StaticMass); break; } }
public ucGearboxShifterGraph(ShifterTableConfiguration cfg) { config = cfg; InitializeComponent(); }