Skip to content

Commit

Permalink
Reduce N and C content with AD substrates, initialize silage yield
Browse files Browse the repository at this point in the history
  • Loading branch information
holos-aafc committed Sep 12, 2024
1 parent 7cfd305 commit 8e9a85a
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 9 deletions.
4 changes: 2 additions & 2 deletions H.Core/Calculators/Infrastructure/ADCalculator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -727,15 +727,15 @@ public List<SubstrateFlowInformation> GetDailyFlowRatesForSubstrateTypes(
if (type == SubstrateType.ImportedManure)
{
// Equation 4.8.1-30
substrateFlow.NitrogenFlowOfSubstrate = substrateViewItemBase.FlowRate * substrateViewItemBase.NitrogenContent;
substrateFlow.NitrogenFlowOfSubstrate = substrateViewItemBase.FlowRate * (substrateViewItemBase.NitrogenContent / 100.0);
}

// Equation 4.8.1-14
substrateFlow.CarbonFlowOfSubstrate = substrateViewItemBase.TotalCarbon;
if (type == SubstrateType.ImportedManure)
{
// Equation 4.8.1-31
substrateFlow.CarbonFlowOfSubstrate = substrateViewItemBase.FlowRate * substrateViewItemBase.CarbonContent;
substrateFlow.CarbonFlowOfSubstrate = substrateViewItemBase.FlowRate * (substrateViewItemBase.CarbonContent / 100.0);
}

result.Add(substrateFlow);
Expand Down
2 changes: 0 additions & 2 deletions H.Core/Calculators/Nitrogen/N2OEmissionFactorCalculator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -650,7 +650,5 @@ private double CalculateEmissionFactorUsingPotentialEvapotranspiration(double po
}

#endregion


}
}
1 change: 0 additions & 1 deletion H.Core/Models/Animals/AnimalGroup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,6 @@ public int GetNumberOfAnimalsByDate(DateTime dateTime)
/// <returns>The <see cref="ManagementPeriod"/> that contains the given <see cref="DateTime"/>, or null if the <see cref="ManagementPeriod"/> doesn't exist</returns>
public ManagementPeriod GetManagementPeriodByDate(DateTime dateTime)
{

var result = this.ManagementPeriods.OrderBy(managementPeriod => managementPeriod.Start).FirstOrDefault(managementPeriod => managementPeriod.Start <= dateTime && managementPeriod.End >= dateTime);
if (result != null)
{
Expand Down
6 changes: 2 additions & 4 deletions H.Core/Services/Animals/AnimalResultsServiceBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,11 @@ public abstract partial class AnimalResultsServiceBase : IAnimalResultsService

private static readonly DietProvider _dietProvider;

protected readonly Table_49_Electricity_Conversion_Defaults_Provider _energyConversionDefaultsProvider =
new Table_49_Electricity_Conversion_Defaults_Provider();
protected readonly Table_49_Electricity_Conversion_Defaults_Provider _energyConversionDefaultsProvider = new Table_49_Electricity_Conversion_Defaults_Provider();

protected readonly Table_43_Beef_Dairy_Default_Emission_Factors_Provider _defaultEmissionFactorsProvider = new Table_43_Beef_Dairy_Default_Emission_Factors_Provider();

protected IAdditiveReductionFactorsProvider AdditiveReductionFactorsProvider =
new Table_19_Additive_Reduction_Factors_Provider();
protected IAdditiveReductionFactorsProvider AdditiveReductionFactorsProvider = new Table_19_Additive_Reduction_Factors_Provider();

protected readonly Table_36_Livestock_Emission_Conversion_Factors_Provider
_livestockEmissionConversionFactorsProvider = new Table_36_Livestock_Emission_Conversion_Factors_Provider();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,7 @@ public void InitializeSilageCropYield(CropViewItem silageCropViewItem, Farm farm

// We call AssignSystemDefaults with the CropViewItem representing the grain crop to get its default values.
this.InitializePercentageReturns(farm, grainCropViewItem);
this.InitializeBiomassCoefficients(grainCropViewItem, farm);

// We specifically find the PlantCarbonInAgriculturalProduct of the grain crop as that is needed in the yield calculation.
grainCropViewItem.PlantCarbonInAgriculturalProduct = _icbmCarbonInputCalculator.CalculatePlantCarbonInAgriculturalProduct(previousYearViewItem: null, currentYearViewItem: grainCropViewItem, farm: farm);
Expand Down

0 comments on commit 8e9a85a

Please sign in to comment.