Exemple #1
0
 private void ExternalApp_SimStop(SimulationEvent e)
 {
     if (v3 != null)
     {
         v3.Cleanup();
         v3 = null;
     }
 }
Exemple #2
0
 public ExternalCommunicationSim()
 {
     blackboard    = null;
     bbClient      = null;
     distributor   = null;
     distClient    = null;
     simModel      = null;
     objectProxies = null;
     v3            = null;
 }
 public ExternalCommunicationSim()
 {
     blackboard = null;
     bbClient = null;
     distributor = null;
     distClient = null;
     simModel = null;
     objectProxies = null;
     v3 = null;
 }
Exemple #4
0
        public void Initialize(ref SimulationModelInfo simModel, ref Blackboard blackboard, ref SimulationEventDistributor distributor)
        {
            this.blackboard  = blackboard;
            this.bbClient    = new BlackboardClient();
            this.distributor = distributor;
            this.distClient  = new SimulationEventDistributorClient();
            this.simModel    = simModel;

            //distributor.RegisterClient(ref distClient);
            //distClient.Subscribe("NewObject");
            //distClient.Subscribe("RevealObject");
            //distClient.Subscribe("AttackSucceeded");
            //distClient.Subscribe("AttackObject");
            //distClient.Subscribe("WeaponLaunch");
            //distClient.Subscribe("ExternalApp_SimStop");

            blackboard.RegisterClient(ref bbClient);
            bbClient.Subscribe("PhysicalObject", "ID", true, false);
            bbClient.Subscribe("PhysicalObject", "Location", true, false);
            bbClient.Subscribe("PhysicalObject", "ParentObjectID", true, false);
            //bbClient.Subscribe("PhysicalObject", "ClassName", true, true);
            //bbClient.Subscribe("PhysicalObject", "Size", true, true);
            //bbClient.Subscribe("PhysicalObject", "MaximumSpeed", true, true);
            //bbClient.Subscribe("PhysicalObject", "State", true, true);
            //bbClient.Subscribe("PhysicalObject", "StateTable", true, true);
            //bbClient.Subscribe("PhysicalObject", "Sensors", true, true);
            //bbClient.Subscribe("PhysicalObject", "Emitters", true, true);
            //bbClient.Subscribe("PhysicalObject", "LaunchDuration", true, true);
            //bbClient.Subscribe("PhysicalObject", "AttackDuration", true, true);
            //bbClient.Subscribe("PhysicalObject", "DockingDuration", true, true);
            bbClient.Subscribe("PhysicalObject", "IsWeapon", true, false);
            //bbClient.Subscribe("PhysicalObject", "IconName", true, true);
            //bbClient.Subscribe("PhysicalObject", "RemoveOnDestruction", true, true);
            //bbClient.Subscribe("PhysicalObject", "CustomAttributes", true, true);
            objectProxies = new Dictionary <string, SimulationObjectProxy>();


            v3 = new V3DVTE_Publisher();
            string errMsg = string.Empty;

            //v3.Initialize("Aptima_DDD_Test",
            //              @"C:\svnroot\phoenix\DataFiles\v3_dvte.fed",
            //              @"C:\svnroot\phoenix\DataFiles\v3_dvte.xml",
            //              out errMsg);
            bool v3Result = v3.Initialize(ServerOptions.HLAFederationExecutionName,
                                          ServerOptions.HLAFederationFilePath,
                                          ServerOptions.HLAXMLFilePath,
                                          out errMsg);

            if (!v3Result)
            {
                ServerOptions.HLAExport = false;
                throw new Exception("Error initializing V3DVTE Publisher. " + errMsg);
            }
            List <string> interactions = new List <string>();

            interactions.Add("DamageAssessment");
            interactions.Add("DVTEVehicleEmbark.DVTEDisembarkResponse");
            interactions.Add("WeaponFire");
            interactions.Add("MunitionDetonation");

            List <string> attributes = new List <string>();

            attributes.Add("comment");
            attributes.Add("WorldLocation");
            bool bInteractions = v3.PublishInteractions(interactions);
            bool bObjects      = v3.PublishObjectClass(_physicalEntity, attributes);

            bObjects = v3.PublishObjectClass(_aircraft, attributes);
            bObjects = v3.PublishObjectClass(_seaSurface, attributes);
            bObjects = v3.PublishObjectClass(_landUnit, attributes);
            bObjects = v3.PublishObjectClass(_munition, attributes);
        }
        public void Initialize(ref SimulationModelInfo simModel, ref Blackboard blackboard, ref SimulationEventDistributor distributor)
        {
            this.blackboard = blackboard;
            this.bbClient = new BlackboardClient();
            this.distributor = distributor;
            this.distClient = new SimulationEventDistributorClient();
            this.simModel = simModel;

            //distributor.RegisterClient(ref distClient);
            //distClient.Subscribe("NewObject");
            //distClient.Subscribe("RevealObject");
            //distClient.Subscribe("AttackSucceeded");
            //distClient.Subscribe("AttackObject");
            //distClient.Subscribe("WeaponLaunch");
            //distClient.Subscribe("ExternalApp_SimStop");

            blackboard.RegisterClient(ref bbClient);
            bbClient.Subscribe("PhysicalObject", "ID", true, false);
            bbClient.Subscribe("PhysicalObject", "Location", true, false);
            bbClient.Subscribe("PhysicalObject", "ParentObjectID", true, false);
            //bbClient.Subscribe("PhysicalObject", "ClassName", true, true);
            //bbClient.Subscribe("PhysicalObject", "Size", true, true);
            //bbClient.Subscribe("PhysicalObject", "MaximumSpeed", true, true);
            //bbClient.Subscribe("PhysicalObject", "State", true, true);
            //bbClient.Subscribe("PhysicalObject", "StateTable", true, true);
            //bbClient.Subscribe("PhysicalObject", "Sensors", true, true);
            //bbClient.Subscribe("PhysicalObject", "Emitters", true, true);
            //bbClient.Subscribe("PhysicalObject", "LaunchDuration", true, true);
            //bbClient.Subscribe("PhysicalObject", "AttackDuration", true, true);
            //bbClient.Subscribe("PhysicalObject", "DockingDuration", true, true);
            bbClient.Subscribe("PhysicalObject", "IsWeapon", true, false);
            //bbClient.Subscribe("PhysicalObject", "IconName", true, true);
            //bbClient.Subscribe("PhysicalObject", "RemoveOnDestruction", true, true);
            //bbClient.Subscribe("PhysicalObject", "CustomAttributes", true, true);
            objectProxies = new Dictionary<string, SimulationObjectProxy>();


            v3 = new V3DVTE_Publisher();
            string errMsg = string.Empty;

            //v3.Initialize("Aptima_DDD_Test",
            //              @"C:\svnroot\phoenix\DataFiles\v3_dvte.fed",
            //              @"C:\svnroot\phoenix\DataFiles\v3_dvte.xml",
            //              out errMsg);
            bool v3Result = v3.Initialize(ServerOptions.HLAFederationExecutionName,
                          ServerOptions.HLAFederationFilePath,
                          ServerOptions.HLAXMLFilePath,
                          out errMsg);
            if (!v3Result)
            {
                ServerOptions.HLAExport = false;
                throw new Exception("Error initializing V3DVTE Publisher. " + errMsg);
            }
            List<string> interactions = new List<string>();
            interactions.Add("DamageAssessment");
            interactions.Add("DVTEVehicleEmbark.DVTEDisembarkResponse");
            interactions.Add("WeaponFire");
            interactions.Add("MunitionDetonation");

            List<string> attributes = new List<string>();
            attributes.Add("comment");
            attributes.Add("WorldLocation");
            bool bInteractions = v3.PublishInteractions(interactions);
            bool bObjects = v3.PublishObjectClass(_physicalEntity, attributes);
            bObjects = v3.PublishObjectClass(_aircraft, attributes);
            bObjects = v3.PublishObjectClass(_seaSurface, attributes);
            bObjects = v3.PublishObjectClass(_landUnit, attributes);
            bObjects = v3.PublishObjectClass(_munition, attributes);



        }
 private void ExternalApp_SimStop(SimulationEvent e)
 {
     if (v3 != null)
     {
         v3.Cleanup();
         v3 = null;
     }
 }