public override SimulationEvent ToSimulationEvent(ref SimulationModelInfo simModel) { SimulationEvent ev = SimulationEventFactory.BuildEvent(ref simModel, EVENTTYPE); AttributeCollectionValue attributes = new AttributeCollectionValue(); attributes.attributes.Add("Location", this.Location); attributes.attributes.Add("State", DataValueFactory.BuildString(this.State)); if(ObjectType != null && ObjectType != String.Empty) { attributes.attributes.Add("ClassName", DataValueFactory.BuildString(ObjectType)); } if(OwnerID != null && OwnerID != String.Empty) { attributes.attributes.Add("OwnerID", DataValueFactory.BuildString(OwnerID)); } if(StartupParameters != null) { foreach(String s in StartupParameters.Keys) { attributes.attributes.Add(s, StartupParameters[s]); } } //do stuff ((StringValue)ev["ObjectID"]).value = this.ObjectID; ev["Attributes"] = attributes; return ev; }
public void ClearTextServerVariables() { simModelName = String.Empty; simModelInfo = null; roomMembership = new Dictionary<string, List<string>>(); roomNextObjectIndex = new Dictionary<string, int>(); }
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("TimeTick"); //distClient.Subscribe("StateChange"); //distClient.Subscribe("ResetSimulation"); blackboard.RegisterClient(ref bbClient); bbClient.Subscribe("PhysicalObject", "ID", true, false); bbClient.Subscribe("PhysicalObject", "StateTable", true, false); bbClient.Subscribe("PhysicalObject", "Throttle", true, false); bbClient.Subscribe("PhysicalObject", "FuelCapacity", true, true); bbClient.Subscribe("PhysicalObject", "FuelAmount", true, true); bbClient.Subscribe("PhysicalObject", "FuelConsumptionRate", true, true); bbClient.Subscribe("PhysicalObject", "FuelDepletionState", true, true); bbClient.Subscribe("PhysicalObject", "DockedToParent", true, false); objectProxies = new Dictionary<string, SimulationObjectProxy>(); }
/// <summary> /// This method reads in a simulation model xml file and builds a SimulationModelInfo object. /// </summary> /// <param name="fileName"></param> /// <returns></returns> public SimulationModelInfo readModel(string fileName) { SimulationModelInfo simMod = new SimulationModelInfo(); GeneratedCode.SimulationModelRoot model = null; try { FileStream f = new FileStream(fileName, FileMode.Open, FileAccess.Read); XmlSerializer newSr = new XmlSerializer(typeof(GeneratedCode.SimulationModelRoot)); model = (GeneratedCode.SimulationModelRoot)newSr.Deserialize(f); f.Close(); } catch (Exception err) { throw new Exception(String.Format("Error reading simulation model file: \"{0}\"", fileName), err); System.Console.WriteLine("file=" + fileName); System.Console.WriteLine( "** Parsing error" + ", line " + err.StackTrace); System.Console.WriteLine(" " + err.Message); System.Environment.Exit(1); } simMod.eventModel = getEventModelInfo(model); simMod.objectModel = getObjectModelInfo(model); simMod.simulationExecutionModel = getSimulationExecutionModelInfo(model); return(simMod); }
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("MoveObject"); //distClient.Subscribe("TimeTick"); //distClient.Subscribe("ResetSimulation"); blackboard.RegisterClient(ref bbClient); bbClient.Subscribe("PhysicalObject", "ID", true, false); bbClient.Subscribe("PhysicalObject", "Location", true, false); bbClient.Subscribe("PhysicalObject", "Velocity", true, false); bbClient.Subscribe("PhysicalObject", "Size", true, false); bbClient.Subscribe("PhysicalObject", "DockedToParent", true, false); bbClient.Subscribe("PhysicalObject", "Capability", true, false); bbClient.Subscribe("PhysicalObject", "Vulnerability", true, false); bbClient.Subscribe("PhysicalObject", "TargetsInRange", true, true); bbClient.Subscribe("PhysicalObject", "State", true, false); //bbClient.Subscribe("PhysicalObject", "MaximumSpeed", true, false); //bbClient.Subscribe("PhysicalObject", "Throttle", true, false); //bbClient.Subscribe("PhysicalObject", "DestinationLocation", true, false); objectProxies = new Dictionary<string, SimulationObjectProxy>(); }
public ForkReplayToQueues(String replayName, SimulationModelInfo simModelInfo) { m_simModelInfo = simModelInfo; List<SimulationEvent> events = LoadForkReplayFile(replayName); if (events.Count == 0) // this is not a fork replay { return; } SimulationEvent start = SimulationEventFactory.BuildEvent(ref simModelInfo, "ForkReplayStarted"); SimulationEvent finish = SimulationEventFactory.BuildEvent(ref simModelInfo, "ForkReplayFinished"); TimerQueueClass.SendBeforeStartup(new ForkReplayEventType(start)); int lastTime = 1; foreach (SimulationEvent ev in events) { ForkReplayEventType fr = new ForkReplayEventType(ev); TimerQueueClass.Add(fr.Time, fr); lastTime = fr.Time; } ForkReplayEventType fr2 = new ForkReplayEventType(finish); fr2.Time = lastTime + 1; TimerQueueClass.Add(fr2.Time, fr2); }
static public SimulationEvent BuildStateChangeEvent(ref SimulationModelInfo simModel, int time, string id, string state) { SimulationEvent sc = SimulationEventFactory.BuildEvent(ref simModel, "StateChange"); ((StringValue)sc["ObjectID"]).value = id; ((StringValue)sc["NewState"]).value = state; ((IntegerValue)sc["Time"]).value = time; return sc; }
static public SimulationEvent BuildMoveDoneEvent(ref SimulationModelInfo simModel, int time, string id, string reason) { SimulationEvent sc = SimulationEventFactory.BuildEvent(ref simModel, "MoveDone"); ((StringValue)sc["ObjectID"]).value = id; ((IntegerValue)sc["Time"]).value = time; ((StringValue)sc["Reason"]).value = reason; return sc; }
public BlackboardManagerSim() { blackboard = null; bbClient = null; distributor = null; distClient = null; simModel = null; }
public AuthenticationManager(ref SimulationEventDistributorClient netServ, ref SimulationModelInfo simModel, int numberfOfSeats) { simModelInfo = simModel; server = netServ; currentlyLoggedInUsers = 0; maxNumberOfUsers = numberfOfSeats; terminalIdMapping = new Dictionary<string, LoginInfo>(); }
public StaticAttributeSim() { blackboard = null; bbClient = null; distributor = null; distClient = null; simModel = null; objectProxies = null; }
public CollisionDetectionSim() { time = 0; blackboard = null; bbClient = null; distributor = null; distClient = null; simModel = null; objectProxies = null; }
public FuelHandlingSim() { time = 0; blackboard = null; bbClient = null; distributor = null; distClient = null; simModel = null; objectProxies = null; }
public TextChatServer(string simModelPath, ref SimulationEventDistributor distributor) { simModelName = simModelPath; simModelInfo = smr.readModel(simModelName); isRunning = false; roomMembership = new Dictionary<string, List<string>>(); server = new SimulationEventDistributorClient(); distributor.RegisterClient(ref server); }
static public SimulationEvent BuildMoveObjectRequestEvent(ref SimulationModelInfo simModel, int time, string userID, string objectID, Vec3D destination, double throttle) { SimulationEvent sc = SimulationEventFactory.BuildEvent(ref simModel, "MoveObjectRequest"); ((StringValue)sc["UserID"]).value = userID; ((StringValue)sc["ObjectID"]).value = objectID; ((IntegerValue)sc["Time"]).value = time; ((DoubleValue)sc["Throttle"]).value = throttle; sc["DestinationLocation"] = destination.ToLocationValue(); return sc; }
public ExternalCommunicationSim() { blackboard = null; bbClient = null; distributor = null; distClient = null; simModel = null; objectProxies = null; v3 = null; }
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; this.dmColorMapping = new Dictionary<string, int>(); this.teamDefinitions = new Dictionary<string, List<string>>(); this.networkRosters = new Dictionary<string, List<string>>(); this.dmTeamsMap = new Dictionary<string, string>(); this.networkObjects = new Dictionary<string, List<string>>(); this.listOfObstructionIDs = new List<string>(); this.obstructions = new Dictionary<string, StateDB.ActiveRegion>(); this.listOfObjectIDs = new List<string>(); this.dmOwnedObjects = new Dictionary<string, List<string>>(); objectViews = new Dictionary<string, ObjectsAttributeCollection>(); teamClassifications = new Dictionary<string, Dictionary<string, string>>(); teamClassificationChanges = new Dictionary<string, Dictionary<string, string>>(); dmViews = new Dictionary<string, ObjectsAttributeCollection>(); activeDMs = new List<string>(); activeSensorNetworks = new Dictionary<string, bool>(); //singletonDMs = new List<string>(); currentAttacks = new List<Attack>(); ClassificationsEnum = new List<String>(); movingObjects = new List<string>(); randomGenerator = new Random(randomSeed); this.dTimeSec = ((double)simModel.GetUpdateFrequency()) / 1000; this.dTimeMSec = simModel.GetUpdateFrequency(); currentTick = 0; distributor.RegisterClient(ref distClient); blackboard.RegisterClient(ref bbClient); // subscribe to events that aren't OwnerObservable bbClient.Subscribe("PhysicalObject", "Emitters", true, false); bbClient.Subscribe("PhysicalObject", "RemoveOnDestruction", true, false); bbClient.Subscribe("PhysicalObject", "ActiveRegionSpeedMultiplier", true, false); bbClient.Subscribe("PhysicalObject", "DefaultClassification", true, false); bbClient.Subscribe("PhysicalObject", "ClassificationDisplayRules", true, false); foreach (KeyValuePair<string, AttributeInfo> kvp in simModel.objectModel.objects["PhysicalObject"].attributes) { if (kvp.Value.ownerObservable == true) { bbClient.Subscribe("PhysicalObject", kvp.Key, true, false); } } bbClient.Subscribe("DecisionMaker", "RoleName", true, false); bbClient.Subscribe("SensorNetwork", "DMMembers", true, false); bbClient.Subscribe("Region", "Polygon", true, false); bbClient.Subscribe("ActiveRegion", "BlocksSensorTypes", true, false); objectProxies = new Dictionary<string, SimulationObjectProxy>(); }
public DynamicRegionSim() { time = 0; blackboard = null; bbClient = null; distributor = null; distClient = null; simModel = null; objectProxies = null; }
public override SimulationEvent ToSimulationEvent(ref SimulationModelInfo simModel) { SimulationEvent ev = SimulationEventFactory.BuildEvent(ref simModel, EVENTTYPE); //do stuff ((StringValue)ev["ObjectID"]).value = this.ObjectID; // ((StringValue)ev["NewState"]).value = this.StateName; //This was throwing an error... ((StringValue)ev["State"]).value = this.StateName; //Trying this instead -Lisa return ev; }
public override SimulationEvent ToSimulationEvent(ref SimulationModelInfo simModel) { SimulationEvent ev = SimulationEventFactory.BuildEvent(ref simModel, EVENTTYPE); //do stuff ((StringValue)ev["ObjectID"]).value = this.ObjectID; ((StringValue)ev["TargetObjectID"]).value = this.TargetID; ((StringValue)ev["CapabilityName"]).value = this.CapabilityName; return ev; }
public ReplayLogger(string logsPath, string simModelPath, ref SimulationEventDistributor distributor, string mode) { logPath = logsPath; simModelName = simModelPath; simModelInfo = smr.readModel(simModelName); isRunning = false; logMode = mode; //server = new NetworkClient(); //server.Connect(hostName, Convert.ToInt32(portNumber)); cc = new SimulationEventDistributorClient(); distributor.RegisterClient(ref cc); }
public AttackProcessorSim() { time = 0; blackboard = null; bbClient = null; distributor = null; distClient = null; simModel = null; objectProxies = null; randomSeed = 0; random = new Random(randomSeed); }
public override SimulationEvent ToSimulationEvent(ref SimulationModelInfo simModel) { SimulationEvent ev = SimulationEventFactory.BuildEvent(ref simModel, EVENTTYPE); //do stuff ((StringValue)ev["ObjectID"]).value = this.ObjectID; ((DoubleValue)ev["Throttle"]).value = this.Throttle; ev["DestinationLocation"] = this.DestinationLocation; return ev; }
public ScoringSim() { time = 0; blackboard = null; bbClient = null; distributor = null; distClient = null; simModel = null; objectProxies = null; lastScore = new Dictionary<string, double>(); //regions = new Dictionary<string, BlockingRegion>(); }
public override SimulationEvent ToSimulationEvent(ref SimulationModelInfo simModel) { SimulationEvent ev = SimulationEventFactory.BuildEvent(ref simModel, EVENTTYPE); //do stuff ((StringValue)ev["ObjectID"]).value = this.AttackerID; ((StringValue)ev["TargetObjectID"]).value = this.TargetID; ((StringValue)ev["CapabilityName"]).value = this.CapabilityName; ((IntegerValue)ev["PercentageApplied"]).value = 100; return ev; }
public WhiteboardServer(string simModelPath, ref SimulationEventDistributor distributor) { simModelName = simModelPath; simModelInfo = smr.readModel(simModelName); lock (isRunningLock) { isRunning = false; } roomMembership = new Dictionary<string, List<string>>(); roomNextObjectIndex = new Dictionary<string, int>(); server = new SimulationEventDistributorClient(); distributor.RegisterClient(ref server); }
public MotionSim() { time = 0; blackboard = null; bbClient = null; distributor = null; distClient = null; simModel = null; objectProxies = null; collisionShapes = new Dictionary<string, Polygon3D>(); //landRegions = new Dictionary<string, LandRegion>(); //activeRegions = new Dictionary<string, ActiveRegion>(); }
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("MoveObject"); //distClient.Subscribe("SubplatformLaunch"); //distClient.Subscribe("WeaponLaunch"); //distClient.Subscribe("StateChange"); //distClient.Subscribe("ObjectCollision"); //distClient.Subscribe("TimeTick"); //distClient.Subscribe("SubplatformDock"); //distClient.Subscribe("ResetSimulation"); blackboard.RegisterClient(ref bbClient); bbClient.Subscribe("PhysicalObject", "ID", true, false); bbClient.Subscribe("PhysicalObject", "StateTable", true, false); bbClient.Subscribe("PhysicalObject", "State", true, false); bbClient.Subscribe("PhysicalObject", "OwnerID", true, false); bbClient.Subscribe("PhysicalObject", "Location", true, true); bbClient.Subscribe("PhysicalObject", "Size", true, false); bbClient.Subscribe("PhysicalObject", "Velocity", true, true); bbClient.Subscribe("PhysicalObject", "MaximumSpeed", true, false); bbClient.Subscribe("PhysicalObject", "Throttle", true, true); bbClient.Subscribe("PhysicalObject", "DestinationLocation", true, true); bbClient.Subscribe("PhysicalObject", "DockedToParent", true, false); bbClient.Subscribe("PhysicalObject", "LaunchStarted", true, false); bbClient.Subscribe("PhysicalObject", "LaunchEndTime", true, false); bbClient.Subscribe("PhysicalObject", "LaunchDone", true, true); bbClient.Subscribe("PhysicalObject", "LinkedRegion", true, true); bbClient.Subscribe("PhysicalObject", "PursueStarted", true, true); bbClient.Subscribe("PhysicalObject", "PursueTargetID", true, true); bbClient.Subscribe("PhysicalObject", "ParentObjectID", true, false); bbClient.Subscribe("PhysicalObject", "LaunchIsWeapon", true, false); bbClient.Subscribe("PhysicalObject", "LaunchWeaponTargetID", true, false); bbClient.Subscribe("PhysicalObject", "LaunchDestinationLocation", true, false); bbClient.Subscribe("PhysicalObject", "InActiveRegions", true, true); bbClient.Subscribe("PhysicalObject", "ActiveRegionSpeedMultiplier", true, true); // bbClient.Subscribe("Region", "LinkedObject", true, true); objectProxies = new Dictionary<string, SimulationObjectProxy>(); }
//private Dictionary<string, Team> teams; //private Dictionary<string, DecisionMaker> decisionMakers; public SelfDefenseSim() { time = 0; blackboard = null; bbClient = null; distributor = null; distClient = null; simModel = null; objectProxies = null; randomSeed = 0; random = new Random(randomSeed); //teams = new Dictionary<string, Team>(); //decisionMakers = new Dictionary<string, DecisionMaker>(); }
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); blackboard.RegisterClient(ref bbClient); bbClient.Subscribe("PhysicalObject", "ID", true, false); bbClient.Subscribe("PhysicalObject", "Location", true, false); objectProxies = new Dictionary<string, SimulationObjectProxy>(); }
public Player() { playerThread = null; distClient = null; simModel = null; time = 0; paused = false; updateFrequency = 0; events = new List<SimulationEvent>(); loop = false; logname = null; isReady = false; replaySpeed = 1; }
public SimulationModelInfo readModel(Stream str) { SimulationModelInfo simMod = new SimulationModelInfo(); GeneratedCode.SimulationModelRoot model = null; try { XmlSerializer newSr = new XmlSerializer(typeof(GeneratedCode.SimulationModelRoot)); model = (GeneratedCode.SimulationModelRoot)newSr.Deserialize(str); str.Close(); } catch (Exception err) { throw new Exception("Error reading simulation model stream:" + err.Message); } simMod.eventModel = getEventModelInfo(model); simMod.objectModel = getObjectModelInfo(model); simMod.simulationExecutionModel = getSimulationExecutionModelInfo(model); return(simMod); }