示例#1
0
        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;
        }
示例#2
0
        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());
        }
示例#3
0
        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;
        }
示例#4
0
        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;
        }
示例#5
0
 public void RecalcTable()
 {
     configuration = new ShifterTableConfiguration(configuration.Mode, Main.Drivetrain, configuration.SpdPerGear, configuration.Mass);
 }
示例#6
0
        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;
            }
        }
示例#7
0
 public ucGearboxShifterGraph(ShifterTableConfiguration cfg)
 {
     config = cfg;
     InitializeComponent();
 }