diff --git a/HSPEXP/CookieCutterGraphs.vb b/HSPEXP/CookieCutterGraphs.vb
index 46681b891..5f66dd39e 100644
--- a/HSPEXP/CookieCutterGraphs.vb
+++ b/HSPEXP/CookieCutterGraphs.vb
@@ -22,7 +22,8 @@ Public Module CookieCutterGraphs
If Not System.IO.Directory.Exists(lOutputFolder) Then
System.IO.Directory.CreateDirectory(lOutputFolder)
- End If
+ End If
+
With lConstituentsToGraph
.Add("BALCLA1", "Benthic Algae")
.Add("PHYCLA", "Phytoplankton as Chlorophyll a")
@@ -31,9 +32,10 @@ Public Module CookieCutterGraphs
.Add("NO3-CONCDIS", "Nitrate")
.Add("IVOL", "Water Volume")
.Add("P-TOT-IN", "Input of Total P (Existing Conditions)")
- .Add("SSED-TOT", "Total Suspended Solids (mg/l)")
+ .Add("SSED-TOT", "Total Suspended Solids (mg/L)")
.Add("RO", "Flow (cfs)")
.Add("BEDDEP", "Bed Depth (ft)")
+ .Add("DOXCONC", "Dissolved Oxygen (mg/L)")
End With
Dim lLocations As New atcCollection
@@ -61,8 +63,10 @@ Public Module CookieCutterGraphs
lScenarioResults.DataSets.Add(lTs)
End If
Next lTs
- End If
- For Each RCHRES In lLocations
+ End If
+
+ For Each RCHRES In lLocations
+#Region "Plotting Nutrient Curves"
If RCHRES.Contains("R:") Then
Dim lRchId = RCHRES.split(":")(1)
@@ -169,15 +173,15 @@ Public Module CookieCutterGraphs
lCurve.Line.Color = Drawing.Color.FromName("Black")
lCurve.Line.Width = 1
lCurve.Label.Text = "Dissolved NO3-N"
- lZgc.SaveIn(lOutputFolder & "RCHRES_" & lRchId & ".png")
+ lZgc.SaveIn(lOutputFolder & "Nutrient_RCHRES_" & lRchId & ".png")
Else
' Logger.Msg("Cannot generate Regan Plot for RCHRES" & lRchId & ". :
'All timeseries are not available at the RCHRES" & lRchId & ". Therefore Regan plot will not be generated for this reach.")
- End If
-
- 'Plotting the TSS Curve
-
-
+ End If
+#End Region
+ 'Plotting the TSS Curve
+#Region "Plotting TSS Curve"
+
lTimeseriesGroup = New atcTimeseriesGroup
lTimeSeries = lScenarioResults.DataSets.FindData("Location", RCHRES).FindData("Constituent", "RO")(0)
@@ -246,14 +250,47 @@ Public Module CookieCutterGraphs
lCurve.Line.Width = 1
lCurve.Label.Text = "Bed Depth (ft)"
lZgc.SaveIn(lOutputFolder & "TSS_RCHRES_" & lRchId & ".png")
- End If
-
-
- 'Plotting Load Duration Curve
- 'Read the RES_TP_Standard.csv
+ End If
+#End Region
+
+ 'Plotting DO Concentrations
+ Dim lTimeseriesGroupDO As New atcTimeseriesGroup
+ Dim lTimeSeriesDO As New atcTimeseries(Nothing)
+ lTimeSeriesDO = lScenarioResults.DataSets.FindData("Location", RCHRES).FindData("Constituent", "DOXCONC")(0)
+ If lTimeSeriesDO.Attributes.GetDefinedValue("Time Unit").Value <= 3 Then
+ lTimeseriesGroupDO.Add(Aggregate(lTimeSeriesDO, atcTimeUnit.TUDay, 1, atcTran.TranMax))
+ lTimeseriesGroupDO.Add(Aggregate(lTimeSeriesDO, atcTimeUnit.TUDay, 1, atcTran.TranMin))
+
+ Dim lZgc As ZedGraphControl = CreateZgc(, 1024, 768)
+ Dim lGrapher As New clsGraphTime(lTimeseriesGroupDO, lZgc)
+ Dim lMainPane As GraphPane = lZgc.MasterPane.PaneList(0)
+
+ Dim lCurve As ZedGraph.LineItem = Nothing
+ lCurve = lMainPane.CurveList.Item(0)
+ lCurve.Line.IsVisible = True
+ lCurve.Symbol.Type = SymbolType.None
+ lCurve.Line.Color = Drawing.Color.FromName("red")
+ lCurve.Line.Width = 1
+ lCurve.Label.Text = "Maximum Daily DO Concentration"
+ lCurve = lMainPane.CurveList.Item(1)
+ lCurve.Line.IsVisible = True
+ lCurve.Symbol.Type = SymbolType.None
+ lCurve.Line.Color = Drawing.Color.FromName("green")
+ lCurve.Line.Width = 1
+ lCurve.Label.Text = "Minimum Daily DO Concentration"
+
+ lMainPane.YAxis.Title.Text = "Dissolved Oxygen (mg/L)"
+ lMainPane.YAxis.Scale.Min = 0
+ lMainPane.YAxis.Scale.Max = 20
+ lZgc.SaveIn(lOutputFolder & "DO_Concentration_RCHRES_" & RCHRES.split(":")(1) & ".png")
+
+ End If
+
+ 'Plotting Load Duration Curve
+ 'Read the RES_TP_Standard.csv
+#Region "Plotting RES Curve"
If CommonRESStandard = 0.0 Then
-
If Not (lRchId = LowerRangeRCHId Or lRchId = HigherRangeRCHId Or
(lRchId > LowerRangeRCHId AndAlso lRchId < HigherRangeRCHId)) Then
WQCriteriaInmgperliter = 0.0
@@ -348,13 +385,13 @@ Public Module CookieCutterGraphs
lCurve = lMainPane.CurveList.Item(0)
lCurve.Line.IsVisible = True
lCurve.Symbol.Type = SymbolType.None
- lCurve.Line.Color = Drawing.Color.FromName("orange")
+ lCurve.Line.Color = Drawing.Color.FromName("green")
lCurve.Line.Width = 2
lCurve.Label.Text = "RES Standard (" & WQCriteriaInmgperliter & " mg/L)"
lCurve = lMainPane.CurveList.Item(1)
lCurve.Line.IsVisible = True
lCurve.Symbol.Type = SymbolType.None
- lCurve.Line.Color = Drawing.Color.FromName("blue")
+ lCurve.Line.Color = Drawing.Color.FromName("red")
lCurve.Line.Width = 2
lCurve.Label.Text = "Baseline"
@@ -366,18 +403,24 @@ Public Module CookieCutterGraphs
End If
- End If
-
- End If
-
-
-
+ End If
+
+
+
+ End If
+#End Region
+
+
+
+
+
Next RCHRES
- End If
- atcDataManager.DataSets.Clear()
+ End If
+
Next i
+
Dim lGraphFilesCount = 0
'Dim lRCH As HspfOperation
diff --git a/HSPEXP/HSPEXP+-D4EM10_common.vbproj b/HSPEXP/HSPEXP+-D4EM10_common.vbproj
index 2b978ce18..26ed89d92 100644
--- a/HSPEXP/HSPEXP+-D4EM10_common.vbproj
+++ b/HSPEXP/HSPEXP+-D4EM10_common.vbproj
@@ -43,7 +43,7 @@
false
en
HSPEXP+
- AQUA TERRA Consultants %28a division of RESPEC%29
+ RESPEC
index.htm
false
0
@@ -59,7 +59,8 @@
true
true
bin\Debug\
- HSPEXP+.xml
+
+
42016,41999,42017,42018,42019,42032,42036,42020,42021,42022,42353,42354,42355
@@ -68,7 +69,8 @@
true
true
bin\Release\
- HSPEXP+.xml
+
+
42016,41999,42017,42018,42019,42032,42036,42020,42021,42022,42353,42354,42355
@@ -76,15 +78,18 @@
true
true
bin\x86\Debug\
- HSPEXP+.xml
+
+
42016,41999,42017,42018,42019,42032,42036,42020,42021,42022,42353,42354,42355
full
x86
+ false
true
bin\x86\Release\
- HSPEXP+.xml
+
+
true
42016,41999,42017,42018,42019,42032,42036,42020,42021,42022,42353,42354,42355
pdbonly
@@ -98,6 +103,7 @@
False
+
False
@@ -158,7 +164,7 @@
Form
-
+
SplashScreen1.vb
diff --git a/HSPEXP/HSPFOutputReports.vb b/HSPEXP/HSPFOutputReports.vb
index 9ee781a50..55a560443 100644
--- a/HSPEXP/HSPFOutputReports.vb
+++ b/HSPEXP/HSPFOutputReports.vb
@@ -134,7 +134,7 @@ Module HSPFOutputReports
If MultiSimulation Then
SubMultiSim(pHSPFExe, pBaseName, pTestPath, SDateJ, EDateJ, lHspfEchoFileName)
- Logger.Msg("Sensitivity/Uncertainty Analysis Complete", vbOKOnly)
+ Logger.Msg("Multi Simulation Manager Process Complete", vbOKOnly)
OpenFile(pTestPath)
End
@@ -476,6 +476,7 @@ Module HSPFOutputReports
Case "TotalP"
lConstituentName = "TP"
lConstProperties = Utility.LocateConstituentNames(aHspfUci, lConstituent)
+ lActiveSections.Add("NITR")
lActiveSections.Add("PHOS")
lActiveSections.Add("PQUAL")
lActiveSections.Add("IQUAL")
@@ -494,23 +495,24 @@ Module HSPFOutputReports
lConstituentName = "FColi"
lActiveSections.Add("PQUAL")
lActiveSections.Add("IQUAL")
- lActiveSections.Add("RQUAL")
+ lActiveSections.Add("GQUAL")
End Select
Dim lScenarioResults As New atcDataSource
- If lOpenHspfBinDataSource.DataSets.Count > 1 Then
- Dim lConstituentsToOutput As atcCollection = Utility.ConstituentsToOutput(lConstituent, lConstProperties)
- For Each ConstituentForAnalysis As String In lConstituentsToOutput.Keys
- 'If ConstituentForAnalysis.StartsWith("I:") Then Stop
- ConstituentForAnalysis = SafeSubstring(ConstituentForAnalysis, 2)
- If ConstituentForAnalysis.EndsWith("1") Or ConstituentForAnalysis.EndsWith("2") Then
- ConstituentForAnalysis = Left(ConstituentForAnalysis, ConstituentForAnalysis.Length - 1)
- End If
- lScenarioResults.DataSets.Add(atcDataManager.DataSets.FindData("Constituent", ConstituentForAnalysis))
+ 'If lOpenHspfBinDataSource.DataSets.Count > 1 Then
+ ' Dim lConstituentsToOutput As atcCollection = Utility.ConstituentsToOutput(lConstituent, lConstProperties)
+ ' For Each ConstituentForAnalysis As String In lConstituentsToOutput.Keys
+ ' Dim OpnType As String = SafeSubstring(ConstituentForAnalysis, 0, 2)
+ ' ConstituentForAnalysis = SafeSubstring(ConstituentForAnalysis, 2)
+ ' If Not OpnType = "R:" AndAlso (ConstituentForAnalysis.EndsWith("1") Or ConstituentForAnalysis.EndsWith("2")) Then
- Next
+ ' ConstituentForAnalysis = Left(ConstituentForAnalysis, ConstituentForAnalysis.Length - 1)
+ ' End If
+ ' lScenarioResults.DataSets.Add(atcDataManager.DataSets.FindData("Constituent", ConstituentForAnalysis))
- End If
+ ' Next
+
+ 'End If
If lScenarioResults.DataSets.Count = 0 Then
For Each activeSection As String In lActiveSections
diff --git a/HSPEXP/MultiSimulatioManager.vb b/HSPEXP/MultiSimulatioManager.vb
index 769385caf..cc7081df7 100644
--- a/HSPEXP/MultiSimulatioManager.vb
+++ b/HSPEXP/MultiSimulatioManager.vb
@@ -106,7 +106,7 @@ You can edit this specification file and add more parameters and outputs.", vbOK
SensitivityParameterFile.Close()
End If
- Dim lOutputFile As StreamWriter = File.CreateText("MultiSimOutput.csv")
+ 'Dim lOutputFile As StreamWriter = File.CreateText("MultiSimOutput.csv")
Dim loutputTable As DataTable
loutputTable = New DataTable("MultiSimOutput")
loutputTable = AddOutputTableColumns(loutputTable)
@@ -115,7 +115,7 @@ You can edit this specification file and add more parameters and outputs.", vbOK
For Each TableColumn As DataColumn In loutputTable.Columns 'Writing the table headings
TextToWrite &= TableColumn.Caption & ","
Next
- lOutputFile.WriteLine(TextToWrite)
+ 'lOutputFile.WriteLine(TextToWrite)
'The file listing the sensitive parameters and the output DSN already exists.
Dim lSpecificationFileRecordsNew As New ArrayList
@@ -246,15 +246,17 @@ You can edit this specification file and add more parameters and outputs.", vbOK
End If
Loop While lcsvRecordIndex < lSpecificationFileRecordsNew.Count - 1
-
- For Each TableRow As DataRow In loutputTable.Rows 'Writing the table contents
- TextToWrite = ""
- For Each TableColumn As DataColumn In loutputTable.Columns
- TextToWrite &= TableRow(TableColumn) & ","
- Next TableColumn
- lOutputFile.WriteLine(TextToWrite)
- Next TableRow
- lOutputFile.Close()
+ Dim lOutputFile2 As StreamWriter = File.CreateText(Path.Combine(pTestPath, "MultiSimOutput.xml"))
+ loutputTable.WriteXml(lOutputFile2)
+ 'For Each TableRow As DataRow In loutputTable.Rows 'Writing the table contents
+ ' TextToWrite = ""
+ ' For Each TableColumn As DataColumn In loutputTable.Columns
+ ' TextToWrite &= TableRow(TableColumn) & ","
+ ' Next TableColumn
+ ' lOutputFile.WriteLine(TextToWrite)
+ 'Next TableRow
+ 'lOutputFile.Close()
+ lOutputFile2.Close()
End Sub
Private Function ReadCSVFile(aSensitivitySpecificationFile As String)
@@ -557,26 +559,28 @@ You can edit this specification file and add more parameters and outputs.", vbOK
row(ColumnName) = SimulatedTS.Attributes.GetDefinedValue("Sum").Value - SimulatedTS.Attributes.GetDefinedValue("%Sum75").Value
Case "50%High"
row(ColumnName) = SimulatedTS.Attributes.GetDefinedValue("Sum").Value - SimulatedTS.Attributes.GetDefinedValue("%Sum50").Value
- Case "30-day GeoMean"
- If SimulatedTS.Values.Count >= 30 Then
+ Case "max(30-day GeoMean)"
+ Dim lDailyTs As atcTimeseries = Aggregate(SimulatedTS, atcTimeUnit.TUDay, 1, atcTran.TranAverSame)
+ If lDailyTs.Values.Count >= 30 Then
Dim GeoMean As New List(Of Double)
Dim lCount As Integer = 0
Dim Test As Double = 0.0
- For i As Integer = 1 To SimulatedTS.Values.Count-1
- If SimulatedTS.Value(i) > 0 Then
- Test += Math.Log10(SimulatedTS.Value(i))
+ For i As Integer = 1 To lDailyTs.Values.Count - 1
+ If lDailyTs.Value(i) > 0 Then
+ Test += Math.Log10(lDailyTs.Value(i))
End If
- If i >= 31 Then
- If SimulatedTS.Value(i - 30) > 0 Then Test -= Math.Log10(SimulatedTS.Value(i - 30))
+ If i >= 30 Then
+ If lDailyTs.Value(i - 30) > 0 Then Test -= Math.Log10(lDailyTs.Value(i - 30))
GeoMean.Add(10 ^ (Test / 30))
End If
Next i
+ Test = 0.0
For Each lValue As Double In GeoMean
- Test += lValue
+ If lValue > Test Then Test = lValue
Next
- row(ColumnName) = Test / GeoMean.Count
+ row(ColumnName) = Test
End If
Case Else
@@ -645,8 +649,8 @@ You can edit this specification file and add more parameters and outputs.", vbOK
column = New DataColumn()
column.DataType = Type.GetType("System.Double")
- column.ColumnName = "30-day GeoMean"
- column.Caption = "30-day Geometric Mean"
+ column.ColumnName = "max(30-day GeoMean)"
+ column.Caption = "Max(30-day Geometric Mean)"
aDataTable.Columns.Add(column)
column = New DataColumn()
diff --git a/HSPEXP/StartUp.vb b/HSPEXP/StartUp.vb
index b06d00ca3..1d809cf2e 100644
--- a/HSPEXP/StartUp.vb
+++ b/HSPEXP/StartUp.vb
@@ -207,6 +207,7 @@ Public Class StartUp
chkDO.Enabled = False
chkHeat.Checked = False
chkHeat.Enabled = False
+ txtRCH.Enabled = False
Else
chkRunHSPF.Enabled = True
diff --git a/HSPFSimulationManager/frmEditWatershed.vb b/HSPFSimulationManager/frmEditWatershed.vb
index c857df7f8..ae986eaf6 100644
--- a/HSPFSimulationManager/frmEditWatershed.vb
+++ b/HSPFSimulationManager/frmEditWatershed.vb
@@ -100,13 +100,17 @@ Public Class frmEditWatershed
'do connection check to see if this newly added UCI is connected to the downstream UCI
Dim lUCIs As New atcCollection
+ Dim lUpstreamUCIs As New atcCollection
+ Dim lDownstreamUCIs As New atcCollection
lUCIs.Add(pIcon.UciFile)
+ lUpstreamUCIs.Add(pIcon.UciFile)
Dim lDownIcon As clsIcon = Nothing
If cboDownstream.SelectedItem.Trim <> "None" Then
lDownIcon = Schematic.AllIcons.FindOrAddIcon(cboDownstream.SelectedItem.Trim)
End If
If lDownIcon IsNot Nothing AndAlso lDownIcon.UciFile IsNot Nothing Then
lUCIs.Add(lDownIcon.UciFile)
+ lDownstreamUCIs.Add(lDownIcon.UciFile)
Logger.Dbg("frmEditWatershed_clicked_ok added icon: " & lDownIcon.UciFileName)
Logger.Dbg("frmEditWatershed_clicked_ok added icon name: " & lDownIcon.UciFile.Name)
End If
@@ -115,7 +119,7 @@ Public Class frmEditWatershed
'return name of transfer wdm if models are connected using a single transfer wdm
'return 'MULTIPLE' if models are connected but connections use multiple wdms
Logger.Progress(1, 1) 'attempt to get rid of lingering progress messages
- Dim lTransferWDM As String = UsesTransfer(lUCIs)
+ Dim lTransferWDM As String = UsesTransfer(lUpstreamUCIs, lDownstreamUCIs)
Logger.Dbg("frmEditWatershed_clicked_ok transfer wdm: " & lTransferWDM)
If lTransferWDM.Length = 0 Then
'these models are not connected, ask about connecting them
diff --git a/HSPFSimulationManager/frmHspfSimulationManager.vb b/HSPFSimulationManager/frmHspfSimulationManager.vb
index 49e658484..cb5658486 100644
--- a/HSPFSimulationManager/frmHspfSimulationManager.vb
+++ b/HSPFSimulationManager/frmHspfSimulationManager.vb
@@ -281,17 +281,25 @@ Public Class frmHspfSimulationManager
Logger.Dbg("Beginning Connection Report")
Dim lUCIs As New atcCollection
+ Dim lUpstreamUCIs As New atcCollection
+ Dim lDownstreamUCIs As New atcCollection
For Each lIcon As clsIcon In SchematicDiagram.AllIcons
If lIcon.Scenario IsNot Nothing Then
If lIcon.UciFile IsNot Nothing Then
Logger.Dbg("Connection Report:Adding UCI:" & lIcon.UciFileName)
lUCIs.Add(lIcon.UciFile)
+ If lIcon.UpstreamIcons.Count Then
+ lDownstreamUCIs.Add(lIcon.UciFile)
+ End If
+ If lIcon.DownstreamIcon IsNot Nothing Then
+ lUpstreamUCIs.Add(lIcon.UciFile)
+ End If
Logger.Dbg("Connection Report:Added UCI:" & lIcon.UciFile.Name)
End If
End If
Next
Logger.Dbg("Connection Report:Finished Adding UCIs")
- Dim lTransferWDM As String = UsesTransfer(lUCIs)
+ Dim lTransferWDM As String = UsesTransfer(lUpstreamUCIs, lDownstreamUCIs)
Logger.Dbg("Connection Report:Transfer WDM:" & lTransferWDM)
lReport &= vbCrLf & "Transfer WDM Used: " & lTransferWDM & vbCrLf
@@ -368,19 +376,29 @@ Public Class frmHspfSimulationManager
Logger.Dbg("In TransferWDMCheck")
Dim lUCIs As New atcCollection
+ Dim lUpstreamUCIs As New atcCollection
+ Dim lDownstreamUCIs As New atcCollection
For Each lIcon As clsIcon In SchematicDiagram.AllIcons
If lIcon.Scenario IsNot Nothing Then
Logger.Dbg("TransferWDMCheck:Adding UCI:" & lIcon.UciFileName)
+ Logger.Status("Opening UCI: " & lIcon.UciFileName)
lUCIs.Add(lIcon.UciFile)
+ If lIcon.UpstreamIcons.Count Then
+ lDownstreamUCIs.Add(lIcon.UciFile)
+ End If
+ If lIcon.DownstreamIcon IsNot Nothing Then
+ lUpstreamUCIs.Add(lIcon.UciFile)
+ End If
Logger.Dbg("TransferWDMCheck:Added UCI:" & lIcon.UciFile.Name)
End If
Next
Logger.Dbg("TransferWDMCheck:Finished Adding UCIs")
+ Logger.Status("")
If lUCIs.Count > 1 Then
'return blank if models are not connected
'return name of transfer wdm if models are connected using a single transfer wdm
'return 'MULTIPLE' if models are connected but connections use multiple wdms
- Dim lTransferWDM As String = UsesTransfer(lUCIs)
+ Dim lTransferWDM As String = UsesTransfer(lUpstreamUCIs, lDownstreamUCIs)
Logger.Dbg("TransferWDMCheck:Transfer WDM:" & lTransferWDM)
If lTransferWDM.Length = 0 Then
'these models are not connected
diff --git a/HSPFSimulationManager/modUCI.vb b/HSPFSimulationManager/modUCI.vb
index 1b6317a53..e38441269 100644
--- a/HSPFSimulationManager/modUCI.vb
+++ b/HSPFSimulationManager/modUCI.vb
@@ -163,16 +163,17 @@ FindMsg: lMsgFile = FindFile("Locate Message WDM", lMsgFile, "wdm", aUser
Return lAllWDMs
End Function
- Public Function UsesTransfer(ByVal aUCIs As atcCollection) As String
+ Public Function UsesTransfer(ByVal aSourceUCIs As atcCollection, ByVal aTargetUCIs As atcCollection) As String
'return blank if models are not connected
'return name of transfer wdm if models are connected using a single transfer wdm
'return 'MULTIPLE' if models are connected but connections use multiple wdms
Dim lUsesTransfer As String = ""
- For Each lTargetUCI As HspfUci In aUCIs
- For Each lSourceUCI As HspfUci In aUCIs
+ For Each lTargetUCI As HspfUci In aTargetUCIs
+ For Each lSourceUCI As HspfUci In aSourceUCIs
If lSourceUCI.Name <> lTargetUCI.Name Then
+ Logger.Status("Checking connections into " & lTargetUCI.Name)
'build collection of wdms used by source uci
Dim lSourceWDMs As New atcCollection
For lIndex As Integer = 1 To lSourceUCI.FilesBlock.Count
@@ -242,6 +243,7 @@ FindMsg: lMsgFile = FindFile("Locate Message WDM", lMsgFile, "wdm", aUser
End If
Next
Next
+ Logger.Status("")
Return lUsesTransfer
End Function
@@ -265,9 +267,13 @@ FindMsg: lMsgFile = FindFile("Locate Message WDM", lMsgFile, "wdm", aUser
Dim lConnections As New atcCollection
'Do a check on just these 2 UCIs to see if they already use this transfer WDM
Dim lUcis As New atcCollection
+ Dim lUpstreamUcis As New atcCollection
+ Dim lDownstreamUcis As New atcCollection
lUcis.Add(lSourceUCI)
+ lUpstreamUcis.Add(lSourceUCI)
lUcis.Add(lTargetUCI)
- Dim lTrans As String = UsesTransfer(lUcis)
+ lDownstreamUcis.Add(lTargetUCI)
+ Dim lTrans As String = UsesTransfer(lUpstreamUcis, lDownstreamUcis)
If Not lTrans.ToLower = aTransferWDMName.ToLower Then
'they don't use the transfer wdm yet, so update them
lConnections = FindConnections(lSourceUCI, lTargetUCI, lTransferWDM)
diff --git a/atcGraphExperimental/frmGraphEditor.Designer.vb b/atcGraphExperimental/frmGraphEditor.Designer.vb
index 7c96a8338..c2f6dbce0 100644
--- a/atcGraphExperimental/frmGraphEditor.Designer.vb
+++ b/atcGraphExperimental/frmGraphEditor.Designer.vb
@@ -62,10 +62,6 @@ Partial Class frmGraphEditor
Me.lblCurveWidth = New System.Windows.Forms.Label()
Me.tabsCategory = New System.Windows.Forms.TabControl()
Me.tabAxes = New System.Windows.Forms.TabPage()
- Me.panelProbability = New System.Windows.Forms.Panel()
- Me.radioProbablilityReturnPeriod = New System.Windows.Forms.RadioButton()
- Me.radioProbablilityFraction = New System.Windows.Forms.RadioButton()
- Me.radioProbablilityPercent = New System.Windows.Forms.RadioButton()
Me.chkRangeReverse = New System.Windows.Forms.CheckBox()
Me.radioAxisAux = New System.Windows.Forms.RadioButton()
Me.radioAxisRight = New System.Windows.Forms.RadioButton()
@@ -73,6 +69,10 @@ Partial Class frmGraphEditor
Me.radioAxisBottom = New System.Windows.Forms.RadioButton()
Me.chkAxisMinorTicsVisible = New System.Windows.Forms.CheckBox()
Me.chkAxisMajorTicsVisible = New System.Windows.Forms.CheckBox()
+ Me.panelProbability = New System.Windows.Forms.Panel()
+ Me.radioProbablilityReturnPeriod = New System.Windows.Forms.RadioButton()
+ Me.radioProbablilityFraction = New System.Windows.Forms.RadioButton()
+ Me.radioProbablilityPercent = New System.Windows.Forms.RadioButton()
Me.panelAxisType = New System.Windows.Forms.Panel()
Me.radioAxisProbability = New System.Windows.Forms.RadioButton()
Me.radioAxisLogarithmic = New System.Windows.Forms.RadioButton()
@@ -120,6 +120,7 @@ Partial Class frmGraphEditor
Me.btnTextAdd = New System.Windows.Forms.Button()
Me.txtText = New System.Windows.Forms.TextBox()
Me.chkAutoApply = New System.Windows.Forms.CheckBox()
+ Me.chkHoldOpposite = New System.Windows.Forms.CheckBox()
Me.tabsCategory.SuspendLayout()
Me.tabAxes.SuspendLayout()
Me.panelProbability.SuspendLayout()
@@ -534,6 +535,7 @@ Partial Class frmGraphEditor
'
'tabAxes
'
+ Me.tabAxes.Controls.Add(Me.chkHoldOpposite)
Me.tabAxes.Controls.Add(Me.btnScaleFont)
Me.tabAxes.Controls.Add(Me.btnAxisFont)
Me.tabAxes.Controls.Add(Me.chkRangeReverse)
@@ -571,54 +573,6 @@ Partial Class frmGraphEditor
Me.tabAxes.Text = "Axes"
Me.tabAxes.UseVisualStyleBackColor = True
'
- 'panelProbability
- '
- Me.panelProbability.Anchor = CType(((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Left) _
- Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles)
- Me.panelProbability.Controls.Add(Me.txtProbabilityDeviations)
- Me.panelProbability.Controls.Add(Me.lblProbabilityDeviations)
- Me.panelProbability.Controls.Add(Me.radioProbablilityReturnPeriod)
- Me.panelProbability.Controls.Add(Me.radioProbablilityFraction)
- Me.panelProbability.Controls.Add(Me.radioProbablilityPercent)
- Me.panelProbability.Location = New System.Drawing.Point(74, 32)
- Me.panelProbability.Name = "panelProbability"
- Me.panelProbability.Size = New System.Drawing.Size(390, 28)
- Me.panelProbability.TabIndex = 39
- Me.panelProbability.Visible = False
- '
- 'radioProbablilityReturnPeriod
- '
- Me.radioProbablilityReturnPeriod.AutoSize = True
- Me.radioProbablilityReturnPeriod.Location = New System.Drawing.Point(150, 5)
- Me.radioProbablilityReturnPeriod.Name = "radioProbablilityReturnPeriod"
- Me.radioProbablilityReturnPeriod.Size = New System.Drawing.Size(90, 17)
- Me.radioProbablilityReturnPeriod.TabIndex = 40
- Me.radioProbablilityReturnPeriod.TabStop = True
- Me.radioProbablilityReturnPeriod.Text = "Return Period"
- Me.radioProbablilityReturnPeriod.UseVisualStyleBackColor = True
- '
- 'radioProbablilityFraction
- '
- Me.radioProbablilityFraction.AutoSize = True
- Me.radioProbablilityFraction.Location = New System.Drawing.Point(81, 5)
- Me.radioProbablilityFraction.Name = "radioProbablilityFraction"
- Me.radioProbablilityFraction.Size = New System.Drawing.Size(63, 17)
- Me.radioProbablilityFraction.TabIndex = 39
- Me.radioProbablilityFraction.TabStop = True
- Me.radioProbablilityFraction.Text = "Fraction"
- Me.radioProbablilityFraction.UseVisualStyleBackColor = True
- '
- 'radioProbablilityPercent
- '
- Me.radioProbablilityPercent.AutoSize = True
- Me.radioProbablilityPercent.Location = New System.Drawing.Point(7, 5)
- Me.radioProbablilityPercent.Name = "radioProbablilityPercent"
- Me.radioProbablilityPercent.Size = New System.Drawing.Size(62, 17)
- Me.radioProbablilityPercent.TabIndex = 38
- Me.radioProbablilityPercent.TabStop = True
- Me.radioProbablilityPercent.Text = "Percent"
- Me.radioProbablilityPercent.UseVisualStyleBackColor = True
- '
'chkRangeReverse
'
Me.chkRangeReverse.Anchor = CType((System.Windows.Forms.AnchorStyles.Bottom Or System.Windows.Forms.AnchorStyles.Left), System.Windows.Forms.AnchorStyles)
@@ -694,6 +648,54 @@ Partial Class frmGraphEditor
Me.chkAxisMajorTicsVisible.Text = "tics"
Me.chkAxisMajorTicsVisible.UseVisualStyleBackColor = True
'
+ 'panelProbability
+ '
+ Me.panelProbability.Anchor = CType(((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Left) _
+ Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles)
+ Me.panelProbability.Controls.Add(Me.txtProbabilityDeviations)
+ Me.panelProbability.Controls.Add(Me.lblProbabilityDeviations)
+ Me.panelProbability.Controls.Add(Me.radioProbablilityReturnPeriod)
+ Me.panelProbability.Controls.Add(Me.radioProbablilityFraction)
+ Me.panelProbability.Controls.Add(Me.radioProbablilityPercent)
+ Me.panelProbability.Location = New System.Drawing.Point(74, 32)
+ Me.panelProbability.Name = "panelProbability"
+ Me.panelProbability.Size = New System.Drawing.Size(390, 28)
+ Me.panelProbability.TabIndex = 39
+ Me.panelProbability.Visible = False
+ '
+ 'radioProbablilityReturnPeriod
+ '
+ Me.radioProbablilityReturnPeriod.AutoSize = True
+ Me.radioProbablilityReturnPeriod.Location = New System.Drawing.Point(150, 5)
+ Me.radioProbablilityReturnPeriod.Name = "radioProbablilityReturnPeriod"
+ Me.radioProbablilityReturnPeriod.Size = New System.Drawing.Size(90, 17)
+ Me.radioProbablilityReturnPeriod.TabIndex = 40
+ Me.radioProbablilityReturnPeriod.TabStop = True
+ Me.radioProbablilityReturnPeriod.Text = "Return Period"
+ Me.radioProbablilityReturnPeriod.UseVisualStyleBackColor = True
+ '
+ 'radioProbablilityFraction
+ '
+ Me.radioProbablilityFraction.AutoSize = True
+ Me.radioProbablilityFraction.Location = New System.Drawing.Point(81, 5)
+ Me.radioProbablilityFraction.Name = "radioProbablilityFraction"
+ Me.radioProbablilityFraction.Size = New System.Drawing.Size(63, 17)
+ Me.radioProbablilityFraction.TabIndex = 39
+ Me.radioProbablilityFraction.TabStop = True
+ Me.radioProbablilityFraction.Text = "Fraction"
+ Me.radioProbablilityFraction.UseVisualStyleBackColor = True
+ '
+ 'radioProbablilityPercent
+ '
+ Me.radioProbablilityPercent.AutoSize = True
+ Me.radioProbablilityPercent.Location = New System.Drawing.Point(7, 5)
+ Me.radioProbablilityPercent.Name = "radioProbablilityPercent"
+ Me.radioProbablilityPercent.Size = New System.Drawing.Size(62, 17)
+ Me.radioProbablilityPercent.TabIndex = 38
+ Me.radioProbablilityPercent.TabStop = True
+ Me.radioProbablilityPercent.Text = "Percent"
+ Me.radioProbablilityPercent.UseVisualStyleBackColor = True
+ '
'panelAxisType
'
Me.panelAxisType.Anchor = CType(((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Left) _
@@ -1206,6 +1208,17 @@ Partial Class frmGraphEditor
Me.chkAutoApply.Text = "Apply Automatically"
Me.chkAutoApply.UseVisualStyleBackColor = True
'
+ 'chkHoldOpposite
+ '
+ Me.chkHoldOpposite.Anchor = CType((System.Windows.Forms.AnchorStyles.Bottom Or System.Windows.Forms.AnchorStyles.Left), System.Windows.Forms.AnchorStyles)
+ Me.chkHoldOpposite.AutoSize = True
+ Me.chkHoldOpposite.Location = New System.Drawing.Point(371, 126)
+ Me.chkHoldOpposite.Name = "chkHoldOpposite"
+ Me.chkHoldOpposite.Size = New System.Drawing.Size(93, 17)
+ Me.chkHoldOpposite.TabIndex = 56
+ Me.chkHoldOpposite.Text = "Hold Opposite"
+ Me.chkHoldOpposite.UseVisualStyleBackColor = True
+ '
'frmGraphEditor
'
Me.AcceptButton = Me.btnApply
@@ -1343,4 +1356,5 @@ Partial Class frmGraphEditor
Friend WithEvents lblAuxSize As System.Windows.Forms.Label
Friend WithEvents txtAuxSize As System.Windows.Forms.TextBox
Friend WithEvents btnNewColors As System.Windows.Forms.Button
+ Private WithEvents chkHoldOpposite As Windows.Forms.CheckBox
End Class
diff --git a/atcGraphExperimental/frmGraphEditor.vb b/atcGraphExperimental/frmGraphEditor.vb
index d8cdfc37e..3e17be257 100644
--- a/atcGraphExperimental/frmGraphEditor.vb
+++ b/atcGraphExperimental/frmGraphEditor.vb
@@ -130,11 +130,20 @@ Public Class frmGraphEditor
Private Function AxisFromCombo() As Axis
If Not pPane Is Nothing Then
+ chkHoldOpposite.Visible = False
If radioAxisBottom.Checked Then
Return pPane.XAxis
ElseIf radioAxisLeft.Checked Then
+ If pPane.YAxis.IsVisible And pPane.Y2Axis.IsVisible Then
+ chkHoldOpposite.Text = "Hold Right"
+ chkHoldOpposite.Visible = True
+ End If
Return pPane.YAxis
ElseIf radioAxisRight.Checked Then
+ If pPane.YAxis.IsVisible And pPane.Y2Axis.IsVisible Then
+ chkHoldOpposite.Text = "Hold Left"
+ chkHoldOpposite.Visible = True
+ End If
Return pPane.Y2Axis
ElseIf radioAxisAux.Checked Then
If pPaneAux Is Nothing Then
@@ -263,7 +272,7 @@ Public Class frmGraphEditor
Dim lNewMax As Double
If Double.TryParse(txtAxisDisplayMinimum.Text, lNewMin) AndAlso _
Double.TryParse(txtAxisDisplayMaximum.Text, lNewMax) Then
- SetYAxisScales(aAxis, lNewMin, lNewMax)
+ SetYAxisScales(aAxis, lNewMin, lNewMax, chkHoldOpposite.Checked)
End If
.MajorGrid.Color = txtAxisMajorGridColor.BackColor
@@ -293,7 +302,7 @@ Public Class frmGraphEditor
End If
End Sub
- Private Sub SetYAxisScales(ByVal aYAxis As Axis, ByVal aMin As Double, ByVal aMax As Double)
+ Private Sub SetYAxisScales(ByVal aYAxis As Axis, ByVal aMin As Double, ByVal aMax As Double, Optional aHoldOpposite As Boolean = False)
Dim lOppositeYAxis As Axis = Nothing
If aYAxis IsNot Nothing Then
Dim lName As String = aYAxis.GetType().Name
@@ -322,22 +331,24 @@ Public Class frmGraphEditor
lIsReversed = .Scale.IsReverse
End With
If lOppositeYAxis IsNot Nothing Then
- Dim lChangeFractionMin As Double = (aMin - lYAxisMin0) / (lYAxisMax0 - lYAxisMin0)
- Dim lChangeFractionMax As Double = (aMax - lYAxisMax0) / (lYAxisMax0 - lYAxisMin0)
- With lOppositeYAxis.Scale
- Dim lIsReversedOp As Boolean = .IsReverse
- Dim lYAxisMinOp0 As Double = .Min
- Dim lYAxisMaxOp0 As Double = .Max
- .MinAuto = False
- .MaxAuto = False
- If (lIsReversed And Not lIsReversedOp) OrElse (Not lIsReversed And lIsReversedOp) Then
- .Max -= lChangeFractionMin * (lYAxisMaxOp0 - lYAxisMinOp0)
- .Min -= lChangeFractionMax * (lYAxisMaxOp0 - lYAxisMinOp0)
- Else
- .Min += lChangeFractionMin * (lYAxisMaxOp0 - lYAxisMinOp0)
- .Max += lChangeFractionMax * (lYAxisMaxOp0 - lYAxisMinOp0)
- End If
- End With
+ If Not aHoldOpposite Then
+ Dim lChangeFractionMin As Double = (aMin - lYAxisMin0) / (lYAxisMax0 - lYAxisMin0)
+ Dim lChangeFractionMax As Double = (aMax - lYAxisMax0) / (lYAxisMax0 - lYAxisMin0)
+ With lOppositeYAxis.Scale
+ Dim lIsReversedOp As Boolean = .IsReverse
+ Dim lYAxisMinOp0 As Double = .Min
+ Dim lYAxisMaxOp0 As Double = .Max
+ .MinAuto = False
+ .MaxAuto = False
+ If (lIsReversed And Not lIsReversedOp) OrElse (Not lIsReversed And lIsReversedOp) Then
+ .Max -= lChangeFractionMin * (lYAxisMaxOp0 - lYAxisMinOp0)
+ .Min -= lChangeFractionMax * (lYAxisMaxOp0 - lYAxisMinOp0)
+ Else
+ .Min += lChangeFractionMin * (lYAxisMaxOp0 - lYAxisMinOp0)
+ .Max += lChangeFractionMax * (lYAxisMaxOp0 - lYAxisMinOp0)
+ End If
+ End With
+ End If
End If
End Sub
diff --git a/atcHspfSupport/atcConstituentTables.vb b/atcHspfSupport/atcConstituentTables.vb
index 26e772a2b..25630eed6 100644
--- a/atcHspfSupport/atcConstituentTables.vb
+++ b/atcHspfSupport/atcConstituentTables.vb
@@ -441,7 +441,11 @@ Public Module atcConstituentTables
Dim RowNumber As Integer = 0
For Each lOperation As HspfOperation In aUCI.OpnSeqBlock.Opns
- If Not (lOperation.Name = "PERLND" OrElse lOperation.Name = "IMPLND") Then Continue For
+ 'If lOperation.Name = "IMPLND" Then Stop
+
+ If Not ((lOperation.Name = "PERLND" AndAlso lOperation.Tables("ACTIVITY").Parms("SEDFG").Value = "1") OrElse
+ (lOperation.Name = "IMPLND" AndAlso lOperation.Tables("ACTIVITY").Parms("SLDFG").Value = "1")) Then Continue For
+ 'If lOperation.Name = "IMPLND" Then Stop
Dim LocationName As String = lOperation.Name.Substring(0, 1) & ":" & lOperation.Id
landUseNameForTheCollection = lOperation.Name.Substring(0, 1) & ":" & lOperation.Description
If Not listLanduses.Contains(landUseNameForTheCollection) Then
@@ -653,7 +657,7 @@ Public Module atcConstituentTables
Dim lMultipleIndex As Integer = 0
If constituent.ConstNameForEXPPlus.ToLower.Contains("ref") Then
lMultipleIndex = 1
- ElseIf constituent.ConstNameForEXPPlus.Contains("lab") Then
+ ElseIf constituent.ConstNameForEXPPlus.ToLower.Contains("lab") Then
lMultipleIndex = 2
End If
@@ -773,7 +777,7 @@ Public Module atcConstituentTables
Dim SelectExpression As String = "OpTypeNumber = '" & lOperation & "' And Year = '" & lYear & "'"
Dim foundRows() As DataRow = Land_Constituent_Table.Select(SelectExpression)
row = Land_Constituent_Table.NewRow
- Logger.Dbg(SelectExpression)
+ 'Logger.Dbg(SelectExpression)
row("OpTypeNumber") = foundRows(0)("OpTypeNumber")
row("OpDesc") = foundRows(0)("OpDesc")
row("Year") = foundRows(0)("Year")
@@ -861,8 +865,11 @@ Public Module atcConstituentTables
lReport_Monthly.AppendLine(" " & aUCI.GlobalBlock.RunInf.Value)
lReport_Monthly.AppendLine(" Run Made " & aRunMade)
lReport_Monthly.AppendLine(" " & TimeSpanAsString(aSDateJ, aEDateJ, "Analysis Period: "))
- SaveFileString(aoutfoldername & aBalanceType & "_Monthly_Land_Loadings.txt", lReport_Monthly.ToString)
+ SaveFileString(aoutfoldername & "\MonthlyLoadings\" & aBalanceType & "_Monthly_Land_Loadings.txt", lReport_Monthly.ToString)
+ Dim lMonthNames() As String = {"Mean Month 01 Jan", "Mean Month 02 Feb", "Mean Month 03 Mar", "Mean Month 04 Apr",
+ "Mean Month 05 May", "Mean Month 06 Jun", "Mean Month 07 Jul", "Mean Month 08 Aug",
+ "Mean Month 09 Sep", "Mean Month 10 Oct", "Mean Month 11 Nov", "Mean Month 12 Dec"}
If Not aConstProperties.Count = 0 Then
For Each Constituent As ConstituentProperties In aConstProperties
lDataForBoxWhiskerPlot.Constituent = Constituent.ConstNameForEXPPlus
@@ -881,7 +888,39 @@ Public Module atcConstituentTables
lDataForBoxWhiskerPlot.LabelValueCollection = landUseSumAnnualValues
CreateGraph_BoxAndWhisker(lDataForBoxWhiskerPlot, aoutfoldername & Constituent.ConstNameForEXPPlus & "_BoxWhisker.png")
landUseSumAnnualValues.Clear()
+ Next
+
+ For Each Constituent As ConstituentProperties In aConstProperties
+ lDataForBoxWhiskerPlot.Constituent = Constituent.ConstNameForEXPPlus
+ For Each item As String In listLanduses
+ Dim OpType1 As String = item.Split("-")(0)
+ Dim SelectExpression As String = "OpTypeNumber Like '" & item.Split(":")(0) & "%' And OpDesc ='" & item.Split(":")(1) & "' And ConstNameEXP = '" & Constituent.ConstNameForEXPPlus & "'"
+ Dim foundRows() As DataRow = Land_Constituent_Monthly_Table.Select(SelectExpression)
+
+ For Each month As String In lMonthNames
+ Dim Values As New List(Of Double)
+ For Each MonthRow As DataRow In foundRows
+ Values.Add(MonthRow(month))
+ Next
+ landUseSumAnnualValues.Add(Right(month, 3), Values.ToArray)
+ Next
+
+ lDataForBoxWhiskerPlot.LabelValueCollection = landUseSumAnnualValues
+ lDataForBoxWhiskerPlot.Units = "(" & foundRows(0)("Unit") & ")"
+
+ CreateGraph_BoxAndWhisker(lDataForBoxWhiskerPlot, AbsolutePath(System.IO.Path.Combine("MonthlyLoadings\" & Constituent.ConstNameForEXPPlus & "_" & item.Split(":")(0) & "_" & item.Split(":")(1) & "_BoxWhisker.png"), aoutfoldername),
+ "Monthly Loading Rate from Land Use " & item & "")
+ landUseSumAnnualValues.Clear()
+
+
+
+ Next item
+
+
Next
+
+
+
Else
lDataForBoxWhiskerPlot.Constituent = aBalanceType
For Each item As String In listLanduses
@@ -897,7 +936,31 @@ Public Module atcConstituentTables
lDataForBoxWhiskerPlot.Units = "(" & lUnits & "/yr)"
lDataForBoxWhiskerPlot.LabelValueCollection = landUseSumAnnualValues
CreateGraph_BoxAndWhisker(lDataForBoxWhiskerPlot, aoutfoldername & aBalanceType & "_BoxWhisker.png")
- landUseSumAnnualValues.Clear()
+ landUseSumAnnualValues.Clear()
+
+
+ lDataForBoxWhiskerPlot.Constituent = aBalanceType
+ For Each item As String In listLanduses
+ Dim OpType1 As String = item.Split("-")(0)
+ Dim SelectExpression As String = "OpTypeNumber Like '" & item.Split(":")(0) & "%' And OpDesc ='" & item.Split(":")(1) & "'"
+ Dim foundRows() As DataRow = Land_Constituent_Monthly_Table.Select(SelectExpression)
+
+ For Each month As String In lMonthNames
+ Dim Values As New List(Of Double)
+ For Each MonthRow As DataRow In foundRows
+ Values.Add(MonthRow(month))
+ Next
+ landUseSumAnnualValues.Add(Right(month, 3), Values.ToArray)
+ Next
+
+ lDataForBoxWhiskerPlot.LabelValueCollection = landUseSumAnnualValues
+ lDataForBoxWhiskerPlot.Units = "(" & lUnits & ")"
+
+ CreateGraph_BoxAndWhisker(lDataForBoxWhiskerPlot, AbsolutePath(System.IO.Path.Combine("MonthlyLoadings\" & aBalanceType & "_" & item.Split(":")(0) & "_" & item.Split(":")(1) & "_BoxWhisker.png"), aoutfoldername),
+ "Monthly Loading Rate from Land Use " & item & "")
+ landUseSumAnnualValues.Clear()
+ Next
+
End If
@@ -1006,6 +1069,7 @@ Public Module atcConstituentTables
Dim lTS As New atcTimeseries(Nothing)
Dim AddTS As New atcDataGroup
Dim lTotalTS As New atcTimeseries(Nothing)
+ 'If lReach.Id = 103 Then Stop
Dim lDownstreamReachID As Integer = lReach.DownOper("RCHRES")
Dim lUpstreamIn As Double = 0.0
If lUpstreamInflows.Keys.Contains(lReach.Id) Then
@@ -1016,10 +1080,18 @@ Public Module atcConstituentTables
Dim lOutflow As Double = SubsetByDate(aBinaryData.DataSets.FindData("Location", LocationName).FindData("Constituent", "DOXOUTTOT")(0),
aSDateJ, aEDateJ, Nothing).Attributes.GetDefinedValue("SumAnnual").Value
Dim lTotalIn As Double = SubsetByDate(aBinaryData.DataSets.FindData("Location", LocationName).FindData("Constituent", "DOXIN")(0),
- aSDateJ, aEDateJ, Nothing).Attributes.GetDefinedValue("SumAnnual").Value
- Dim lDiversion As Double = CalculateDiversion(lReach, lUpstreamInflows, lDownstreamReachID, lOutflow)
+ aSDateJ, aEDateJ, Nothing).Attributes.GetDefinedValue("SumAnnual").Value
+ Dim lPrecIn As Double = 0
+ Try
+ lPrecIn = SubsetByDate(aBinaryData.DataSets.FindData("Location", LocationName).FindData("Constituent", "DOXIN-PREC")(0),
+ aSDateJ, aEDateJ, Nothing).Attributes.GetDefinedValue("SumAnnual").Value
+ Catch
+ Logger.Dbg("Precipitation does not contain DO in this model.")
+ End Try
+ Dim lDiversion As Double = CalculateDiversion(aUCI, aBinaryData, lReach, lUpstreamInflows, lDownstreamReachID,
+ lOutflow, aBalanceType)
Dim lGENERLoad As Double = CalculateGENERLoad(aUCI, lReach, aBalanceType, aSDateJ, aEDateJ)
- Dim lMassBalance As Double = lTotalIn - lNPSLoad - lUpstreamIn - lPSLoad - lGENERLoad
+ Dim lMassBalance As Double = lTotalIn - lNPSLoad - lUpstreamIn - lPSLoad - lGENERLoad - lPrecIn
For Each columnValue As DataColumn In Reach_Budget_Table.Columns
Dim ColumnName As String = columnValue.ColumnName
Select Case ColumnName
@@ -1030,7 +1102,9 @@ Public Module atcConstituentTables
Case "NPSLoad"
row(ColumnName) = HspfTable.NumFmtRE(lNPSLoad, 10)
Case "PSLoad"
- row(ColumnName) = HspfTable.NumFmtRE(CalculatePSLoad(aUCI, lReach, aSDateJ, aEDateJ, aBalanceType), 10)
+ row(ColumnName) = HspfTable.NumFmtRE(lPSLoad, 10)
+ Case "GENERLoad"
+ row(ColumnName) = HspfTable.NumFmtRE(lGENERLoad, 10)
Case "Diversion"
row(ColumnName) = HspfTable.NumFmtRE(lDiversion, 10)
Case "MassBalance"
@@ -1160,7 +1234,7 @@ Public Module atcConstituentTables
aSDateJ, aEDateJ, Nothing).Attributes.GetDefinedValue("SumAnnual").Value
Dim lTotalIn As Double = SubsetByDate(aBinaryData.DataSets.FindData("Location", LocationName).FindData("Constituent", "IHEAT")(0),
aSDateJ, aEDateJ, Nothing).Attributes.GetDefinedValue("SumAnnual").Value
- Dim lDiversion As Double = CalculateDiversion(lReach, lUpstreamInflows, lDownstreamReachID, lOutflow)
+ Dim lDiversion As Double = CalculateDiversion(aUCI, aBinaryData, lReach, lUpstreamInflows, lDownstreamReachID, lOutflow, aBalanceType)
Dim lGENERLoad As Double = CalculateGENERLoad(aUCI, lReach, aBalanceType, aSDateJ, aEDateJ)
Dim lMassBalance As Double = lTotalIn - lNPSLoad - lUpstreamIn - lPSLoad - lGENERLoad
For Each columnValue As DataColumn In Reach_Budget_Table.Columns
@@ -1173,7 +1247,9 @@ Public Module atcConstituentTables
Case "NPSLoad"
row(ColumnName) = HspfTable.NumFmtRE(lNPSLoad, 10)
Case "PSLoad"
- row(ColumnName) = HspfTable.NumFmtRE(CalculatePSLoad(aUCI, lReach, aSDateJ, aEDateJ, aBalanceType), 10)
+ row(ColumnName) = HspfTable.NumFmtRE(lPSLoad, 10)
+ Case "GENERLoad"
+ row(ColumnName) = HspfTable.NumFmtRE(lGENERLoad, 10)
Case "Diversion"
row(ColumnName) = HspfTable.NumFmtRE(lDiversion, 10)
Case "MassBalance"
@@ -1299,7 +1375,7 @@ Public Module atcConstituentTables
aSDateJ, aEDateJ, Nothing).Attributes.GetDefinedValue("SumAnnual").Value
Dim lTotalIn As Double = SubsetByDate(aBinaryData.DataSets.FindData("Location", LocationName).FindData("Constituent", "BODIN")(0),
aSDateJ, aEDateJ, Nothing).Attributes.GetDefinedValue("SumAnnual").Value
- Dim lDiversion As Double = CalculateDiversion(lReach, lUpstreamInflows, lDownstreamReachID, lOutflow)
+ Dim lDiversion As Double = CalculateDiversion(aUCI, aBinaryData, lReach, lUpstreamInflows, lDownstreamReachID, lOutflow, aBalanceType)
Dim lGENERLoad As Double = CalculateGENERLoad(aUCI, lReach, aBalanceType, aSDateJ, aEDateJ)
Dim lMassBalance As Double = lTotalIn - lNPSLoad - lUpstreamIn - lPSLoad - lGENERLoad
@@ -1311,9 +1387,12 @@ Public Module atcConstituentTables
Case "OpDesc"
row(ColumnName) = lReach.Description
Case "NPSLoad"
- row(ColumnName) = HspfTable.NumFmtRE(lNPSLoad, 10)
+ row(ColumnName) = HspfTable.NumFmtRE(lNPSLoad, 10)
+
Case "PSLoad"
- row(ColumnName) = HspfTable.NumFmtRE(lPSLoad, 10)
+ row(ColumnName) = HspfTable.NumFmtRE(lPSLoad, 10)
+ Case "GENERLoad"
+ row(ColumnName) = HspfTable.NumFmtRE(lGENERLoad, 10)
Case "Diversion"
row(ColumnName) = HspfTable.NumFmtRE(lDiversion, 10)
Case "MassBalance"
@@ -1404,12 +1483,28 @@ Public Module atcConstituentTables
Dim lPSLoad As Double = CalculatePSLoad(aUCI, lReach, aSDateJ, aEDateJ, lReachConstituent)
Dim lOutflow As Double = SubsetByDate(aBinaryData.DataSets.FindData("Location", LocationName).FindData("Constituent", lReachConstituent & "-OUTTOT")(0),
aSDateJ, aEDateJ, Nothing).Attributes.GetDefinedValue("SumAnnual").Value
+
Dim lTotalIn As Double = SubsetByDate(aBinaryData.DataSets.FindData("Location", LocationName).FindData("Constituent", lReachConstituent & "-INTOT")(0),
aSDateJ, aEDateJ, Nothing).Attributes.GetDefinedValue("SumAnnual").Value
Dim lTotalAtmDep As Double = SubsetByDate(aBinaryData.DataSets.FindData("Location", LocationName).FindData("Constituent", lReachConstituent & "-ATMDEPTOT")(0),
aSDateJ, aEDateJ, Nothing).Attributes.GetDefinedValue("SumAnnual").Value
- Dim lDiversion As Double = CalculateDiversion(lReach, lUpstreamInflows, lDownstreamReachID, lOutflow)
- Dim lGENERLoad As Double = CalculateGENERLoad(aUCI, lReach, aBalanceType, aSDateJ, aEDateJ)
+ Dim lProcFluxTot As Double = SubsetByDate(aBinaryData.DataSets.FindData("Location", LocationName).FindData("Constituent", lReachConstituent & "-PROCFLUX-TOT")(0),
+ aSDateJ, aEDateJ, Nothing).Attributes.GetDefinedValue("SumAnnual").Value
+ If lReachConstituent = "NO3" Then
+ Try
+ lOutflow += SubsetByDate(aBinaryData.DataSets.FindData("Location", LocationName).FindData("Constituent", "NO2-OUTTOT")(0),
+ aSDateJ, aEDateJ, Nothing).Attributes.GetDefinedValue("SumAnnual").Value
+ lTotalIn += SubsetByDate(aBinaryData.DataSets.FindData("Location", LocationName).FindData("Constituent", "NO2-INTOT")(0),
+ aSDateJ, aEDateJ, Nothing).Attributes.GetDefinedValue("SumAnnual").Value
+ lProcFluxTot += SubsetByDate(aBinaryData.DataSets.FindData("Location", LocationName).FindData("Constituent", "NO2-PROCFLUX-TOT")(0),
+ aSDateJ, aEDateJ, Nothing).Attributes.GetDefinedValue("SumAnnual").Value
+ Catch
+ End Try
+
+ End If
+
+ Dim lDiversion As Double = CalculateDiversion(aUCI, aBinaryData, lReach, lUpstreamInflows, lDownstreamReachID, lOutflow, lReachConstituent)
+ Dim lGENERLoad As Double = CalculateGENERLoad(aUCI, lReach, lReachConstituent, aSDateJ, aEDateJ)
Dim lMassBalance As Double = lTotalIn - lNPSLoad - lUpstreamIn - lPSLoad - lGENERLoad - lTotalAtmDep
For Each columnValue As DataColumn In Reach_Budget_Table.Columns
Dim ColumnName As String = columnValue.ColumnName
@@ -1422,15 +1517,24 @@ Public Module atcConstituentTables
row(ColumnName) = HspfTable.NumFmtRE(lNPSLoad, 10)
Case "PSLoad"
row(ColumnName) = HspfTable.NumFmtRE(lPSLoad, 10)
+ Case "GENERLoad"
+ row(ColumnName) = HspfTable.NumFmtRE(lGENERLoad, 10)
Case "Diversion"
row(ColumnName) = HspfTable.NumFmtRE(lDiversion, 10)
Case "MassBalance"
row(ColumnName) = HspfTable.NumFmtRE(lMassBalance, 10)
Case "UpstreamIn"
row(ColumnName) = HspfTable.NumFmtRE(lUpstreamIn, 10)
+ Case lReachConstituent & "-INTOT"
+ row(ColumnName) = HspfTable.NumFmtRE(lTotalIn, 10)
+ Case lReachConstituent & "-PROCFLUX-TOT"
+ row(ColumnName) = lProcFluxTot
+ Case lReachConstituent & "-OUTTOT"
+ row(ColumnName) = lOutflow
Case Else
row(ColumnName) = HspfTable.NumFmtRE(SubsetByDate(aBinaryData.DataSets.FindData("Location", LocationName).FindData("Constituent", ColumnName)(0),
aSDateJ, aEDateJ, Nothing).Attributes.GetDefinedValue("SumAnnual").Value, 10)
+
End Select
Next columnValue
@@ -1456,7 +1560,7 @@ Public Module atcConstituentTables
lReport.AppendLine(" " & aUCI.GlobalBlock.RunInf.Value)
lReport.AppendLine(" Run Made " & aRunMade)
lReport.AppendLine(" " & TimeSpanAsString(aSDateJ, aEDateJ, "Analysis Period: "))
- SaveFileString(aoutfoldername & aBalanceType & "_Reach_Budget.txt", lReport.ToString)
+ SaveFileString(aoutfoldername & lConstituent.ConstNameForEXPPlus & "_Reach_Budget.txt", lReport.ToString)
End If
Next lConstituent
#End Region
@@ -1523,9 +1627,9 @@ Public Module atcConstituentTables
Dim lTotalAtmDep As Double = SubsetByDate(aBinaryData.DataSets.FindData("Location", LocationName).FindData("Constituent", lReachConstituent & "-ATMDEPTOT")(0),
aSDateJ, aEDateJ, Nothing).Attributes.GetDefinedValue("SumAnnual").Value
- Dim lDiversion As Double = CalculateDiversion(lReach, lUpstreamInflows, lDownstreamReachID, lOutflow)
+ Dim lDiversion As Double = CalculateDiversion(aUCI, aBinaryData, lReach, lUpstreamInflows, lDownstreamReachID, lOutflow, lReachConstituent)
- Dim lGENERLoad As Double = CalculateGENERLoad(aUCI, lReach, aBalanceType, aSDateJ, aEDateJ)
+ Dim lGENERLoad As Double = CalculateGENERLoad(aUCI, lReach, lReachConstituent, aSDateJ, aEDateJ)
Dim lMassBalance As Double = lTotalIn - lNPSLoad - lUpstreamIn - lPSLoad - lGENERLoad - lTotalAtmDep
For Each columnValue As DataColumn In Reach_Budget_Table.Columns
Dim ColumnName As String = columnValue.ColumnName
@@ -1538,6 +1642,8 @@ Public Module atcConstituentTables
row(ColumnName) = HspfTable.NumFmtRE(lNPSLoad, 10)
Case "PSLoad"
row(ColumnName) = HspfTable.NumFmtRE(lPSLoad, 10)
+ Case "GENERLoad"
+ row(ColumnName) = HspfTable.NumFmtRE(lGENERLoad, 10)
Case "Diversion"
row(ColumnName) = HspfTable.NumFmtRE(lDiversion, 10)
Case "MassBalance"
@@ -1572,7 +1678,7 @@ Public Module atcConstituentTables
lReport.AppendLine(" " & aUCI.GlobalBlock.RunInf.Value)
lReport.AppendLine(" Run Made " & aRunMade)
lReport.AppendLine(" " & TimeSpanAsString(aSDateJ, aEDateJ, "Analysis Period: "))
- SaveFileString(aoutfoldername & aBalanceType & "_Reach_Budget.txt", lReport.ToString)
+ SaveFileString(aoutfoldername & lConstituent.ConstNameForEXPPlus & "_Reach_Budget.txt", lReport.ToString)
End If
Next lConstituent
#End Region
@@ -1585,7 +1691,7 @@ Public Module atcConstituentTables
Dim SelectExpression As String = ""
For Each lReachSource As HspfConnection In aReach.Sources
Try
- If lReachSource.Source.Opn Is Nothing Then Continue For
+ If lReachSource.Source.Opn Is Nothing OrElse lReachSource.Source.Opn.Name = "RCHRES" Then Continue For
'If Not ((lReachSource.Source.Opn.Name = "PERLND" AndAlso lReachSource.Source.Opn.Tables("ACTIVITY").Parms("PQALFG").Value = "1") OrElse
' (lReachSource.Source.Opn.Name = "IMPLND" AndAlso lReachSource.Source.Opn.Tables("ACTIVITY").Parms("IQALFG").Value = "1")) Then Continue For
Dim lConnectionArea As Double = lReachSource.MFact
@@ -1597,7 +1703,7 @@ Public Module atcConstituentTables
End If
Dim foundRows() As DataRow = Land_Constituent_Table.Select(SelectExpression)
- 'If foundRows.Length > 1 Then Stop
+ If foundRows.Length = 0 Then Continue For
NPSLoad += lConnectionArea * foundRows(0)("TotalOutflow")
Catch
End Try
@@ -1614,10 +1720,38 @@ Public Module atcConstituentTables
Case "DO"
For Each lSource As HspfPointSource In aReach.PointSources
If lSource.Target.Group = "INFLOW" AndAlso lSource.Target.Member = "OXIF" AndAlso lSource.Target.MemSub1 = 1 Then
+ Dim TimeSeriesTransformaton As String = lSource.Tran.ToString
+ Dim VolName As String = lSource.Source.VolName
+ Dim lDSN As Integer = lSource.Source.VolId
+ Dim lMfact As Double = lSource.MFact
+ Dim TransformationMultFact As Double = 0
+ For i As Integer = 0 To aUCI.FilesBlock.Count
+ If aUCI.FilesBlock.Value(i).Typ = VolName Then
+ Dim lFileName As String = AbsolutePath(aUCI.FilesBlock.Value(i).Name.Trim, CurDir())
+ Dim lDataSource As atcDataSource = atcDataManager.DataSourceBySpecification(lFileName)
+ If lDataSource Is Nothing Then
+ If atcDataManager.OpenDataSource(lFileName) Then
+ lDataSource = atcDataManager.DataSourceBySpecification(lFileName)
+ End If
+ End If
+ Dim ltimeseries As atcTimeseries = lDataSource.DataSets.FindData("ID", lDSN)(0)
+ ltimeseries = SubsetByDate(ltimeseries, aSDateJ, aEDateJ, Nothing)
+ TransformationMultFact = MultiFactorForPointSource(ltimeseries.Attributes.GetDefinedValue("Time Step").Value, ltimeseries.Attributes.GetDefinedValue("Time Unit").Value.ToString,
+ TimeSeriesTransformaton, aUCI.OpnSeqBlock.Delt)
+ PSLoad += ltimeseries.Attributes.GetDefinedValue("Sum").Value * lMfact * TransformationMultFact / YearCount(aSDateJ, aEDateJ)
+ End If
+ Next
+
+ End If
+ Next lSource
+ Case "BOD-Labile"
+ For Each lSource As HspfPointSource In aReach.PointSources
+ If lSource.Target.Group = "INFLOW" AndAlso lSource.Target.Member = "OXIF" AndAlso lSource.Target.MemSub1 = 2 Then
Dim TimeSeriesTransformaton As String = lSource.Tran.ToString
Dim VolName As String = lSource.Source.VolName
Dim lDSN As Integer = lSource.Source.VolId
Dim lMfact As Double = lSource.MFact
+ Dim TransformationMultFact As Double = 0
For i As Integer = 0 To aUCI.FilesBlock.Count
If aUCI.FilesBlock.Value(i).Typ = VolName Then
Dim lFileName As String = AbsolutePath(aUCI.FilesBlock.Value(i).Name.Trim, CurDir())
@@ -1629,9 +1763,10 @@ Public Module atcConstituentTables
End If
Dim ltimeseries As atcTimeseries = lDataSource.DataSets.FindData("ID", lDSN)(0)
ltimeseries = SubsetByDate(ltimeseries, aSDateJ, aEDateJ, Nothing)
- PSLoad += ltimeseries.Attributes.GetDefinedValue("Sum").Value * lMfact / YearCount(aSDateJ, aEDateJ)
- PSLoad *= MultiFactorForPointSource(ltimeseries.Attributes.GetDefinedValue("Time Step").Value, ltimeseries.Attributes.GetDefinedValue("Time Unit").Value.ToString,
- TimeSeriesTransformaton, aUCI.OpnSeqBlock.Delt)
+ TransformationMultFact = MultiFactorForPointSource(ltimeseries.Attributes.GetDefinedValue("Time Step").Value, ltimeseries.Attributes.GetDefinedValue("Time Unit").Value.ToString,
+ TimeSeriesTransformaton, aUCI.OpnSeqBlock.Delt)
+ PSLoad += ltimeseries.Attributes.GetDefinedValue("Sum").Value * lMfact * TransformationMultFact / YearCount(aSDateJ, aEDateJ)
+
End If
Next
@@ -1644,7 +1779,8 @@ Public Module atcConstituentTables
Dim TimeSeriesTransformaton As String = lSource.Tran.ToString
Dim VolName As String = lSource.Source.VolName
Dim lDSN As Integer = lSource.Source.VolId
- Dim lMfact As Double = lSource.MFact
+ Dim lMfact As Double = lSource.MFact
+ Dim TransformationMultFact As Double = 0
For i As Integer = 0 To aUCI.FilesBlock.Count
If aUCI.FilesBlock.Value(i).Typ = VolName Then
Dim lFileName As String = AbsolutePath(aUCI.FilesBlock.Value(i).Name.Trim, CurDir())
@@ -1656,9 +1792,9 @@ Public Module atcConstituentTables
End If
Dim ltimeseries As atcTimeseries = lDataSource.DataSets.FindData("ID", lDSN)(0)
ltimeseries = SubsetByDate(ltimeseries, aSDateJ, aEDateJ, Nothing)
- PSLoad += ltimeseries.Attributes.GetDefinedValue("Sum").Value * lMfact / YearCount(aSDateJ, aEDateJ)
- PSLoad *= MultiFactorForPointSource(ltimeseries.Attributes.GetDefinedValue("Time Step").Value, ltimeseries.Attributes.GetDefinedValue("Time Unit").Value.ToString,
- TimeSeriesTransformaton, aUCI.OpnSeqBlock.Delt)
+ TransformationMultFact = MultiFactorForPointSource(ltimeseries.Attributes.GetDefinedValue("Time Step").Value, ltimeseries.Attributes.GetDefinedValue("Time Unit").Value.ToString,
+ TimeSeriesTransformaton, aUCI.OpnSeqBlock.Delt)
+ PSLoad += ltimeseries.Attributes.GetDefinedValue("Sum").Value * lMfact * TransformationMultFact / YearCount(aSDateJ, aEDateJ)
End If
Next
@@ -1672,7 +1808,8 @@ Public Module atcConstituentTables
Dim TimeSeriesTransformaton As String = lSource.Tran.ToString
Dim VolName As String = lSource.Source.VolName
Dim lDSN As Integer = lSource.Source.VolId
- Dim lMfact As Double = lSource.MFact
+ Dim lMfact As Double = lSource.MFact
+ Dim TransformationMultFact As Double = 0
For i As Integer = 0 To aUCI.FilesBlock.Count
If aUCI.FilesBlock.Value(i).Typ = VolName Then
Dim lFileName As String = AbsolutePath(aUCI.FilesBlock.Value(i).Name.Trim, CurDir())
@@ -1684,9 +1821,9 @@ Public Module atcConstituentTables
End If
Dim ltimeseries As atcTimeseries = lDataSource.DataSets.FindData("ID", lDSN)(0)
ltimeseries = SubsetByDate(ltimeseries, aSDateJ, aEDateJ, Nothing)
- PSLoad += ltimeseries.Attributes.GetDefinedValue("Sum").Value * lMfact / YearCount(aSDateJ, aEDateJ)
- PSLoad *= MultiFactorForPointSource(ltimeseries.Attributes.GetDefinedValue("Time Step").Value, ltimeseries.Attributes.GetDefinedValue("Time Unit").Value.ToString,
- TimeSeriesTransformaton, aUCI.OpnSeqBlock.Delt)
+ TransformationMultFact = MultiFactorForPointSource(ltimeseries.Attributes.GetDefinedValue("Time Step").Value, ltimeseries.Attributes.GetDefinedValue("Time Unit").Value.ToString,
+ TimeSeriesTransformaton, aUCI.OpnSeqBlock.Delt)
+ PSLoad += ltimeseries.Attributes.GetDefinedValue("Sum").Value * lMfact * TransformationMultFact / YearCount(aSDateJ, aEDateJ)
End If
Next
@@ -1703,7 +1840,8 @@ Public Module atcConstituentTables
Dim TimeSeriesTransformaton As String = lSource.Tran.ToString
Dim VolName As String = lSource.Source.VolName
Dim lDSN As Integer = lSource.Source.VolId
- Dim lMfact As Double = lSource.MFact
+ Dim lMfact As Double = lSource.MFact
+ Dim TransformationMultFact As Double = 0
For i As Integer = 0 To aUCI.FilesBlock.Count
If aUCI.FilesBlock.Value(i).Typ = VolName Then
Dim lFileName As String = AbsolutePath(aUCI.FilesBlock.Value(i).Name.Trim, CurDir())
@@ -1715,9 +1853,9 @@ Public Module atcConstituentTables
End If
Dim ltimeseries As atcTimeseries = lDataSource.DataSets.FindData("ID", lDSN)(0)
ltimeseries = SubsetByDate(ltimeseries, aSDateJ, aEDateJ, Nothing)
- PSLoad += ltimeseries.Attributes.GetDefinedValue("Sum").Value * lMfact / YearCount(aSDateJ, aEDateJ)
- PSLoad *= MultiFactorForPointSource(ltimeseries.Attributes.GetDefinedValue("Time Step").Value, ltimeseries.Attributes.GetDefinedValue("Time Unit").Value.ToString,
- TimeSeriesTransformaton, aUCI.OpnSeqBlock.Delt)
+ TransformationMultFact = MultiFactorForPointSource(ltimeseries.Attributes.GetDefinedValue("Time Step").Value, ltimeseries.Attributes.GetDefinedValue("Time Unit").Value.ToString,
+ TimeSeriesTransformaton, aUCI.OpnSeqBlock.Delt)
+ PSLoad += ltimeseries.Attributes.GetDefinedValue("Sum").Value * lMfact * TransformationMultFact / YearCount(aSDateJ, aEDateJ)
End If
Next
@@ -1733,7 +1871,8 @@ Public Module atcConstituentTables
Dim TimeSeriesTransformaton As String = lSource.Tran.ToString
Dim VolName As String = lSource.Source.VolName
Dim lDSN As Integer = lSource.Source.VolId
- Dim lMfact As Double = lSource.MFact
+ Dim lMfact As Double = lSource.MFact
+ Dim TransformationMultFact As Double = 0
For i As Integer = 0 To aUCI.FilesBlock.Count
If aUCI.FilesBlock.Value(i).Typ = VolName Then
Dim lFileName As String = AbsolutePath(aUCI.FilesBlock.Value(i).Name.Trim, CurDir())
@@ -1745,9 +1884,9 @@ Public Module atcConstituentTables
End If
Dim ltimeseries As atcTimeseries = lDataSource.DataSets.FindData("ID", lDSN)(0)
ltimeseries = SubsetByDate(ltimeseries, aSDateJ, aEDateJ, Nothing)
- PSLoad += ltimeseries.Attributes.GetDefinedValue("Sum").Value * lMfact / YearCount(aSDateJ, aEDateJ)
- PSLoad *= MultiFactorForPointSource(ltimeseries.Attributes.GetDefinedValue("Time Step").Value, ltimeseries.Attributes.GetDefinedValue("Time Unit").Value.ToString,
- TimeSeriesTransformaton, aUCI.OpnSeqBlock.Delt)
+ TransformationMultFact = MultiFactorForPointSource(ltimeseries.Attributes.GetDefinedValue("Time Step").Value, ltimeseries.Attributes.GetDefinedValue("Time Unit").Value.ToString,
+ TimeSeriesTransformaton, aUCI.OpnSeqBlock.Delt)
+ PSLoad += ltimeseries.Attributes.GetDefinedValue("Sum").Value * lMfact * TransformationMultFact / YearCount(aSDateJ, aEDateJ)
End If
Next
@@ -1776,14 +1915,72 @@ Public Module atcConstituentTables
Return MultiFactor
End Function
- Private Function CalculateDiversion(ByVal aReach As HspfOperation, ByRef aUpstreamInflows As atcCollection,
- ByVal aDownstreamReachID As Integer, ByVal aOutflow As Double) As Double
+ Private Function CalculateDiversion(ByVal aUCI As HspfUci, ByVal aBinaryDataSource As atcDataSource, ByVal aReach As HspfOperation, ByRef aUpstreamInflows As atcCollection,
+ ByVal aDownstreamReachID As Integer, ByVal aOutflow As Double, ByVal aConstituent As String) As Double
Dim lDiversion As Double = 0.0
Try
If aReach.Tables("GEN-INFO").Parms("NEXITS").Value = 1 Then
- Logger.Dbg(aReach.Id)
- aUpstreamInflows.Increment(aDownstreamReachID, aOutflow)
+ 'Logger.Dbg(aReach.Id)
+ aUpstreamInflows.Increment(aDownstreamReachID, aOutflow)
+ Else
+ Dim lExitNUmber As Integer = 0
+ FindDownStreamExitNumber(aUCI, aReach, lExitNUmber)
+ Dim lExitFlowConstituent As String = ""
+ Dim lTotalOutFlow As Double = 0.0
+ Select Case aConstituent
+ Case "DO"
+ lExitFlowConstituent = "DOXOUT-EXIT" & lExitNUmber
+ lTotalOutFlow = (aBinaryDataSource.DataSets.FindData("Location", "R:" & aReach.Id).
+ FindData("Constituent", lExitFlowConstituent)(0).Attributes.GetDefinedValue("SumAnnual").Value)
+ lDiversion = aOutflow - lTotalOutFlow
+
+ Case "BOD-Labile"
+ lExitFlowConstituent = "BODOUT-EXIT" & lExitNUmber
+ lTotalOutFlow = (aBinaryDataSource.DataSets.FindData("Location", "R:" & aReach.Id).
+ FindData("Constituent", lExitFlowConstituent)(0).Attributes.GetDefinedValue("SumAnnual").Value)
+ lDiversion = aOutflow - lTotalOutFlow
+
+ Case "Heat"
+ lExitFlowConstituent = "OHEAT - EXIT-" & lExitNUmber
+ lTotalOutFlow = (aBinaryDataSource.DataSets.FindData("Location", "R:" & aReach.Id).
+ FindData("Constituent", lExitFlowConstituent)(0).Attributes.GetDefinedValue("SumAnnual").Value)
+ lDiversion = aOutflow - lTotalOutFlow
+
+
+ Case "NO3"
+
+ lExitFlowConstituent = "NO3-OUTDIS-EXIT" & lExitNUmber
+ lTotalOutFlow = (aBinaryDataSource.DataSets.FindData("Location", "R:" & aReach.Id).
+ FindData("Constituent", lExitFlowConstituent)(0).Attributes.GetDefinedValue("SumAnnual").Value)
+ lExitFlowConstituent = "NO2-OUTDIS-EXIT" & lExitNUmber
+ lTotalOutFlow += (aBinaryDataSource.DataSets.FindData("Location", "R:" & aReach.Id).
+ FindData("Constituent", lExitFlowConstituent)(0).Attributes.GetDefinedValue("SumAnnual").Value)
+ lDiversion = aOutflow - lTotalOutFlow
+
+ Case "TAM"
+
+ lExitFlowConstituent = "TAM-OUTDIS-EXIT" & lExitNUmber
+ lTotalOutFlow = (aBinaryDataSource.DataSets.FindData("Location", "R:" & aReach.Id).
+ FindData("Constituent", lExitFlowConstituent)(0).Attributes.GetDefinedValue("SumAnnual").Value)
+ lExitFlowConstituent = "TAM-OUTPART-TOT-EXIT" & lExitNUmber
+ lTotalOutFlow += (aBinaryDataSource.DataSets.FindData("Location", "R:" & aReach.Id).
+ FindData("Constituent", lExitFlowConstituent)(0).Attributes.GetDefinedValue("SumAnnual").Value)
+ lDiversion = aOutflow - lTotalOutFlow
+
+ Case "PO4"
+
+ lExitFlowConstituent = "PO4-OUTDIS-EXIT" & lExitNUmber
+ lTotalOutFlow = (aBinaryDataSource.DataSets.FindData("Location", "R:" & aReach.Id).
+ FindData("Constituent", lExitFlowConstituent)(0).Attributes.GetDefinedValue("SumAnnual").Value)
+ lExitFlowConstituent = "PO4-OUTPART-TOT-EXIT" & lExitNUmber
+ lTotalOutFlow += (aBinaryDataSource.DataSets.FindData("Location", "R:" & aReach.Id).
+ FindData("Constituent", lExitFlowConstituent)(0).Attributes.GetDefinedValue("SumAnnual").Value)
+ lDiversion = aOutflow - lTotalOutFlow
+
+ End Select
+ aUpstreamInflows.Increment(aDownstreamReachID, lTotalOutFlow)
End If
+
Catch ex As Exception
Logger.Msg("Trouble reading the parameters of RCHRES " & aReach.Id & ". Constituent Reports will not be generated.", MsgBoxStyle.Critical, "RCHRES Parameter Issue.")
Return Nothing
@@ -1796,96 +1993,237 @@ Public Module atcConstituentTables
ByVal aSDateJ As Double, ByVal aEDateJ As Double) As Double
Dim lGENERLoad As Double = 0.0
- Select Case aConstituentName
+ Select Case aConstituentName
+ Case "PO4"
+ lGENERLoad = 0
+ 'If aReach.Id = 157 Then Stop
+ For Each lSource As HspfConnection In aReach.Sources
+ Dim lGENERSum As Double = 0.0
+ Dim lMfact As Double = 0.0
+ If lSource.Source.VolName = "GENER" Then
+ Dim lGENEROperationisOutputtoWDM As Boolean = False
+ With GetGENERSum(aUCI, lSource, aSDateJ, aEDateJ)
+ lGENERSum = .Item1
+ lGENEROperationisOutputtoWDM = .Item2
+ End With
+ If lSource.MassLink > 0 Then
+ lGENERSum *= lSource.MFact
+ For Each lMassLink As HspfMassLink In aUCI.MassLinks
+ If lMassLink.MassLinkId = lSource.MassLink AndAlso lMassLink.Target.Member = "NUIF1" AndAlso lMassLink.Target.MemSub1 = 4 Then
+ lGENERSum *= lMassLink.MFact
+ lGENERLoad += lGENERSum
+ Exit For
+ End If
+ Next lMassLink
+ ElseIf lSource.Target.Group = "INFLOW" AndAlso lSource.Target.Member = "NUIF1" AndAlso lSource.Target.MemSub1 = 4 Then
+ lGENERSum *= lSource.MFact
+ lGENERLoad += lGENERSum
+ End If
+ If Not lGENEROperationisOutputtoWDM Then
+ Logger.Dbg("GENER Loadings Issue: The RCHRES operation " & aReach.Id & " has loadings input for the constituent " & aConstituentName & " from GENER connections in the Network Block. Please make sure that these GENER operations output to a WDM dataset for accurate source accounting.")
+ End If
+ End If
+
+ Next lSource
+ Case "TAM"
+ lGENERLoad = 0
+ 'If aReach.Id = 157 Then Stop
+ For Each lSource As HspfConnection In aReach.Sources
+ Dim lGENERSum As Double = 0.0
+ Dim lMfact As Double = 0.0
+ If lSource.Source.VolName = "GENER" Then
+ Dim lGENEROperationisOutputtoWDM As Boolean = False
+ With GetGENERSum(aUCI, lSource, aSDateJ, aEDateJ)
+ lGENERSum = .Item1
+ lGENEROperationisOutputtoWDM = .Item2
+ End With
+ If lSource.MassLink > 0 Then
+ lGENERSum *= lSource.MFact
+ For Each lMassLink As HspfMassLink In aUCI.MassLinks
+ If lMassLink.MassLinkId = lSource.MassLink AndAlso lMassLink.Target.Member = "NUIF1" AndAlso lMassLink.Target.MemSub1 = 2 Then
+ lGENERSum *= lMassLink.MFact
+ lGENERLoad += lGENERSum
+ Exit For
+ End If
+ Next lMassLink
+ ElseIf lSource.Target.Group = "INFLOW" AndAlso lSource.Target.Member = "NUIF1" AndAlso lSource.Target.MemSub1 = 2 Then
+ lGENERSum *= lSource.MFact
+ lGENERLoad += lGENERSum
+ End If
+ If Not lGENEROperationisOutputtoWDM Then
+ Logger.Dbg("GENER Loadings Issue: The RCHRES operation " & aReach.Id & " has loadings input for the constituent " & aConstituentName & " from GENER connections in the Network Block. Please make sure that these GENER operations output to a WDM dataset for accurate source accounting.")
+ End If
+ End If
+
+ Next lSource
+ Case "NO3"
+ lGENERLoad = 0
+ 'If aReach.Id = 157 Then Stop
+ For Each lSource As HspfConnection In aReach.Sources
+ Dim lGENERSum As Double = 0.0
+ Dim lMfact As Double = 0.0
+ If lSource.Source.VolName = "GENER" Then
+ Dim lGENEROperationisOutputtoWDM As Boolean = False
+ With GetGENERSum(aUCI, lSource, aSDateJ, aEDateJ)
+ lGENERSum = .Item1
+ lGENEROperationisOutputtoWDM = .Item2
+ End With
+ If lSource.MassLink > 0 Then
+ lGENERSum *= lSource.MFact
+ For Each lMassLink As HspfMassLink In aUCI.MassLinks
+ If lMassLink.MassLinkId = lSource.MassLink AndAlso lMassLink.Target.Member = "NUIF1" AndAlso lMassLink.Target.MemSub1 = 1 Then
+ lGENERSum *= lMassLink.MFact
+ lGENERLoad += lGENERSum
+ ElseIf lMassLink.MassLinkId = lSource.MassLink AndAlso lMassLink.Target.Member = "NUIF1" AndAlso lMassLink.Target.MemSub1 = 3 Then
+ lGENERSum *= lMassLink.MFact
+ lGENERLoad += lGENERSum
+ End If
+ Next lMassLink
+ ElseIf lSource.Target.Group = "INFLOW" AndAlso lSource.Target.Member = "NUIF1" AndAlso lSource.Target.MemSub1 = 1 Then
+ lGENERSum *= lSource.MFact
+ lGENERLoad += lGENERSum
+ ElseIf lSource.Target.Group = "INFLOW" AndAlso lSource.Target.Member = "NUIF1" AndAlso lSource.Target.MemSub1 = 3 Then
+ lGENERSum *= lSource.MFact
+ lGENERLoad += lGENERSum
+ End If
+ If Not lGENEROperationisOutputtoWDM Then
+ Logger.Dbg("GENER Loadings Issue: The RCHRES operation " & aReach.Id & " has loadings input for the constituent " & aConstituentName & " from GENER connections in the Network Block. Please make sure that these GENER operations output to a WDM dataset for accurate source accounting.")
+ End If
+ End If
+
+ Next lSource
Case "Heat"
- For Each lSource As HspfConnection In aReach.Sources
- If lSource.Source.VolName = "GENER" AndAlso lSource.Target.Group = "INFLOW" AndAlso lSource.Target.Member = "IHEAT" Then
-
- Dim lGENERID As Integer = lSource.Source.VolId
- Dim lMfact As Double = lSource.MFact
- Dim lGENEROperationisOutputtoWDM As Boolean = False
- Dim lGENEROperation As HspfOperation = lSource.Source.Opn
- For Each EXTTarget As HspfConnection In lGENEROperation.Targets
-
- If EXTTarget.Target.VolName.Contains("WDM") Then
- lGENEROperationisOutputtoWDM = True
- Dim lWDMFile As String = EXTTarget.Target.VolName.ToString
- Dim lDSN As Integer = EXTTarget.Target.VolId
-
- For i As Integer = 0 To aUCI.FilesBlock.Count
-
- If aUCI.FilesBlock.Value(i).Typ = lWDMFile Then
- Dim lFileName As String = AbsolutePath(aUCI.FilesBlock.Value(i).Name.Trim, CurDir())
- Dim lDataSource As atcDataSource = atcDataManager.DataSourceBySpecification(lFileName)
- If lDataSource Is Nothing Then
- If atcDataManager.OpenDataSource(lFileName) Then
- lDataSource = atcDataManager.DataSourceBySpecification(lFileName)
- End If
- End If
- Dim ltimeseries As atcTimeseries = lDataSource.DataSets.FindData("ID", lDSN)(0)
- ltimeseries = SubsetByDate(ltimeseries, aSDateJ, aEDateJ, Nothing)
- lGENERLoad += ltimeseries.Attributes.GetDefinedValue("Sum").Value * lMfact / YearCount(aSDateJ, aEDateJ)
-
- End If
- Next
-
- End If
-
- Next EXTTarget
+ lGENERLoad = 0
+ 'If aReach.Id = 157 Then Stop
+ For Each lSource As HspfConnection In aReach.Sources
+ Dim lGENERSum As Double = 0.0
+ Dim lMfact As Double = 0.0
+ If lSource.Source.VolName = "GENER" Then
+ Dim lGENEROperationisOutputtoWDM As Boolean = False
+ With GetGENERSum(aUCI, lSource, aSDateJ, aEDateJ)
+ lGENERSum = .Item1
+ lGENEROperationisOutputtoWDM = .Item2
+ End With
+ If lSource.MassLink > 0 Then
+ lGENERSum *= lSource.MFact
+ For Each lMassLink As HspfMassLink In aUCI.MassLinks
+ If lMassLink.MassLinkId = lSource.MassLink AndAlso lMassLink.Target.Member = "IHEAT" Then
+ lGENERSum *= lMassLink.MFact
+ lGENERLoad += lGENERSum
+ Exit For
+ End If
+ Next lMassLink
+ ElseIf lSource.Target.Group = "INFLOW" AndAlso lSource.Target.Member = "IHEAT" Then
+ lGENERSum *= lSource.MFact
+ lGENERLoad += lGENERSum
+ End If
If Not lGENEROperationisOutputtoWDM Then
- Logger.Dbg("GENER Loadings Issue: The RCHRES operation " & aReach.Id & " has loadings input for the constituent " & aConstituentName & " from GENER connections in the Network Block. Please make sure that these GENER operations output to a WDM dataset for accurate source accounting.")
-
-
- End If
-
- End If
- Next lSource
-
+ Logger.Dbg("GENER Loadings Issue: The RCHRES operation " & aReach.Id & " has loadings input for the constituent " & aConstituentName & " from GENER connections in the Network Block. Please make sure that these GENER operations output to a WDM dataset for accurate source accounting.")
+ End If
+ End If
+
+ Next lSource
+ Case "DO"
+ lGENERLoad = 0
+ 'If aReach.Id = 157 Then Stop
+ For Each lSource As HspfConnection In aReach.Sources
+ Dim lGENERSum As Double = 0.0
+ Dim lMfact As Double = 0.0
+ If lSource.Source.VolName = "GENER" Then
+ Dim lGENEROperationisOutputtoWDM As Boolean = False
+ With GetGENERSum(aUCI, lSource, aSDateJ, aEDateJ)
+ lGENERSum = .Item1
+ lGENEROperationisOutputtoWDM = .Item2
+ End With
+ If lSource.MassLink > 0 Then
+ lGENERSum *= lSource.MFact
+ For Each lMassLink As HspfMassLink In aUCI.MassLinks
+ If lMassLink.MassLinkId = lSource.MassLink AndAlso lMassLink.Target.Member = "OXIF" AndAlso lMassLink.Target.MemSub1 = 1 Then
+ lGENERSum *= lMassLink.MFact
+ lGENERLoad += lGENERSum
+ Exit For
+ End If
+ Next lMassLink
+ ElseIf lSource.Target.Group = "INFLOW" AndAlso lSource.Target.Member = "OXIF" AndAlso lSource.Target.MemSub1 = 1 Then
+ lGENERSum *= lSource.MFact
+ lGENERLoad += lGENERSum
+ End If
+ If Not lGENEROperationisOutputtoWDM Then
+ Logger.Dbg("GENER Loadings Issue: The RCHRES operation " & aReach.Id & " has loadings input for the constituent " & aConstituentName & " from GENER connections in the Network Block. Please make sure that these GENER operations output to a WDM dataset for accurate source accounting.")
+ End If
+ End If
+
+ Next lSource
+ Case "BOD-Labile"
+ lGENERLoad = 0
+ 'If aReach.Id = 157 Then Stop
+ For Each lSource As HspfConnection In aReach.Sources
+ Dim lGENERSum As Double = 0.0
+ Dim lMfact As Double = 0.0
+ If lSource.Source.VolName = "GENER" Then
+ Dim lGENEROperationisOutputtoWDM As Boolean = False
+ With GetGENERSum(aUCI, lSource, aSDateJ, aEDateJ)
+ lGENERSum = .Item1
+ lGENEROperationisOutputtoWDM = .Item2
+ End With
+ If lSource.MassLink > 0 Then
+ lGENERSum *= lSource.MFact
+ For Each lMassLink As HspfMassLink In aUCI.MassLinks
+ If lMassLink.MassLinkId = lSource.MassLink AndAlso lMassLink.Target.Member = "OXIF" AndAlso lMassLink.Target.MemSub1 = 2 Then
+ lGENERSum *= lMassLink.MFact
+ lGENERLoad += lGENERSum
+ Exit For
+ End If
+ Next lMassLink
+ ElseIf lSource.Target.Group = "INFLOW" AndAlso lSource.Target.Member = "OXIF" AndAlso lSource.Target.MemSub1 = 2 Then
+ lGENERSum *= lSource.MFact
+ lGENERLoad += lGENERSum
+ End If
+ If Not lGENEROperationisOutputtoWDM Then
+ Logger.Dbg("GENER Loadings Issue: The RCHRES operation " & aReach.Id & " has loadings input for the constituent " & aConstituentName & " from GENER connections in the Network Block. Please make sure that these GENER operations output to a WDM dataset for accurate source accounting.")
+ End If
+ End If
+
+ Next lSource
+
Case "Sediment"
- For Each lSource As HspfConnection In aReach.Sources
- If lSource.Source.VolName = "GENER" AndAlso lSource.Target.Group = "INFLOW" AndAlso lSource.Target.Member = "ISED" Then
-
- Dim lGENERID As Integer = lSource.Source.VolId
- Dim lMfact As Double = lSource.MFact
- Dim lGENEROperationisOutputtoWDM As Boolean = False
- Dim lGENEROperation As HspfOperation = lSource.Source.Opn
- For Each EXTTarget As HspfConnection In lGENEROperation.Targets
-
- If EXTTarget.Target.VolName.Contains("WDM") Then
- lGENEROperationisOutputtoWDM = True
- Dim lWDMFile As String = EXTTarget.Target.VolName.ToString
- Dim lDSN As Integer = EXTTarget.Target.VolId
- For i As Integer = 0 To aUCI.FilesBlock.Count
- If aUCI.FilesBlock.Value(i).Typ = lWDMFile Then
- Dim lFileName As String = AbsolutePath(aUCI.FilesBlock.Value(i).Name.Trim, CurDir())
- Dim lDataSource As atcDataSource = atcDataManager.DataSourceBySpecification(lFileName)
- If lDataSource Is Nothing Then
- If atcDataManager.OpenDataSource(lFileName) Then
- lDataSource = atcDataManager.DataSourceBySpecification(lFileName)
- End If
- End If
- Dim ltimeseries As atcTimeseries = lDataSource.DataSets.FindData("ID", lDSN)(0)
- ltimeseries = SubsetByDate(ltimeseries, aSDateJ, aEDateJ, Nothing)
- lGENERLoad += ltimeseries.Attributes.GetDefinedValue("Sum").Value * lMfact / YearCount(aSDateJ, aEDateJ)
-
- End If
- Next
-
- End If
- Next EXTTarget
+ lGENERLoad = 0
+ 'If aReach.Id = 157 Then Stop
+ For Each lSource As HspfConnection In aReach.Sources
+ Dim lGENERSum As Double = 0.0
+ Dim lMfact As Double = 0.0
+ If lSource.Source.VolName = "GENER" Then
+ Dim lGENEROperationisOutputtoWDM As Boolean = False
+ With GetGENERSum(aUCI, lSource, aSDateJ, aEDateJ)
+ lGENERSum = .Item1
+ lGENEROperationisOutputtoWDM = .Item2
+ End With
+ If lSource.MassLink > 0 Then
+ lGENERSum *= lSource.MFact
+ For Each lMassLink As HspfMassLink In aUCI.MassLinks
+ If lMassLink.MassLinkId = lSource.MassLink AndAlso lMassLink.Target.Member = "ISED" Then
+ lGENERSum *= lMassLink.MFact
+ lGENERLoad += lGENERSum
+ Exit For
+ End If
+ Next lMassLink
+ ElseIf lSource.Target.Group = "INFLOW" AndAlso lSource.Target.Member = "ISED" Then
+ lGENERSum *= lSource.MFact
+ lGENERLoad += lGENERSum
+ End If
If Not lGENEROperationisOutputtoWDM Then
- Logger.Dbg("GENER Loadings Issue: The RCHRES operation " & aReach.Id & " has loadings input for the constituent " & aConstituentName & " from GENER connections in the Network Block. Please make sure that these GENER operations output to a WDM dataset for accurate source accounting.")
-
-
- End If
+ Logger.Dbg("GENER Loadings Issue: The RCHRES operation " & aReach.Id & " has loadings input for the constituent " & aConstituentName & " from GENER connections in the Network Block. Please make sure that these GENER operations output to a WDM dataset for accurate source accounting.")
+ End If
+ End If
+
+ Next lSource
- End If
- Next lSource
End Select
Return lGENERLoad
- End Function
+ End Function
+
Private Function AddFirstSixColumnsReachBudget(ByRef aDataTable As Data.DataTable, ByRef aUnits As String) As DataTable
Dim column As DataColumn
column = New DataColumn()
@@ -1910,20 +2248,28 @@ Public Module atcConstituentTables
column.DataType = Type.GetType("System.Double")
column.ColumnName = "PSLoad"
column.Caption = "Point Source Loads (" & aUnits & ")"
- aDataTable.Columns.Add(column)
-
+ aDataTable.Columns.Add(column)
+
column = New DataColumn()
column.DataType = Type.GetType("System.Double")
- column.ColumnName = "Diversion"
- column.Caption = "Diversion (" & aUnits & ")"
- aDataTable.Columns.Add(column)
-
+ column.ColumnName = "GENERLoad"
+ column.Caption = "GENER Loads (" & aUnits & ")"
+ aDataTable.Columns.Add(column)
+
column = New DataColumn()
column.DataType = Type.GetType("System.Double")
column.ColumnName = "MassBalance"
column.Caption = "Mass Balance (" & aUnits & ")"
- aDataTable.Columns.Add(column)
-
+ aDataTable.Columns.Add(column)
+
+ column = New DataColumn()
+ column.DataType = Type.GetType("System.Double")
+ column.ColumnName = "Diversion"
+ column.Caption = "Diversion (" & aUnits & ")"
+ aDataTable.Columns.Add(column)
+
+
+
column = New DataColumn()
column.DataType = Type.GetType("System.Double")
column.ColumnName = "UpstreamIn"
diff --git a/atcHspfSupport/atcHspfConstituentBudget.vb b/atcHspfSupport/atcHspfConstituentBudget.vb
index f094bb4cb..85137af52 100644
--- a/atcHspfSupport/atcHspfConstituentBudget.vb
+++ b/atcHspfSupport/atcHspfConstituentBudget.vb
@@ -223,17 +223,18 @@ Public Module ConstituentBudget
For Each lID As HspfOperation In lRchresOperations
+
+ Dim lTotalPointVol As Double = 0.0
.CurrentRecord += 1
- Dim lPointVol As Double = 0.0
For Each lSource As HspfPointSource In lID.PointSources
If lSource.Target.Group = "INFLOW" AndAlso lSource.Target.Member = "IVOL" Then
+ Dim lPointVol As Double = 0.0
Dim TimeSeriesTransformaton As String = lSource.Tran.ToString
Dim VolName As String = lSource.Source.VolName
Dim lDSN As Integer = lSource.Source.VolId
Dim lMfact As Double = lSource.MFact
For i As Integer = 0 To aUci.FilesBlock.Count
- Dim lPointSourceLoad As Double = 0.0
If aUci.FilesBlock.Value(i).Typ = VolName Then
Dim lFileName As String = AbsolutePath(aUci.FilesBlock.Value(i).Name.Trim, CurDir())
Dim lDataSource As atcDataSource = atcDataManager.DataSourceBySpecification(lFileName)
@@ -244,57 +245,45 @@ Public Module ConstituentBudget
End If
Dim ltimeseries As atcTimeseries = lDataSource.DataSets.FindData("ID", lDSN)(0)
ltimeseries = SubsetByDate(ltimeseries, aSDateJ, aEDateJ, Nothing)
- lPointSourceLoad = ltimeseries.Attributes.GetDefinedValue("Sum").Value * lMfact / YearsOfSimulation
- lPointSourceLoad *= MultiFactorForPointSource(ltimeseries.Attributes.GetDefinedValue("Time Step").Value, ltimeseries.Attributes.GetDefinedValue("Time Unit").Value.ToString,
- TimeSeriesTransformaton, aUci.OpnSeqBlock.Delt)
- lPointVol += lPointSourceLoad
+ lPointVol += ltimeseries.Attributes.GetDefinedValue("Sum").Value * lMfact / YearsOfSimulation
+ lPointVol *= MultiFactorForPointSource(ltimeseries.Attributes.GetDefinedValue("Time Step").Value, ltimeseries.Attributes.GetDefinedValue("Time Unit").Value.ToString,
+ TimeSeriesTransformaton, aUci.OpnSeqBlock.Delt)
End If
Next
+ lTotalPointVol += lPointVol
End If
- Next lSource
+ Next
+
Dim lGENERLoad As Double = 0.0
For Each lSource As HspfConnection In lID.Sources
- If lSource.Source.VolName = "GENER" AndAlso lSource.Target.Member = "IVOL" Then
-
- Dim lGENERID As Integer = lSource.Source.VolId
- Dim lMfact As Double = lSource.MFact
+ Dim lGENERTSSum As Double = 0.0
+ Dim lMfact As Double = 0.0
+ If lSource.Source.VolName = "GENER" Then
Dim lGENEROperationisOutputtoWDM As Boolean = False
- Dim lGENEROperation As HspfOperation = lSource.Source.Opn
- For Each EXTTarget As HspfConnection In lGENEROperation.Targets
-
- If EXTTarget.Target.VolName.Contains("WDM") Then
- lGENEROperationisOutputtoWDM = True
- Dim lWDMFile As String = EXTTarget.Target.VolName.ToString
- Dim lDSN As Integer = EXTTarget.Target.VolId
-
- For i As Integer = 0 To aUci.FilesBlock.Count
- Dim lGENERSourceLoad As Double = 0.0
- If aUci.FilesBlock.Value(i).Typ = lWDMFile Then
- Dim lFileName As String = AbsolutePath(aUci.FilesBlock.Value(i).Name.Trim, CurDir())
- Dim lDataSource As atcDataSource = atcDataManager.DataSourceBySpecification(lFileName)
- If lDataSource Is Nothing Then
- If atcDataManager.OpenDataSource(lFileName) Then
- lDataSource = atcDataManager.DataSourceBySpecification(lFileName)
- End If
- End If
- Dim ltimeseries As atcTimeseries = lDataSource.DataSets.FindData("ID", lDSN)(0)
- ltimeseries = SubsetByDate(ltimeseries, aSDateJ, aEDateJ, Nothing)
- lGENERSourceLoad = ltimeseries.Attributes.GetDefinedValue("Sum").Value * lMfact / YearsOfSimulation
- lGENERLoad += lGENERSourceLoad
-
- End If
- Next
-
- End If
-
- Next EXTTarget
- If Not lGENEROperationisOutputtoWDM Then 'AndAlso Not lGENERInNetworkBlockMessageShown Then
- Logger.Dbg("GENER Loadings Issue: Some RCHRES operation have loadings input from GENER connections in the Network Block.
- Please make sure that these GENER operations output to a WDM dataset for accurate source accounting." & aBalanceType)
- 'lGENERInNetworkBlockMessageShown = True
+ With GetGENERSum(aUci, lSource, aSDateJ, aEDateJ)
+ lGENERTSSum = .Item1
+ lGENEROperationisOutputtoWDM = .Item2
+ End With
+ If lSource.MassLink > 0 Then
+ lGENERTSSum *= lSource.MFact 'Multiplying with MFact in Schematic Block
+ For Each lMassLink As HspfMassLink In aUci.MassLinks
+ Dim GENERMassLinkMFact As Double = 0
+ If lMassLink.MassLinkId = lSource.MassLink AndAlso lMassLink.Target.Member = "IVOL" Then
+ GENERMassLinkMFact = lMassLink.MFact
+ lMfact += GENERMassLinkMFact
+ End If
+ Next lMassLink
+ lGENERTSSum *= lMfact
+ lGENERLoad += lGENERTSSum
+ ElseIf lSource.Target.Group = "INFLOW" AndAlso lSource.Target.Member = "IVOL" Then
+ Dim lGENERTSSourceMFact As Double = lSource.MFact
+ lGENERTSSum *= lGENERTSSourceMFact
+ lGENERLoad += lGENERTSSum
+ End If
+ If Not lGENEROperationisOutputtoWDM Then
+ Logger.Dbg("GENER Loadings Issue: The RCHRES operation " & lID.Id & " has loadings input for the constituent " & aBalanceType & " from GENER connections in the Network Block. Please make sure that these GENER operations output to a WDM dataset for accurate source accounting.")
End If
-
End If
Next lSource
@@ -316,14 +305,14 @@ Public Module ConstituentBudget
lUpstreamInflows.Increment(lDownstreamReachID, lOutflow)
Else
Dim lExitOutFlow As atcTimeseries = aScenarioResults.DataSets.FindData("Location", "R:" & lID.Id).FindData("Constituent", "OVOL-" & lExitNumber)(0)
- lDiversion = -(lOutflow - lExitOutFlow.Attributes.GetValue("SumAnnual"))
- lOutflow = lExitOutFlow.Attributes.GetValue("SumAnnual")
+ lDiversion = -(lOutflow - lExitOutFlow.Attributes.GetDefinedValue("SumAnnual").Value)
+ lOutflow = lExitOutFlow.Attributes.GetDefinedValue("SumAnnual").Value
lUpstreamInflows.Increment(lDownstreamReachID, lOutflow)
End If
End If
- With ConstituentLoadingByLanduse(aUci, lID, aBalanceType, lNonpointData, 0.0, lPointVol, lGENERLoad, 0.0, 0.0,
+ With ConstituentLoadingByLanduse(aUci, lID, aBalanceType, lNonpointData, 0.0, lTotalPointVol, lGENERLoad, 0.0, 0.0,
lTotalInflow, lUpstreamIn, lDiversion, aSDateJ, aEDateJ, aConstProperties)
lReport2.Append(.Item1)
lNonpointVol = .Item2
@@ -335,8 +324,8 @@ Public Module ConstituentBudget
Dim lEvapLoss As Double = ValueForReach(lID, lEvapLossData)
Dim lAdditionalSource As Double = 0.0
- lAdditionalSource = lTotalInflow - lNonpointVol - lUpstreamIn - lPointVol - lGENERLoad
- Dim lCumulativePointNonpoint As Double = lNonpointVol + lPointVol + lAdditionalSource
+ lAdditionalSource = lTotalInflow - lNonpointVol - lUpstreamIn - lTotalPointVol - lGENERLoad
+ Dim lCumulativePointNonpoint As Double = lNonpointVol + lTotalPointVol + lAdditionalSource
If lCumulativePointNonpointColl.Keys.Contains(lID.Id) Then
lCumulativePointNonpoint += lCumulativePointNonpointColl.ItemByKey(lID.Id)
End If
@@ -360,7 +349,7 @@ Public Module ConstituentBudget
lField = 0
lField += 1 : .Value(lField) = lID.Name & " " & lID.Id & " - " & lID.Description
lField += 1 : .Value(lField) = DoubleToString(lNonpointVol, , lNumberFormat,,, lNumberOfSignificantDigits)
- lField += 1 : .Value(lField) = DoubleToString(lPointVol, , lNumberFormat,,, lNumberOfSignificantDigits)
+ lField += 1 : .Value(lField) = DoubleToString(lTotalPointVol, , lNumberFormat,,, lNumberOfSignificantDigits)
If pGENERLoadingExists Then
lField += 1 : .Value(lField) = DoubleToString(lGENERLoad, , lNumberFormat,,, lNumberOfSignificantDigits)
@@ -416,11 +405,12 @@ Public Module ConstituentBudget
End If
If lID.Tables("ACTIVITY").Parms("SEDFG").Value = 1 Then
- Dim lPointTons As Double = 0.0
+ Dim lTotalPointTons As Double = 0.0
.CurrentRecord += 1
- 'If lID.Id = 610 Then Stop
+
For Each lSource As HspfPointSource In lID.PointSources
If lSource.Target.Group = "INFLOW" AndAlso lSource.Target.Member = "ISED" Then
+ Dim lPointTons As Double = 0.0
Dim TimeSeriesTransformaton As String = lSource.Tran.ToString
Dim VolName As String = lSource.Source.VolName
Dim lDSN As Integer = lSource.Source.VolId
@@ -438,54 +428,44 @@ Public Module ConstituentBudget
ltimeseries = SubsetByDate(ltimeseries, aSDateJ, aEDateJ, Nothing)
lPointTons += ltimeseries.Attributes.GetDefinedValue("Sum").Value * lMfact / YearsOfSimulation
lPointTons *= MultiFactorForPointSource(ltimeseries.Attributes.GetDefinedValue("Time Step").Value, ltimeseries.Attributes.GetDefinedValue("Time Unit").Value.ToString,
- TimeSeriesTransformaton, aUci.OpnSeqBlock.Delt)
+ TimeSeriesTransformaton, aUci.OpnSeqBlock.Delt)
End If
Next
-
+ lTotalPointTons += lPointTons
End If
- Next lSource
+ Next
Dim lGENERLoad As Double = 0.0
- For Each lSource As HspfConnection In lID.Sources
- If lSource.Source.VolName = "GENER" AndAlso lSource.Target.Group = "INFLOW" AndAlso lSource.Target.Member = "ISED" Then
- Dim lGENERID As Integer = lSource.Source.VolId
- Dim lMfact As Double = lSource.MFact
+ For Each lSource As HspfConnection In lID.Sources
+ Dim lGENERTSSum As Double = 0.0
+ Dim lMfact As Double = 0.0
+ If lSource.Source.VolName = "GENER" Then
Dim lGENEROperationisOutputtoWDM As Boolean = False
- Dim lGENEROperation As HspfOperation = lSource.Source.Opn
- For Each EXTTarget As HspfConnection In lGENEROperation.Targets
-
- If EXTTarget.Target.VolName.Contains("WDM") Then
- lGENEROperationisOutputtoWDM = True
- Dim lWDMFile As String = EXTTarget.Target.VolName.ToString
- Dim lDSN As Integer = EXTTarget.Target.VolId
-
- For i As Integer = 0 To aUci.FilesBlock.Count
-
- If aUci.FilesBlock.Value(i).Typ = lWDMFile Then
- Dim lFileName As String = AbsolutePath(aUci.FilesBlock.Value(i).Name.Trim, CurDir())
- Dim lDataSource As atcDataSource = atcDataManager.DataSourceBySpecification(lFileName)
- If lDataSource Is Nothing Then
- If atcDataManager.OpenDataSource(lFileName) Then
- lDataSource = atcDataManager.DataSourceBySpecification(lFileName)
- End If
- End If
- Dim ltimeseries As atcTimeseries = lDataSource.DataSets.FindData("ID", lDSN)(0)
- ltimeseries = SubsetByDate(ltimeseries, aSDateJ, aEDateJ, Nothing)
- lGENERLoad += ltimeseries.Attributes.GetDefinedValue("Sum").Value * lMfact / YearsOfSimulation
+ With GetGENERSum(aUci, lSource, aSDateJ, aEDateJ)
+ lGENERTSSum = .Item1
+ lGENEROperationisOutputtoWDM = .Item2
+ End With
+ If lSource.MassLink > 0 Then
+ lGENERTSSum *= lSource.MFact 'Multiplying with MFact in Schematic Block
+ For Each lMassLink As HspfMassLink In aUci.MassLinks
+ Dim GENERMassLinkMFact As Double = 0
+ If lMassLink.MassLinkId = lSource.MassLink AndAlso lMassLink.Target.Member = "ISED" Then
+ GENERMassLinkMFact = lMassLink.MFact
+ lMfact += GENERMassLinkMFact
- End If
- Next
-
- End If
-
- Next EXTTarget
- If Not lGENEROperationisOutputtoWDM Then 'AndAlso Not lGENERInNetworkBlockMessageShown Then
- Logger.Dbg("GENER Loadings Issue: Some RCHRES operation have loadings input from GENER connections in the Network Block.
- Please make sure that these GENER operations output to a WDM dataset for accurate source accounting." & aBalanceType)
- 'lGENERInNetworkBlockMessageShown = True
+ End If
+ Next lMassLink
+ lGENERTSSum *= lMfact
+ lGENERLoad += lGENERTSSum
+ ElseIf lSource.Target.Group = "INFLOW" AndAlso lSource.Target.Member = "ISED" Then
+ Dim lGENERTSSourceMFact As Double = lSource.MFact
+ lGENERTSSum *= lGENERTSSourceMFact
+ lGENERLoad += lGENERTSSum
+ End If
+ If Not lGENEROperationisOutputtoWDM Then
+ Logger.Dbg("GENER Loadings Issue: The RCHRES operation " & lID.Id & " has loadings input for the constituent " & aBalanceType & " from GENER connections in the Network Block. Please make sure that these GENER operations output to a WDM dataset for accurate source accounting.")
End If
-
End If
Next lSource
@@ -513,8 +493,8 @@ Public Module ConstituentBudget
lUpstreamInflows.Increment(lDownstreamReachID, lOutflow)
Else
Dim lExitOutFlow As atcTimeseries = aScenarioResults.DataSets.FindData("Location", "R:" & lID.Id).FindData("Constituent", "OSED-TOT-EXIT" & lExitNumber)(0)
- lDiversion = -(lOutflow - lExitOutFlow.Attributes.GetValue("SumAnnual"))
- lOutflow = lExitOutFlow.Attributes.GetValue("SumAnnual")
+ lDiversion = -(lOutflow - lExitOutFlow.Attributes.GetDefinedValue("SumAnnual").Value)
+ lOutflow = lExitOutFlow.Attributes.GetDefinedValue("SumAnnual").Value
lUpstreamInflows.Increment(lDownstreamReachID, lOutflow)
End If
@@ -525,7 +505,7 @@ Public Module ConstituentBudget
End Try
- With ConstituentLoadingByLanduse(aUci, lID, aBalanceType, lNonpointData, 0.0, lPointTons, lGENERLoad, 0.0, -lDepScour, lTotalInflow, lUpstreamIn,
+ With ConstituentLoadingByLanduse(aUci, lID, aBalanceType, lNonpointData, 0.0, lTotalPointTons, lGENERLoad, 0.0, -lDepScour, lTotalInflow, lUpstreamIn,
lDiversion, aSDateJ, aEDateJ, aConstProperties)
lReport2.Append(.Item1)
lNonpointTons = .Item2
@@ -534,8 +514,8 @@ Public Module ConstituentBudget
'scour is the gain from the stream. Using this terminology for Load Allocation report makes it consistent for the Load Allocation Report.
End With
- Dim lAdditionalSourceTons As Double = lTotalInflow - lNonpointTons - lUpstreamIn - lPointTons - lGENERLoad
- Dim lCumulativePointNonpoint As Double = lNonpointTons + lAdditionalSourceTons + lPointTons
+ Dim lAdditionalSourceTons As Double = lTotalInflow - lNonpointTons - lUpstreamIn - lTotalPointTons - lGENERLoad
+ Dim lCumulativePointNonpoint As Double = lNonpointTons + lAdditionalSourceTons + lTotalPointTons
If lCumulativePointNonpointColl.Keys.Contains(lID.Id) Then
lCumulativePointNonpoint += lCumulativePointNonpointColl.ItemByKey(lID.Id)
End If
@@ -560,7 +540,7 @@ Public Module ConstituentBudget
lField = 0
lField += 1 : .Value(lField) = lID.Name & " " & lID.Id & " - " & lID.Description
lField += 1 : .Value(lField) = DoubleToString(lNonpointTons, , lNumberFormat,,, lNumberOfSignificantDigits)
- lField += 1 : .Value(lField) = DoubleToString(lPointTons, , lNumberFormat,,, lNumberOfSignificantDigits)
+ lField += 1 : .Value(lField) = DoubleToString(lTotalPointTons, , lNumberFormat,,, lNumberOfSignificantDigits)
If pGENERLoadingExists Then
lField += 1 : .Value(lField) = DoubleToString(lGENERLoad, , lNumberFormat,,, lNumberOfSignificantDigits)
End If
@@ -620,21 +600,20 @@ Public Module ConstituentBudget
Return Nothing
End If
- Dim lPointlbs As Double = 0.0
+ Dim lTotalPointlbs As Double = 0.0
.CurrentRecord += 1
Dim CVON As Double = ConversionFactorfromOxygen(aUci, aBalanceType, lID)
For Each lSource As HspfPointSource In lID.PointSources
- If lSource.Target.Group = "INFLOW" AndAlso ((lSource.Target.Member = "NUIF1" AndAlso lSource.Target.MemSub1 = 1) _
- Or (lSource.Target.Member = "NUIF1" AndAlso lSource.Target.MemSub1 = 2) _
- Or (lSource.Target.Member = "NUIF1" AndAlso lSource.Target.MemSub1 = 3) _
- Or (lSource.Target.Member = "NUIF2" AndAlso lSource.Target.MemSub1 = 1 AndAlso lSource.Target.MemSub2 = 1) _
- Or (lSource.Target.Member = "NUIF2" AndAlso lSource.Target.MemSub1 = 2 AndAlso lSource.Target.MemSub2 = 1) _
- Or (lSource.Target.Member = "NUIF2" AndAlso lSource.Target.MemSub1 = 3 AndAlso lSource.Target.MemSub2 = 1) _
- Or (lSource.Target.Member = "PKIF" AndAlso lSource.Target.MemSub1 = 3) _
- Or (lSource.Target.Member = "PKIF" AndAlso lSource.Target.MemSub1 = 1) _
- Or (lSource.Target.Member = "PKIF" AndAlso lSource.Target.MemSub1 = 2) _
- Or (lSource.Target.Member = "OXIF" AndAlso lSource.Target.MemSub1 = 2)) Then
+ If lSource.Target.Group = "INFLOW" AndAlso ((lSource.Target.Member = "NUIF1" AndAlso lSource.Target.MemSub1 = 1) OrElse
+ (lSource.Target.Member = "NUIF1" AndAlso lSource.Target.MemSub1 = 2) OrElse
+ (lSource.Target.Member = "NUIF1" AndAlso lSource.Target.MemSub1 = 3) OrElse
+ (lSource.Target.Member = "NUIF2" AndAlso lSource.Target.MemSub2 = 1) OrElse
+ (lSource.Target.Member = "PKIF" AndAlso lSource.Target.MemSub1 = 3) OrElse
+ (lSource.Target.Member = "PKIF" AndAlso lSource.Target.MemSub1 = 1) OrElse
+ (lSource.Target.Member = "PKIF" AndAlso lSource.Target.MemSub1 = 2) OrElse
+ (lSource.Target.Member = "OXIF" AndAlso lSource.Target.MemSub1 = 2)) Then
+ Dim lPointlbs As Double = 0.0
Dim TimeSeriesTransformaton As String = lSource.Tran.ToString
Dim VolName As String = lSource.Source.VolName
Dim lDSN As Integer = lSource.Source.VolId
@@ -658,62 +637,119 @@ Public Module ConstituentBudget
TimeSeriesTransformaton, aUci.OpnSeqBlock.Delt)
End If
Next
+ lTotalPointlbs += lPointlbs
End If
Next
Dim lGENERLoad As Double = 0.0
+
For Each lSource As HspfConnection In lID.Sources
- If lSource.Source.VolName = "GENER" AndAlso lSource.Target.Group = "INFLOW" AndAlso ((lSource.Target.Member = "NUIF1" AndAlso lSource.Target.MemSub1 = 1) _
- Or (lSource.Target.Member = "NUIF1" AndAlso lSource.Target.MemSub1 = 2) _
- Or (lSource.Target.Member = "NUIF1" AndAlso lSource.Target.MemSub1 = 3) _
- Or (lSource.Target.Member = "NUIF2" AndAlso lSource.Target.MemSub1 = 1 AndAlso lSource.Target.MemSub2 = 1) _
- Or (lSource.Target.Member = "NUIF2" AndAlso lSource.Target.MemSub1 = 2 AndAlso lSource.Target.MemSub2 = 1) _
- Or (lSource.Target.Member = "NUIF2" AndAlso lSource.Target.MemSub1 = 3 AndAlso lSource.Target.MemSub2 = 1) _
- Or (lSource.Target.Member = "PKIF" AndAlso lSource.Target.MemSub1 = 3) _
- Or (lSource.Target.Member = "PKIF" AndAlso lSource.Target.MemSub1 = 1) _
- Or (lSource.Target.Member = "PKIF" AndAlso lSource.Target.MemSub1 = 2) _
- Or (lSource.Target.Member = "OXIF" AndAlso lSource.Target.MemSub1 = 2)) Then
-
- Dim lGENERID As Integer = lSource.Source.VolId
- Dim lMfact As Double = lSource.MFact
- If lSource.Target.Member = "OXIF" Then lMfact *= CVON
- If lSource.Target.Member = "PKIF" And (lSource.Target.MemSub1 = 1 Or lSource.Target.MemSub1 = 2) Then lMfact *= ConversionFactorfromBiomass(aUci, aBalanceType, lID)
- Dim lGENEROperation As HspfOperation = lSource.Source.Opn
+ Dim lGENERTSSum As Double = 0.0
+ Dim lMfact As Double = 0.0
+ If lSource.Source.VolName = "GENER" Then
Dim lGENEROperationisOutputtoWDM As Boolean = False
- For Each EXTTarget As HspfConnection In lGENEROperation.Targets
-
- If EXTTarget.Target.VolName.Contains("WDM") Then
- lGENEROperationisOutputtoWDM = True
- Dim lWDMFile As String = EXTTarget.Target.VolName.ToString
- Dim lDSN As Integer = EXTTarget.Target.VolId
-
- For i As Integer = 0 To aUci.FilesBlock.Count
-
- If aUci.FilesBlock.Value(i).Typ = lWDMFile Then
- Dim lFileName As String = AbsolutePath(aUci.FilesBlock.Value(i).Name.Trim, CurDir())
- Dim lDataSource As atcDataSource = atcDataManager.DataSourceBySpecification(lFileName)
- If lDataSource Is Nothing Then
- If atcDataManager.OpenDataSource(lFileName) Then
- lDataSource = atcDataManager.DataSourceBySpecification(lFileName)
- End If
- End If
- Dim ltimeseries As atcTimeseries = lDataSource.DataSets.FindData("ID", lDSN)(0)
- ltimeseries = SubsetByDate(ltimeseries, aSDateJ, aEDateJ, Nothing)
- lGENERLoad += ltimeseries.Attributes.GetDefinedValue("Sum").Value * lMfact / YearsOfSimulation
+ With GetGENERSum(aUci, lSource, aSDateJ, aEDateJ)
+ lGENERTSSum = .Item1
+ lGENEROperationisOutputtoWDM = .Item2
+ End With
+ If lSource.MassLink > 0 Then
+ lGENERTSSum *= lSource.MFact 'Multiplying with MFact in Schematic Block
+ For Each lMassLink As HspfMassLink In aUci.MassLinks
+ Dim GENERMassLinkMFact As Double = 0
+ If lMassLink.MassLinkId = lSource.MassLink AndAlso
+ ((lMassLink.Target.Member = "NUIF1" AndAlso lMassLink.Target.MemSub1 = 1) OrElse
+ (lMassLink.Target.Member = "NUIF1" AndAlso lMassLink.Target.MemSub1 = 2) OrElse
+ (lMassLink.Target.Member = "NUIF1" AndAlso lMassLink.Target.MemSub1 = 3) OrElse
+ (lMassLink.Target.Member = "NUIF2" AndAlso lMassLink.Target.MemSub2 = 1) OrElse
+ (lMassLink.Target.Member = "PKIF" AndAlso lMassLink.Target.MemSub1 = 3) OrElse
+ (lMassLink.Target.Member = "PKIF" AndAlso lMassLink.Target.MemSub1 = 1) OrElse
+ (lMassLink.Target.Member = "PKIF" AndAlso lMassLink.Target.MemSub1 = 2) OrElse
+ (lMassLink.Target.Member = "OXIF" AndAlso lMassLink.Target.MemSub1 = 2)) Then
+ GENERMassLinkMFact = lMassLink.MFact
+ If lMassLink.Target.Member = "OXIF" Then GENERMassLinkMFact = lMassLink.MFact * CVON
+ If lMassLink.Target.Member = "PKIF" And (lMassLink.Target.MemSub1 = 1 Or lMassLink.Target.MemSub1 = 2) Then GENERMassLinkMFact = lMassLink.MFact * ConversionFactorfromBiomass(aUci, aBalanceType, lID)
+ lMfact += GENERMassLinkMFact
- End If
- Next
+ End If
+ Next lMassLink
+ lGENERTSSum *= lMfact
+ lGENERLoad += lGENERTSSum
+ ElseIf lSource.Target.Group = "INFLOW" AndAlso ((lSource.Target.Member = "NUIF1" AndAlso lSource.Target.MemSub1 = 1) OrElse
+ (lSource.Target.Member = "NUIF1" AndAlso lSource.Target.MemSub1 = 2) OrElse
+ (lSource.Target.Member = "NUIF1" AndAlso lSource.Target.MemSub1 = 3) OrElse
+ (lSource.Target.Member = "NUIF2" AndAlso lSource.Target.MemSub2 = 1) OrElse
+ (lSource.Target.Member = "PKIF" AndAlso lSource.Target.MemSub1 = 3) OrElse
+ (lSource.Target.Member = "PKIF" AndAlso lSource.Target.MemSub1 = 1) OrElse
+ (lSource.Target.Member = "PKIF" AndAlso lSource.Target.MemSub1 = 2) OrElse
+ (lSource.Target.Member = "OXIF" AndAlso lSource.Target.MemSub1 = 2)) Then
+ Dim lGENERTSSourceMFact As Double = lSource.MFact
+ If lSource.Target.Member = "OXIF" Then lGENERTSSourceMFact *= CVON
+ If lSource.Target.Member = "PKIF" And (lSource.Target.MemSub1 = 1 Or lSource.Target.MemSub1 = 2) Then lGENERTSSourceMFact *= ConversionFactorfromBiomass(aUci, aBalanceType, lID)
+ lGENERTSSum *= lGENERTSSourceMFact
+ lGENERLoad += lGENERTSSum
+ End If
+ If Not lGENEROperationisOutputtoWDM Then
+ Logger.Dbg("GENER Loadings Issue: The RCHRES operation " & lID.Id & " has loadings input for the constituent " & aBalanceType & " from GENER connections in the Network Block. Please make sure that these GENER operations output to a WDM dataset for accurate source accounting.")
+ End If
+ End If
- End If
- Next EXTTarget
- If Not lGENEROperationisOutputtoWDM Then 'AndAlso Not lGENERInNetworkBlockMessageShown Then
- Logger.Dbg("GENER Loadings Issue: Some RCHRES operation have loadings input from GENER connections in the Network Block.
- Please make sure that these GENER operations output to a WDM dataset for accurate source accounting." & aBalanceType)
- 'lGENERInNetworkBlockMessageShown = True
- End If
- End If
+ 'If lSource.Source.VolName = "GENER" AndAlso lSource.Target.Group = "INFLOW" AndAlso ((lSource.Target.Member = "NUIF1" AndAlso lSource.Target.MemSub1 = 1) _
+ ' Or (lSource.Target.Member = "NUIF1" AndAlso lSource.Target.MemSub1 = 2) _
+ ' Or (lSource.Target.Member = "NUIF1" AndAlso lSource.Target.MemSub1 = 3) _
+ ' Or (lSource.Target.Member = "NUIF2" AndAlso lSource.Target.MemSub1 = 1 AndAlso lSource.Target.MemSub2 = 1) _
+ ' Or (lSource.Target.Member = "NUIF2" AndAlso lSource.Target.MemSub1 = 2 AndAlso lSource.Target.MemSub2 = 1) _
+ ' Or (lSource.Target.Member = "NUIF2" AndAlso lSource.Target.MemSub1 = 3 AndAlso lSource.Target.MemSub2 = 1) _
+ ' Or (lSource.Target.Member = "PKIF" AndAlso lSource.Target.MemSub1 = 3) _
+ ' Or (lSource.Target.Member = "PKIF" AndAlso lSource.Target.MemSub1 = 1) _
+ ' Or (lSource.Target.Member = "PKIF" AndAlso lSource.Target.MemSub1 = 2) _
+ ' Or (lSource.Target.Member = "OXIF" AndAlso lSource.Target.MemSub1 = 2)) Then
+
+ 'Dim lGENERID As Integer = lSource.Source.VolId
+ 'Dim lMfact As Double = lSource.MFact
+ 'If lSource.Target.Member = "OXIF" Then lMfact *= CVON
+ 'If lSource.Target.Member = "PKIF" And (lSource.Target.MemSub1 = 1 Or lSource.Target.MemSub1 = 2) Then lMfact *= ConversionFactorfromBiomass(aUci, aBalanceType, lID)
+ 'Dim lGENEROperation As HspfOperation = lSource.Source.Opn
+ 'Dim lGENEROperationisOutputtoWDM As Boolean = False
+ 'With GetGENERSum(aUci, lSource, aSDateJ, aEDateJ)
+ ' lGENERLoad = .Item1 * lMfact
+ ' lGENEROperationisOutputtoWDM = .Item2
+ 'End With
+ 'For Each EXTTarget As HspfConnection In lGENEROperation.Targets
+
+ ' If EXTTarget.Target.VolName.Contains("WDM") Then
+ ' lGENEROperationisOutputtoWDM = True
+ ' Dim lWDMFile As String = EXTTarget.Target.VolName.ToString
+ ' Dim lDSN As Integer = EXTTarget.Target.VolId
+
+ ' For i As Integer = 0 To aUci.FilesBlock.Count
+
+ ' If aUci.FilesBlock.Value(i).Typ = lWDMFile Then
+ ' Dim lFileName As String = AbsolutePath(aUci.FilesBlock.Value(i).Name.Trim, CurDir())
+ ' Dim lDataSource As atcDataSource = atcDataManager.DataSourceBySpecification(lFileName)
+ ' If lDataSource Is Nothing Then
+ ' If atcDataManager.OpenDataSource(lFileName) Then
+ ' lDataSource = atcDataManager.DataSourceBySpecification(lFileName)
+ ' End If
+ ' End If
+ ' Dim ltimeseries As atcTimeseries = lDataSource.DataSets.FindData("ID", lDSN)(0)
+ ' ltimeseries = SubsetByDate(ltimeseries, aSDateJ, aEDateJ, Nothing)
+ ' lGENERLoad += ltimeseries.Attributes.GetDefinedValue("Sum").Value * lMfact / YearsOfSimulation
+
+ ' End If
+ ' Next
+
+ ' End If
+
+ 'Next EXTTarget
+ 'If Not lGENEROperationisOutputtoWDM Then 'AndAlso Not lGENERInNetworkBlockMessageShown Then
+ ' Logger.Dbg("GENER Loadings Issue: Some RCHRES operation have loadings input from GENER connections in the Network Block.
+ ' Please make sure that these GENER operations output to a WDM dataset for accurate source accounting." & aBalanceType)
+ ' 'lGENERInNetworkBlockMessageShown = True
+ 'End If
+
+ 'End If
Next lSource
Dim lNonpointlbs As Double = 0.0
@@ -757,16 +793,16 @@ Public Module ConstituentBudget
Return Nothing
End Try
- With ConstituentLoadingByLanduse(aUci, lID, aBalanceType, lNonpointData, CVON, lPointlbs, lGENERLoad, lTotalAtmDep, lDepScour, lTotalInflow, lUpstreamIn,
+ With ConstituentLoadingByLanduse(aUci, lID, aBalanceType, lNonpointData, CVON, lTotalPointlbs, lGENERLoad, lTotalAtmDep, lDepScour, lTotalInflow, lUpstreamIn,
lDiversion, aSDateJ, aEDateJ, aConstProperties)
lReport2.Append(.Item1)
lNonpointlbs = .Item2
lGENERLoad = .Item3
End With
- lAdditionalSourcelbs = lTotalInflow - lNonpointlbs - lTotalAtmDep - lUpstreamIn - lPointlbs - lGENERLoad
+ lAdditionalSourcelbs = lTotalInflow - lNonpointlbs - lTotalAtmDep - lUpstreamIn - lTotalPointlbs - lGENERLoad
- Dim lCumulativePointNonpoint As Double = lNonpointlbs + lPointlbs + lAdditionalSourcelbs
+ Dim lCumulativePointNonpoint As Double = lNonpointlbs + lTotalPointlbs + lAdditionalSourcelbs
If lCumulativePointNonpointColl.Keys.Contains(lID.Id) Then
lCumulativePointNonpoint += lCumulativePointNonpointColl.ItemByKey(lID.Id)
End If
@@ -790,7 +826,7 @@ Public Module ConstituentBudget
lField = 0
lField += 1 : .Value(lField) = lID.Name & " " & lID.Id & " - " & lID.Description
lField += 1 : .Value(lField) = DoubleToString(lNonpointlbs, 15, lNumberFormat,,, lNumberOfSignificantDigits)
- lField += 1 : .Value(lField) = DoubleToString(lPointlbs, 15, lNumberFormat,,, lNumberOfSignificantDigits)
+ lField += 1 : .Value(lField) = DoubleToString(lTotalPointlbs, 15, lNumberFormat,,, lNumberOfSignificantDigits)
lField += 1 : .Value(lField) = DoubleToString(lTotalAtmDep, 15, lNumberFormat,,, lNumberOfSignificantDigits)
If pGENERLoadingExists Then
lField += 1 : .Value(lField) = DoubleToString(lGENERLoad, , lNumberFormat,,, lNumberOfSignificantDigits)
@@ -854,20 +890,18 @@ Public Module ConstituentBudget
End If
If lID.Tables("ACTIVITY").Parms("NUTFG").Value = 1 Then
'If lID.Id = 815 Then Stop
-
- Dim lPointlbs As Double = 0.0
+ Dim lTotalPointlbs As Double = 0.0
.CurrentRecord += 1
- Dim CVOP As Double = ConversionFactorfromOxygen(aUci, aBalanceType, lID)
+ Dim CVOP As Double = ConversionFactorfromOxygen(aUci, aBalanceType, lID)
For Each lSource As HspfPointSource In lID.PointSources
- If lSource.Target.Group = "INFLOW" AndAlso ((lSource.Target.Member = "NUIF1" AndAlso lSource.Target.MemSub1 = 4) _
- Or (lSource.Target.Member = "NUIF2" AndAlso lSource.Target.MemSub1 = 1 AndAlso lSource.Target.MemSub2 = 2) _
- Or (lSource.Target.Member = "NUIF2" AndAlso lSource.Target.MemSub1 = 2 AndAlso lSource.Target.MemSub2 = 2) _
- Or (lSource.Target.Member = "NUIF2" AndAlso lSource.Target.MemSub1 = 3 AndAlso lSource.Target.MemSub2 = 2) _
- Or (lSource.Target.Member = "PKIF" AndAlso lSource.Target.MemSub1 = 4) _
- Or (lSource.Target.Member = "PKIF" AndAlso lSource.Target.MemSub1 = 1) _
- Or (lSource.Target.Member = "PKIF" AndAlso lSource.Target.MemSub1 = 2) _
- Or (lSource.Target.Member = "OXIF" AndAlso lSource.Target.MemSub1 = 2)) Then
+ If lSource.Target.Group = "INFLOW" AndAlso ((lSource.Target.Member = "NUIF1" AndAlso lSource.Target.MemSub1 = 4) OrElse
+ (lSource.Target.Member = "NUIF2" AndAlso lSource.Target.MemSub2 = 2) OrElse
+ (lSource.Target.Member = "PKIF" AndAlso lSource.Target.MemSub1 = 4) OrElse
+ (lSource.Target.Member = "PKIF" AndAlso lSource.Target.MemSub1 = 1) OrElse
+ (lSource.Target.Member = "PKIF" AndAlso lSource.Target.MemSub1 = 2) OrElse
+ (lSource.Target.Member = "OXIF" AndAlso lSource.Target.MemSub1 = 2)) Then
+ Dim lPointlbs As Double = 0.0
Dim TimeSeriesTransformaton As String = lSource.Tran.ToString
Dim VolName As String = lSource.Source.VolName
Dim lDSN As Integer = lSource.Source.VolId
@@ -891,61 +925,149 @@ Public Module ConstituentBudget
TimeSeriesTransformaton, aUci.OpnSeqBlock.Delt)
End If
Next
+ lTotalPointlbs += lPointlbs
End If
Next
Dim lGENERLoad As Double = 0.0
+
For Each lSource As HspfConnection In lID.Sources
- If lSource.Source.VolName = "GENER" AndAlso lSource.Target.Group = "INFLOW" AndAlso ((lSource.Target.Member = "NUIF1" AndAlso lSource.Target.MemSub1 = 4) _
- Or (lSource.Target.Member = "NUIF2" AndAlso lSource.Target.MemSub1 = 1 AndAlso lSource.Target.MemSub2 = 2) _
- Or (lSource.Target.Member = "NUIF2" AndAlso lSource.Target.MemSub1 = 2 AndAlso lSource.Target.MemSub2 = 2) _
- Or (lSource.Target.Member = "NUIF2" AndAlso lSource.Target.MemSub1 = 3 AndAlso lSource.Target.MemSub2 = 2) _
- Or (lSource.Target.Member = "PKIF" AndAlso lSource.Target.MemSub1 = 4) _
- Or (lSource.Target.Member = "PKIF" AndAlso lSource.Target.MemSub1 = 1) _
- Or (lSource.Target.Member = "PKIF" AndAlso lSource.Target.MemSub1 = 2) _
- Or (lSource.Target.Member = "OXIF" AndAlso lSource.Target.MemSub1 = 2)) Then
-
- Dim lGENERID As Integer = lSource.Source.VolId
- Dim lMfact As Double = lSource.MFact
- If lSource.Target.Member = "OXIF" Then lMfact *= CVOP
- If lSource.Target.Member = "PKIF" And (lSource.Target.MemSub1 = 1 Or lSource.Target.MemSub1 = 2) Then lMfact *= ConversionFactorfromBiomass(aUci, aBalanceType, lID)
- Dim lGENEROperation As HspfOperation = lSource.Source.Opn
+ Dim lGENERTSSum As Double = 0.0
+ Dim lMfact As Double = 0.0
+ If lSource.Source.VolName = "GENER" Then
Dim lGENEROperationisOutputtoWDM As Boolean = False
- For Each EXTTarget As HspfConnection In lGENEROperation.Targets
-
- If EXTTarget.Target.VolName.Contains("WDM") Then
- lGENEROperationisOutputtoWDM = True
- Dim lWDMFile As String = EXTTarget.Target.VolName.ToString
- Dim lDSN As Integer = EXTTarget.Target.VolId
-
- For i As Integer = 0 To aUci.FilesBlock.Count
-
- If aUci.FilesBlock.Value(i).Typ = lWDMFile Then
- Dim lFileName As String = AbsolutePath(aUci.FilesBlock.Value(i).Name.Trim, CurDir())
- Dim lDataSource As atcDataSource = atcDataManager.DataSourceBySpecification(lFileName)
- If lDataSource Is Nothing Then
- If atcDataManager.OpenDataSource(lFileName) Then
- lDataSource = atcDataManager.DataSourceBySpecification(lFileName)
- End If
- End If
- Dim ltimeseries As atcTimeseries = lDataSource.DataSets.FindData("ID", lDSN)(0)
- ltimeseries = SubsetByDate(ltimeseries, aSDateJ, aEDateJ, Nothing)
- lGENERLoad += ltimeseries.Attributes.GetDefinedValue("Sum").Value * lMfact / YearsOfSimulation
+ With GetGENERSum(aUci, lSource, aSDateJ, aEDateJ)
+ lGENERTSSum = .Item1
+ lGENEROperationisOutputtoWDM = .Item2
+ End With
+ If lSource.MassLink > 0 Then
+ lGENERTSSum *= lSource.MFact 'Multiplying with MFact in Schematic Block
+ For Each lMassLink As HspfMassLink In aUci.MassLinks
+ Dim GENERMassLinkMFact As Double = 0
+ If lMassLink.MassLinkId = lSource.MassLink AndAlso
+ ((lMassLink.Target.Member = "NUIF1" AndAlso lMassLink.Target.MemSub1 = 4) OrElse
+ (lMassLink.Target.Member = "NUIF2" AndAlso lMassLink.Target.MemSub2 = 2) OrElse
+ (lMassLink.Target.Member = "PKIF" AndAlso lMassLink.Target.MemSub1 = 4) OrElse
+ (lMassLink.Target.Member = "PKIF" AndAlso lMassLink.Target.MemSub1 = 1) OrElse
+ (lMassLink.Target.Member = "PKIF" AndAlso lMassLink.Target.MemSub1 = 2) OrElse
+ (lMassLink.Target.Member = "OXIF" AndAlso lMassLink.Target.MemSub1 = 2)) Then
+ GENERMassLinkMFact = lMassLink.MFact
+ If lMassLink.Target.Member = "OXIF" Then GENERMassLinkMFact = lMassLink.MFact * CVOP
+ If lMassLink.Target.Member = "PKIF" And (lMassLink.Target.MemSub1 = 1 Or lMassLink.Target.MemSub1 = 2) Then GENERMassLinkMFact = lMassLink.MFact * ConversionFactorfromBiomass(aUci, aBalanceType, lID)
+ lMfact += GENERMassLinkMFact
- End If
- Next
-
- End If
-
- Next EXTTarget
- If Not lGENEROperationisOutputtoWDM Then 'AndAlso Not lGENERInNetworkBlockMessageShown Then
- Logger.Dbg("GENER Loadings Issue: Some RCHRES operation have loadings input from GENER connections in the Network Block.
- Please make sure that these GENER operations output to a WDM dataset for accurate source accounting." & aBalanceType)
- 'lGENERInNetworkBlockMessageShown = True
+ End If
+ Next lMassLink
+ lGENERTSSum *= lMfact
+ lGENERLoad += lGENERTSSum
+ ElseIf lSource.Target.Group = "INFLOW" AndAlso ((lSource.Target.Member = "NUIF1" AndAlso lSource.Target.MemSub1 = 4) OrElse
+ (lSource.Target.Member = "NUIF2" AndAlso lSource.Target.MemSub2 = 2) OrElse
+ (lSource.Target.Member = "PKIF" AndAlso lSource.Target.MemSub1 = 4) OrElse
+ (lSource.Target.Member = "PKIF" AndAlso lSource.Target.MemSub1 = 1) OrElse
+ (lSource.Target.Member = "PKIF" AndAlso lSource.Target.MemSub1 = 2) OrElse
+ (lSource.Target.Member = "OXIF" AndAlso lSource.Target.MemSub1 = 2)) Then
+ Dim lGENERTSSourceMFact As Double = lSource.MFact
+ If lSource.Target.Member = "OXIF" Then lGENERTSSourceMFact *= CVOP
+ If lSource.Target.Member = "PKIF" And (lSource.Target.MemSub1 = 1 Or lSource.Target.MemSub1 = 2) Then lGENERTSSourceMFact *= ConversionFactorfromBiomass(aUci, aBalanceType, lID)
+ lGENERTSSum *= lGENERTSSourceMFact
+ lGENERLoad += lGENERTSSum
+ End If
+ If Not lGENEROperationisOutputtoWDM Then
+ Logger.Dbg("GENER Loadings Issue: The RCHRES operation " & lID.Id & " has loadings input for the constituent " & aBalanceType & " from GENER connections in the Network Block. Please make sure that these GENER operations output to a WDM dataset for accurate source accounting.")
End If
-
End If
Next lSource
+ 'Dim lPointlbs As Double = 0.0
+ '.CurrentRecord += 1
+ 'Dim CVOP As Double = ConversionFactorfromOxygen(aUci, aBalanceType, lID)
+
+ 'For Each lSource As HspfPointSource In lID.PointSources
+ ' If lSource.Target.Group = "INFLOW" AndAlso ((lSource.Target.Member = "NUIF1" AndAlso lSource.Target.MemSub1 = 4) _
+ ' Or (lSource.Target.Member = "NUIF2" AndAlso lSource.Target.MemSub1 = 1 AndAlso lSource.Target.MemSub2 = 2) _
+ ' Or (lSource.Target.Member = "NUIF2" AndAlso lSource.Target.MemSub1 = 2 AndAlso lSource.Target.MemSub2 = 2) _
+ ' Or (lSource.Target.Member = "NUIF2" AndAlso lSource.Target.MemSub1 = 3 AndAlso lSource.Target.MemSub2 = 2) _
+ ' Or (lSource.Target.Member = "PKIF" AndAlso lSource.Target.MemSub1 = 4) _
+ ' Or (lSource.Target.Member = "PKIF" AndAlso lSource.Target.MemSub1 = 1) _
+ ' Or (lSource.Target.Member = "PKIF" AndAlso lSource.Target.MemSub1 = 2) _
+ ' Or (lSource.Target.Member = "OXIF" AndAlso lSource.Target.MemSub1 = 2)) Then
+ ' Dim TimeSeriesTransformaton As String = lSource.Tran.ToString
+ ' Dim VolName As String = lSource.Source.VolName
+ ' Dim lDSN As Integer = lSource.Source.VolId
+ ' Dim lMfact As Double = lSource.MFact
+ ' If lSource.Target.Member = "OXIF" Then lMfact *= CVOP
+ ' If lSource.Target.Member = "PKIF" And (lSource.Target.MemSub1 = 1 Or lSource.Target.MemSub1 = 2) Then lMfact *= ConversionFactorfromBiomass(aUci, aBalanceType, lID)
+ ' For i As Integer = 0 To aUci.FilesBlock.Count
+
+ ' If aUci.FilesBlock.Value(i).Typ = VolName Then
+ ' Dim lFileName As String = AbsolutePath(aUci.FilesBlock.Value(i).Name.Trim, CurDir())
+ ' Dim lDataSource As atcDataSource = atcDataManager.DataSourceBySpecification(lFileName)
+ ' If lDataSource Is Nothing Then
+ ' If atcDataManager.OpenDataSource(lFileName) Then
+ ' lDataSource = atcDataManager.DataSourceBySpecification(lFileName)
+ ' End If
+ ' End If
+ ' Dim ltimeseries As atcTimeseries = lDataSource.DataSets.FindData("ID", lDSN)(0)
+ ' ltimeseries = SubsetByDate(ltimeseries, aSDateJ, aEDateJ, Nothing)
+ ' lPointlbs += ltimeseries.Attributes.GetDefinedValue("Sum").Value * lMfact / YearsOfSimulation
+ ' lPointlbs *= MultiFactorForPointSource(ltimeseries.Attributes.GetDefinedValue("Time Step").Value, ltimeseries.Attributes.GetDefinedValue("Time Unit").Value.ToString,
+ ' TimeSeriesTransformaton, aUci.OpnSeqBlock.Delt)
+ ' End If
+ ' Next
+ ' End If
+ 'Next
+
+ 'Dim lGENERLoad As Double = 0.0
+ 'For Each lSource As HspfConnection In lID.Sources
+ ' If lSource.Source.VolName = "GENER" AndAlso lSource.Target.Group = "INFLOW" AndAlso ((lSource.Target.Member = "NUIF1" AndAlso lSource.Target.MemSub1 = 4) _
+ ' Or (lSource.Target.Member = "NUIF2" AndAlso lSource.Target.MemSub1 = 1 AndAlso lSource.Target.MemSub2 = 2) _
+ ' Or (lSource.Target.Member = "NUIF2" AndAlso lSource.Target.MemSub1 = 2 AndAlso lSource.Target.MemSub2 = 2) _
+ ' Or (lSource.Target.Member = "NUIF2" AndAlso lSource.Target.MemSub1 = 3 AndAlso lSource.Target.MemSub2 = 2) _
+ ' Or (lSource.Target.Member = "PKIF" AndAlso lSource.Target.MemSub1 = 4) _
+ ' Or (lSource.Target.Member = "PKIF" AndAlso lSource.Target.MemSub1 = 1) _
+ ' Or (lSource.Target.Member = "PKIF" AndAlso lSource.Target.MemSub1 = 2) _
+ ' Or (lSource.Target.Member = "OXIF" AndAlso lSource.Target.MemSub1 = 2)) Then
+
+ ' Dim lGENERID As Integer = lSource.Source.VolId
+ ' Dim lMfact As Double = lSource.MFact
+ ' If lSource.Target.Member = "OXIF" Then lMfact *= CVOP
+ ' If lSource.Target.Member = "PKIF" And (lSource.Target.MemSub1 = 1 Or lSource.Target.MemSub1 = 2) Then lMfact *= ConversionFactorfromBiomass(aUci, aBalanceType, lID)
+ ' Dim lGENEROperation As HspfOperation = lSource.Source.Opn
+ ' Dim lGENEROperationisOutputtoWDM As Boolean = False
+ ' For Each EXTTarget As HspfConnection In lGENEROperation.Targets
+
+ ' If EXTTarget.Target.VolName.Contains("WDM") Then
+ ' lGENEROperationisOutputtoWDM = True
+ ' Dim lWDMFile As String = EXTTarget.Target.VolName.ToString
+ ' Dim lDSN As Integer = EXTTarget.Target.VolId
+
+ ' For i As Integer = 0 To aUci.FilesBlock.Count
+
+ ' If aUci.FilesBlock.Value(i).Typ = lWDMFile Then
+ ' Dim lFileName As String = AbsolutePath(aUci.FilesBlock.Value(i).Name.Trim, CurDir())
+ ' Dim lDataSource As atcDataSource = atcDataManager.DataSourceBySpecification(lFileName)
+ ' If lDataSource Is Nothing Then
+ ' If atcDataManager.OpenDataSource(lFileName) Then
+ ' lDataSource = atcDataManager.DataSourceBySpecification(lFileName)
+ ' End If
+ ' End If
+ ' Dim ltimeseries As atcTimeseries = lDataSource.DataSets.FindData("ID", lDSN)(0)
+ ' ltimeseries = SubsetByDate(ltimeseries, aSDateJ, aEDateJ, Nothing)
+ ' lGENERLoad += ltimeseries.Attributes.GetDefinedValue("Sum").Value * lMfact / YearsOfSimulation
+
+ ' End If
+ ' Next
+
+ ' End If
+
+ ' Next EXTTarget
+ ' If Not lGENEROperationisOutputtoWDM Then 'AndAlso Not lGENERInNetworkBlockMessageShown Then
+ ' Logger.Dbg("GENER Loadings Issue: Some RCHRES operation have loadings input from GENER connections in the Network Block.
+ ' Please make sure that these GENER operations output to a WDM dataset for accurate source accounting." & aBalanceType)
+ ' 'lGENERInNetworkBlockMessageShown = True
+ ' End If
+
+ ' End If
+ 'Next lSource
Dim lNonpointlbs As Double = 0.0
Dim lUpstreamIn As Double = 0.0
@@ -988,13 +1110,13 @@ Public Module ConstituentBudget
End Try
Dim lDepScour As Double = lOutflow - lTotalInflow - lDiversion
- With ConstituentLoadingByLanduse(aUci, lID, aBalanceType, lNonpointData, CVOP, lPointlbs, lGENERLoad, lTotalAtmDep,
+ With ConstituentLoadingByLanduse(aUci, lID, aBalanceType, lNonpointData, CVOP, lTotalPointlbs, lGENERLoad, lTotalAtmDep,
lDepScour, lTotalInflow, lUpstreamIn, lDiversion, aSDateJ, aEDateJ, aConstProperties)
lReport2.Append(.Item1)
lNonpointlbs = .Item2
lGENERLoad = .Item3
End With
- lAdditionalSourcelbs = lTotalInflow - lNonpointlbs - lUpstreamIn - lTotalAtmDep - lPointlbs - lGENERLoad
+ lAdditionalSourcelbs = lTotalInflow - lNonpointlbs - lUpstreamIn - lTotalAtmDep - lTotalPointlbs - lGENERLoad
Dim lCumulativePointNonpoint As Double = lNonpointlbs + lAdditionalSourcelbs
If lCumulativePointNonpointColl.Keys.Contains(lID.Id) Then
@@ -1020,7 +1142,7 @@ Public Module ConstituentBudget
lField = 0
lField += 1 : .Value(lField) = lID.Name & " " & lID.Id & " - " & lID.Description
lField += 1 : .Value(lField) = DoubleToString(lNonpointlbs, , lNumberFormat,,, lNumberOfSignificantDigits)
- lField += 1 : .Value(lField) = DoubleToString(lPointlbs, , lNumberFormat,,, lNumberOfSignificantDigits)
+ lField += 1 : .Value(lField) = DoubleToString(lTotalPointlbs, , lNumberFormat,,, lNumberOfSignificantDigits)
lField += 1 : .Value(lField) = DoubleToString(lTotalAtmDep, , lNumberFormat,,, lNumberOfSignificantDigits)
If pGENERLoadingExists Then
@@ -1301,7 +1423,7 @@ Public Module ConstituentBudget
For Each lTs As atcTimeseries In aNonpointData.FindData("Location", lTestLocation)
Dim lMassLinkFactor As Double = 0.0
- If lTs.Attributes.GetValue("SumAnnual") > 0 Then
+ If lTs.Attributes.GetDefinedValue("SumAnnual").Value > 0 Then
Dim ConstNameMassLink As String = lTs.Attributes.GetValue("Constituent")
If Not (aConstProperties.Count = 0 OrElse (lConnection.Source.Opn.Name = "PERLND" AndAlso
lConnection.Source.Opn.Tables("ACTIVITY").Parms("PQALFG").Value = "0")) Then
@@ -1317,7 +1439,7 @@ Public Module ConstituentBudget
Next
End If
-
+ 'If ConstNameMassLink = "SOSLD" Then Stop
lMassLinkFactor = FindMassLinkFactor(aUCI, lMassLinkID, ConstNameMassLink, aBalanceType,
aConversionFactor, aMultipleIndex:=0)
End If
@@ -1432,7 +1554,7 @@ Public Module ConstituentBudget
ByVal aNonpointData As atcTimeseriesGroup,
ByVal aConversionFactor As Double,
ByVal aPoint As Double,
- ByRef aGENERLoad As Double,
+ ByVal aGENERLoad As Double,
ByVal aAtmDep As Double,
ByVal GainLoss As Double,
ByVal aTotalInflow As Double,
@@ -1462,63 +1584,63 @@ Public Module ConstituentBudget
felu(aUCI, aReach, aBalanceType, "IMPLND", pIMPLND, aNonpointData, aConversionFactor, LoadingByLanduse, aTotalInflow, True, lContribPercent, aConstProperties)
'If aReach.Id = 102 Then Stop
- Dim GENERTSinWDM As Boolean = False
- Dim SingleGENERLoad As Double = 0.0
- Dim TotalGENERLoad As Double = 0.0
- Dim lGENERLoadingExists As Boolean = False
-
- For Each GENERConnection As HspfConnection In aReach.Sources
- If GENERConnection.Source.VolName = "GENER" Then
- Dim GENERID As String = GENERConnection.Source.VolId
- Dim lSchematicMFact As Double = GENERConnection.MFact
- Dim lMassLinkID As Integer = GENERConnection.MassLink
- If Not aUCI.OperationExists("GENER", GENERID) Or lMassLinkID = 0 Then Continue For
- lGENERLoadingExists = True
-
- For Each EXTTarget As HspfConnection In aUCI.Connections
- If EXTTarget.Source.VolName = "GENER" AndAlso EXTTarget.Source.VolId = GENERID AndAlso EXTTarget.Target.VolName.Contains("WDM") Then
- 'The GENER timeseries is available as a WDM timeseries
- GENERTSinWDM = True
- Dim VolName As String = EXTTarget.Target.VolName
- Dim lDSN As Integer = EXTTarget.Target.VolId
- Dim lMfact As Double = EXTTarget.MFact
- For i As Integer = 0 To aUCI.FilesBlock.Count
- If aUCI.FilesBlock.Value(i).Typ = VolName Then
- Dim lFileName As String = AbsolutePath(aUCI.FilesBlock.Value(i).Name.Trim, CurDir())
- Dim lDataSource As atcDataSource = atcDataManager.DataSourceBySpecification(lFileName)
- If lDataSource Is Nothing Then
- If atcDataManager.OpenDataSource(lFileName) Then
- lDataSource = atcDataManager.DataSourceBySpecification(lFileName)
- End If
- End If
- Dim ltimeseries As atcTimeseries = lDataSource.DataSets.FindData("ID", lDSN)(0)
- ltimeseries = SubsetByDate(ltimeseries, aSDateJ, aEDateJ, Nothing)
- SingleGENERLoad += ltimeseries.Attributes.GetDefinedValue("Sum").Value * lMfact / YearCount(aSDateJ, aEDateJ)
- Exit For
- End If
- Next
-
- End If
-
- Next
-
- SingleGENERLoad *= FindMassLinkFactor(aUCI, lMassLinkID, "GENER", aBalanceType, aConversionFactor, aMultipleIndex:=0)
- SingleGENERLoad *= lSchematicMFact
-
- End If
- TotalGENERLoad += SingleGENERLoad
- SingleGENERLoad = 0.0
-
- Next GENERConnection
-
-
- aGENERLoad += TotalGENERLoad
+ 'Dim GENERTSinWDM As Boolean = False
+ 'Dim SingleGENERLoad As Double = 0.0
+ 'Dim TotalGENERLoad As Double = 0.0
+ 'Dim lGENERLoadingExists As Boolean = False
+
+ 'For Each GENERConnection As HspfConnection In aReach.Sources
+ ' If GENERConnection.Source.VolName = "GENER" Then
+ ' Dim GENERID As String = GENERConnection.Source.VolId
+ ' Dim lSchematicMFact As Double = GENERConnection.MFact
+ ' Dim lMassLinkID As Integer = GENERConnection.MassLink
+ ' If Not aUCI.OperationExists("GENER", GENERID) Or lMassLinkID = 0 Then Continue For
+ ' lGENERLoadingExists = True
+
+ ' For Each EXTTarget As HspfConnection In aUCI.Connections
+ ' If EXTTarget.Source.VolName = "GENER" AndAlso EXTTarget.Source.VolId = GENERID AndAlso EXTTarget.Target.VolName.Contains("WDM") Then
+ ' 'The GENER timeseries is available as a WDM timeseries
+ ' GENERTSinWDM = True
+ ' Dim VolName As String = EXTTarget.Target.VolName
+ ' Dim lDSN As Integer = EXTTarget.Target.VolId
+ ' Dim lMfact As Double = EXTTarget.MFact
+ ' For i As Integer = 0 To aUCI.FilesBlock.Count
+ ' If aUCI.FilesBlock.Value(i).Typ = VolName Then
+ ' Dim lFileName As String = AbsolutePath(aUCI.FilesBlock.Value(i).Name.Trim, CurDir())
+ ' Dim lDataSource As atcDataSource = atcDataManager.DataSourceBySpecification(lFileName)
+ ' If lDataSource Is Nothing Then
+ ' If atcDataManager.OpenDataSource(lFileName) Then
+ ' lDataSource = atcDataManager.DataSourceBySpecification(lFileName)
+ ' End If
+ ' End If
+ ' Dim ltimeseries As atcTimeseries = lDataSource.DataSets.FindData("ID", lDSN)(0)
+ ' ltimeseries = SubsetByDate(ltimeseries, aSDateJ, aEDateJ, Nothing)
+ ' SingleGENERLoad += ltimeseries.Attributes.GetDefinedValue("Sum").Value * lMfact / YearCount(aSDateJ, aEDateJ)
+ ' Exit For
+ ' End If
+ ' Next
+
+ ' End If
+
+ ' Next
+
+ ' SingleGENERLoad *= FindMassLinkFactor(aUCI, lMassLinkID, "GENER", aBalanceType, aConversionFactor, aMultipleIndex:=0)
+ ' SingleGENERLoad *= lSchematicMFact
+
+ ' End If
+ ' TotalGENERLoad += SingleGENERLoad
+ ' SingleGENERLoad = 0.0
+
+ 'Next GENERConnection
+
+
+ 'aGENERLoad += TotalGENERLoad
Dim lAdditionalSource As Double = aTotalInflow - lReachTotal - aAtmDep - aPoint - aUpstreamIn - aGENERLoad + UpStreamDiversion
- If lGENERLoadingExists AndAlso (Not GENERTSinWDM) AndAlso (Not pMessageShown) Then
- Logger.Msg("GENER Loadings Issue: Some RCHRES operation have loadings input from GENER connections. Please make sure that these GENER operations output to a WDM dataset for accurate source accounting.
-This message box will not be shown again for." & aBalanceType)
- pMessageShown = True
- End If
+ ' If lGENERLoadingExists AndAlso (Not GENERTSinWDM) AndAlso (Not pMessageShown) Then
+ ' Logger.Msg("GENER Loadings Issue: Some RCHRES operation have loadings input from GENER connections. Please make sure that these GENER operations output to a WDM dataset for accurate source accounting.
+ 'This message box will not be shown again for." & aBalanceType)
+ ' pMessageShown = True
+ ' End If
For Each lTributary As HspfConnection In aReach.Sources
If lTributary.Source.VolName = "RCHRES" Then
@@ -1528,7 +1650,7 @@ This message box will not be shown again for." & aBalanceType)
aAtmDep += pRunningTotals.ItemByKey("Reach" & lTributaryId & " DirectAtmosphericDeposition")
aDiversion += pRunningTotals.ItemByKey("Reach" & lTributaryId & " Diversion")
If pGENERLoadingExists Then
- aGENERLoad += pRunningTotals.ItemByKey("Reach" & lTributaryId & " GENERSources")
+ 'aGENERLoad += pRunningTotals.ItemByKey("Reach" & lTributaryId & " GENERSources")
End If
pRunningTotals.Increment("Reach" & aReach.Id & " Gain", pRunningTotals.ItemByKey("Reach" & lTributaryId & " Gain"))
pRunningTotals.Increment("Reach" & aReach.Id & " Loss", pRunningTotals.ItemByKey("Reach" & lTributaryId & " Loss"))
@@ -1575,31 +1697,10 @@ This message box will not be shown again for." & aBalanceType)
End If
- Return New Tuple(Of String, Double, Double)(LoadingByLanduse, lReachTotal, TotalGENERLoad)
+ Return New Tuple(Of String, Double, Double)(LoadingByLanduse, lReachTotal, aGENERLoad)
End Function
- Private Function FindDownStreamExitNumber(ByVal aUCI As HspfUci,
- ByVal aReachID As HspfOperation,
- ByRef aExitNumber As Integer) As Integer
- 'Function to find the EXIT number through which the flow is sent to the downstream waterbody.
- Dim lDownstreamReachID As Integer = aReachID.DownOper("RCHRES")
- For Each lReachConnection As HspfConnection In aReachID.Targets
- If lReachConnection.Target.VolId = lDownstreamReachID Then
- Dim lMasslinkID As Integer = lReachConnection.MassLink
- For Each lMasslink As HspfMassLink In aUCI.MassLinks
- If lMasslink.MassLinkId = lMasslinkID Then
- If lMasslink.Source.Member.ToString = "ROFLOW" Then
- aExitNumber = 0
- Else
- aExitNumber = lMasslink.Source.MemSub1
- Exit For
- End If
- End If
- Next
- End If
- Next
- Return aExitNumber
- End Function
+
Private Function MultiFactorForPointSource(ByVal aTStep As Integer, ByVal aTimeUnit As String, ByVal aTransformation As String,
ByVal aDelta As atcTimeUnit) As Double
Dim MultiFactor As Double = 0.0
diff --git a/atcHspfSupport/modGraphBoxWhiskers.vb b/atcHspfSupport/modGraphBoxWhiskers.vb
index b28bba9b5..d3ca1a0c8 100644
--- a/atcHspfSupport/modGraphBoxWhiskers.vb
+++ b/atcHspfSupport/modGraphBoxWhiskers.vb
@@ -43,29 +43,35 @@ End Class
Public Module modGraphBoxWhiskers
- Public Sub CreateGraph_BoxAndWhisker(items As BoxWhiskerItem, aOutputFileName As String)
+ Public Sub CreateGraph_BoxAndWhisker(items As BoxWhiskerItem, aOutputFileName As String, Optional aTitle As String = "")
Dim lZgc As New ZedGraph.ZedGraphControl()
lZgc.Width = 1024
lZgc.Height = 768
Dim lGrapher As New atcGraph.clsGraphBoxWhisker(Nothing, lZgc, True)
-
- lGrapher.Title = "Box-Whisker plot of " & items.Constituent & " loading rate from all land uses in " & items.Scenario & " model." &
- vbCrLf & items.TimeSpan
- 'Select Case items.Constituent
- ' Case "Sediment"
- ' lGrapher.Title = "Box-Whisker plot of sediment loading rate from all land uses in " & items.Scenario & " model." &
- ' vbCrLf & items.TimeSpan
- ' Case "TotalP"
- ' lGrapher.Title = "Box-Whisker plot of total phosphorus loading rate from all land uses in " & items.Scenario & " model." &
- ' vbCrLf & items.TimeSpan
- ' Case "TotalN"
- ' lGrapher.Title = "Box-Whisker plot of total nitrogen loading rate from all land uses in " & items.Scenario & " model." &
- ' vbCrLf & items.TimeSpan
- ' Case Else
- ' Exit Sub
- 'End Select
+ If aTitle.Length > 1 Then
+ lGrapher.Title = aTitle
+ Else
+ lGrapher.Title = "Box-Whisker plot of " & items.Constituent & " loading rate from all land uses in " & items.Scenario & " model." &
+ vbCrLf & items.TimeSpan
+ End If
+
+
+
+ 'Select Case items.Constituent
+ ' Case "Sediment"
+ ' lGrapher.Title = "Box-Whisker plot of sediment loading rate from all land uses in " & items.Scenario & " model." &
+ ' vbCrLf & items.TimeSpan
+ ' Case "TotalP"
+ ' lGrapher.Title = "Box-Whisker plot of total phosphorus loading rate from all land uses in " & items.Scenario & " model." &
+ ' vbCrLf & items.TimeSpan
+ ' Case "TotalN"
+ ' lGrapher.Title = "Box-Whisker plot of total nitrogen loading rate from all land uses in " & items.Scenario & " model." &
+ ' vbCrLf & items.TimeSpan
+ ' Case Else
+ ' Exit Sub
+ 'End Select
lGrapher.DatasetsCollection = items.LabelValueCollection
lGrapher.ShowOutliers = False
diff --git a/atcHspfSupport/modUtility.vb b/atcHspfSupport/modUtility.vb
index df07c8ede..5b0c03991 100644
--- a/atcHspfSupport/modUtility.vb
+++ b/atcHspfSupport/modUtility.vb
@@ -514,29 +514,32 @@ Public Module Utility
Select Case ConstProperty.ConstNameForEXPPlus
Case "NO3"
.Add("P:Header4", "NO3+NO2 (PQUAL)")
- .Add("P:SOQO-" & ConstProperty.ConstituentNameInUCI, " Surface Flow")
- .Add("P:IOQUAL-" & ConstProperty.ConstituentNameInUCI, " Interflow")
- .Add("P:AOQUAL-" & ConstProperty.ConstituentNameInUCI, " Groundwater Flow")
+ .Add("P:SOQO-" & ConstProperty.ConstituentNameInUCI, " Dissolved with Surface Flow")
+ .Add("P:IOQUAL-" & ConstProperty.ConstituentNameInUCI, " Dissolved with Interflow")
+ .Add("P:AOQUAL-" & ConstProperty.ConstituentNameInUCI, " Dissolved with Groundwater Flow")
Case "TAM"
.Add("P:Header5", "NH3+NH4 (PQUAL)")
.Add("P:WASHQS-" & ConstProperty.ConstituentNameInUCI, " Sediment Attached")
- .Add("P:SOQUAL-" & ConstProperty.ConstituentNameInUCI, " Surface Flow")
- .Add("P:IOQUAL-" & ConstProperty.ConstituentNameInUCI, " Interflow")
- .Add("P:AOQUAL-" & ConstProperty.ConstituentNameInUCI, " Groundwater Flow")
+ .Add("P:SCRQS-" & ConstProperty.ConstituentNameInUCI, " Scoured Sediment Attached")
+ .Add("P:SOQO-" & ConstProperty.ConstituentNameInUCI, " Dissolved with Surface Flow")
+ .Add("P:IOQUAL-" & ConstProperty.ConstituentNameInUCI, " Dissolved with Interflow")
+ .Add("P:AOQUAL-" & ConstProperty.ConstituentNameInUCI, " Dissolved with Groundwater Flow")
Case "lab-OrgN"
.Add("P:Header6", "LabileOrgN (PQUAL)")
.Add("P:WASHQS-" & ConstProperty.ConstituentNameInUCI & "2", " Sediment Attached")
- .Add("P:SOQUAL-" & ConstProperty.ConstituentNameInUCI & "2", " Surface Flow")
- .Add("P:IOQUAL-" & ConstProperty.ConstituentNameInUCI & "2", " Interflow")
- .Add("P:AOQUAL-" & ConstProperty.ConstituentNameInUCI & "2", " Groundwater Flow")
+ .Add("P:SCRQS-" & ConstProperty.ConstituentNameInUCI & "2", " Scoured Sediment Attached")
+ .Add("P:SOQUAL-" & ConstProperty.ConstituentNameInUCI & "2", " Dissolved with Surface Flow")
+ .Add("P:IOQUAL-" & ConstProperty.ConstituentNameInUCI & "2", " Dissolved with Interflow")
+ .Add("P:AOQUAL-" & ConstProperty.ConstituentNameInUCI & "2", " Dissolved with Groundwater Flow")
Case "Ref-OrgN"
.Add("P:Header7", "RefOrgN (PQUAL)")
.Add("P:WASHQS-" & ConstProperty.ConstituentNameInUCI & "1", " Sediment Attached")
- .Add("P:SOQUAL-" & ConstProperty.ConstituentNameInUCI & "1", " Surface Flow")
- .Add("P:IOQUAL-" & ConstProperty.ConstituentNameInUCI & "1", " Interflow")
- .Add("P:AOQUAL-" & ConstProperty.ConstituentNameInUCI & "1", " Groundwater Flow")
+ .Add("P:SCRQS-" & ConstProperty.ConstituentNameInUCI & "1", " Scoured Sediment Attached")
+ .Add("P:SOQO-" & ConstProperty.ConstituentNameInUCI & "1", " Dissolved with Surface Flow")
+ .Add("P:IOQUAL-" & ConstProperty.ConstituentNameInUCI & "1", " Dissolved with Interflow")
+ .Add("P:AOQUAL-" & ConstProperty.ConstituentNameInUCI & "1", " Dissolved with Groundwater Flow")
End Select
.Add("P:Total3" & headerLabel(headerLabelCount), " Total")
@@ -692,25 +695,28 @@ Public Module Utility
Case "PO4"
.Add("P:Header7", "ORTHO P (PQUAL)")
.Add("P:WASHQS-" & ConstProperty.ConstituentNameInUCI, " Surface Flow with Sediment")
+ .Add("P:SCRQS-" & ConstProperty.ConstituentNameInUCI, " Surface Flow with Scoured Sediment")
.Add("P:SOQO-" & ConstProperty.ConstituentNameInUCI, " Surface Flow as Dissolved")
.Add("P:IOQUAL-" & ConstProperty.ConstituentNameInUCI, " Interflow")
.Add("P:AOQUAL-" & ConstProperty.ConstituentNameInUCI, " Groundwater Flow")
- .Add("P:Total3a", " Total")
+ .Add("P:Total3c", " Total")
Case "Ref-OrgP"
.Add("P:Header8", "RefOrgP (PQUAL)")
.Add("P:WASHQS-" & ConstProperty.ConstituentNameInUCI & "1", " Surface Flow with Sediment")
+ .Add("P:SCRQS-" & ConstProperty.ConstituentNameInUCI & "1", " Surface Flow with Scoured Sediment")
.Add("P:SOQO-" & ConstProperty.ConstituentNameInUCI & "1", " Surface Flow as Dissolved")
.Add("P:IOQUAL-" & ConstProperty.ConstituentNameInUCI & "1", " Interflow")
.Add("P:AOQUAL-" & ConstProperty.ConstituentNameInUCI & "1", " Groundwater Flow")
- .Add("P:Total3b", " Total")
+ .Add("P:Total3d", " Total")
Case "lab-OrgP"
.Add("P:Header9", "LabileOrgP (PQUAL)")
.Add("P:WASHQS-" & ConstProperty.ConstituentNameInUCI & "2", " Surface Flow with Sediment")
- .Add("P:SOQUAL-" & ConstProperty.ConstituentNameInUCI & "2", " Surface Flow as Dissolved")
+ .Add("P:SCRQS-" & ConstProperty.ConstituentNameInUCI & "2", " Surface Flow with Scoured Sediment")
+ .Add("P:SOQO-" & ConstProperty.ConstituentNameInUCI & "2", " Surface Flow as Dissolved")
.Add("P:IOQUAL-" & ConstProperty.ConstituentNameInUCI & "2", " Interflow")
.Add("P:AOQUAL-" & ConstProperty.ConstituentNameInUCI & "2", " Groundwater Flow")
- .Add("P:Total3c", " Total")
+ .Add("P:Total3e", " Total")
End Select
Next
@@ -1157,102 +1163,83 @@ Public Module Utility
End If
Case "TotalN"
+ Select Case True
+ Case (aConstituent = "NO3+NO2-N - SURFACE LAYER OUTFLOW" OrElse aConstituent = "NO3+NO2-N - UPPER LAYER OUTFLOW" OrElse
+ aConstituent = "NO3+NO2-N - GROUNDWATER OUTFLOW" OrElse aConstituent = "NO3-N - TOTAL OUTFLOW") AndAlso
+ lMassLink.Target.Member.ToString = "NUIF1" And lMassLink.Target.MemSub1 = 1
+ lMassLinkFactor = lMassLink.MFact
+ Return lMassLinkFactor
- Select Case aConstituent & "_" & lMassLink.Target.Member.ToString & "_" & lMassLink.Target.MemSub1
- Case "NO3+NO2-N - SURFACE LAYER OUTFLOW_NUIF1_1", "NO3+NO2-N - UPPER LAYER OUTFLOW_NUIF1_1", "NO3+NO2-N - GROUNDWATER OUTFLOW_NUIF1_1",
- "NO3-N - TOTAL OUTFLOW_NUIF1_1"
+ Case (aConstituent = "NH4-N IN SOLUTION - SURFACE LAYER OUTFLOW" OrElse aConstituent = "NH4-N IN SOLUTION - UPPER LAYER OUTFLOW" OrElse
+ aConstituent = "NH4-N IN SOLUTION - GROUNDWATER OUTFLOW") AndAlso lMassLink.Target.Member.ToString = "NUIF1" AndAlso lMassLink.Target.MemSub1 = 2
lMassLinkFactor = lMassLink.MFact
Return lMassLinkFactor
- Case "NH4-N IN SOLUTION - SURFACE LAYER OUTFLOW_NUIF1_2", "NH4-N IN SOLUTION - UPPER LAYER OUTFLOW_NUIF1_2",
- "NH4-N IN SOLUTION - GROUNDWATER OUTFLOW_NUIF1_2"
+ Case aConstituent = "NH4-N ADS - SEDIMENT ASSOC OUTFLOW" AndAlso lMassLink.Target.Member.ToString = "NUIF2" AndAlso
+ lMassLink.Target.MemSub2 = 1 'lMassLink.Target.MemSub1 = 1 AndAlso
+ lMassLinkFactor += lMassLink.MFact
+ Case (aConstituent = "SOQUAL-NH3+NH4" OrElse aConstituent = "SOQO-NH3+NH4") AndAlso lMassLink.Target.Member.ToString = "NUIF1" AndAlso lMassLink.Target.MemSub1 = 2 AndAlso
+ (lMassLink.Source.Member = "SOQUAL" OrElse lMassLink.Source.Member = "POQUAL")
lMassLinkFactor = lMassLink.MFact
Return lMassLinkFactor
- Case "NH4-N ADS - SEDIMENT ASSOC OUTFLOW_NUIF2_1"
- If lMassLink.Target.MemSub2 = 1 Then
- lMassLinkFactor += lMassLink.MFact
- End If
- Case "NH4-N ADS - SEDIMENT ASSOC OUTFLOW_NUIF2_2"
- If lMassLink.Target.MemSub2 = 1 Then
- lMassLinkFactor += lMassLink.MFact
- End If
- Case "NH4-N ADS - SEDIMENT ASSOC OUTFLOW_NUIF2_3"
- If lMassLink.Target.MemSub2 = 1 Then
- lMassLinkFactor += lMassLink.MFact
- End If
-
- Case "POQUAL-NH3+NH4_NUIF1_2", "SOQUAL-NH3+NH4_NUIF1_2",
- "AOQUAL-NH3+NH4_NUIF1_2", "IOQUAL-NH3+NH4_NUIF1_2",
- "SOQO-NH3+NH4_NUIF1_2"
-
- If lMassLink.Source.Member = aConstituent.Substring(0, 6) Or lMassLink.Source.Member = "POQUAL" Or
- (lMassLink.Source.Member = "SOQUAL" AndAlso lMassLink.Source.Group = "IQUAL") Then
+ Case aConstituent = "AOQUAL-NH3+NH4" AndAlso lMassLink.Target.Member.ToString = "NUIF1" AndAlso lMassLink.Target.MemSub1 = 2 AndAlso
+ (lMassLink.Source.Member = "AOQUAL" OrElse lMassLink.Source.Member = "POQUAL")
+ lMassLinkFactor = lMassLink.MFact
+ Return lMassLinkFactor
+ Case aConstituent = "IOQUAL-NH3+NH4" AndAlso lMassLink.Target.Member.ToString = "NUIF1" AndAlso lMassLink.Target.MemSub1 = 2 AndAlso
+ (lMassLink.Source.Member = "IOQUAL" OrElse lMassLink.Source.Member = "POQUAL")
+ lMassLinkFactor = lMassLink.MFact
+ Return lMassLinkFactor
+ Case (aConstituent = "WASHQS-NH3+NH4" OrElse aConstituent = "SCRQS-NH3+NH4") AndAlso lMassLink.Target.Member.ToString = "NUIF1" AndAlso
+ lMassLink.Target.MemSub1 = 2 AndAlso (lMassLink.Source.Member = "SOQUAL" OrElse lMassLink.Source.Member = "POQUAL")
+ lMassLinkFactor = lMassLink.MFact
+ Case (aConstituent = "SOQUAL-NO3" OrElse aConstituent = "SOQO-NO3") AndAlso lMassLink.Target.Member.ToString = "NUIF1" AndAlso lMassLink.Target.MemSub1 = 1 AndAlso
+ (lMassLink.Source.Member = "SOQUAL" OrElse lMassLink.Source.Member = "POQUAL")
+ lMassLinkFactor = lMassLink.MFact
+ Return lMassLinkFactor
+ Case aConstituent = "AOQUAL-NO3" AndAlso lMassLink.Target.Member.ToString = "NUIF1" AndAlso lMassLink.Target.MemSub1 = 1 AndAlso
+ (lMassLink.Source.Member = "AOQUAL" OrElse lMassLink.Source.Member = "POQUAL")
+ lMassLinkFactor = lMassLink.MFact
+ Return lMassLinkFactor
+ Case aConstituent = "IOQUAL-NO3" AndAlso lMassLink.Target.Member.ToString = "NUIF1" AndAlso lMassLink.Target.MemSub1 = 1 AndAlso
+ (lMassLink.Source.Member = "IOQUAL" OrElse lMassLink.Source.Member = "POQUAL")
+ lMassLinkFactor = lMassLink.MFact
+ Return lMassLinkFactor
+ Case (aConstituent = "WASHQS-BOD" OrElse aConstituent = "SCRQS-BOD" OrElse aConstituent = "SOQO-BOD" OrElse aConstituent = "SOQUAL-BOD" OrElse
+ aConstituent = "WASHQS-Ref-OrgN" OrElse aConstituent = "SCRQS-Ref-OrgN" OrElse aConstituent = "SOQO-Ref-OrgN" OrElse aConstituent = "SOQUAL-Ref-OrgN" OrElse
+ aConstituent = "WASHQS-lab-OrgN" OrElse aConstituent = "SCRQS-lab-OrgN" OrElse aConstituent = "SOQO-lab-OrgN" OrElse aConstituent = "SOQUAL-lab-OrgN") AndAlso
+ lMassLink.Target.Member.ToString = "PKIF" AndAlso lMassLink.Target.MemSub1 = 3 AndAlso
+ (lMassLink.Source.Member = "SOQUAL" OrElse lMassLink.Source.Member = "POQUAL")
+ If aMultipleIndex = 1 Then
lMassLinkFactor = lMassLink.MFact
- 'Return lMassLinkFactor
- End If
-
- Case "POQUAL-NH3+NH4_NUIF2_2", "SOQUAL-NH3+NH4_NUIF2_2", "AOQUAL-NH3+NH4_NUIF2_2", "IOQUAL-NH3+NH4_NUIF2_2",
- "POQUAL-NH3+NH4_NUIF2_3", "SOQUAL-NH3+NH4_NUIF2_3", "AOQUAL-NH3+NH4_NUIF2_3", "IOQUAL-NH3+NH4_NUIF2_3",
- "POQUAL-NH3+NH4_NUIF2_1", "SOQUAL-NH3+NH4_NUIF2_1", "AOQUAL-NH3+NH4_NUIF2_1", "IOQUAL-NH3+NH4_NUIF2_1",
- "WASHQS-NH3+NH4_NUIF2_1", "WASHQS-NH3+NH4_NUIF2_2", "WASHQS-NH3+NH4_NUIF2_3",
- "SCRQS-NH3+NH4_NUIF2_1", "SCRQS-NH3+NH4_NUIF2_2", "SCRQS-NH3+NH4_NUIF2_3"
- If lMassLink.Target.MemSub2 = 1 Then
- If lMassLink.Source.Member = aConstituent.Substring(0, 6) Or lMassLink.Source.Member = "POQUAL" Then
- lMassLinkFactor += lMassLink.MFact
- 'Return lMassLinkFactor
- End If
-
+ ElseIf aMultipleIndex = 2 Then
+ lMassLinkFactor = BODMFact(aUCI, "SOQUAL-BOD", lMassLink.MassLinkId) * aConversionFactor
+ ElseIf aMultipleIndex = 0 Then
+ lMassLinkFactor = lMassLink.MFact + BODMFact(aUCI, "SOQUAL-BOD", lMassLink.MassLinkId) * aConversionFactor
End If
-
-
- Case "SOQO-NO3_NUIF1_1", "POQUAL-NO3_NUIF1_1", "SOQUAL-NO3_NUIF1_1", "IOQUAL-NO3_NUIF1_1", "AOQUAL-NO3_NUIF1_1"
- If lMassLink.Source.Member = aConstituent.Substring(0, 6) Or lMassLink.Source.Member = "POQUAL" Or
- (lMassLink.Source.Member = "SOQUAL" AndAlso lMassLink.Source.Group = "IQUAL") Then
+ Return lMassLinkFactor
+ Case (aConstituent = "IOQUAL-BOD" OrElse aConstituent = "IOQUAL-Ref-OrgN" OrElse aConstituent = "IOQUAL-lab-OrgN") AndAlso
+ lMassLink.Target.Member.ToString = "PKIF" AndAlso lMassLink.Target.MemSub1 = 3 AndAlso
+ (lMassLink.Source.Member = "IOQUAL" OrElse lMassLink.Source.Member = "POQUAL")
+ If aMultipleIndex = 1 Then
lMassLinkFactor = lMassLink.MFact
- Return lMassLinkFactor
- End If
- Case "WASHQS-BOD_PKIF_3", "SCRQS-BOD_PKIF_3", "SOQO-BOD_PKIF_3", "SOQUAL-BOD_PKIF_3", "IOQUAL-BOD_PKIF_3", "AOQUAL-BOD_PKIF_3", "POQUAL-BOD_PKIF_3"
- If lMassLink.Source.Member = aConstituent.Substring(0, 6) Or lMassLink.Source.Member = "POQUAL" Or
- (lMassLink.Source.Member = "SOQUAL" AndAlso lMassLink.Source.Group = "IQUAL") Then
- If aMultipleIndex = 1 Then
- lMassLinkFactor = lMassLink.MFact
- ElseIf aMultipleIndex = 2 Then
- lMassLinkFactor = BODMFact(aUCI, aConstituent, lMassLink.MassLinkId) * aConversionFactor
- ElseIf aMultipleIndex = 0 Then
- lMassLinkFactor = lMassLink.MFact + BODMFact(aUCI, aConstituent, lMassLink.MassLinkId) * aConversionFactor
- End If
- Return lMassLinkFactor
-
- End If
- Case "WASHQS-Ref-OrgN_PKIF_3", "SCRQS-Ref-OrgN_PKIF_3", "SOQO-Ref-OrgN_PKIF_3", "SOQUAL-Ref-OrgN_PKIF_3", "IOQUAL-Ref-OrgN_PKIF_3", "AOQUAL-Ref-OrgN_PKIF_3", "POQUAL-Ref-OrgN_PKIF_3"
- If lMassLink.Source.Member = aConstituent.Substring(0, 6) Or lMassLink.Source.Member = "POQUAL" Or
- (lMassLink.Source.Member = "SOQUAL" AndAlso lMassLink.Source.Group = "IQUAL") Then
- If aMultipleIndex = 1 Then
- lMassLinkFactor = lMassLink.MFact
- ElseIf aMultipleIndex = 2 Then
- lMassLinkFactor = BODMFact(aUCI, aConstituent, lMassLink.MassLinkId) * aConversionFactor
- ElseIf aMultipleIndex = 0 Then
- lMassLinkFactor = lMassLink.MFact + BODMFact(aUCI, aConstituent, lMassLink.MassLinkId) * aConversionFactor
- End If
- Return lMassLinkFactor
-
+ ElseIf aMultipleIndex = 2 Then
+ lMassLinkFactor = BODMFact(aUCI, "IOQUAL-BOD", lMassLink.MassLinkId) * aConversionFactor
+ ElseIf aMultipleIndex = 0 Then
+ lMassLinkFactor = lMassLink.MFact + BODMFact(aUCI, "IOQUAL-BOD", lMassLink.MassLinkId) * aConversionFactor
End If
-
- Case "WASHQS-lab-OrgN_PKIF_3", "SCRQS-lab-OrgN_PKIF_3", "SOQO-lab-OrgN_PKIF_3", "SOQUAL-lab-OrgN_PKIF_3", "IOQUAL-lab-OrgN_PKIF_3", "AOQUAL-lab-OrgN_PKIF_3", "POQUAL-lab-OrgN_PKIF_3"
- If lMassLink.Source.Member = aConstituent.Substring(0, 6) Or lMassLink.Source.Member = "POQUAL" Or
- (lMassLink.Source.Member = "SOQUAL" AndAlso lMassLink.Source.Group = "IQUAL") Then
- If aMultipleIndex = 1 Then
- lMassLinkFactor = lMassLink.MFact
- ElseIf aMultipleIndex = 2 Then
- lMassLinkFactor = BODMFact(aUCI, aConstituent, lMassLink.MassLinkId) * aConversionFactor
- ElseIf aMultipleIndex = 0 Then
- lMassLinkFactor = lMassLink.MFact + BODMFact(aUCI, aConstituent, lMassLink.MassLinkId) * aConversionFactor
- End If
- Return lMassLinkFactor
-
+ Return lMassLinkFactor
+ Case (aConstituent = "AOQUAL-BOD" OrElse aConstituent = "AOQUAL-Ref-OrgN" OrElse aConstituent = "AOQUAL-lab-OrgN") AndAlso
+ lMassLink.Target.Member.ToString = "PKIF" AndAlso lMassLink.Target.MemSub1 = 3 AndAlso
+ (lMassLink.Source.Member = "AOQUAL" OrElse lMassLink.Source.Member = "POQUAL")
+ If aMultipleIndex = 1 Then
+ lMassLinkFactor = lMassLink.MFact
+ ElseIf aMultipleIndex = 2 Then
+ lMassLinkFactor = BODMFact(aUCI, "AOQUAL-BOD", lMassLink.MassLinkId) * aConversionFactor
+ ElseIf aMultipleIndex = 0 Then
+ lMassLinkFactor = lMassLink.MFact + BODMFact(aUCI, "AOQUAL-BOD", lMassLink.MassLinkId) * aConversionFactor
End If
-
-
- Case "ORGN - TOTAL OUTFLOW_PKIF_3"
+ Return lMassLinkFactor
+ Case aConstituent = "ORGN - TOTAL OUTFLOW" AndAlso lMassLink.Target.Member.ToString = "PKIF" AndAlso lMassLink.Target.MemSub1 = 3
If aMultipleIndex = 2 Then
lMassLinkFactor = lMassLink.MFact
ElseIf aMultipleIndex = 1 Then
@@ -1261,163 +1248,294 @@ Public Module Utility
lMassLinkFactor = 1
End If
Return lMassLinkFactor
- Case "LABILE ORGN - SEDIMENT ASSOC OUTFLOW_PKIF_3", "REFRAC ORGN - SEDIMENT ASSOC OUTFLOW_PKIF_3"
+ Case (aConstituent = "LABILE ORGN - SEDIMENT ASSOC OUTFLOW" OrElse aConstituent = "REFRAC ORGN - SEDIMENT ASSOC OUTFLOW") AndAlso
+ lMassLink.Target.Member.ToString = "PKIF" AndAlso lMassLink.Target.MemSub1 = 3
If aConstituent.Contains("REFRAC") Then
lMassLinkFactor = 0
Else
lMassLinkFactor = 0
End If
Return lMassLinkFactor
+ Case aConstituent.Contains("NITROGEN - TOTAL OUTFLOW")
+ lMassLinkFactor = 1
+ Return lMassLinkFactor
+
End Select
- If aConstituent.Contains("NITROGEN - TOTAL OUTFLOW") Then
- lMassLinkFactor = 1
- Return lMassLinkFactor
- ElseIf (lMassLink.Source.VolName = aConstituent AndAlso lMassLink.Target.Member = "NUIF1" AndAlso lMassLink.Target.MemSub1 = 1) Then
- lMassLinkFactor += lMassLink.MFact
- ElseIf (lMassLink.Source.VolName = aConstituent AndAlso lMassLink.Target.Member = "NUIF1" AndAlso lMassLink.Target.MemSub1 = 2) Then
- lMassLinkFactor += lMassLink.MFact
+ ' 'Anurag does not remember what specific cases do three following lines address.
+ 'ElseIf (lMassLink.Source.VolName = aConstituent AndAlso lMassLink.Target.Member = "NUIF1" AndAlso lMassLink.Target.MemSub1 = 1) Then
+ ' lMassLinkFactor += lMassLink.MFact
- ElseIf (lMassLink.Source.VolName = aConstituent AndAlso lMassLink.Target.Member = "OXIF" AndAlso lMassLink.Target.MemSub1 = 2) Then
- lMassLinkFactor += lMassLink.MFact * aConversionFactor
+ 'ElseIf (lMassLink.Source.VolName = aConstituent AndAlso lMassLink.Target.Member = "NUIF1" AndAlso lMassLink.Target.MemSub1 = 2) Then
+ ' lMassLinkFactor += lMassLink.MFact
- End If
+ 'ElseIf (lMassLink.Source.VolName = aConstituent AndAlso lMassLink.Target.Member = "OXIF" AndAlso lMassLink.Target.MemSub1 = 2) Then
+ ' lMassLinkFactor += lMassLink.MFact * aConversionFactor
+
+ 'End If
Case "TotalP"
'If aConstituent.Contains("SOQUAL") Then Stop
- Select Case aConstituent & "_" & lMassLink.Target.Member.ToString & "_" & lMassLink.Target.MemSub1
-
- Case "POQUAL-ORTHO P_NUIF1_4", "SOQO-ORTHO P_NUIF1_4", "SOQUAL-ORTHO P_NUIF1_4", "IOQUAL-ORTHO P_NUIF1_4",
- "AOQUAL-ORTHO P_NUIF1_4", "SCRQS-ORTHO P_NUIF1_4", "WASHQS-ORTHO P_NUIF1_4"
- If lMassLink.Source.Member = aConstituent.Substring(0, 6) Or lMassLink.Source.Member = "POQUAL" Or
- (lMassLink.Source.Member = "SOQUAL" AndAlso lMassLink.Source.Group = "IQUAL") Then
- lMassLinkFactor = lMassLink.MFact
- 'Return lMassLinkFactor
- End If
-
- Case "POQUAL-PO4_NUIF1_4", "SOQO-PO4_NUIF1_4", "SOQUAL-PO4_NUIF1_4", "IOQUAL-PO4_NUIF1_4",
- "AOQUAL-PO4_NUIF1_4", "SCRQS-PO4_NUIF1_4", "WASHQS-PO4_NUIF1_4"
- If lMassLink.Source.Member = aConstituent.Substring(0, 6) Or lMassLink.Source.Member = "POQUAL" Or
- (lMassLink.Source.Member = "SOQUAL" AndAlso lMassLink.Source.Group = "IQUAL") Then
- lMassLinkFactor = lMassLink.MFact
- 'Return lMassLinkFactor
- End If
-
- Case "POQUAL-ORTHO P_NUIF2_2", "SOQUAL-ORTHO P_NUIF2_2", "AOQUAL-ORTHO P_NUIF2_2", "IOQUAL-ORTHO P_NUIF2_2",
- "POQUAL-ORTHO P_NUIF2_3", "SOQUAL-ORTHO P_NUIF2_3", "AOQUAL-ORTHO P_NUIF2_3", "IOQUAL-ORTHO P_NUIF2_3",
- "POQUAL-ORTHO P_NUIF2_1", "SOQUAL-ORTHO P_NUIF2_1", "AOQUAL-ORTHO P_NUIF2_1", "IOQUAL-ORTHO P_NUIF2_1",
- "WASHQS-ORTHO P_NUIF2_1", "WASHQS-ORTHO P_NUIF2_2", "WASHQS-ORTHO P_NUIF2_3",
- "SCRQS-ORTHO P_NUIF2_1", "SCRQS-ORTHO P_NUIF2_2", "SCRQS-ORTHO P_NUIF2_3"
-
- If lMassLink.Target.MemSub2 = 2 Then
- If lMassLink.Source.Member = aConstituent.Substring(0, 6) Or lMassLink.Source.Member = "POQUAL" Then
- lMassLinkFactor += lMassLink.MFact
- 'Return lMassLinkFactor
- End If
- End If
-
+ Select Case True
+ Case (aConstituent = "SOQUAL-PO4" OrElse aConstituent = "SOQO-PO4") AndAlso lMassLink.Target.Member.ToString = "NUIF1" AndAlso lMassLink.Target.MemSub1 = 4 AndAlso
+ (lMassLink.Source.Member = "SOQUAL" OrElse lMassLink.Source.Member = "POQUAL")
+ lMassLinkFactor = lMassLink.MFact
+ Return lMassLinkFactor
+ Case aConstituent = "AOQUAL-PO4" AndAlso lMassLink.Target.Member.ToString = "NUIF1" AndAlso lMassLink.Target.MemSub1 = 4 AndAlso
+ (lMassLink.Source.Member = "AOQUAL" OrElse lMassLink.Source.Member = "POQUAL")
+ lMassLinkFactor = lMassLink.MFact
+ Return lMassLinkFactor
+ Case aConstituent = "IOQUAL-PO4" AndAlso lMassLink.Target.Member.ToString = "NUIF1" AndAlso lMassLink.Target.MemSub1 = 4 AndAlso
+ (lMassLink.Source.Member = "IOQUAL" OrElse lMassLink.Source.Member = "POQUAL")
+ lMassLinkFactor += lMassLink.MFact
+ Case (aConstituent = "WASHQS-PO4" OrElse aConstituent = "SCRQS-PO4") AndAlso lMassLink.Target.Member.ToString = "NUIF2" AndAlso
+ lMassLink.Target.MemSub2 = 2 AndAlso (lMassLink.Source.Member = "SOQUAL" OrElse lMassLink.Source.Member = "POQUAL")
+ lMassLinkFactor += lMassLink.MFact
- Case "POQUAL-PO4_NUIF2_2", "SOQUAL-PO4_NUIF2_2", "AOQUAL-PO4_NUIF2_2", "IOQUAL-PO4_NUIF2_2",
- "POQUAL-PO4_NUIF2_3", "SOQUAL-PO4_NUIF2_3", "AOQUAL-PO4_NUIF2_3", "IOQUAL-PO4_NUIF2_3",
- "POQUAL-PO4_NUIF2_1", "SOQUAL-PO4_NUIF2_1", "AOQUAL-PO4_NUIF2_1", "IOQUAL-PO4_NUIF2_1",
- "WASHQS-PO4_NUIF2_1", "WASHQS-PO4_NUIF2_2", "WASHQS-PO4_NUIF2_3",
- "SCRQS-PO4_NUIF2_1", "SCRQS-PO4_NUIF2_2", "SCRQS-PO4_NUIF2_3"
+ Case (aConstituent = "WASHQS-PO4" OrElse aConstituent = "SCRQS-PO4") AndAlso lMassLink.Target.Member.ToString = "NUIF1" AndAlso
+ lMassLink.Target.MemSub1 = 4 AndAlso (lMassLink.Source.Member = "SOQUAL" OrElse lMassLink.Source.Member = "POQUAL")
+ lMassLinkFactor = lMassLink.MFact
- If lMassLink.Target.MemSub2 = 2 Then
- If lMassLink.Source.Member = aConstituent.Substring(0, 6) Or lMassLink.Source.Member = "POQUAL" Then
- lMassLinkFactor += lMassLink.MFact
- 'Return lMassLinkFactor
- End If
- End If
+ Case (aConstituent = "SOQUAL-ORTHO P" OrElse aConstituent = "SOQO-ORTHO P") AndAlso lMassLink.Target.Member.ToString = "NUIF1" AndAlso lMassLink.Target.MemSub1 = 4 AndAlso
+ (lMassLink.Source.Member = "SOQUAL" OrElse lMassLink.Source.Member = "POQUAL")
+ lMassLinkFactor = lMassLink.MFact
+ Return lMassLinkFactor
+ Case aConstituent = "AOQUAL-ORTHO P" AndAlso lMassLink.Target.Member.ToString = "NUIF1" AndAlso lMassLink.Target.MemSub1 = 4 AndAlso
+ (lMassLink.Source.Member = "AOQUAL" OrElse lMassLink.Source.Member = "POQUAL")
+ lMassLinkFactor = lMassLink.MFact
+ Return lMassLinkFactor
+ Case aConstituent = "IOQUAL-ORTHO P" AndAlso lMassLink.Target.Member.ToString = "NUIF1" AndAlso lMassLink.Target.MemSub1 = 4 AndAlso
+ (lMassLink.Source.Member = "IOQUAL" OrElse lMassLink.Source.Member = "POQUAL")
+ lMassLinkFactor = lMassLink.MFact
+ Return lMassLinkFactor
+ Case (aConstituent = "WASHQS-ORTHO P" OrElse aConstituent = "SCRQS-ORTHO P") AndAlso lMassLink.Target.Member.ToString = "NUIF1" AndAlso
+ lMassLink.Target.MemSub1 = 4 AndAlso (lMassLink.Source.Member = "SOQUAL" OrElse lMassLink.Source.Member = "POQUAL")
+ lMassLinkFactor += lMassLink.MFact
+ Case (aConstituent = "WASHQS-ORTHO P" OrElse aConstituent = "SCRQS-ORTHO P") AndAlso lMassLink.Target.Member.ToString = "NUIF2" AndAlso
+ lMassLink.Target.MemSub2 = 2 AndAlso (lMassLink.Source.Member = "SOQUAL" OrElse lMassLink.Source.Member = "POQUAL")
+ lMassLinkFactor += lMassLink.MFact
- Case "WASHQS-BOD_PKIF_4", "SOQUAL-BOD_PKIF_4", "IOQUAL-BOD_PKIF_4", "AOQUAL-BOD_PKIF_4", "POQUAL-BOD_PKIF_4"
- If (lMassLink.Source.Member = aConstituent.Substring(0, 6) Or lMassLink.Source.Member = "POQUAL") Or
- (lMassLink.Source.Member = "SOQUAL" AndAlso lMassLink.Source.Group = "IQUAL") Then
- If aMultipleIndex = 1 Then
- lMassLinkFactor = lMassLink.MFact
- ElseIf aMultipleIndex = 2 Then
- lMassLinkFactor = BODMFact(aUCI, aConstituent, lMassLink.MassLinkId) * aConversionFactor
- ElseIf aMultipleIndex = 0 Then
- lMassLinkFactor = lMassLink.MFact + BODMFact(aUCI, aConstituent, lMassLink.MassLinkId) * aConversionFactor
- End If
- Return lMassLinkFactor
+ Case (aConstituent = "WASHQS-BOD" OrElse aConstituent = "SCRQS-BOD" OrElse aConstituent = "SOQO-BOD" OrElse aConstituent = "SOQUAL-BOD" OrElse
+ aConstituent = "WASHQS-Ref-OrgP" OrElse aConstituent = "SCRQS-Ref-OrgP" OrElse aConstituent = "SOQO-Ref-OrgP" OrElse aConstituent = "SOQUAL-Ref-OrgP" OrElse
+ aConstituent = "WASHQS-lab-OrgP" OrElse aConstituent = "SCRQS-lab-OrgP" OrElse aConstituent = "SOQO-lab-OrgP" OrElse aConstituent = "SOQUAL-lab-OrgP") AndAlso
+ lMassLink.Target.Member.ToString = "PKIF" AndAlso lMassLink.Target.MemSub1 = 4 AndAlso
+ (lMassLink.Source.Member = "SOQUAL" OrElse lMassLink.Source.Member = "POQUAL")
+ If aMultipleIndex = 1 Then
+ lMassLinkFactor = lMassLink.MFact
+ ElseIf aMultipleIndex = 2 Then
+ lMassLinkFactor = BODMFact(aUCI, "SOQUAL-BOD", lMassLink.MassLinkId) * aConversionFactor
+ ElseIf aMultipleIndex = 0 Then
+ lMassLinkFactor = lMassLink.MFact + BODMFact(aUCI, "SOQUAL-BOD", lMassLink.MassLinkId) * aConversionFactor
End If
-
- Case "WASHQS-Ref-OrgP_PKIF_4", "SOQO-Ref-OrgP_PKIF_4", "IOQUAL-Ref-OrgP_PKIF_4", "AOQUAL-Ref-OrgP_PKIF_4", "POQUAL-Ref-OrgP_PKIF_4"
- If (lMassLink.Source.Member = aConstituent.Substring(0, 6) Or lMassLink.Source.Member = "POQUAL") Or
- (lMassLink.Source.Member = "SOQUAL" AndAlso lMassLink.Source.Group = "IQUAL") Then
- If aMultipleIndex = 1 Then
- lMassLinkFactor = lMassLink.MFact
- ElseIf aMultipleIndex = 2 Then
- lMassLinkFactor = BODMFact(aUCI, aConstituent, lMassLink.MassLinkId) * aConversionFactor
- ElseIf aMultipleIndex = 0 Then
- lMassLinkFactor = lMassLink.MFact + BODMFact(aUCI, aConstituent, lMassLink.MassLinkId) * aConversionFactor
- End If
- Return lMassLinkFactor
+ Return lMassLinkFactor
+ Case (aConstituent = "IOQUAL-BOD" OrElse aConstituent = "IOQUAL-Ref-OrgP" OrElse aConstituent = "IOQUAL-lab-OrgP") AndAlso
+ lMassLink.Target.Member.ToString = "PKIF" AndAlso lMassLink.Target.MemSub1 = 4 AndAlso
+ (lMassLink.Source.Member = "IOQUAL" OrElse lMassLink.Source.Member = "POQUAL")
+ If aMultipleIndex = 1 Then
+ lMassLinkFactor = lMassLink.MFact
+ ElseIf aMultipleIndex = 2 Then
+ lMassLinkFactor = BODMFact(aUCI, "IOQUAL-BOD", lMassLink.MassLinkId) * aConversionFactor
+ ElseIf aMultipleIndex = 0 Then
+ lMassLinkFactor = lMassLink.MFact + BODMFact(aUCI, "IOQUAL-BOD", lMassLink.MassLinkId) * aConversionFactor
End If
-
- Case "WASHQS-lab-OrgP_PKIF_4", "SOQO-lab-OrgP_PKIF_4", "IOQUAL-lab-OrgP_PKIF_4", "AOQUAL-lab-OrgP_PKIF_4", "POQUAL-lab-OrgP_PKIF_4"
- If (lMassLink.Source.Member = aConstituent.Substring(0, 6) Or lMassLink.Source.Member = "POQUAL") Or
- (lMassLink.Source.Member = "SOQUAL" AndAlso lMassLink.Source.Group = "IQUAL") Then
- If aMultipleIndex = 1 Then
- lMassLinkFactor = lMassLink.MFact
- ElseIf aMultipleIndex = 2 Then
- lMassLinkFactor = BODMFact(aUCI, aConstituent, lMassLink.MassLinkId) * aConversionFactor
- ElseIf aMultipleIndex = 0 Then
- lMassLinkFactor = lMassLink.MFact + BODMFact(aUCI, aConstituent, lMassLink.MassLinkId) * aConversionFactor
- End If
- Return lMassLinkFactor
+ Return lMassLinkFactor
+ Case (aConstituent = "AOQUAL-BOD" OrElse aConstituent = "AOQUAL-Ref-OrgP" OrElse aConstituent = "AOQUAL-lab-OrgP") AndAlso
+ lMassLink.Target.Member.ToString = "PKIF" AndAlso lMassLink.Target.MemSub1 = 4 AndAlso
+ (lMassLink.Source.Member = "AOQUAL" OrElse lMassLink.Source.Member = "POQUAL")
+ If aMultipleIndex = 1 Then
+ lMassLinkFactor = lMassLink.MFact
+ ElseIf aMultipleIndex = 2 Then
+ lMassLinkFactor = BODMFact(aUCI, "AOQUAL-BOD", lMassLink.MassLinkId) * aConversionFactor
+ ElseIf aMultipleIndex = 0 Then
+ lMassLinkFactor = lMassLink.MFact + BODMFact(aUCI, "AOQUAL-BOD", lMassLink.MassLinkId) * aConversionFactor
End If
-
-
- Case "PO4-P IN SOLUTION - SURFACE LAYER - OUTFLOW_NUIF1_4"
+ Return lMassLinkFactor
+ Case aConstituent = "PO4-P IN SOLUTION - SURFACE LAYER - OUTFLOW" AndAlso lMassLink.Target.Member = "NUIF1" AndAlso lMassLink.Target.MemSub1 = 4
lMassLinkFactor = lMassLink.MFact
Return lMassLinkFactor
- Case "PO4-P IN SOLUTION - INTERFLOW - OUTFLOW_NUIF1_4"
+
+ Case aConstituent = "PO4-P IN SOLUTION - INTERFLOW - OUTFLOW" AndAlso lMassLink.Target.Member = "NUIF1" AndAlso lMassLink.Target.MemSub1 = 4
lMassLinkFactor = lMassLink.MFact
Return lMassLinkFactor
- Case "PO4-P IN SOLUTION - GROUNDWATER - OUTFLOW_NUIF1_4"
+ Case aConstituent = "PO4-P IN SOLUTION - GROUNDWATER - OUTFLOW" AndAlso lMassLink.Target.Member = "NUIF1" AndAlso lMassLink.Target.MemSub1 = 4
lMassLinkFactor = lMassLink.MFact
Return lMassLinkFactor
- Case "SDP4A_NUIF2_1", "SDP4A_NUIF2_2", "SDP4A_NUIF2_3", "SOQUAL-ORTHO P_NUIF2_1",
- "SOQUAL-ORTHO P_NUIF2_2", "SOQUAL-ORTHO P_NUIF2_3"
- If lMassLink.Target.MemSub2 = 2 Then
- lMassLinkFactor += lMassLink.MFact
- End If
+ Case aConstituent = "SDP4A" AndAlso lMassLink.Target.Member = "NUIF2" AndAlso lMassLink.Target.MemSub2 = 2
- Case "SDORP_PKIF_4"
+ lMassLinkFactor += lMassLink.MFact
+
+ Case aConstituent = "SDORP" AndAlso lMassLink.Target.Member = "PKIF" AndAlso lMassLink.Target.MemSub1 = 4
lMassLinkFactor = lMassLink.MFact
Return lMassLinkFactor
- Case "ORGN - TOTAL OUTFLOW_OXIF_2"
+ Case aConstituent = "ORGN - TOTAL OUTFLOW" AndAlso lMassLink.Target.Member = "OXIF" AndAlso lMassLink.Target.MemSub1 = 2
lMassLinkFactor = lMassLink.MFact * aConversionFactor
Return lMassLinkFactor
-
End Select
- If (lMassLink.Source.VolName = aConstituent AndAlso lMassLink.Target.Member = "NUIF1" AndAlso lMassLink.Target.MemSub1 = 4) Then
- lMassLinkFactor += lMassLink.MFact
-
- ElseIf (lMassLink.Source.VolName = aConstituent AndAlso lMassLink.Target.Member = "OXIF" AndAlso lMassLink.Target.MemSub1 = 2) Then
- lMassLinkFactor += lMassLink.MFact * aConversionFactor
-
- End If
+ 'Select Case aConstituent & "_" & lMassLink.Target.Member.ToString & "_" & lMassLink.Target.MemSub1
+
+ ' 'Case "POQUAL-ORTHO P_NUIF1_4", "SOQO-ORTHO P_NUIF1_4", "SOQUAL-ORTHO P_NUIF1_4", "IOQUAL-ORTHO P_NUIF1_4",
+ ' ' "AOQUAL-ORTHO P_NUIF1_4", "SCRQS-ORTHO P_NUIF1_4", "WASHQS-ORTHO P_NUIF1_4"
+ ' ' If lMassLink.Source.Member = aConstituent.Substring(0, 6) Or lMassLink.Source.Member = "POQUAL" Or
+ ' ' (lMassLink.Source.Member = "SOQUAL" AndAlso lMassLink.Source.Group = "IQUAL") Then
+ ' ' lMassLinkFactor = lMassLink.MFact
+ ' ' 'Return lMassLinkFactor
+ ' ' End If
+
+ ' 'Case "POQUAL-PO4_NUIF1_4", "SOQO-PO4_NUIF1_4", "SOQUAL-PO4_NUIF1_4", "IOQUAL-PO4_NUIF1_4",
+ ' ' "AOQUAL-PO4_NUIF1_4", "SCRQS-PO4_NUIF1_4", "WASHQS-PO4_NUIF1_4"
+ ' ' If lMassLink.Source.Member = aConstituent.Substring(0, 6) OrElse lMassLink.Source.Member = "POQUAL" OrElse
+ ' ' lMassLink.Source.Member = "SOQUAL" Then 'AndAlso lMassLink.Source.Group = "IQUAL") Then
+ ' ' lMassLinkFactor = lMassLink.MFact
+ ' ' 'Return lMassLinkFactor
+ ' ' End If
+
+ ' 'Case "POQUAL-ORTHO P_NUIF2_2", "SOQUAL-ORTHO P_NUIF2_2", "AOQUAL-ORTHO P_NUIF2_2", "IOQUAL-ORTHO P_NUIF2_2",
+ ' ' "POQUAL-ORTHO P_NUIF2_3", "SOQUAL-ORTHO P_NUIF2_3", "AOQUAL-ORTHO P_NUIF2_3", "IOQUAL-ORTHO P_NUIF2_3",
+ ' ' "POQUAL-ORTHO P_NUIF2_1", "SOQUAL-ORTHO P_NUIF2_1", "AOQUAL-ORTHO P_NUIF2_1", "IOQUAL-ORTHO P_NUIF2_1",
+ ' ' "WASHQS-ORTHO P_NUIF2_1", "WASHQS-ORTHO P_NUIF2_2", "WASHQS-ORTHO P_NUIF2_3",
+ ' ' "SCRQS-ORTHO P_NUIF2_1", "SCRQS-ORTHO P_NUIF2_2", "SCRQS-ORTHO P_NUIF2_3"
+
+ ' ' If lMassLink.Target.MemSub2 = 2 Then
+ ' ' If lMassLink.Source.Member = aConstituent.Substring(0, 6) Or lMassLink.Source.Member = "POQUAL" Then
+ ' ' lMassLinkFactor += lMassLink.MFact
+ ' ' 'Return lMassLinkFactor
+ ' ' End If
+ ' ' End If
+
+
+ ' 'Case "POQUAL-PO4_NUIF2_2", "SOQUAL-PO4_NUIF2_2", "AOQUAL-PO4_NUIF2_2", "IOQUAL-PO4_NUIF2_2",
+ ' ' "POQUAL-PO4_NUIF2_3", "SOQUAL-PO4_NUIF2_3", "AOQUAL-PO4_NUIF2_3", "IOQUAL-PO4_NUIF2_3",
+ ' ' "POQUAL-PO4_NUIF2_1", "SOQUAL-PO4_NUIF2_1", "AOQUAL-PO4_NUIF2_1", "IOQUAL-PO4_NUIF2_1",
+ ' ' "WASHQS-PO4_NUIF2_1", "WASHQS-PO4_NUIF2_2", "WASHQS-PO4_NUIF2_3",
+ ' ' "SCRQS-PO4_NUIF2_1", "SCRQS-PO4_NUIF2_2", "SCRQS-PO4_NUIF2_3"
+
+ ' ' If lMassLink.Target.MemSub2 = 2 Then
+ ' ' If lMassLink.Source.Member = aConstituent.Substring(0, 6) OrElse lMassLink.Source.Member = "POQUAL" OrElse lMassLink.Source.Member = "SOQUAL" Then
+ ' ' lMassLinkFactor += lMassLink.MFact
+ ' ' 'Return lMassLinkFactor
+ ' ' End If
+ ' ' End If
+
+ ' 'Case "WASHQS-BOD_PKIF_4", "SOQUAL-BOD_PKIF_4", "IOQUAL-BOD_PKIF_4", "AOQUAL-BOD_PKIF_4", "POQUAL-BOD_PKIF_4"
+ ' ' If (lMassLink.Source.Member = aConstituent.Substring(0, 6) Or lMassLink.Source.Member = "POQUAL") Or
+ ' ' (lMassLink.Source.Member = "SOQUAL" AndAlso lMassLink.Source.Group = "IQUAL") Then
+ ' ' If aMultipleIndex = 1 Then
+ ' ' lMassLinkFactor = lMassLink.MFact
+ ' ' ElseIf aMultipleIndex = 2 Then
+ ' ' lMassLinkFactor = BODMFact(aUCI, aConstituent, lMassLink.MassLinkId) * aConversionFactor
+ ' ' ElseIf aMultipleIndex = 0 Then
+ ' ' lMassLinkFactor = lMassLink.MFact + BODMFact(aUCI, aConstituent, lMassLink.MassLinkId) * aConversionFactor
+ ' ' End If
+ ' ' Return lMassLinkFactor
+ ' ' End If
+
+ ' 'Case "WASHQS-Ref-OrgP_PKIF_4", "SOQO-Ref-OrgP_PKIF_4", "IOQUAL-Ref-OrgP_PKIF_4", "AOQUAL-Ref-OrgP_PKIF_4", "POQUAL-Ref-OrgP_PKIF_4"
+ ' ' If (lMassLink.Source.Member = aConstituent.Substring(0, 6) Or lMassLink.Source.Member = "POQUAL") Or
+ ' ' (lMassLink.Source.Member = "SOQUAL" AndAlso lMassLink.Source.Group = "IQUAL") Then
+ ' ' If aMultipleIndex = 1 Then
+ ' ' lMassLinkFactor = lMassLink.MFact
+ ' ' ElseIf aMultipleIndex = 2 Then
+ ' ' lMassLinkFactor = BODMFact(aUCI, aConstituent, lMassLink.MassLinkId) * aConversionFactor
+ ' ' ElseIf aMultipleIndex = 0 Then
+ ' ' lMassLinkFactor = lMassLink.MFact + BODMFact(aUCI, aConstituent, lMassLink.MassLinkId) * aConversionFactor
+ ' ' End If
+ ' ' Return lMassLinkFactor
+ ' ' End If
+
+ ' 'Case "WASHQS-lab-OrgP_PKIF_4", "SOQO-lab-OrgP_PKIF_4", "IOQUAL-lab-OrgP_PKIF_4", "AOQUAL-lab-OrgP_PKIF_4", "POQUAL-lab-OrgP_PKIF_4"
+ ' ' If (lMassLink.Source.Member = aConstituent.Substring(0, 6) Or lMassLink.Source.Member = "POQUAL") Or
+ ' ' (lMassLink.Source.Member = "SOQUAL" AndAlso lMassLink.Source.Group = "IQUAL") Then
+ ' ' If aMultipleIndex = 1 Then
+ ' ' lMassLinkFactor = lMassLink.MFact
+ ' ' ElseIf aMultipleIndex = 2 Then
+ ' ' lMassLinkFactor = BODMFact(aUCI, aConstituent, lMassLink.MassLinkId) * aConversionFactor
+ ' ' ElseIf aMultipleIndex = 0 Then
+ ' ' lMassLinkFactor = lMassLink.MFact + BODMFact(aUCI, aConstituent, lMassLink.MassLinkId) * aConversionFactor
+ ' ' End If
+ ' ' Return lMassLinkFactor
+ ' ' End If
+
+
+ ' 'Case "PO4-P IN SOLUTION - SURFACE LAYER - OUTFLOW_NUIF1_4"
+ ' ' lMassLinkFactor = lMassLink.MFact
+ ' ' Return lMassLinkFactor
+ ' Case "PO4-P IN SOLUTION - INTERFLOW - OUTFLOW_NUIF1_4"
+ ' lMassLinkFactor = lMassLink.MFact
+ ' Return lMassLinkFactor
+ ' Case "PO4-P IN SOLUTION - GROUNDWATER - OUTFLOW_NUIF1_4"
+ ' lMassLinkFactor = lMassLink.MFact
+ ' Return lMassLinkFactor
+ ' Case "SDP4A_NUIF2_1", "SDP4A_NUIF2_2", "SDP4A_NUIF2_3", "SOQUAL-ORTHO P_NUIF2_1",
+ ' "SOQUAL-ORTHO P_NUIF2_2", "SOQUAL-ORTHO P_NUIF2_3"
+ ' If lMassLink.Target.MemSub2 = 2 Then
+ ' lMassLinkFactor += lMassLink.MFact
+ ' End If
+
+ ' Case "SDORP_PKIF_4"
+ ' lMassLinkFactor = lMassLink.MFact
+ ' Return lMassLinkFactor
+ ' Case "ORGN - TOTAL OUTFLOW_OXIF_2"
+ ' lMassLinkFactor = lMassLink.MFact * aConversionFactor
+ ' Return lMassLinkFactor
+
+ 'End Select
+
+ 'Anurag is not sure about following two cases.
+ 'If (lMassLink.Source.VolName = aConstituent AndAlso lMassLink.Target.Member = "NUIF1" AndAlso lMassLink.Target.MemSub1 = 4) Then
+ ' lMassLinkFactor += lMassLink.MFact
+
+ 'ElseIf (lMassLink.Source.VolName = aConstituent AndAlso lMassLink.Target.Member = "OXIF" AndAlso lMassLink.Target.MemSub1 = 2) Then
+ ' lMassLinkFactor += lMassLink.MFact * aConversionFactor
+
+ 'End If
Case "BOD-Labile"
- Select Case aConstituent & "_" & lMassLink.Target.Member.ToString & "_" & lMassLink.Target.MemSub1
- Case "WASHQS-BOD-Labile_OXIF_2", "SOQUAL-BOD-Labile_OXIF_2", "IOQUAL-BOD-Labile_OXIF_2", "AOQUAL-BOD-Labile_OXIF_2",
- "POQUAL-BOD-Labile_OXIF_2", "SOQO-BOD-Labile_OXIF_2"
+ Select Case True
+ Case (lMassLink.Source.Member = "SOQUAL" OrElse lMassLink.Source.Member = "POQUAL" OrElse lMassLink.Source.Member = "WASHQS") AndAlso
+ aConstituent = "WASHQS-BOD-Labile" AndAlso lMassLink.Target.Member = "OXIF" AndAlso lMassLink.Target.MemSub1 = 2
+ lMassLinkFactor = lMassLink.MFact
+ Return lMassLinkFactor
+ Case (lMassLink.Source.Member = "SOQUAL" OrElse lMassLink.Source.Member = "POQUAL" OrElse lMassLink.Source.Member = "SCRQS") AndAlso
+ aConstituent = "SCRQS-BOD-Labile" AndAlso lMassLink.Target.Member = "OXIF" AndAlso lMassLink.Target.MemSub1 = 2
+ lMassLinkFactor = lMassLink.MFact
+ Return lMassLinkFactor
+ Case (lMassLink.Source.Member = "SOQUAL" OrElse lMassLink.Source.Member = "POQUAL") AndAlso
+ aConstituent = "SOQO-BOD-Labile" AndAlso lMassLink.Target.Member = "OXIF" AndAlso lMassLink.Target.MemSub1 = 2
+ lMassLinkFactor = lMassLink.MFact
+ Return lMassLinkFactor
+ Case (lMassLink.Source.Member = "IOQUAL" OrElse lMassLink.Source.Member = "POQUAL") AndAlso
+ aConstituent = "IOQUAL-BOD-Labile" AndAlso lMassLink.Target.Member = "OXIF" AndAlso lMassLink.Target.MemSub1 = 2
lMassLinkFactor = lMassLink.MFact
Return lMassLinkFactor
- Case "WASHQS-BOD_OXIF_2", "SOQUAL-BOD_OXIF_2", "IOQUAL-BOD_OXIF_2", "AOQUAL-BOD_OXIF_2",
- "POQUAL-BOD_OXIF_2", "SOQO-BOD_OXIF_2"
+ Case (lMassLink.Source.Member = "AOQUAL" OrElse lMassLink.Source.Member = "POQUAL") AndAlso
+ aConstituent = "AOQUAL-BOD-Labile" AndAlso lMassLink.Target.Member = "OXIF" AndAlso lMassLink.Target.MemSub1 = 2
lMassLinkFactor = lMassLink.MFact
Return lMassLinkFactor
- Case "ORGN - TOTAL OUTFLOW_OXIF_2"
+ Case aConstituent = "ORGN - TOTAL OUTFLOW" AndAlso lMassLink.Target.Member = "OXIF" AndAlso lMassLink.Target.MemSub1 = 2
lMassLinkFactor = lMassLink.MFact
Return lMassLinkFactor
End Select
+
+ 'Select Case aConstituent & "_" & lMassLink.Target.Member.ToString & "_" & lMassLink.Target.MemSub1
+
+ ' 'Case "WASHQS-BOD-Labile_OXIF_2", "SOQUAL-BOD-Labile_OXIF_2", "IOQUAL-BOD-Labile_OXIF_2", "AOQUAL-BOD-Labile_OXIF_2",
+ ' ' "POQUAL-BOD-Labile_OXIF_2", "SOQO-BOD-Labile_OXIF_2"
+ ' ' If lMassLink.Source.Member.Substring(0, 3) = aConstituent.Substring(0, 3) Or lMassLink.Source.Member = "POQUAL" Or
+ ' ' (lMassLink.Source.Member = "SOQUAL" AndAlso lMassLink.Source.Group = "IQUAL") Then
+ ' ' lMassLinkFactor = lMassLink.MFact
+ ' ' Return lMassLinkFactor
+ ' ' End If
+ ' 'Case "WASHQS-BOD_OXIF_2", "SOQUAL-BOD_OXIF_2", "IOQUAL-BOD_OXIF_2", "AOQUAL-BOD_OXIF_2",
+ ' ' "POQUAL-BOD_OXIF_2", "SOQO-BOD_OXIF_2"
+ ' ' lMassLinkFactor = lMassLink.MFact
+ ' ' Return lMassLinkFactor
+ ' Case "ORGN - TOTAL OUTFLOW_OXIF_2"
+ ' lMassLinkFactor = lMassLink.MFact
+ ' Return lMassLinkFactor
+ 'End Select
Case "DO"
Select Case aConstituent & "_" & lMassLink.Source.Member.ToString & "_" & lMassLink.Target.Member.ToString &
"_" & lMassLink.Target.MemSub1
@@ -1869,4 +1987,56 @@ Public Module Utility
Return lOutflowDataType
End Function
+ Public Function FindDownStreamExitNumber(ByVal aUCI As HspfUci,
+ ByVal aReachID As HspfOperation,
+ ByRef aExitNumber As Integer) As Integer
+ 'Function to find the EXIT number through which the flow is sent to the downstream waterbody.
+ Dim lDownstreamReachID As Integer = aReachID.DownOper("RCHRES")
+ For Each lReachConnection As HspfConnection In aReachID.Targets
+ If lReachConnection.Target.VolId = lDownstreamReachID Then
+ Dim lMasslinkID As Integer = lReachConnection.MassLink
+ For Each lMasslink As HspfMassLink In aUCI.MassLinks
+ If lMasslink.MassLinkId = lMasslinkID Then
+ If lMasslink.Source.Member.ToString = "ROFLOW" Then
+ aExitNumber = 0
+ Else
+ aExitNumber = lMasslink.Source.MemSub1
+ Exit For
+ End If
+ End If
+ Next
+ End If
+ Next
+ Return aExitNumber
+ End Function
+ Public Function GetGENERSum(ByVal aUCI As HspfUci, ByVal aSource As HspfConnection, ByVal aSDateJ As Double, ByVal aEDateJ As Double) As Tuple(Of Double, Boolean)
+ Dim aGenerSum As Double = 0
+ Dim aGENERID As Integer = aSource.Source.VolId
+ Dim aGENEROperationisOutputtoWDM As Boolean = False
+ Dim aGENEROperation As HspfOperation = aSource.Source.Opn
+ For Each EXTTarget As HspfConnection In aGENEROperation.Targets
+ If EXTTarget.Target.VolName.Contains("WDM") Then
+ aGENEROperationisOutputtoWDM = True
+ Dim lWDMFile As String = EXTTarget.Target.VolName.ToString
+ Dim lDSN As Integer = EXTTarget.Target.VolId
+ For i As Integer = 0 To aUCI.FilesBlock.Count
+ If aUCI.FilesBlock.Value(i).Typ = lWDMFile Then
+ Dim lFileName As String = AbsolutePath(aUCI.FilesBlock.Value(i).Name.Trim, CurDir())
+ Dim lDataSource As atcDataSource = atcDataManager.DataSourceBySpecification(lFileName)
+ If lDataSource Is Nothing Then
+ If atcDataManager.OpenDataSource(lFileName) Then
+ lDataSource = atcDataManager.DataSourceBySpecification(lFileName)
+ End If
+ End If
+ Dim ltimeseries As atcTimeseries = lDataSource.DataSets.FindData("ID", lDSN)(0)
+ ltimeseries = SubsetByDate(ltimeseries, aSDateJ, aEDateJ, Nothing)
+ aGenerSum = ltimeseries.Attributes.GetDefinedValue("Sum").Value / YearCount(aSDateJ, aEDateJ)
+
+ End If
+ Next
+ End If
+ Next EXTTarget
+
+ Return New Tuple(Of Double, Boolean)(aGenerSum, aGENEROperationisOutputtoWDM)
+ End Function
End Module