Skip to content

Commit

Permalink
When retrieving harvestable population size do not include calves as …
Browse files Browse the repository at this point in the history
…they are not harvestable.
  • Loading branch information
LeonardoFrid committed Jan 5, 2024
1 parent e69bd7a commit f174c1e
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions src/Runtime/DGSimTransformer.Utilities.vb
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ Partial Class DGSimTransformer

End Function

Private Function GetPopulationSize(
Private Function GetHarvestablePopulationSize(
ByVal stratum As Stratum,
ByVal ageClassId As Nullable(Of Integer),
ByVal sex As Nullable(Of Sex)) As Double
Expand All @@ -129,16 +129,18 @@ Partial Class DGSimTransformer

For Each cohort As AgeSexCohort In stratum.AgeSexCohorts

Dim id As Integer = GetAgeClassIdFromAge(cohort.Age)
If (cohort.Age > 0) Then

If ((Not ageClassId.HasValue) OrElse (id = ageClassId)) Then
Dim id As Integer = GetAgeClassIdFromAge(cohort.Age)

If ((Not sex.HasValue) OrElse (cohort.Sex = sex.Value)) Then
PopSize += cohort.NumIndividuals
End If
If ((Not ageClassId.HasValue) OrElse (id = ageClassId)) Then

End If
If ((Not sex.HasValue) OrElse (cohort.Sex = sex.Value)) Then
PopSize += cohort.NumIndividuals
End If

End If
End If
Next

Return PopSize
Expand Down Expand Up @@ -208,7 +210,7 @@ Partial Class DGSimTransformer

If ((Not ah.Sex.HasValue) OrElse (cohort.Sex = ah.Sex.Value)) Then

Dim pSize As Double = GetPopulationSize(stratum, ah.AgeClassId, ah.Sex)
Dim pSize As Double = GetHarvestablePopulationSize(stratum, ah.AgeClassId, ah.Sex)
Dim InputHarvestAmount As Double = 0.0

If (pSize > 0.0) Then
Expand Down

0 comments on commit f174c1e

Please sign in to comment.