コード例 #1
0
ファイル: TashaRuntime.cs プロジェクト: lunaxi7/XTMF
        public void Start()
        {
            // setup the status to be initializing
            _Status          = null;
            _Progress        = () => 0f;
            CurrentIteration = 0;
            if (!VehicleTypes.Contains(AutoType))
            {
                VehicleTypes.Add(AutoType);
            }
            ZoneSystem.LoadData();
            if (PreRun != null)
            {
                foreach (var module in PreRun)
                {
                    module.Start();
                }
            }
            IterationPercentage = 1f / TotalIterations;
            if (PostScheduler != null)
            {
                foreach (var module in PostScheduler)
                {
                    module.Load(TotalIterations);
                }
            }
            if (PostHousehold != null)
            {
                foreach (var module in PostHousehold)
                {
                    module.Load(TotalIterations);
                }
            }

            if (OverrideModeParameters)
            {
                InitializeParameters();
            }
            LoadNetworkData(0);
            if (Scheduler != null)
            {
                Scheduler.LoadOneTimeLocalData();
            }

            if (ModeChoice != null)
            {
                ModeChoice.LoadOneTimeLocalData();
            }

            for (int i = 0; i < TotalIterations; i++)
            {
                if (!_ExitRequested)
                {
                    CurrentHousehold             = 0;
                    CurrentIteration             = i;
                    CompletedIterationPercentage = i * IterationPercentage;
                    if (LoadAllHouseholds)
                    {
                        if (!SkipLoadingHouseholds)
                        {
                            HouseholdLoader.LoadData();
                        }
                    }
                    RunIteration(i);
                }
            }
            if (PostRun != null)
            {
                foreach (var module in PostRun)
                {
                    module.Start();
                }
            }
            ZoneSystem.UnloadData();
        }