/// <summary> /// Fill a cattle init value /// </summary> /// <param name="model">The animal model</param> /// <param name="animal">The animal type</param> /// <param name="initValue">The cattle init value</param> public static void MakeCattleValue(StockList model, GrazType.AnimalType animal, ref CattleInit[] initValue) { AnimalGroup animalGroup; int count; int idx, jdx; count = 0; for (idx = 1; idx <= model.Count(); idx++) { if (model.At(idx).Genotype.Animal == animal) { count++; } } Array.Resize(ref initValue, count); jdx = 0; for (idx = 1; idx <= model.Count(); idx++) { if (model.At(idx).Genotype.Animal == animal) { animalGroup = model.At(idx); initValue[jdx] = new CattleInit(); initValue[jdx].Genotype = animalGroup.Genotype.sName; initValue[jdx].Number = animalGroup.NoAnimals; initValue[jdx].Sex = model.SexString(idx, false); initValue[jdx].Age = animalGroup.AgeDays; initValue[jdx].Weight = animalGroup.LiveWeight; initValue[jdx].MaxPrevWt = animalGroup.MaxPrevWeight; initValue[jdx].Pregnant = animalGroup.Pregnancy; initValue[jdx].Lactating = animalGroup.Lactation; /*if (Animal == GrazType.AnimalType.Sheep) * { * aValue[Jdx].fleece_wt = aGroup.FleeceCutWeight; * aValue[Jdx].fibre_diam = aGroup.FibreDiam; * aValue[Jdx].no_young = Math.Max(aGroup.NoFoetuses, aGroup.NoOffspring); * } * else*/ if (animal == GrazType.AnimalType.Cattle) { initValue[jdx].NumFoetuses = animalGroup.NoFoetuses; initValue[jdx].NumSuckling = animalGroup.NoOffspring; } if (animalGroup.Lactation > 0) { initValue[jdx].BirthCS = animalGroup.BirthCondition; } if ((animalGroup.Pregnancy > 0) || (animalGroup.Young != null)) { if (animalGroup.MatedTo != null) { initValue[jdx].MatedTo = animalGroup.MatedTo.sName; } else { initValue[jdx].MatedTo = string.Empty; } } else { initValue[jdx].MatedTo = string.Empty; } if (animalGroup.Young != null) { /*if (Animal == GrazType.AnimalType.Sheep) * { * aValue[Jdx].lamb_wt = aGroup.Young.LiveWeight; * aValue[Jdx].lamb_fleece_wt = aGroup.Young.FleeceCutWeight; * } * else*/ if (animal == GrazType.AnimalType.Cattle) { initValue[jdx].CalfWt = animalGroup.Young.LiveWeight; } initValue[jdx].Paddock = model.GetInPadd(idx); initValue[jdx].Tag = model.GetTag(idx); initValue[jdx].Priority = model.GetPriority(idx); } } jdx++; } // next animal }