Skip to content

Commit 99bbc17

Browse files
HSPFOutputReports.vb, atcHspfConstituentBalance.vb, atcHspfWatershedConstituentBalance.vb -- handle state variables in monthly reports
1 parent f8a6ffc commit 99bbc17

File tree

5 files changed

+70
-6
lines changed

5 files changed

+70
-6
lines changed

HSPEXP/HSPFOutputReports.vb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -779,7 +779,7 @@ Module HSPFOutputReports
779779
'Logger.Dbg(Now & " Calculating Annual Constituent Balance for " & lConstituent)
780780
Dim lReportCons As New atcReport.ReportText
781781
lReportCons = HspfSupport.ConstituentBalance.Report(aHspfUci, lConstituent, aOperationTypes, pBaseName,
782-
lReportMonthsScenarioResults, aRunMade, pSDateJ, pEDateJ, lConstProperties, lReportMonthsLabel)
782+
lReportMonthsScenarioResults, aRunMade, pSDateJ, pEDateJ, lConstProperties, lReportMonthsLabel, lReportEndMonth)
783783
lOutFileName = pOutFolderName & lConstituentName & "_" & pBaseName & "_Per_OPN_Per_Year.txt"
784784

785785
SaveFileString(lOutFileName, lReportCons.ToString)
@@ -788,7 +788,7 @@ Module HSPFOutputReports
788788
'constituent balance
789789

790790
lReportCons = HspfSupport.WatershedConstituentBalance.Report(aHspfUci, lConstituent, aOperationTypes, pBaseName,
791-
lReportMonthsScenarioResults, aRunMade, pSDateJ, pEDateJ, lConstProperties, lReportMonthsLabel)
791+
lReportMonthsScenarioResults, aRunMade, pSDateJ, pEDateJ, lConstProperties, lReportMonthsLabel, lReportEndMonth)
792792
lOutFileName = pOutFolderName & lConstituentName & "_" & pBaseName & "_Grp_By_OPN_LU_Ann_Avg.txt"
793793

794794
SaveFileString(lOutFileName, lReportCons.ToString)
@@ -798,7 +798,7 @@ Module HSPFOutputReports
798798
HspfSupport.WatershedConstituentBalance.ReportsToFiles _
799799
(aHspfUci, lConstituent, aOperationTypes, pBaseName,
800800
lReportMonthsScenarioResults, pOutputLocations, aRunMade, pSDateJ, pEDateJ,
801-
lConstProperties, lReportMonthsLabel, pOutFolderName, True)
801+
lConstProperties, lReportMonthsLabel, lReportEndMonth, pOutFolderName, True)
802802
'now pivoted version
803803
'HspfSupport.WatershedConstituentBalance.ReportsToFiles _
804804
' (lHspfUci, lConstituent, lOperationTypes, pBaseName, _

HSPEXP/SetUpScript.iss

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
; SEE THE DOCUMENTATION FOR DETAILS ON CREATING INNO SETUP SCRIPT FILES!
33

44
#define MyAppName "HSPEXP+"
5-
#define MyAppVersion "3.2"
5+
#define MyAppVersion "3.2.1"
66
#define MyAppPublisher "RESPEC"
77
#define MyAppURL "http://www.respec.com/product/hspexp/"
88
#define MyAppExeName "HSPEXP+.exe"
@@ -23,7 +23,7 @@ AppContact= {#MyAppURL}
2323
VersionInfoCopyright=Mozilla Public License (MPL) 1.1
2424
DefaultDirName={reg:HKLM\SOFTWARE\RESPEC\BASINS45,Base Directory|{pf}\HSPEXP+}
2525
DefaultGroupName={#MyAppName}
26-
OutputBaseFilename=HSPEXP+3.2SetUp
26+
OutputBaseFilename=HSPEXP+3.2.1SetUp
2727
Compression=lzma
2828
SolidCompression=yes
2929
InfoBeforeFile=install.txt

HSPEXP/install.txt

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,13 @@
1+
Date: 9/26/2025
2+
3+
HSPEXP+3.2.1
4+
5+
New Features:
6+
1. Generate reports over several years but just using outputs for certain months (i.e. June through September for the River Eutrophication Standard or April through September for the Sediment Standard).
7+
2. Reach Annual Average Budget (RCH_Ann_Avg_Budget) reports now have more descriptive info in the documentation (ConstituentBalanceReportsDocumentation.pdf)
8+
3. Also clarified info in the Load Allocation Tables in the documentation.
9+
10+
111
Date: 2/4/2021
212

313
HSPEXP+3.2

atcHspfSupport/atcHspfConstituentBalance.vb

Lines changed: 29 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ Public Module ConstituentBalance
4040
ByVal aEDateJ As Double,
4141
ByVal aConstProperties As List(Of ConstituentProperties),
4242
ByVal aSeasonsLabel As String,
43+
ByVal aReportEndMonth As Integer,
4344
Optional ByVal aDateRows As Boolean = False,
4445
Optional ByVal aDecimalPlaces As Integer = 3,
4546
Optional ByVal aSignificantDigits As Integer = 5,
@@ -124,9 +125,32 @@ Public Module ConstituentBalance
124125
Else
125126
lSeasons = New atcSeasonsCalendarYear
126127
End If
128+
Dim lEndVals As New atcCollection 'if using monthly reporting save ending value for each year
127129
Dim lSeasonalAttributes As New atcDataAttributes
128130
If ConstituentsThatUseLast.Contains(lConstituentDataName) Then
129131
lSeasonalAttributes.SetValue("Last", 0)
132+
133+
'pbd this is where we might want to compute a different state variable when using months to report
134+
' like April to Sept should report Sept's end value
135+
If aReportEndMonth < 12 Then
136+
Dim lTmpTs As atcTimeseries = lTempDataSet
137+
Dim lEndVal As Double = -999.0
138+
J2Date(lTmpTs.Dates.Value(0), lDate)
139+
Dim lCurYear As Integer = lDate(0)
140+
For iValue As Integer = 0 To lTmpTs.numValues
141+
J2Date(lTmpTs.Dates.Value(iValue) - 0.001, lDate)
142+
If lCurYear < lDate(0) Or iValue = lTmpTs.numValues Then
143+
'lSeasonalAttributes.SetValue("Last CalendarYear " & lDate(0) - 1, lEndVal)
144+
'lSeasonalAttributes.SetValue("Last", lEndVal)
145+
lEndVals.Add(lEndVal)
146+
lCurYear = lDate(0)
147+
End If
148+
If lDate(1) <= aReportEndMonth Then
149+
lEndVal = lTmpTs.Value(iValue)
150+
End If
151+
Next
152+
End If
153+
130154
Else
131155
lSeasonalAttributes.SetValue("Sum", 0) 'fluxes are summed from daily, monthly or annual to annual
132156
End If
@@ -279,7 +303,11 @@ Public Module ConstituentBalance
279303
End If
280304
Dim lFieldIndex As Integer = 3
281305
For Each lAttribute In lYearlyAttributes
282-
.Value(lFieldIndex) = DecimalAlign(lMult * lAttribute.Value, aFieldWidth, aDecimalPlaces, aSignificantDigits)
306+
If ConstituentsThatUseLast.Contains(lConstituentDataName) And aReportEndMonth < 12 Then 'pbd for monthly report option
307+
.Value(lFieldIndex) = DecimalAlign(lMult * lEndVals(lFieldIndex - 3), aFieldWidth, aDecimalPlaces, aSignificantDigits)
308+
Else
309+
.Value(lFieldIndex) = DecimalAlign(lMult * lAttribute.Value, aFieldWidth, aDecimalPlaces, aSignificantDigits)
310+
End If
283311
lFieldIndex += 1
284312
Next
285313
Else

atcHspfSupport/atcHspfWatershedConstituentBalance.vb

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ Public Module WatershedConstituentBalance
4040
ByVal aEDateJ As String,
4141
ByVal aConstProperties As List(Of ConstituentProperties),
4242
ByVal aSeasonsLabel As String,
43+
ByVal aReportEndMonth As Integer,
4344
Optional ByVal aOutFilePrefix As String = "",
4445
Optional ByVal aOutletDetails As Boolean = False,
4546
Optional ByVal aSegmentRows As Boolean = False,
@@ -56,6 +57,7 @@ Public Module WatershedConstituentBalance
5657
aScenario, aScenarioResults,
5758
aRunMade, aSDateJ, aEDateJ, aConstProperties,
5859
aSeasonsLabel,
60+
aReportEndMonth,
5961
lOutletLocation,
6062
aOutFilePrefix, True,
6163
aSegmentRows, aDecimalPlaces, aSignificantDigits, aFieldWidth, aSkipZeroOrNoValue)
@@ -255,6 +257,7 @@ Public Module WatershedConstituentBalance
255257
ByVal aEDateJ As Double,
256258
ByVal aConstProperties As List(Of ConstituentProperties),
257259
ByVal aSeasonsLabel As String,
260+
ByVal aReportEndMonth As Integer,
258261
Optional ByVal aOutletLocation As String = "",
259262
Optional ByVal aOutFilePrefix As String = "",
260263
Optional ByVal aOutletDetails As Boolean = False,
@@ -523,6 +526,29 @@ Public Module WatershedConstituentBalance
523526
lAttribute = lSeasonalAttributes(0)
524527
'Mark added this option to calculate the average of end of the year values for state variables.
525528
'Earlier we were getting end of the simulation period value.
529+
530+
'pbd this is where we might want to compute a different state variable when using months to report
531+
' like April to Sept should report average Sept's end value
532+
If aReportEndMonth < 12 Then
533+
Dim lTmpTs As atcTimeseries = lTempDataSet
534+
Dim lEndVal As Double = -999.0
535+
J2Date(lTmpTs.Dates.Value(0), lDate)
536+
Dim lCurYear As Integer = lDate(0)
537+
Dim lSum As Double = 0.0
538+
For iValue As Integer = 0 To lTmpTs.numValues
539+
J2Date(lTmpTs.Dates.Value(iValue) - 0.001, lDate)
540+
If lCurYear < lDate(0) Or iValue = lTmpTs.numValues Then
541+
lSum += lEndVal
542+
lCurYear = lDate(0)
543+
End If
544+
If lDate(1) <= aReportEndMonth Then
545+
lEndVal = lTmpTs.Value(iValue)
546+
End If
547+
Next
548+
lSeasonalAttributes(0).Value = lSum / lYearlyAttributes.Count
549+
lAttribute = lSeasonalAttributes(0)
550+
End If
551+
526552
Else
527553
lAttribute = lTempDataSet.Attributes.GetDefinedValue("SumAnnual")
528554
End If

0 commit comments

Comments
 (0)