public MySimulation(double startTime, double hockeyMatchTime, double endTime) { StartTime = startTime; HockeyMatchTime = hockeyMatchTime; EndTime = endTime; // init input properties LineVehicles = new[] { new List <int>(), new List <int>(), new List <int>() }; LineBusesStartTimes = new[] { new List <double>(), new List <double>(), new List <double>() }; LineMicrobuses = new[] { 0, 0, 0 }; LineMicrobusesStartTimes = new[] { new List <double>(), new List <double>(), new List <double>() }; // init statistics AveragePassengerWaitingTimeSim = new Stat(); ArrivedAfterStartRatioSim = new Stat(); AverageVehicleLoadSim = new Stat(); // init configuration properties LinesConfiguration = new LinesConfiguration(); // init generators Random seedGenerator = new Random(); ExponentialRNG.SetSeedGen(seedGenerator); TriangularRNG.SetSeedGen(seedGenerator); UniformContinuousRNG.SetSeedGen(seedGenerator); Init(); }
public void CreateBusStopsMap(LinesConfiguration linesConfiguration) { StartsOfTheLines = new BusStopNavigationNode[3]; int endBusStopId = linesConfiguration.GetIdByName("st"); StartsOfTheLines[0] = CreateLineMap(linesConfiguration, linesConfiguration.LineANames, linesConfiguration.LineATimes, new BusStopNavigationNode(endBusStopId, 1500, "st")); StartsOfTheLines[1] = CreateLineMap(linesConfiguration, linesConfiguration.LineBNames, linesConfiguration.LineBTimes, new BusStopNavigationNode(endBusStopId, 600, "st")); StartsOfTheLines[2] = CreateLineMap(linesConfiguration, linesConfiguration.LineCNames, linesConfiguration.LineCTimes, new BusStopNavigationNode(endBusStopId, 1800, "st")); }
protected override void DoInitialize() { logger.Info("Инициализация..."); var appPath = Application.StartupPath + "/"; configuration = LinesConfiguration.LoadFromFile(appPath + "Settings/LinesConfiguration.xml"); var network = ConnectionConfiguration.Default; oracleConnectionHolder = new OracleConnectionHolder(network.OracleConnectionString); oracleConnectionHolder.SetCheckConnectionInterval(TimeSpan.FromMinutes(1)); oracleConnectionHolder.SetReconnectionInterval(TimeSpan.FromMinutes(1)); oracleConnectionHolder.SetHolderName("Oracle"); oracleConnectionHolder.Subscribe(this); opcConnectionHolder = new OpcConnectionHolder(network.OpcServerName, network.OpcServerHost); opcConnectionHolder.SetCheckConnectionInterval(TimeSpan.FromMinutes(1)); opcConnectionHolder.SetReconnectionInterval(TimeSpan.FromMinutes(1)); opcConnectionHolder.SetHolderName("OPC"); opcConnectionHolder.Subscribe(this); dataBuffer = new MemoryBufferImpl(); kppConnector = new KppImpl(); kppConnector.SetConnectionHolder(opcConnectionHolder); var parameters = new List <QueryParameter>(); foreach (var lineConfiguration in configuration.Lines) { parameters.AddRange(lineConfiguration.Parameters); } kppConnector.SetParametersNames(parameters.ToArray()); itsConnector = new ItsImpl(); itsConnector.SetConnectionHoder(oracleConnectionHolder); itsConnector.SetLinesConfiguration(configuration); itsConnector.Initialize(); // Открытие соединений. opcConnectionHolder.TryConnect(); oracleConnectionHolder.TryConnect(); opcConnectionHolder.Start(); oracleConnectionHolder.Start(); checkTimer = new Timer(checkInterval.TotalMilliseconds); checkTimer.Elapsed += CheckerTimerTick; backgroundWorker = new BackgroundWorker(); backgroundWorker.DoWork += DoCheckLines; logger.Info("Инициализация завершена."); }
private BusStopNavigationNode CreateLineMap(LinesConfiguration configuration, string[] names, double[] times, BusStopNavigationNode endBusStop) { string name = names[0]; double timeToNext = times[0]; var initNode = new BusStopNavigationNode(configuration.GetIdByName(name), timeToNext, name); var node = initNode; for (int i = 1; i < names.Length; i++) { name = names[i]; timeToNext = times[i]; var nextNode = new BusStopNavigationNode(configuration.GetIdByName(name), timeToNext, name); node.Next = nextNode; node = nextNode; } node.Next = endBusStop; endBusStop.Next = initNode; return(initNode); }
public void SetLinesConfiguration(LinesConfiguration aConfiguration) { configuration = aConfiguration; }
public void SetLinesConfiguration(LinesConfiguration aConfiguration) { configuration = aConfiguration; }