Skip to content

Commit

Permalink
1. Added check to make sure that HSPEXP+ does not crash if GENER oper…
Browse files Browse the repository at this point in the history
…ation doesn't exist.

2. Added more colors fo Box-Whiskers plot.
  • Loading branch information
mishranurag committed Mar 29, 2018
1 parent b2ffea2 commit f701d51
Show file tree
Hide file tree
Showing 6 changed files with 93 additions and 42 deletions.
4 changes: 2 additions & 2 deletions HSPEXP/SetUpScript.iss
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
; SEE THE DOCUMENTATION FOR DETAILS ON CREATING INNO SETUP SCRIPT FILES!

#define MyAppName "HSPEXP+"
#define MyAppVersion "2.00beta1"
#define MyAppVersion "2.00beta2"
#define MyAppPublisher "RESPEC"
#define MyAppURL "http://www.respec.com/product/hspexp/"
#define MyAppExeName "HSPEXP+.exe"
Expand All @@ -23,7 +23,7 @@ AppContact= {#MyAppURL}
VersionInfoCopyright=Mozilla Public License (MPL) 1.1
DefaultDirName={reg:HKLM\SOFTWARE\RESPEC\BASINS45,Base Directory|{pf}\HSPEXP+}
DefaultGroupName={#MyAppName}
OutputBaseFilename=HSPEXP+2.00beta1SetUp
OutputBaseFilename=HSPEXP+2.00beta2SetUp
Compression=lzma
SolidCompression=yes
InfoBeforeFile=install.txt
Expand Down
2 changes: 1 addition & 1 deletion HSPEXP/SplashScreen1.vb
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
' Version.Text = System.String.Format(Version.Text, My.Application.Info.Version.Major, My.Application.Info.Version.Minor, My.Application.Info.Version.Build, My.Application.Info.Version.Revision)

With My.Application.Info.Version
Version.Text = "Version " & .Major & "." & .Minor & " beta1"
Version.Text = "Version " & .Major & "." & .Minor & " beta2"
If .MajorRevision > 0 OrElse .MinorRevision > 0 Then
Version.Text &= "." & .MajorRevision & "." & .MinorRevision
End If
Expand Down
6 changes: 6 additions & 0 deletions HSPEXP/install.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
HSPEXP+2.0beta2
Date: 03/28/2018

Bugs Fixed
1. In some cases, if the GENER operation didn't exist, HSPEXP+ crashed. That behavior has been fixed.

HSPEXP+2.0beta1
Date: 03/17/2018
Features:
Expand Down
73 changes: 53 additions & 20 deletions atcHspfSupport/atcConstituentTables.vb
Original file line number Diff line number Diff line change
Expand Up @@ -2451,6 +2451,37 @@ Public Module atcConstituentTables

Next lSource

Case "Water"
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 = "IVOL" Then
lGENERSum *= lMassLink.MFact
lGENERLoad += lGENERSum
Exit For
End If
Next lMassLink
ElseIf lSource.Target.Group = "INFLOW" AndAlso lSource.Target.Member = "IVOL" 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 Else
lGENERLoad = 0

Expand Down Expand Up @@ -2653,28 +2684,30 @@ Public Module atcConstituentTables
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)
If Not aGENEROperation Is Nothing Then
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
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)
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
End If
Next
End If
Next EXTTarget
End If

Return New Tuple(Of Double, Boolean)(aGenerSum, aGENEROperationisOutputtoWDM)
End Function
Expand Down
42 changes: 23 additions & 19 deletions atcHspfSupport/atcHspfConstituentBudget.vb
Original file line number Diff line number Diff line change
Expand Up @@ -1723,28 +1723,32 @@ Public Module ConstituentBudget
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)
If Not aGENEROperation Is Nothing Then
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
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)
Next
End If
Next EXTTarget

End If

End If
Next
End If
Next EXTTarget

Return New Tuple(Of Double, Boolean)(aGenerSum, aGENEROperationisOutputtoWDM)
End Function
Expand Down
8 changes: 8 additions & 0 deletions atcHspfSupport/modGraphBoxWhiskers.vb
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,14 @@ Public Module modGraphBoxWhiskers
.Add(Color.DodgerBlue)
.Add(Color.Gold)
.Add(Color.Indigo)
.Add(Color.Aqua)
.Add(Color.Black)
.Add(Color.BlanchedAlmond)
.Add(Color.CornflowerBlue)
.Add(Color.DarkOrange)
.Add(Color.Gray)
.Add(Color.HotPink)

End With
lGrapher.DataColors = data_colors

Expand Down

0 comments on commit f701d51

Please sign in to comment.