void RcvManure(ManureType aUrine, ManureType aFaeces) { foreach (Component AnimalSection in My.Children) { Console.WriteLine(AnimalSection.Children.Count); Console.WriteLine(AnimalSection.Name); double ExcretaPartition; AnimalSection.Get("ExcretaPartition", out ExcretaPartition); aUrine.amount *= ExcretaPartition; AnimalSection.Publish("RcvFluidManure", aUrine); if (aFaeces != null) { aFaeces.amount *= ExcretaPartition; AnimalSection.Publish("RcvSolidManure", aFaeces); } } }
public void OnProcess() { Console.WriteLine(My.Name); Console.WriteLine(My.Children.Count); My.LinkByName("floor1"); Component Floor1 = (Component)MyPaddock.LinkByName("floor1"); double ExcretaPartition; Floor1.Get("ExcretaPartition", out ExcretaPartition); for (int i = 0; i < My.Children.Count; i++) { ; Console.WriteLine(My.Children[i].Name); } foreach (Component AnimalSection in My.Children) { Console.WriteLine(AnimalSection.Children.Count); Console.WriteLine(AnimalSection.Name); AnimalSection.Get("ExcretaPartition", out ExcretaPartition); } if (NrOfAnimals > 0) { ManureType WASHWATER = new ManureType(); WASHWATER.amount = NrOfAnimals * SpiltDrinkingWater / 1000.0; RcvManure(WASHWATER, null); ManureType someStraw = new ManureType(); foreach (Component AnimalSection in My.Children) { AnimalSection.Get("ExcretaPartition", out ExcretaPartition); double StrawAdded; AnimalSection.Get("StrawAdded", out StrawAdded); someStraw.amount = NrOfAnimals * StrawAdded * ExcretaPartition / 1000; AnimalSection.Publish("RcvBedding", someStraw); } } }