Example #1
0
    public ManureType CleanFloor(int NrOfAnimals)
    {
        ManureType manure = new ManureType();

        manure.amount = WashingWater * NrOfAnimals / 1000.0;
        return(manure);
    }
    void produceSlurry()
    {
        DM += changeDM;

        ManureType ting = new ManureType();

        ting.amount = 1000.0;        //kg
        ting.Ash    = slurry_Ash;    //  0.11; //proportion of DM
        ting.Tan    = slurry_TAN;    // 0.001; //proportion of FW
        ting.RP     = slurry_RP;     // 0.188; //proportion of DM
        ting.fInert = slurry_fInert; // 0.0; //proportion of organic N in an inert form
        ting.NDF    = slurry_NDF;    // 0.271; //
        ting.RL     = slurry_RL;     // 0.039;
        ting.VFA    = slurry_VFA;    // 0.0152;
        ting.TotalS = slurry_TotalS; // 0.69;//g per kg fresh weight
        ting.SulphS = slurry_SulphS; // 0.24; //g per kg fresh weight
        //Jonas please add
        // ting.SulphideS = 0.24; //g per kg fresh weight
        // ting.SulphateS = 0.24; //g per kg fresh weight
        ting.ADL = slurry_ADL; // 0.115;
        ting.Rem = 1 - (ting.RL + ting.RP + ting.NDF + ting.VFA + ting.Ash);
        ting.DM  = slurry_DM;  // 0.1;
        ting.pH  = slurry_pH;
        for (int i = 0; i < MyPaddock.Children.Count; i++)
        {
            Component item = MyPaddock.Children[i];

            if (item.Name.CompareTo(SlurryTo) == 0)
            {
                item.Publish("AddSlurry", ting);
            }
        }
    }
Example #3
0
    public ManureType CleanStore()
    {
        ManureType ReturnValue = manure;

        manure.amount = 0;
        return(ReturnValue);
    }
Example #4
0
    private void CleanManure()
    {
        ManureType totalManure = new ManureType();

        for (int i = 0; i < AnimalSections.Count; i++)
        {
            totalManure.amount += AnimalSections.ElementAt(i).CleanSection().amount;
        }
        for (int i = 0; i < inhouseStores.Count; i++)
        {
            if (inhouseStores.ElementAt(i).GetAmountInManureStore() < inhouseStores.ElementAt(i).GetCapacity())
            {
                inhouseStores.ElementAt(i).RcvManure(totalManure);
            }
        }
        totalManure.amount = 0;
        for (int i = 0; i < inhouseStores.Count; i++)
        {
            if (inhouseStores.ElementAt(i).GetAmountInManureStore() >= inhouseStores.ElementAt(i).GetCapacity())
            {
                totalManure.amount += inhouseStores.ElementAt(i).CleanStore().amount;
            }
        }
        AddSlurry.Invoke(totalManure);
    }
Example #5
0
    public ManureType CleanFloor()
    {
        ManureType returnValue = new ManureType();

        returnValue.amount = liquid.CleanStore().amount;

        return(returnValue);
    }
Example #6
0
    public ManureType CleanSection()
    {
        ManureType manure = new ManureType();

        for (int i = 0; i < FloorsInSections.Count; i++)
        {
            manure.amount += FloorsInSections.ElementAt(i).CleanFloor(NrOfAnimals).amount;
        }
        return(manure);
    }
Example #7
0
    public void OnProcess()
    {
        ManureType WASHWATER = new ManureType();

        WASHWATER.amount = NrOfAnimals * SpiltDrinkingWater / 1000.0;
        RcvManure(WASHWATER);
        ManureType WHEATSTRAW = new ManureType();

        for (int i = 0; i < FloorsInSections.Count(); i++)
        {
            WHEATSTRAW.amount = NrOfAnimals * StrawAdded * (1 / FloorsInSections.Count) / 1000.0; //add bedding material
            FloorsInSections.ElementAt(i).RcvManure(WHEATSTRAW);
        }
    }
Example #8
0
    public void RcvManure(ManureType aUrine)
    {
        ManureType someManure = new ManureType();

        for (int i = 0; i < FloorsInSections.Count(); i++)
        {
            someManure = aUrine;

            someManure.amount = aUrine.amount * (1 / FloorsInSections.Count);



            FloorsInSections.ElementAt(i).RcvManure(someManure);
        }
    }
 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);
      *  }
      * }*/
 }
Example #10
0
    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);
            }
        }
    }
Example #11
0
    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);
            }
        }
    }
Example #12
0
    public void OnCleanFloor(DoubleType numberOfAnimals)
    {
        ManureType water = new ManureType();

        water.amount  = WashingWater * numberOfAnimals.Value / 1000.0;
        water.amount += Solid.CleanStore().amount;
        water.amount += liquid.CleanStore().amount;
        bool found = false;

        for (int i = 0; i < MyPaddock.Children.Count(); i++)
        {
            if (MyPaddock.Children[i].Name.CompareTo(WhereTo) == 0)
            {
                MyPaddock.Children[i].Publish("RcvManure", water);
            }
        }
        if (found == false)
        {
            throw new Exception("Floor::OnCleanFloor: cannot move manure to " + WhereTo.ToString());
        }
    }
Example #13
0
    public void OnProcess()
    {
        ManureType manure = new ManureType();

        manure.amount = 1000.0; //kg
        manure.Ash    = 0.11;   //proportion of DM
        manure.Tan    = 0.001;  //proportion of FW
        manure.RP     = 0.188;  //proportion of DM
        manure.fInert = 0.0;    //proportion of organic N in an inert form
        manure.NDF    = 0.271;  //
        manure.RL     = 0.039;
        manure.VFA    = 0.0152;
        manure.TotalS = 0.69; //g per kg fresh weight
        manure.SulphS = 0.24; //g per kg fresh weight

        manure.Rem = 1 - (manure.RL + manure.RP + manure.NDF + manure.VFA + manure.Ash);
        manure.DM  = 1;
        manure.pH  = 7;

        AddSlurry.Invoke(manure);
    }
Example #14
0
    public void OnProcess()
    {
        if (NrOfAnimals > 0)
        {
            // ManureType WASHWATERInput = WASHWATER;
            // WASHWATERInput.amount = NrOfAnimals * SpiltDrinkingWater / 1000.0;
            //RcvManure(WASHWATERInput, null);

            ManureType someStraw = new ManureType();

            for (int i = 0; i < My.ChildrenAsObjects.Count; i++)
            {
                double ExcretaPartition = 0;

                /* My.ChildrenAsObjects[i].Get("ExcretaPartition", out ExcretaPartition);
                 * double StrawAdded=0;
                 * My.ChildrenAsObjects[i].Get("StrawAdded", out StrawAdded);
                 * someStraw.amount = NrOfAnimals * StrawAdded*ExcretaPartition / 1000;
                 * My.ChildrenAsObjects[i].Publish("RcvBedding", someStraw);*/
            }
        }
    }
Example #15
0
 public void RcvManure(ManureType type)
 {
     manure.amount = manure.amount + type.amount;
 }
Example #16
0
 public void OnRcvSolidManure(ManureType Manure)
 {
     Solid.RcvManure(Manure);
 }
Example #17
0
 public void OnRcvFluidManure(ManureType Manure)
 {
     liquid.RcvManure(Manure);
 }
Example #18
0
 public void OnRcvBedding(ManureType aBeddingMaterial)
 {
     Solid.RcvManure(aBeddingMaterial);
 }
Example #19
0
 public void RcvManure(ManureType aUrine)
 {
     liquid.RcvManure(aUrine);
 }
Example #20
0
    public void OnAddSlurry(ManureType input)
    {
        slurrypH = input.pH;
        //slurrypH = measurement_no
        double amount = input.amount;

        DM   = amount * input.DM;
        Ash += DM * input.Ash;                // formel 1.2 AshContent  //kg
        double TanAdded = amount * input.Tan; //1.3  // kg

        //TotalNInput += TanAdded;
        Tan += TanAdded;
        double RP = DM * input.RP;
        //org N is obtained by dividing CP by 6.25
        double orgNAdded = RP / 6.25; // 1.5	//kg
        //TotalNInput += orgNAdded;
        //Partition org N between inert and Fast pools
        double N_InertAdded = input.fInert * orgNAdded;     //1.4

        N_Inert += N_InertAdded;                            //kg //fInert should be between 0 and 1
        double NFastAdded = (1 - input.fInert) * orgNAdded; // 1.5

        NFast += NFastAdded;                                //kg
        //! calculate the carbon content of the inert pool
        double C_InertAdded = 10 * input.fInert * orgNAdded;

        //TotalCInput += C_InertAdded;
        C_Inert += C_InertAdded;                   //1.6 //kg
        HInert  += 0.055 * C_InertAdded;           //1.34
        OInert  += 0.444 * C_InertAdded;           // 1.35
        //! Calculate the carbon content of the raw protein
        double CIn_RP = 4.28 * NFastAdded;         //1.6 //kg
        //! Calculate the carbon content of the lignin
        double CIn_Lignin = DM * 0.55 * input.ADL; //1.8 //kg

        //TotalCInput += CIn_Lignin;
        C_Lignin += CIn_Lignin;
        //! Calculate the carbon content of the slow pool
        double CIn_Slow = DM * 0.44 * (input.NDF - input.ADL); //1.9

        //TotalCInput += CIn_Slow;
        CSlow += CIn_Slow;                     //kg
        //! Calculate the carbon content of the raw lipid
        double CIn_RL = DM * 0.77 * input.RL;  //1.10 //kg
        //! calculate the carbon content of the volatile fatty acids
        double CIn_VFA = DM * 0.4 * input.VFA; //1.11 //kg

        //TotalCInput += CIn_VFA;
        CVFA += CIn_VFA;
        double HIn_VFA = DM * 0.167 * input.VFA;//1.16 // kg

        HVFA += HIn_VFA;
        double OIn_VFA = DM * 0.889 * input.VFA;//1.19 // kg

        OVFA += OIn_VFA;
        //! Calculate the carbon content of the starch and sugar
        double CIn_Starch = DM * 0.44 * input.Rem; //1.12 //kg

        //! Calculate the carbon content of the Fast pool
        CFast += CIn_RP + CIn_RL + CIn_Starch; //1.13
        //TotalCInput += CIn_RP + CIn_RL + CIn_Starch;
        //! Calculate the hydrogen in the Fast and Slow pools
        HFast += 0.117 * CIn_RP + 0.152 * CIn_RL + 0.139 * CIn_Starch; //1.14
        HSlow += 0.139 * CIn_Slow;                                     //1.15
        //! Calculate the oxygen in the Fast and Slow
        OFast += 0.533 * CIn_RP + 0.14 * CIn_RL + 1.111 * CIn_Starch;  //1.17
        OSlow += 1.111 * CSlow;                                        //1.18
        //! Calculate the sulphur in the Fast and Sulphate pools
        //correct form is this!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
        // S_S04 += amount * input.SulphateS;//1.21
        //S2_S += amount * input.SulphideS; // 1.22
        //SFast += amount * (input.TotalS - (input.SulphateS + input.SulphideS));//1.20
        TotalSInput += amount * input.TotalS / 1000.0;                  //total S in input is in g/kg
        SFast       += amount * (input.TotalS - input.SulphS) / 1000.0; //1.20
        S_S04       += amount * input.SulphS / 1000.0;                  //1.21
        S2_S        += 0;                                               // 1.22
        Water       += amount * (1 - input.DM);                         // 1.1 //kg
        initialOM    = GetOM();
    }