Ejemplo n.º 1
0
        public bool TryMakeTurbofan(float bypassratio, int numberofshafts, Generator gen, List <Spool> spools, int egt, int isp,
                                    int numberofcycles, List <Propellant> fueList, List <Oxidiser> oxidisers, string manuf, string model,
                                    string serialnumber, float maxpower, float operatingtime, float fuelflow, OnOff stat, out Turbofan incomingTurbofan, bool isgeared = false,
                                    bool hasreverse = true, PoweredAircraft parentvehicle = null)
        {
            try
            {
                Turbofan turbofan = MakeTurbofan(bypassratio, numberofshafts, gen, spools, egt, isp,
                                                 numberofcycles, fueList,
                                                 oxidisers, manuf, model, serialnumber, maxpower, operatingtime, fuelflow, stat, isgeared, hasreverse,
                                                 parentvehicle);

                incomingTurbofan = turbofan;
                return(true);
            }
            catch (ArgumentNullException argumentNullException)
            {
                Console.WriteLine(argumentNullException.Message);
                incomingTurbofan = null;
                return(false);
            }
            catch (ArgumentException argumentException)
            {
                Console.WriteLine(argumentException.Message);
                incomingTurbofan = null;
                return(false);
            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message);
                incomingTurbofan = null;
                return(false);
            }
        }
Ejemplo n.º 2
0
        public Turbofan MakeTurbofan(float bypassratio, int numberofshafts, Generator gen, List <Spool> spools, int egt, int isp,
                                     int numberofcycles, List <Propellant> fueList, List <Oxidiser> oxidisers, string manuf, string model,
                                     string serialnumber, float maxpower, float operatingtime, float fuelflow, OnOff stat, bool isgeared = false,
                                     bool hasreverse = true, PoweredAircraft parentvehicle = null)
        {
            //return new Turbofan(3, false, true, 3, new Dictionary<Generator, double>(new GeneratorComparer()),
            //                    new List<Spool>(), 600, 500, 5, new List<Propellants> { Propellants.Jet_A },
            //                    new List<Oxidisers> { Oxidisers.GOX }, "Rolls-Royce", "RB-201", "100000008", 27000, 12, "88", 0, OnOff.Stopped);

            GeneralConditionsChecker(numberofshafts, spools, fueList, oxidisers, serialnumber);


            Debug.WriteLine("Creating a new turbofan ({0})", serialnumber);
            return(new Turbofan(bypassratio, isgeared, hasreverse, numberofshafts, gen, spools, egt, isp,
                                numberofcycles, fueList, oxidisers,
                                manuf, model, serialnumber, maxpower, operatingtime, parentvehicle, fuelflow, stat));
        }
Ejemplo n.º 3
0
        public Turbofan TryMakeTurbofan(float bypassratio, int numberofshafts, Generator gen, List <Spool> spools, int egt, int isp,
                                        int numberofcycles, List <Propellant> fueList, List <Oxidiser> oxidisers, string manuf, string model,
                                        string serialnumber, float maxpower, float operatingtime, float fuelflow, OnOff stat, bool isgeared = false,
                                        bool hasreverse = true, PoweredAircraft parentvehicle = null)
        {
            Turbofan turbofan = new Turbofan();

            try
            {
                turbofan = MakeTurbofan(bypassratio, numberofshafts, gen, spools, egt, isp,
                                        numberofcycles, fueList,
                                        oxidisers, manuf, model, serialnumber, maxpower, operatingtime, fuelflow, stat, isgeared, hasreverse,
                                        parentvehicle);
            }
            catch (ArgumentNullException argumentNullException)
            {
                Console.WriteLine(argumentNullException.Message);
                switch (argumentNullException.ParamName)
                {
                case nameof(spools):
                    spools = new List <Spool>();
                    TryMakeTurbofan(bypassratio, numberofshafts, gen, spools, egt, isp,
                                    numberofcycles, fueList,
                                    oxidisers, manuf, model, serialnumber, maxpower, operatingtime, fuelflow, stat, isgeared,
                                    hasreverse,
                                    parentvehicle);
                    break;

                case nameof(serialnumber):
                    serialnumber = "no serial number specified";
                    TryMakeTurbofan(bypassratio, numberofshafts, gen, spools, egt, isp,
                                    numberofcycles, fueList,
                                    oxidisers, manuf, model, serialnumber, maxpower, operatingtime, fuelflow, stat, isgeared,
                                    hasreverse,
                                    parentvehicle);
                    break;

                case nameof(fueList):
                    fueList = new List <Propellant>();
                    TryMakeTurbofan(bypassratio, numberofshafts, gen, spools, egt, isp,
                                    numberofcycles, fueList,
                                    oxidisers, manuf, model, serialnumber, maxpower, operatingtime, fuelflow, stat, isgeared,
                                    hasreverse,
                                    parentvehicle);
                    break;

                case nameof(oxidisers):
                    oxidisers = new List <Oxidiser>();
                    TryMakeTurbofan(bypassratio, numberofshafts, gen, spools, egt, isp,
                                    numberofcycles, fueList,
                                    oxidisers, manuf, model, serialnumber, maxpower, operatingtime, fuelflow, stat, isgeared,
                                    hasreverse,
                                    parentvehicle);
                    break;
                }
            }
            catch (ArgumentException argumentException) when(argumentException.ParamName == nameof(numberofshafts))
            {
                Console.WriteLine(argumentException.Message);
                if (argumentException.ParamName == nameof(numberofshafts))
                {
                    numberofshafts = 1;
                    TryMakeTurbofan(bypassratio, numberofshafts, gen, spools, egt, isp,
                                    numberofcycles, fueList,
                                    oxidisers, manuf, model, serialnumber, maxpower, operatingtime, fuelflow, stat, isgeared,
                                    hasreverse,
                                    parentvehicle);
                }
            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message);
            }
            return(turbofan);
        }
Ejemplo n.º 4
0
        public Turbojet MakeTurbojet(int numberofshafts, Generator gen, List <Spool> spools, int egt, int isp, int numberofcycles,
                                     List <Propellant> fueList, List <Oxidiser> oxidisers, string manuf, string model, string serialnumber, float maxpower,
                                     float operatingtime, float fuelflow, OnOff stat, bool hasreverse = true, PoweredAircraft parentvehicle = null)
        {
            GeneralConditionsChecker(numberofshafts, spools, fueList, oxidisers, serialnumber);

            return(new Turbojet(hasreverse, numberofshafts, gen, spools, egt, isp,
                                numberofcycles, fueList,
                                oxidisers, manuf, model, serialnumber, maxpower, operatingtime, parentvehicle, fuelflow, stat));
        }
Ejemplo n.º 5
0
        public Turboshaft MakeTurboshaft(float gearingR, float maxtorque, int numberofshafts, Generator gen,
                                         List <Spool> spools, int egt, int isp, int numberofcycles, List <Propellant> fueList,
                                         List <Oxidiser> oxidisers, string manuf, string model, string serialnumber, float maxpower,
                                         float operatingtime, float fuelflow, OnOff stat, bool hasreverse = true, PoweredAircraft parentvehicle = null)
        {
            GeneralConditionsChecker(numberofshafts, spools, fueList, oxidisers, serialnumber);

            if (maxtorque <= 0)
            {
                throw new ArgumentException("No max torque data was provided", nameof(maxtorque));
            }

            return(new Turboshaft(gearingR, maxtorque, hasreverse, numberofshafts, gen, spools, egt, isp,
                                  numberofcycles, fueList,
                                  oxidisers, manuf, model, serialnumber, maxpower, operatingtime, parentvehicle, fuelflow, stat));
        }