コード例 #1
0
        public void TemperatureTracking(EngineSimulation engine)
        {
            while (true)
            {
                if (engine.TempEngine >= engine.T)
                {
                    break;
                }

                time++;

                currentVelocity += engine.a;

                foreach (var currentRange in ranges)
                {
                    if (currentRange.InRange(currentVelocity))
                    {
                        engine.gear = currentRange.value;
                        break;
                    }
                }

                engine.TempEngine += engine.Vh;
                engine.TempEngine -= engine.Vc;
            }
        }
コード例 #2
0
        static void Main(string[] args)
        {
            int time;

            string     jsonString = File.ReadAllText("Test.config");
            SourceData data       = JsonConvert.DeserializeObject <SourceData>(jsonString);

            EngineSimulation engine  = new EngineSimulation(data);
            EngineTesting    testing = new EngineTesting();

            Console.WriteLine("Please, enter the ambient temperature. Input format \"en-Gb\", 00.00°C");

            while (true)
            {
                if (float.TryParse(Console.ReadLine(), NumberStyles.Float, CultureInfo.CreateSpecificCulture("en-GB"), out float result))
                {
                    engine.TempAmbient = result;
                    break;
                }
                else
                {
                    Console.WriteLine("Please, enter the ambient temperature. Input format \"en-Gb\", 00.00°C");
                }
            }

            time = testing.EngineOn(engine);
            Console.WriteLine($"Time = {time}sec");
        }
コード例 #3
0
        public int EngineOn(EngineSimulation engine)
        {
            engine.TempEngine = engine.TempAmbient;

            TemperatureTracking(engine);

            return(time);
        }