public GrazeFoodStoreType GetGrazeFoodStore(GrazeFoodStore store) { return(new GrazeFoodStoreType(store) { NToDMDCoefficient = GetValue <double>(SingleParams, "Coeff_DMD"), NToDMDIntercept = GetValue <double>(SingleParams, "Incpt_DMD"), GreenNitrogen = GetValue <double>(SingleParams, "Native_N"), DecayNitrogen = GetValue <double>(SingleParams, "Decay_N"), MinimumNitrogen = GetValue <double>(SingleParams, "Native_N_min"), DecayDMD = GetValue <double>(SingleParams, "Decay_DMD"), MinimumDMD = GetValue <double>(SingleParams, "Native_DMD_min"), DetachRate = GetValue <double>(SingleParams, "Native_detach"), CarryoverDetachRate = GetValue <double>(SingleParams, "Carryover_detach"), IntakeTropicalQualityCoefficient = GetValue <double>(SingleParams, "Intake_trop_quality"), IntakeQualityCoefficient = GetValue <double>(SingleParams, "Intake_coeff_quality") }); }
private void OnCLEMInitialiseActivity(object sender, EventArgs e) { GrazeFoodStore grazeFoodStore = Resources.FindResourceGroup <GrazeFoodStore>(); if (grazeFoodStore != null) { this.InitialiseHerd(true, true); // create activity for each pasture type (and common land) and breed at startup // do not include common land pasture.. foreach (GrazeFoodStoreType pastureType in grazeFoodStore.Children.Where(a => a.GetType() == typeof(GrazeFoodStoreType) || a.GetType() == typeof(CommonLandFoodStoreType))) { RuminantActivityGrazePasture ragp = new RuminantActivityGrazePasture { GrazeFoodStoreModel = pastureType, Clock = clock, Parent = this, Name = "Graze_" + (pastureType as Model).Name, OnPartialResourcesAvailableAction = this.OnPartialResourcesAvailableAction }; ragp.ActivityPerformed += BubblePaddock_ActivityPerformed; ragp.SetLinkedModels(Resources); ragp.InitialiseHerd(true, true); foreach (RuminantType herdType in HerdResource.FindAllChildren <RuminantType>()) { RuminantActivityGrazePastureHerd ragpb = new RuminantActivityGrazePastureHerd { GrazeFoodStoreModel = pastureType, RuminantTypeModel = herdType, HoursGrazed = HoursGrazed, Parent = ragp, Name = ragp.Name + "_" + herdType.Name, OnPartialResourcesAvailableAction = this.OnPartialResourcesAvailableAction }; ragpb.SetLinkedModels(Resources); if (ragpb.Clock == null) { ragpb.Clock = this.clock; } ragpb.InitialiseHerd(true, true); if (ragp.ActivityList == null) { ragp.ActivityList = new List <CLEMActivityBase>(); } ragp.ActivityList.Add(ragpb); ragpb.ResourceShortfallOccurred += GrazeAll_ResourceShortfallOccurred; ragpb.ActivityPerformed += BubblePaddock_ActivityPerformed; } if (ActivityList == null) { ActivityList = new List <CLEMActivityBase>(); } ActivityList.Add(ragp); } } else { Summary.WriteWarning(this, $"No GrazeFoodStore is available for the ruminant grazing activity [a={this.Name}]!"); } }
/// <summary> /// Model fodder available through grazing /// </summary> public GrazeFoodStoreType GetGrazeFoodStore(GrazeFoodStore store) { return(new GrazeFoodStoreType(store)); }