/// <summary> /// Initiates the Control's "Startup State" or the "Uninitialized Model" phase. /// </summary> protected void SetupStartupState() { //AGEPRO Input Data, If any inputData = new AgeproInputFile(); //Load User Controls controlGeneralOptions = new ControlGeneral(); controlMiscOptions = new ControlMiscOptions(); controlBootstrap = new ControlBootstrap(); controlFisherySelectivity = new ControlStochasticAge(); controlDiscardFraction = new ControlStochasticAge(); controlNaturalMortality = new ControlStochasticAge(); controlBiological = new ControlBiological(new string[] { string.Empty }); controlJan1Weight = new ControlStochasticWeightAge(new int[] { 0, 1 }); controlSSBWeight = new ControlStochasticWeightAge(new int[] { 0, 1, -1 }); controlMidYearWeight = new ControlStochasticWeightAge(new int[] { 0, 1, -1, -2 }); controlCatchWeight = new ControlStochasticWeightAge(new int[] { 0, 1, -1, -2, -3 }); controlDiscardWeight = new ControlStochasticWeightAge(new int[] { 0, 1, -1, -2, -3, -4 }); controlRecruitment = new ControlRecruitment(); controlHarvestScenario = new ControlHarvestScenario(); //Set General Options Controls (to handle "New Cases") controlGeneralOptions.GeneralInputFile = ""; controlGeneralOptions.GeneralModelId = "untitled"; inputData.General.InputFile = ""; inputData.CaseID = controlGeneralOptions.GeneralModelId; //initially set Number of Ages _ = controlGeneralOptions.GeneralFirstAgeClass; //Spinbox Value //Biological Stochastic Options controlFisherySelectivity.StochasticParameterLabel = "Fishery Selectivity"; controlFisherySelectivity.IsMultiFleet = true; controlFisherySelectivity.FleetDependency = StochasticAgeFleetDependency.dependent; controlDiscardFraction.StochasticParameterLabel = "Discard Fraction"; controlDiscardFraction.IsMultiFleet = true; controlDiscardFraction.FleetDependency = StochasticAgeFleetDependency.dependent; controlNaturalMortality.StochasticParameterLabel = "Natural Mortality"; controlNaturalMortality.IsMultiFleet = false; controlNaturalMortality.FleetDependency = StochasticAgeFleetDependency.independent; //Weight Age Options controlJan1Weight.IsMultiFleet = false; controlJan1Weight.FleetDependency = StochasticAgeFleetDependency.independent; controlSSBWeight.IsMultiFleet = false; controlSSBWeight.FleetDependency = StochasticAgeFleetDependency.independent; controlMidYearWeight.IsMultiFleet = false; controlMidYearWeight.FleetDependency = StochasticAgeFleetDependency.independent; controlCatchWeight.IsMultiFleet = true; controlCatchWeight.FleetDependency = StochasticAgeFleetDependency.dependent; controlDiscardWeight.IsMultiFleet = true; controlDiscardWeight.FleetDependency = StochasticAgeFleetDependency.dependent; //Set WeightAgeType controlJan1Weight.WeightAgeType = StochasticWeightOfAge.Jan1Weight; controlSSBWeight.WeightAgeType = StochasticWeightOfAge.SSBWeight; controlMidYearWeight.WeightAgeType = StochasticWeightOfAge.MidYearWeight; controlCatchWeight.WeightAgeType = StochasticWeightOfAge.CatchWeight; controlDiscardWeight.WeightAgeType = StochasticWeightOfAge.DiscardWeight; //Weights Option controlJan1Weight.ShowJan1WeightsOption = false; controlJan1Weight.ShowSSBWeightsOption = false; controlJan1Weight.showMidYearWeightsOption = false; controlJan1Weight.ShowCatchWeightsOption = false; //SSB controlSSBWeight.ShowSSBWeightsOption = false; controlSSBWeight.showMidYearWeightsOption = false; controlSSBWeight.ShowCatchWeightsOption = false; //Mid-Year controlMidYearWeight.showMidYearWeightsOption = false; controlMidYearWeight.ShowCatchWeightsOption = false; //Catch-weight controlCatchWeight.ShowCatchWeightsOption = false; }
/// <summary> /// Load AGEPRO InputFile data into AGEPRO Parameter Controls /// </summary> /// <param name="inpFile">AGEPRO CoreLib InputFile</param> protected void LoadAgeproModelFromInputFile(AgeproInputFile inpFile) { //General Options controlGeneralOptions.GeneralModelId = inpFile.CaseID; controlGeneralOptions.GeneralFirstYearProjection = inpFile.General.ProjYearStart.ToString(); controlGeneralOptions.GeneralLastYearProjection = inpFile.General.ProjYearEnd.ToString(); controlGeneralOptions.GeneralFirstAgeClass = inpFile.General.AgeBegin; controlGeneralOptions.GeneralLastAgeClass = inpFile.General.AgeEnd; controlGeneralOptions.GeneralNumberFleets = inpFile.General.NumFleets.ToString(); controlGeneralOptions.GeneralNumberRecruitModels = inpFile.General.NumRecModels.ToString(); controlGeneralOptions.GeneralNumberPopulationSimuations = inpFile.General.NumPopSims.ToString(); controlGeneralOptions.GeneralRandomSeed = inpFile.General.Seed.ToString(); controlGeneralOptions.GeneralDiscardsPresent = inpFile.General.HasDiscards; //JAN-1 controlJan1Weight.LoadStochasticWeightAgeInputData(inpFile.Jan1StockWeight, inpFile.General); //SSB controlSSBWeight.LoadStochasticWeightAgeInputData(inpFile.SSBWeight, inpFile.General); //Mid-Year (Mean) controlMidYearWeight.LoadStochasticWeightAgeInputData(inpFile.MeanWeight, inpFile.General); //Catch Weight controlCatchWeight.LoadStochasticWeightAgeInputData(inpFile.CatchWeight, inpFile.General); //Discard Weight controlDiscardWeight.LoadStochasticWeightAgeInputData(inpFile.DiscardWeight, inpFile.General); //Recruitment controlRecruitment.SetupControlRecruitment(inpFile.General.NumRecModels, inpFile.Recruitment); //Fishery Selectivity controlFisherySelectivity.LoadStochasticAgeInputData(inpFile.Fishery, inpFile.General); //Discard Fraction controlDiscardFraction.LoadStochasticAgeInputData(inpFile.DiscardFraction, inpFile.General); //Natural Mortality controlNaturalMortality.LoadStochasticAgeInputData(inpFile.NaturalMortality, inpFile.General); //Fraction Mortality Prior To Spawning (Biological) controlBiological = new ControlBiological(controlGeneralOptions.SeqYears()); controlBiological.TSpawnPanel.TSpawnTableTimeVarying = inpFile.BiologicalTSpawn.TimeVarying; controlBiological.TSpawnPanel.TSpawnTable = inpFile.BiologicalTSpawn.TSpawn; //Maturity (Biological) controlBiological.maturityAge.LoadStochasticAgeInputData(inpFile.BiologicalMaturity, inpFile.General); //Harvest Scenario if (inpFile.HarvestScenario.AnalysisType == HarvestScenarioAnalysis.Rebuilder) { controlHarvestScenario.Rebuilder = inpFile.Rebuild; } else if (inpFile.HarvestScenario.AnalysisType == HarvestScenarioAnalysis.PStar) { controlHarvestScenario.PStar = inpFile.PStar; } controlHarvestScenario.SeqYears = inpFile.Recruitment.ObservationYears.Select(x => x.ToString()).ToArray(); controlHarvestScenario.SetHarvestScenarioInputDataTable(inpFile.HarvestScenario.HarvestScenarioTable); controlHarvestScenario.SetHarvestScenarioCalcControls(inpFile); //Bootstrapping controlBootstrap.BootstrapFilename = inpFile.Bootstrap.BootstrapFile; controlBootstrap.BootstrapIterations = inpFile.Bootstrap.NumBootstraps.ToString(); controlBootstrap.BootstrapScaleFactors = inpFile.Bootstrap.PopScaleFactor.ToString(); //Misc Options controlMiscOptions.MiscOptionsEnableSummaryReport = inpFile.Options.EnableSummaryReport; controlMiscOptions.MiscOptionsEnableAuxStochasticFiles = inpFile.Options.EnableAuxStochasticFiles; controlMiscOptions.MiscOptionsEnableExportR = inpFile.Options.EnableExportR; controlMiscOptions.MiscOptionsEnablePercentileReport = inpFile.Options.EnablePercentileReport; controlMiscOptions.MiscOptionsReportPercentile = Convert.ToDouble(inpFile.ReportPercentile.Percentile); controlMiscOptions.MiscOptionsEnableRefpointsReport = inpFile.Options.EnableRefpoint; controlMiscOptions.MiscOptionsRefSpawnBiomass = inpFile.Refpoint.RefSpawnBio.ToString(); controlMiscOptions.MiscOptionsRefJan1Biomass = inpFile.Refpoint.RefJan1Bio.ToString(); controlMiscOptions.MiscOptionsRefMeanBiomass = inpFile.Refpoint.RefMeanBio.ToString(); controlMiscOptions.MiscOptionsRefFishingMortality = inpFile.Refpoint.RefFMort.ToString(); controlMiscOptions.MiscOptionsEnableScaleFactors = inpFile.Options.EnableScaleFactors; controlMiscOptions.MiscOptionsScaleFactorBiomass = inpFile.Scale.ScaleBio.ToString(); controlMiscOptions.MiscOptionsScaleFactorRecruits = inpFile.Scale.ScaleRec.ToString(); controlMiscOptions.MiscOptionsScaleFactorStockNumbers = inpFile.Scale.ScaleStockNum.ToString(); controlMiscOptions.MiscOptionsBounds = inpFile.Options.EnableBounds; controlMiscOptions.MiscOptionsBoundsMaxWeight = inpFile.Bounds.MaxWeight.ToString(); controlMiscOptions.MiscOptionsBoundsNaturalMortality = inpFile.Bounds.MaxNatMort.ToString(); controlMiscOptions.MiscOptionsEnableRetroAdjustmentFactors = inpFile.Options.EnableRetroAdjustmentFactors; controlMiscOptions.miscOptionsNAges = inpFile.General.NumAges(); controlMiscOptions.miscOptionsFirstAge = inpFile.General.AgeBegin; controlMiscOptions.LoadRetroAdjustmentsFactorTable(inpFile); if (controlMiscOptions.MiscOptionsEnableRetroAdjustmentFactors) { controlMiscOptions.SetRetroAdjustmentFactorRowHeaders(); } Console.WriteLine("Loaded AGEPRO Parameters .."); }