Beispiel #1
0
        /// <summary>
        /// Load the data we only need to get once
        /// </summary>
        public void LoadOneTimeLocalData()
        {
            if ( this.AlternativeTravelModeName != null && this.AlternativeTravelModeName != String.Empty )
            {
                var allModes = this.TashaRuntime.AllModes;
                bool found = false;
                foreach ( var mode in allModes )
                {
                    if ( mode.ModeName == this.AlternativeTravelModeName )
                    {
                        this.AlternativeTravelMode = mode;
                        found = true;
                        break;
                    }
                }
                if ( !found )
                {
                    throw new XTMFRuntimeException( "Unable to find the Alternative Travel Mode called " + this.AlternativeTravelModeName );
                }
            }
            Scheduler.LocalScheduler = this;
            Scheduler.Tasha = this.TashaRuntime;
            Scheduler.MinimumWorkingAge = this.MinWorkingAgeLocal;
            Scheduler.EpisodeSchedulingAttempts = this.EpisodeSchedulingAttemptsLocal;
            Scheduler.ActivityLevels = this.GetFullPath( this.ActivityLevelsLocal );
            Scheduler.SchoolMorningStart = this.SchoolMorningStartDateTime;
            Scheduler.SchoolMorningEnd = this.SchoolMorningEndDateTime;
            Scheduler.SchoolAfternoonStart = this.SchoolAfternoonStartDateTime;
            Scheduler.SchoolAfternoonEnd = this.SchoolAfternoonEndDateTime;
            Scheduler.SecondaryWorkThreshold = this.SecondaryWorkThresholdDateTime;
            Scheduler.StartTimeQuanta = this.StartTimeQuantaLocal;
            Scheduler.StartTimeQuantaInterval = (short)( ( 24 * 60 ) / Scheduler.StartTimeQuanta );
            Time.OneQuantum = this.MinimumDurationDateTime;
            Time.StartOfDay = new Time() { Hours = 4 };
            Time.EndOfDay = new Time() { Hours = 28 };
            Scheduler.PercentOverlapAllowed = this.PercentOverlapAllowedLocal;
            Scheduler.SecondaryWorkMinStartTime = this.SecondaryWorkMinStartTimeDateTime;
            Scheduler.MinPrimaryWorkDurationForReturnHomeFromWork = this.MinPrimaryWorkDurationForReturnHomeFromWorkDateTime;
            Scheduler.MaxPrimeWorkStartTimeForReturnHomeFromWork = this.MaxPrimeWorkStartTimeForReturnHomeFromWorkDateTime;
            Scheduler.ReturnHomeFromWorkMaxEndTime = this.ReturnHomeFromWorkMaxEndTimeDateTime;
            Scheduler.FullTimeActivity = this.FullTimeActivityDateTime;
            Scheduler.LocationChoiceModel = this.LocationChoiceModelLocal;
            Scheduler.LocationChoiceModel.LoadLocationChoiceCache();
            //Distributions
            Scheduler.AdultDistributionsFile = this.GetFullPath( this.AdultDistributionsFileLocal );
            Scheduler.FrequencyDistributionsFile = this.GetFullPath( this.FrequencyDistributionsFileLocal );
            Scheduler.NumberOfDistributions = this.NumberOfDistributionsLocal;
            Scheduler.NumberOfAdultFrequencies = this.NumberOfAdultFrequenciesLocal;
            Scheduler.NumberOfAdultDistributions = this.NumberOfAdultDistributionsLocal;

            Scheduler.MaxFrequency = this.MaxFrequencyLocal;
            Distribution.TashaRuntime = this.TashaRuntime;
            Distribution.InitializeDistributions();

            HouseholdExtender.TashaRuntime = this.TashaRuntime;
            // references in scheduler
            SchedulerHousehold.TashaRuntime = this.TashaRuntime;
            Schedule.Scheduler = this;
        }
Beispiel #2
0
        /// <summary>
        /// Load the data we only need to get once
        /// </summary>
        public void LoadOneTimeLocalData()
        {
            if (this.AlternativeTravelModeName != null && this.AlternativeTravelModeName != String.Empty)
            {
                var  allModes = this.TashaRuntime.AllModes;
                bool found    = false;
                foreach (var mode in allModes)
                {
                    if (mode.ModeName == this.AlternativeTravelModeName)
                    {
                        this.AlternativeTravelMode = mode;
                        found = true;
                        break;
                    }
                }
                if (!found)
                {
                    throw new XTMFRuntimeException("Unable to find the Alternative Travel Mode called " + this.AlternativeTravelModeName);
                }
            }
            Scheduler.LocalScheduler            = this;
            Scheduler.Tasha                     = this.TashaRuntime;
            Scheduler.MinimumWorkingAge         = this.MinWorkingAgeLocal;
            Scheduler.EpisodeSchedulingAttempts = this.EpisodeSchedulingAttemptsLocal;
            Scheduler.ActivityLevels            = this.GetFullPath(this.ActivityLevelsLocal);
            Scheduler.SchoolMorningStart        = this.SchoolMorningStartDateTime;
            Scheduler.SchoolMorningEnd          = this.SchoolMorningEndDateTime;
            Scheduler.SchoolAfternoonStart      = this.SchoolAfternoonStartDateTime;
            Scheduler.SchoolAfternoonEnd        = this.SchoolAfternoonEndDateTime;
            Scheduler.SecondaryWorkThreshold    = this.SecondaryWorkThresholdDateTime;
            Scheduler.StartTimeQuanta           = this.StartTimeQuantaLocal;
            Scheduler.StartTimeQuantaInterval   = (short)((24 * 60) / Scheduler.StartTimeQuanta);
            Time.OneQuantum                     = this.MinimumDurationDateTime;
            Time.StartOfDay                     = new Time()
            {
                Hours = 4
            };
            Time.EndOfDay = new Time()
            {
                Hours = 28
            };
            Scheduler.PercentOverlapAllowed     = this.PercentOverlapAllowedLocal;
            Scheduler.SecondaryWorkMinStartTime = this.SecondaryWorkMinStartTimeDateTime;
            Scheduler.MinPrimaryWorkDurationForReturnHomeFromWork = this.MinPrimaryWorkDurationForReturnHomeFromWorkDateTime;
            Scheduler.MaxPrimeWorkStartTimeForReturnHomeFromWork  = this.MaxPrimeWorkStartTimeForReturnHomeFromWorkDateTime;
            Scheduler.ReturnHomeFromWorkMaxEndTime = this.ReturnHomeFromWorkMaxEndTimeDateTime;
            Scheduler.FullTimeActivity             = this.FullTimeActivityDateTime;
            Scheduler.LocationChoiceModel          = this.LocationChoiceModelLocal;
            Scheduler.LocationChoiceModel.LoadLocationChoiceCache();
            //Distributions
            Scheduler.AdultDistributionsFile     = this.GetFullPath(this.AdultDistributionsFileLocal);
            Scheduler.FrequencyDistributionsFile = this.GetFullPath(this.FrequencyDistributionsFileLocal);
            Scheduler.NumberOfDistributions      = this.NumberOfDistributionsLocal;
            Scheduler.NumberOfAdultFrequencies   = this.NumberOfAdultFrequenciesLocal;
            Scheduler.NumberOfAdultDistributions = this.NumberOfAdultDistributionsLocal;

            Scheduler.MaxFrequency    = this.MaxFrequencyLocal;
            Distribution.TashaRuntime = this.TashaRuntime;
            Distribution.InitializeDistributions();

            HouseholdExtender.TashaRuntime = this.TashaRuntime;
            // references in scheduler
            SchedulerHousehold.TashaRuntime = this.TashaRuntime;
            Schedule.Scheduler = this;
        }