public override void StartSimulation(IRTIambassador rtiAmb)
        {
            if (log.IsInfoEnabled)
            {
                log.Info("Start Time Management simulation");
            }

            try
            {
                rti      = (XrtiExecutiveAmbassador)rtiAmb;
                form     = new TimeManagementForm(rti, this);
                scenario = form.Scenario;

                federateAmbassador = new TimeManagementFederateAmbassador(rtiAmb);
                timeManagementFederateAmbassador = (TimeManagementFederateAmbassador)federateAmbassador;
                mobileServices = new MobileFederateServices(new DoubleValuedLogicalTimeFactory(), new DoubleValuedLogicalTimeIntervalFactory());
                JoinSimulation(rtiAmb, federate.Type, federation.Name);

                AddVisualElements();

                InitFederate();

                // Add Federation's interaction listener
                TimeManagementObjectModelInteractionListener l1 = new TimeManagementObjectModelInteractionListener(rti, mobileServices._timeFactory, home, moveActorInterval, form, this);
                rti.interactionManager.AddInteractionListener(l1);

                MyLowLevelManagementObjectModelInteractionListener l2 = new MyLowLevelManagementObjectModelInteractionListener(rti, "My", form);
                rti.interactionManager.AddInteractionListener(l2);
示例#2
0
        public override void StartSimulation(IRTIambassador rtiAmb)
        {
            if (log.IsInfoEnabled)
            {
                log.Info("Start Boids simulation");
            }

            JoinSimulation(rtiAmb, color, "Boids");

            try
            {
                simulationThread = new Thread(new ThreadStart(SimulationLoop));
                boidsManager     = new BoidsManager(federateAmbassador);
                boidsManager.BuildBoids(NUMBER_BOIDS, new Vector3(750, 60, 750), color);
                BoidsSample app = new BoidsSample(boidsManager, color);
                simulationThread.Start();
                app.Go();
            }
            catch (Exception e)
            {
                if (log.IsErrorEnabled)
                {
                    log.Error("Failed running simulation. Exception :" + e.Message);
                }
            }
        }
示例#3
0
        public virtual void JoinSimulation(IRTIambassador rtiAmb, string federateType, string federation)
        {
            if (rtiAmb == null)
            {
                throw new System.ArgumentNullException("Rti ambassador could not be null");
            }

            rtiAmbassador = rtiAmb;

            InitLogSystem();

            federationName = federation;

            try
            {
                //Build a Uri using a file path
                FileInfo file    = new FileInfo(this.FomList[0].Uri);
                Uri      fileUri = new Uri("file://" + file.FullName);

                //Create Federation
                rtiAmbassador.CreateFederationExecution(federationName, fileUri);
            }
            catch (Exception exception)
            {
                if (log.IsErrorEnabled)
                {
                    log.Error(exception.Message);
                }
            }

            try
            {
                // PATCH ANGEL: Si está inicializado el federateAmbassador no se crea de nuevo
                if (federateAmbassador == null)
                {
                    federateAmbassador = new XrtiFederateAmbassador(rtiAmbassador);
                }

                if (mobileServices == null)
                {
                    mobileServices = new MobileFederateServices(new LongValuedLogicalTimeFactory(), new LongValuedLogicalTimeIntervalFactory());
                }

                // Join to federation
                IFederateHandle federateHandle = rtiAmbassador.JoinFederationExecution(federateType,
                                                                                       federationName,
                                                                                       federateAmbassador,
                                                                                       mobileServices);
            }
            catch (Exception e)
            {
                if (log.IsErrorEnabled)
                {
                    log.Error("Failed while joining to :" + federateAmbassador + ". Exception :" + e.Message);
                }
            }
        }
示例#4
0
        public override void StartSimulation(IRTIambassador rtiAmb)
        {
            JoinSimulation(rtiAmb, "Europe", "HelloWorld");

            try
            {
                internalThread = new Thread(new ThreadStart(SimulationLoop));
                internalThread.Start();
            }
            catch (Exception e)
            {
                if (log.IsErrorEnabled)
                {
                    log.Error("Failed running simulation. Exception :" + e.Message);
                }
            }
        }
示例#5
0
        public override void StartSimulation(IRTIambassador rtiAmb)
        {
            if (log.IsInfoEnabled)
            {
                log.Info("Start Military simulation");
            }

            JoinSimulation(rtiAmb, color, "Military");

            try
            {
                form = new MilitaryForm(militaryScenario);
                form.Show();
                //simulationThread = new Thread(new ThreadStart(SimulationLoop));
                //simulationThread.Start();
            }
            catch (Exception e)
            {
                if (log.IsErrorEnabled)
                {
                    log.Error("Failed running simulation. Exception :" + e.Message);
                }
            }
        }
示例#6
0
        public override void StartSimulation(IRTIambassador rtiAmb)
        {
            if (log.IsInfoEnabled)
                log.Info("Start Military simulation");

            JoinSimulation(rtiAmb, color, "Military");

            try
            {
                form = new MilitaryForm(militaryScenario);
                form.Show();
                //simulationThread = new Thread(new ThreadStart(SimulationLoop));
                //simulationThread.Start();
            }
            catch (Exception e)
            {
                if (log.IsErrorEnabled)
                    log.Error("Failed running simulation. Exception :" + e.Message);
            }
        }
示例#7
0
        public override void StartSimulation(IRTIambassador rtiAmb)
        {
            if (log.IsInfoEnabled)
                log.Info("Start Boids simulation");

            JoinSimulation(rtiAmb, color, "Boids");

            try
            {
                simulationThread = new Thread(new ThreadStart(SimulationLoop));
                boidsManager = new BoidsManager(federateAmbassador);
                boidsManager.BuildBoids(NUMBER_BOIDS, new Vector3(750, 60, 750), color);
                BoidsSample app = new BoidsSample(boidsManager, color);
                simulationThread.Start();
                app.Go();
            }
            catch (Exception e)
            {
                if (log.IsErrorEnabled)
                    log.Error("Failed running simulation. Exception :" + e.Message);
            }
        }
示例#8
0
        public BaseAmbassador(IRTIambassador prtiAmbassador)
        {
            rtiAmbassador = prtiAmbassador;

            InitHandleCounter();
        }
示例#9
0
 public TestFederate(IRTIambassador rtiAmbassador)
     : base(rtiAmbassador)
 {
 }
 public TimeManagementFederateAmbassador(IRTIambassador prtiAmbassador)//, TimeManagementForm aForm)
     : base(prtiAmbassador)
 {
     //this.form = aForm;
 }
示例#11
0
 public FederateAmbassador(IRTIambassador prtiAmbassador)
     : base(prtiAmbassador)
 {
     rti = ((XrtiExecutiveAmbassador)rtiAmbassador);
 }
示例#12
0
 public FederateHelper(IRTIambassador ambassador)
 {
     rtiAmbassador = ambassador;
 }
示例#13
0
 public FederateHelper(IRTIambassador ambassador)
 {
     rtiAmbassador = ambassador;
 }
示例#14
0
        public BaseAmbassador(IRTIambassador prtiAmbassador)
        {
            rtiAmbassador = prtiAmbassador;

            InitHandleCounter();
        }
示例#15
0
 //private IHLAfederate federate;
 public XrtiFederateAmbassador(IRTIambassador prtiAmbassador)
     : base(prtiAmbassador)
 {
 }
示例#16
0
 public TestFederate(IRTIambassador rtiAmbassador)
     : base(rtiAmbassador)
 {
 }
示例#17
0
 public FederateAmbassador(IRTIambassador prtiAmbassador)
     : base(prtiAmbassador)
 {
     rti = ((XrtiExecutiveAmbassador)rtiAmbassador);
 }
示例#18
0
 public MetaFederateAmbassador(IRTIambassador prtiAmbassador)
     : base(prtiAmbassador)
 {
 }
 //, TimeManagementForm aForm)
 public TimeManagementFederateAmbassador(IRTIambassador prtiAmbassador)
     : base(prtiAmbassador)
 {
     //this.form = aForm;
 }
示例#20
0
 public abstract void StartSimulation(IRTIambassador rtiAmb);