/// <summary> /// Returns the valid fleece-free weight range associated with stock of a given /// age etc, along with expected basal weight assuming that the current weight /// /// is the highest weight reached so far(BWFA, or "base weight for age"). /// This is complicated in younger animals by the fact that a given condition /// score may be relative to any of a range of normal weights. /// </summary> /// <param name="mainParams"></param> /// <param name="BreedInfo"></param> /// <param name="iGenotype"></param> /// <param name="Repro"></param> public void ValidFFWeightRange(AnimalParamSet mainParams, SingleGenotypeInits[] BreedInfo, int iGenotype, GrazType.ReproType Repro, int AgeDays, double dLowBC, double dHighBC, out double LowWt, out double HighWt) { GrazType.ReproType[] SexRepro = { GrazType.ReproType.Castrated, GrazType.ReproType.Empty }; int[] MatureMonths = { 24, 36 }; AnimalParamSet Genotype; double MaxNormWt, MinNormWt; Genotype = stock.ParamsFromGenotypeInits(mainParams, BreedInfo, iGenotype); MaxNormWt = AnimalGroup.GrowthCurve(AgeDays, Repro, Genotype); if ((AgeDays < MatureAge[(int)Genotype.Animal]) && (dLowBC <= 1.0)) // Allow for the possibility of a sub- { MinNormWt = 0.7 * MaxNormWt; // optimal normal weight in young } else // animals { MinNormWt = MaxNormWt; } LowWt = MinNormWt * (dLowBC - 0.5 * BC_STEP); HighWt = MaxNormWt * (dHighBC + 0.499 * BC_STEP); if ((Repro == GrazType.ReproType.EarlyPreg) || (Repro == GrazType.ReproType.LatePreg)) // Allowance for conceptus in ewes & cows { HighWt = HighWt * 1.15; } }
/// <summary> /// Set up the form controls with the intial values from the model /// </summary> public void SetValues() { this.paramSet = StockList.MakeParamSet(""); // can use the param filename from component inits genoList.Clear(); string[] genoNames = new string[genotypeInits.Length]; for (int i = 0; i < genotypeInits.Length; i++) { genoNames[i] = genotypeInits[i].Name; genoList.AppendValues(genotypeInits[i].Name); } cbxGroupGenotype.Values = genoNames; // animals tab GenotypeInitArgs args = new GenotypeInitArgs(); args.Genotypes = genotypeInits; args.ParamSet = this.paramSet; for (int idx = 0; idx < genotypeInits.Length; idx++) { args.index = idx; GetGenoParams.Invoke(null, args); // gets params from the stock model if (this.genotypeSet != null) { FGenotypeAnimals[idx] = this.genotypeSet.Animal; } else { FGenotypeAnimals[idx] = GrazType.AnimalType.Sheep; } } FCurrGenotype = Math.Min(0, genotypeInits.Length - 1); FillCurrGenotype(); FILLING = true; if (FCurrGenotype >= 0) { SelectedGenoIndex = FCurrGenotype; } FILLING = false; EnableButtons(); }
private void OnGetGenoParams(object sender, GenotypeInitArgs e) { AnimalParamSet tempParams = stock.ParamsFromGenotypeInits(e.ParamSet, e.Genotypes, e.Index); stockView.SetGenoParams(tempParams); }
/// <summary> /// Responds after a GetGenoParams event is called /// </summary> /// <param name="animalParams"></param> public void SetGenoParams(AnimalParamSet animalParams) { this.genotypeSet = animalParams; }