Exemple #1
0
        private bool Allocate()
        {
            bool result = true;

            atmosphere      = new Atmosphere(this);
            propulsion      = new Propulsion(this);
            aerodynamics    = new Aerodynamics(this);
            FCS             = new FlightControlSystem(this);
            groundReactions = new GroundReactions(this);
            inertial        = new Inertial(this);
            massBalance     = new MassBalance(this);
            propagate       = new Propagate(this);
            auxiliary       = new Auxiliary(this);
            aircraft        = new Aircraft(this);
            //output = new Output(this);
            input          = new Input(this);
            groundCallback = new GroundCallback();
            state          = new State(this); // This must be done here, as the State
            // class needs valid pointers to the above model classes


            // Initialize models so they can communicate with each other

            if (!atmosphere.InitModel())
            {
                if (log.IsErrorEnabled)
                {
                    log.Error("Atmosphere model init failed");
                }
                error += 1;
            }
            if (!FCS.InitModel())
            {
                if (log.IsErrorEnabled)
                {
                    log.Error("FCS model init failed");
                }
                error += 2;
            }
            if (!propulsion.InitModel())
            {
                if (log.IsErrorEnabled)
                {
                    log.Error("Propulsion model init failed");
                }
                error += 4;
            }
            if (!massBalance.InitModel())
            {
                if (log.IsErrorEnabled)
                {
                    log.Error("MassBalance model init failed");
                }
                error += 8;
            }
            if (!aerodynamics.InitModel())
            {
                if (log.IsErrorEnabled)
                {
                    log.Error("Aerodynamics model init failed");
                }
                error += 16;
            }
            if (!inertial.InitModel())
            {
                if (log.IsErrorEnabled)
                {
                    log.Error("Inertial model init failed");
                }
                error += 32;
            }
            if (!groundReactions.InitModel())
            {
                if (log.IsErrorEnabled)
                {
                    log.Error("Ground Reactions model init failed");
                }
                error += 64;
            }
            if (!aircraft.InitModel())
            {
                if (log.IsErrorEnabled)
                {
                    log.Error("Aircraft model init failed");
                }
                error += 128;
            }
            if (!propagate.InitModel())
            {
                if (log.IsErrorEnabled)
                {
                    log.Error("Propagate model init failed");
                }
                error += 256;
            }
            if (!auxiliary.InitModel())
            {
                if (log.IsErrorEnabled)
                {
                    log.Error("Auxiliary model init failed");
                }
                error += 512;
            }
            if (!input.InitModel())
            {
                if (log.IsErrorEnabled)
                {
                    log.Error("Intput model init failed");
                }
                error += 1024;
            }

            if (error > 0)
            {
                result = false;
            }

            ic = new InitialCondition(this);

            // Schedule a model. The second arg (the integer) is the pass number. For
            // instance, the atmosphere model gets executed every fifth pass it is called
            // by the executive. Everything else here gets executed each pass.
            // IC and Trim objects are NOT scheduled.

            Schedule(input, 1);
            Schedule(atmosphere, 1);
            Schedule(FCS, 1);
            Schedule(propulsion, 1);
            Schedule(massBalance, 1);
            Schedule(aerodynamics, 1);
            Schedule(inertial, 1);
            Schedule(groundReactions, 1);
            Schedule(aircraft, 1);
            Schedule(propagate, 1);
            Schedule(auxiliary, 1);
            //Schedule(output, 1);

            modelLoaded = false;
            return(result);
        }