/// <summary> /// Model the management activities for each breed /// </summary> public IEnumerable <ActivityFolder> GetManageBreeds(ActivityFolder herd) { List <ActivityFolder> breeds = new List <ActivityFolder>(); foreach (int id in RumIDs) { // Add a new folder for individual breed ActivityFolder breed = new ActivityFolder(herd) { Name = "Manage " + RumSpecs.ColumnNames[id] }; // Manage breed numbers RuminantActivityManage numbers = new RuminantActivityManage(breed) { MaximumBreedersKept = RumSpecs.GetData <int>(2, id), MinimumBreedersKept = RumSpecs.GetData <int>(38, id), MaximumBreedingAge = RumSpecs.GetData <int>(3, id), MaximumBullAge = RumSpecs.GetData <double>(25, id), MaleSellingAge = RumSpecs.GetData <double>(5, id), MaleSellingWeight = RumSpecs.GetData <double>(6, id) }; numbers.Add(new ActivityTimerInterval(numbers) { Name = "NumbersTimer", Interval = 12, MonthDue = 12 }); breed.Add(numbers); // Manage breed weaning breed.Add(new RuminantActivityWean(breed) { WeaningAge = RumSpecs.GetData <double>(7, id), WeaningWeight = RumSpecs.GetData <double>(8, id) }); // Manage breed milking if (RumSpecs.GetData <double>(18, id) > 0) { breed.Add(new RuminantActivityMilking(breed) { Name = "Milk", ResourceTypeName = "HumanFoodStore." + RumSpecs.ColumnNames[id] + "_Milk" }); } // Manage sale of dry breeders breed.Add(new RuminantActivitySellDryBreeders(breed) { MonthsSinceBirth = RumSpecs.GetData <double>(32, id), ProportionToRemove = RumSpecs.GetData <double>(4, id) * 0.01 }); breeds.Add(breed); } return(breeds); }
public IEnumerable <ActivityFolder> GetManageBreeds(ActivityFolder folder) { List <ActivityFolder> folders = new List <ActivityFolder>(); foreach (string breed in PresentBreeds) { string name = breed.Replace(".", " "); int index = Breeds.IndexOf(breed); ActivityFolder manage = new ActivityFolder(folder) { Name = name }; manage.Add(new RuminantActivityWean(manage) { WeaningAge = GetValue <double>(RumSpecs.Element("Weaning_age"), index), WeaningWeight = GetValue <double>(RumSpecs.Element("Weaning_weight"), index), GrazeFoodStoreName = "NativePasture" }); string homemilk = GetValue <string>(RumSpecs.Element("Home_milk"), index); if (homemilk != "0") { manage.Add(new RuminantActivityMilking(manage) { ResourceTypeName = "HumanFoodStore." + name + "_Milk" }); } manage.Add(new RuminantActivityManage(manage) { MaximumBreedersKept = GetValue <int>(RumSpecs.Element("Max_breeders"), index), MaximumBreedingAge = GetValue <int>(RumSpecs.Element("Max_breeder_age"), index), MaximumBullAge = GetValue <int>(RumSpecs.Element("Max_Bull_age"), index), MaleSellingAge = GetValue <int>(RumSpecs.Element("Anim_sell_age"), index), MaleSellingWeight = GetValue <int>(RumSpecs.Element("Anim_sell_wt"), index), GrazeFoodStoreName = "GrazeFoodStore.NativePasture" }); manage.Add(new RuminantActivitySellDryBreeders(manage) { MinimumConceptionBeforeSell = 1, MonthsSinceBirth = GetValue <int>(RumSpecs.Element("Joining_age"), index), ProportionToRemove = GetValue <double>(RumSpecs.Element("Dry_breeder_cull_rate"), index) * 0.01 }); folders.Add(manage); } return(folders); }
/// <summary> /// Constructs the Native Pasture model /// </summary> public IEnumerable <CropActivityManageCrop> GetNativePasture(ActivityFolder forages) { List <CropActivityManageCrop> pastures = new List <CropActivityManageCrop>(); // Check if there are native pasture feeds before proceeding var feed_type = RumSpecs.GetRowData <int>(28); var feeds = from breed in feed_type where RumIDs.Contains(feed_type.IndexOf(breed)) where breed > 1 select breed; if (feeds.Count() == 0) { return(null); } CropActivityManageCrop farm = new CropActivityManageCrop(forages) { LandItemNameToUse = "Land", UseAreaAvailable = true, Name = "NativePastureFarm" }; farm.Add(new CropActivityManageProduct(farm) { ModelNameFileCrop = "FileForage", CropName = "Native_grass", StoreItemName = "AnimalFoodStore.NativePasture", Name = "Cut and carry Native Pasture" }); CropActivityManageCrop common = new CropActivityManageCrop(forages) { LandItemNameToUse = "Land", Name = "Native Pasture Common Land" }; common.Add(new CropActivityManageProduct(common) { ModelNameFileCrop = "FileForage", CropName = "Native_grass", StoreItemName = "GrazeFoodStore.NativePasture", Name = "Grazed Common Land" }); pastures.Add(farm); pastures.Add(common); return(pastures.AsEnumerable()); }
/// <summary> /// Model each pool in the HumanFoodStore /// </summary> public IEnumerable <HumanFoodStoreType> GetHumanStoreTypes(HumanFoodStore store) { List <HumanFoodStoreType> types = new List <HumanFoodStoreType>(); // Add grain products to the store foreach (int id in GrainIDs) { // Check if the crop is stored at home double home_storage = CropSpecs.GetData <double>(id + 1, 1); if (home_storage <= 0) { continue; } // Add the grain type to the store types.Add(new HumanFoodStoreType(store) { Name = CropSpecs.RowNames[id + 1] }); } // Add milk products to the store foreach (int id in RumIDs) { // Check if milk is stored at home double home_milk = RumSpecs.GetData <double>(18, id); if (home_milk <= 0) { continue; } // Add the milk type to the store types.Add(new HumanFoodStoreType(store) { Name = RumSpecs.ColumnNames[id] + "_Milk" }); } return(types); }