private void OnCLEMInitialiseActivity(object sender, EventArgs e)
        {
            // get pasture
            pasture = Resources.GetResourceItem(this, PaddockName, OnMissingResourceActionTypes.ReportErrorAndStop, OnMissingResourceActionTypes.ReportErrorAndStop) as GrazeFoodStoreType;

            methane = Resources.GetResourceItem(this, typeof(GreenhouseGases), "Methane", OnMissingResourceActionTypes.Ignore, OnMissingResourceActionTypes.Ignore) as GreenhouseGasesType;
            nox     = Resources.GetResourceItem(this, typeof(GreenhouseGases), "N2O", OnMissingResourceActionTypes.Ignore, OnMissingResourceActionTypes.Ignore) as GreenhouseGasesType;
        }
Beispiel #2
0
        private void OnCLEMInitialiseActivity(object sender, EventArgs e)
        {
            // get pasture
            pasture = Resources.FindResourceType <GrazeFoodStore, GrazeFoodStoreType>(this, PaddockName, OnMissingResourceActionTypes.ReportErrorAndStop, OnMissingResourceActionTypes.ReportErrorAndStop);

            if (MethaneStoreName is null || MethaneStoreName == "Use store named Methane if present")
            {
                methaneStore = Resources.FindResourceType <GreenhouseGases, GreenhouseGasesType>(this, "Methane", OnMissingResourceActionTypes.Ignore, OnMissingResourceActionTypes.Ignore);
            }
Beispiel #3
0
 private void OnCLEMInitialiseActivity(object sender, EventArgs e)
 {
     if (TruckMethaneEmissions > 0)
     {
         if (MethaneStoreName is null || MethaneStoreName == "Use store named Methane if present")
         {
             MethaneStore = Resources.GetResourceItem(this, typeof(GreenhouseGases), "Methane", OnMissingResourceActionTypes.Ignore, OnMissingResourceActionTypes.Ignore) as GreenhouseGasesType;
         }
         else
         {
             MethaneStore = Resources.GetResourceItem(this, MethaneStoreName, OnMissingResourceActionTypes.ReportErrorAndStop, OnMissingResourceActionTypes.ReportErrorAndStop) as GreenhouseGasesType;
         }
     }
Beispiel #4
0
        private void OnCLEMInitialiseActivity(object sender, EventArgs e)
        {
            // get pasture
            pasture = Resources.GetResourceItem(this, typeof(GrazeFoodStore), PaddockName, OnMissingResourceActionTypes.ReportErrorAndStop, OnMissingResourceActionTypes.ReportErrorAndStop) as GrazeFoodStoreType;

            // get labour specifications
            labour = Apsim.Children(this, typeof(LabourFilterGroupSpecified)).Cast <LabourFilterGroupSpecified>().ToList(); //  this.Children.Where(a => a.GetType() == typeof(LabourFilterGroupSpecified)).Cast<LabourFilterGroupSpecified>().ToList();
            if (labour == null)
            {
                labour = new List <LabourFilterGroupSpecified>();
            }

            methane = Resources.GetResourceItem(this, typeof(GreenhouseGases), "Methane", OnMissingResourceActionTypes.Ignore, OnMissingResourceActionTypes.Ignore) as GreenhouseGasesType;
            nox     = Resources.GetResourceItem(this, typeof(GreenhouseGases), "NOx", OnMissingResourceActionTypes.Ignore, OnMissingResourceActionTypes.Ignore) as GreenhouseGasesType;
        }
Beispiel #5
0
        private void OnCLEMInitialiseActivity(object sender, EventArgs e)
        {
            GreenhouseGases gasesPresent = Resources.GreenhouseGases();

            if (gasesPresent != null)
            {
                if (TruckMethaneEmissions > 0)
                {
                    MethaneStore = Resources.GetResourceItem(this, typeof(GreenhouseGases), "Methane", OnMissingResourceActionTypes.Ignore, OnMissingResourceActionTypes.ReportErrorAndStop) as GreenhouseGasesType;
                }
                if (TruckCO2Emissions > 0)
                {
                    CO2Store = Resources.GetResourceItem(this, typeof(GreenhouseGases), "CO2", OnMissingResourceActionTypes.Ignore, OnMissingResourceActionTypes.ReportErrorAndStop) as GreenhouseGasesType;
                }
                if (TruckNOxEmissions > 0)
                {
                    NOxStore = Resources.GetResourceItem(this, typeof(GreenhouseGases), "NOx", OnMissingResourceActionTypes.Ignore, OnMissingResourceActionTypes.ReportErrorAndStop) as GreenhouseGasesType;
                }
            }
        }
Beispiel #6
0
        /// <summary>
        /// Method to report trucking emissions.
        /// </summary>
        /// <param name="NumberOfTrucks">Number of trucks</param>
        /// <param name="IsSales">Determines if this is a sales or purchase shipment</param>
        public void ReportEmissions(int NumberOfTrucks, bool IsSales)
        {
            if (NumberOfTrucks > 0)
            {
                List <string> gases = new List <string>()
                {
                    "Methane", "CO2", "NOx"
                };
                double emissions = 0;
                foreach (string gas in gases)
                {
                    GreenhouseGasesType gasstore = null;
                    switch (gas)
                    {
                    case "Methane":
                        gasstore  = MethaneStore;
                        emissions = TruckMethaneEmissions;
                        break;

                    case "CO2":
                        gasstore  = CO2Store;
                        emissions = TruckCO2Emissions;
                        break;

                    case "NOx":
                        gasstore  = NOxStore;
                        emissions = TruckNOxEmissions;
                        break;

                    default:
                        gasstore = null;
                        break;
                    }

                    if (gasstore != null & emissions > 0)
                    {
                        gasstore.Add(NumberOfTrucks * DistanceToMarket * emissions, this.Parent.Name, "Trucking " + (IsSales?"sales":"purchases"));
                    }
                }
            }
        }
 private void OnCLEMInitialiseActivity(object sender, EventArgs e)
 {
     methaneEmissions = Resources.GetResourceItem(this, typeof(GreenhouseGases), "Methane", OnMissingResourceActionTypes.Ignore, OnMissingResourceActionTypes.Ignore) as GreenhouseGasesType;
     manureStore      = Resources.GetResourceItem(this, typeof(ProductStore), "Manure", OnMissingResourceActionTypes.Ignore, OnMissingResourceActionTypes.Ignore) as ProductStoreTypeManure;
 }
Beispiel #8
0
 private void OnCLEMInitialiseActivity(object sender, EventArgs e)
 {
     if (MethaneStoreName is null || MethaneStoreName == "Use store named Methane if present")
     {
         methaneEmissions = Resources.FindResourceType <GreenhouseGases, GreenhouseGasesType>(this, "Methane", OnMissingResourceActionTypes.Ignore, OnMissingResourceActionTypes.Ignore);
     }