public Simits2() { InitializeComponent(); this.configComboTrajectories(); this.configComboMac(); this.scenario = new Scenario(); this.configCombosThroughput(); this.resultsContainer = new Results(); this.collisions = 0; this.successTx = 0; this.noTx = 0; this.gridVehicles.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill; this.gridVehicles.DataSource = this.scenario.Vehicles; this.btStop.Enabled = false; this.btStartSimulation.Enabled = false; this.btWrite.Enabled = false; this.eamGraphs = new Dictionary<string, GraphControl3d.Graph3d>(); this.historyGraphs = new Dictionary<string, GraphControlBasic.BasicGraph>(); this.costGraphs = new Dictionary<string, GraphControlBasic.BasicGraph>(); this.specificRegions = new Dictionary<string, CheckedListBox>(); this.simDelay = 1000; this.storedValuesOfThr = new Dictionary<string, List<double>>(); this.storedValuesOfCollisions = new Dictionary<string, List<int>>(); this.updateTimer = new Timer(); this.updateTimer.Interval = 20; this.updateTimer.Tick += updateTimer_Tick; this.updateTimer.Start(); this.setStatusOff(); this.simulationTimer = new System.Timers.Timer(); this.simulationTimer.Elapsed += simulationTimer_Elapsed; }
public void ApplyScenario(Scenario inputScenario, int inputSimDelay, int numberOfUsers) { this.scenario = inputScenario; Coordinate limits = new Coordinate(this.scenario.MainMap.SizeX, this.scenario.MainMap.SizeY); this.simDelay = inputSimDelay; this.configureInterferences(); this.scenario.Vehicles.Clear(); this.clearTabMatrix(); this.clearTabHistory(); this.clearTabCost(); #region --- inicialización de vehículos --- MacTypes vehicleMac = this.scenario.MediumAccessControl; for (int idx = 1; idx <= numberOfUsers; idx++) { #region NCCMA if (vehicleMac == MacTypes.NCCMA) { if (idx == 1) { this.scenario.Vehicles.Add(new VehicleNccma(new Coordinate(1, 1), idx, Color.Blue, VehicleType.LEADER, vehicleMac, Trajectories.CCW, limits, this.scenario.MainSpectrum.TimeSegments, this.scenario.MainSpectrum.FrequencySegments)); } else { this.scenario.Vehicles.Add(new VehicleNccma(new Coordinate(1, 1), idx, Color.SteelBlue, VehicleType.FOLLOWER, vehicleMac, Trajectories.FOLLOWER, limits, this.scenario.MainSpectrum.TimeSegments, this.scenario.MainSpectrum.FrequencySegments)); } } #endregion #region TDMAGT else if (vehicleMac == MacTypes.TDMA_GT) { if (idx == 1) { this.scenario.Vehicles.Add(new VehicleTdmaGt(new Coordinate(1, 1), idx, Color.Blue, VehicleType.LEADER, vehicleMac, Trajectories.CCW, limits, this.scenario.MainSpectrum.TimeSegments, this.scenario.MainSpectrum.FrequencySegments)); } else { this.scenario.Vehicles.Add(new VehicleTdmaGt(new Coordinate(1, 1), idx, Color.SteelBlue, VehicleType.FOLLOWER, vehicleMac, Trajectories.FOLLOWER, limits, this.scenario.MainSpectrum.TimeSegments, this.scenario.MainSpectrum.FrequencySegments)); } } #endregion #region RR-ALOHA else if (vehicleMac == MacTypes.RR_ALOHA) { if (idx == 1) { this.scenario.Vehicles.Add(new VehicleRrAloha(new Coordinate(1, 1), idx, Color.Blue, VehicleType.LEADER, vehicleMac, Trajectories.CCW, limits, this.scenario.MainSpectrum.TimeSegments, this.scenario.MainSpectrum.FrequencySegments)); } else { this.scenario.Vehicles.Add(new VehicleRrAloha(new Coordinate(1, 1), idx, Color.SteelBlue, VehicleType.FOLLOWER, vehicleMac, Trajectories.FOLLOWER, limits, this.scenario.MainSpectrum.TimeSegments, this.scenario.MainSpectrum.FrequencySegments)); } } #endregion #region OTHERS else { if (idx == 1) { this.scenario.Vehicles.Add(new Vehicle(new Coordinate(1, 1), idx, Color.SteelBlue, VehicleType.LEADER, vehicleMac, Trajectories.CCW, limits)); } else { this.scenario.Vehicles.Add(new Vehicle(new Coordinate(1, 1), idx, Color.SteelBlue, VehicleType.FOLLOWER, vehicleMac, Trajectories.FOLLOWER, limits)); } } #endregion } #endregion this.initMatrixGraphs(); this.initHistoryGraphs(); this.initCostGraphs(); this.specialInterferencesEnabled = false; this.configureResultsContainer(); this.afterApplyScenarioConfiguration(); }
public Writer(Scenario scenario, Results results) { this.Scenario = scenario; this.ResultsContainer = results; this.FieldSeparator = System.Globalization.CultureInfo.CurrentCulture.TextInfo.ListSeparator; }
private Scenario setSpecialModeScenario(string title, MacTypes mac) { Scenario specialModeScenario = new Scenario(title); specialModeScenario.MediumAccessControl = mac; specialModeScenario.MainMap = new Map(SPECIAL_MODE_X_DIM, SPECIAL_MODE_Y_DIM); specialModeScenario.MainSpectrum = new Spectrum(SPECIAL_MODE_TIME_SEGMENTS, SPECIAL_MODE_FREQ_SEGMENTS); specialModeScenario.InterferenceSpectrum = new Spectrum(SPECIAL_MODE_TIME_SEGMENTS, SPECIAL_MODE_FREQ_SEGMENTS); specialModeScenario.SimulationTime.TimeSegments = SPECIAL_MODE_TIME_SEGMENTS; specialModeScenario.SimulationTime.FrequencySegments = SPECIAL_MODE_FREQ_SEGMENTS; specialModeScenario.SimulationTime.CyclesPerRegion = SPECIAL_MODE_CYCLES_PER_REGION; this.ApplyScenario(specialModeScenario, SPECIAL_MODE_SIM_DELAY, SPECIAL_MODE_VEHICLES); this.afterApplyScenarioConfiguration(); return specialModeScenario; }