Skip to content

Commit

Permalink
Merge pull request #379 from OpenWaterAnalytics/merge_usepa5115
Browse files Browse the repository at this point in the history
Merged in USEPA-SWMM5.1.15
  • Loading branch information
bemcdonnell authored Feb 24, 2023
2 parents 7e7e6da + 969e2e5 commit c2c0f4f
Show file tree
Hide file tree
Showing 45 changed files with 687 additions and 406 deletions.
12 changes: 6 additions & 6 deletions .github/workflows/build-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ jobs:
requirements: [requirements-swmm.txt]
include:
- os: windows-2022
sys_pkgs: choco install boost-msvc-14.1
sys_pkgs: choco install boost-msvc-14.3
build_unit_test: make.cmd /g "Visual Studio 17 2022" /A "x64" /t
build_reg_test: make.cmd /g "Visual Studio 17 2022" /A "x64"
before_reg_test: before-nrtest.cmd
Expand Down Expand Up @@ -83,17 +83,17 @@ jobs:

steps:
- name: Checkout repo
uses: actions/checkout@v2
uses: actions/checkout@v3

- name: Clone ci-tools repo
uses: actions/checkout@v2
uses: actions/checkout@v3
with:
repository: OpenWaterAnalytics/ci-tools
ref: master
path: ci-tools

- name: Setup python
uses: actions/setup-python@v2
uses: actions/setup-python@v4
with:
python-version: "3.7"

Expand All @@ -114,15 +114,15 @@ jobs:
- name: Before reg test
env:
NRTESTS_URL: https://github.com/OpenWaterAnalytics/swmm-nrtestsuite
BENCHMARK_TAG: v2.0.1
BENCHMARK_TAG: v2.0.2
run: ./${{ matrix.before_reg_test }} ${{ env.BENCHMARK_TAG }}

- name: Run reg test
run: ./${{ matrix.run_reg_test }} ${{ matrix.build_id }}

- name: Upload artifacts
if: ${{ always() }}
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v3
with:
name: build-test-artifacts
path: upload/*.*
12 changes: 11 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

# Eclipse Stuff
.metadata/
.settings/
Expand All @@ -7,6 +6,17 @@
.pydevproject


.DS_Store

build*/
nrtest*/

*_export.h

src/outfile/include/*_export.h
src/solver/include/*_export.h


# Mac Stuff
.DS_Store

Expand Down
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ endif()


project(swmm-solver
VERSION 5.1.14
VERSION 5.1.15
LANGUAGES C CXX
)

Expand Down
6 changes: 3 additions & 3 deletions extern/boost.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@
# Author: Michael E. Tryby
# US EPA - ORD/CESER
#
# Usage:
# Create environment variable with the following pattern -- "BOOST_ROOT_X_XX_X"
# Usage:
# Create environment variable with the following pattern -- "BOOST_ROOT_X_XX_X"
# where Xs are the Boost version -- pointing to install location.
#
#


if(WIN32)
Expand Down
4 changes: 2 additions & 2 deletions src/outfile/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
#
# Author: Michael E. Tryby
# US EPA ORD/CESER
#
#
#

# configure file groups
Expand All @@ -18,7 +18,7 @@ set(SWMM_OUT_PUBLIC_HEADERS


# the binary output file API
add_library(swmm-output
add_library(swmm-output
swmm_output.c
errormanager.c
)
Expand Down
2 changes: 2 additions & 0 deletions src/outfile/swmm_output.c
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
*/


#define _CRT_SECURE_NO_DEPRECATE

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
Expand Down
5 changes: 3 additions & 2 deletions src/run/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
*/

#include <stdio.h>
#include <string.h>
#include <time.h>
#include <string.h>
#include <math.h>
Expand Down Expand Up @@ -124,7 +125,7 @@ int main(int argc, char *argv[])

else if (strcmp(arg1, "--version") == 0 || strcmp(arg1, "-v") == 0) {
printf("\nVersion:\n");
printf("\tOWA-SWMM v%s (Build %.10s)\n\n", swmm_getSemVersion(),
printf("\tOWA-SWMM v%s (Build %.10s)\n\n", swmm_getSemVersion(),
swmm_getBuildId());
}

Expand All @@ -139,4 +140,4 @@ int main(int argc, char *argv[])
}

return 0;
}
}
16 changes: 6 additions & 10 deletions src/solver/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -38,15 +38,15 @@ if(BUILD_DEF)
PROPERTIES_HEADER_FILE_ONLY TRUE
)

add_library(swmm5
add_library(swmm5
${SWMM_SOURCES}
${PROJECT_SOURCE_DIR/bindings/swmm5.def}
$<TARGET_OBJECTS:shared_objs>
)

else()
# Performs standard library build
add_library(swmm5
add_library(swmm5
${SWMM_SOURCES}
$<TARGET_OBJECTS:shared_objs>
)
Expand Down Expand Up @@ -90,7 +90,7 @@ target_include_directories(swmm5

include(GenerateExportHeader)
generate_export_header(swmm5
BASE_NAME toolkit
BASE_NAME toolkit
EXPORT_MACRO_NAME EXPORT_TOOLKIT
EXPORT_FILE_NAME toolkit_export.h
STATIC_DEFINE SHARED_EXPORTS_BUILT_AS_STATIC
Expand Down Expand Up @@ -118,21 +118,17 @@ install(TARGETS swmm5 EXPORT swmm5Targets
FRAMEWORK DESTINATION "${TOOL_DIST}"
)

# Create target import scripts so other cmake projects can use swmm libraries
install(
EXPORT
swmm5Targets
DESTINATION
"${CONFIG_DIST}"
FILE
swmm5-config.cmake
)
)

install(
FILES
${SWMM_PUBLIC_HEADERS}
DESTINATION
"${INCLUDE_DIST}"
)
install(FILES ${SWMM_PUBLIC_HEADERS} DESTINATION "${INCLUDE_DIST}")


# copy swmm5 to build tree for testing
Expand Down
8 changes: 8 additions & 0 deletions src/solver/consts.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,16 @@
// 08/01/16 (Build 5.1.011)
// 05/10/18 (Build 5.1.013)
// 03/01/20 (Build 5.1.014)
// 04/01/20 (Build 5.1.015)
// Author: L. Rossman
//
// Various Constants
//-----------------------------------------------------------------------------

#ifndef CONSTS_H
#define CONSTS_H


//------------------
// General Constants
//------------------
Expand Down Expand Up @@ -93,3 +98,6 @@
// Token separator characters
//---------------------------
#define SEPSTR " \t\n\r"


#endif //CONSTS_H
7 changes: 7 additions & 0 deletions src/solver/datetime.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@
// - New getTimeStamp function added.
//-----------------------------------------------------------------------------

#ifndef DATETIME_H
#define DATETIME_H


typedef double DateTime;

#define Y_M_D 0
Expand Down Expand Up @@ -61,3 +65,6 @@ void datetime_setDateFormat(int fmt);
DateTime datetime_addSeconds(DateTime date1, double seconds);
DateTime datetime_addDays(DateTime date1, DateTime date2);
long datetime_timeDiff(DateTime date1, DateTime date2);


#endif //DATETIME_H
15 changes: 10 additions & 5 deletions src/solver/dynwave.c
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
// 03/19/15 (5.1.008)
// 08/01/16 (5.1.011)
// 05/10/18 (5.1.013)
// 03/01/20 (5.1.014)
// 07/10/20 (5.1.015)
// Author: L. Rossman (EPA)
// M. Tryby (EPA)
// R. Dickinson (CDM)
Expand Down Expand Up @@ -49,6 +51,9 @@
// - updateNodeFlows() modified to subtract conduit evap. and seepage losses
// from downstream node inflow instead of upstream node outflow.
//
// Build 5.1.015:
// - Roll back the 5.1.014 change for conduit losses in updateNodeFlows().
//
//-----------------------------------------------------------------------------
#define _CRT_SECURE_NO_DEPRECATE

Expand Down Expand Up @@ -403,7 +408,7 @@ void findLinkFlows(double dt)
for ( i = 0; i < Nobjects[LINK]; i++)
{
if ( !isTrueConduit(i) )
{
{
if ( !Link[i].bypassed ) findNonConduitFlow(i, dt);
updateNodeFlows(i);
}
Expand Down Expand Up @@ -551,13 +556,13 @@ void updateNodeFlows(int i)
// --- update total inflow & outflow at upstream/downstream nodes
if ( q >= 0.0 )
{
Node[n1].outflow += q; //(5.1.014)
Node[n2].inflow += q - uniformLossRate; //(5.1.014)
Node[n1].outflow += q + uniformLossRate; //(5.1.015)
Node[n2].inflow += q; //(5.1.015)
}
else
{
Node[n1].inflow -= q + uniformLossRate; //(5.1.014)
Node[n2].outflow -= q; //(5.1.014)
Node[n1].inflow -= q; //(5.1.015)
Node[n2].outflow -= q - uniformLossRate; //(5.1.015)
}

// --- add surf. area contributions to upstream/downstream nodes
Expand Down
27 changes: 17 additions & 10 deletions src/solver/enums.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,14 @@
//
// Build 5.1.013:
// - SURCHARGE_METHOD and RULE_STEP options added.
// - WEIR_CURVE added as a curve type.
// - WEIR_CURVE added as a curve type.
//
//-----------------------------------------------------------------------------

#ifndef ENUMS_H
#define ENUMS_H


//-------------------------------------
// Names of major object types
//-------------------------------------
Expand Down Expand Up @@ -114,18 +118,18 @@
// Cross section shape types
//-------------------------------------
enum XsectType {
DUMMY, // 0
DUMMY, // 0
CIRCULAR, // 1 closed
FILLED_CIRCULAR, // 2 closed
RECT_CLOSED, // 3 closed
RECT_OPEN, // 4
TRAPEZOIDAL, // 5
TRIANGULAR, // 6
RECT_OPEN, // 4
TRAPEZOIDAL, // 5
TRIANGULAR, // 6
PARABOLIC, // 7
POWERFUNC, // 8
RECT_TRIANG, // 9
POWERFUNC, // 8
RECT_TRIANG, // 9
RECT_ROUND, // 10
MOD_BASKET, // 11
MOD_BASKET, // 11
HORIZ_ELLIPSE, // 12 closed
VERT_ELLIPSE, // 13 closed
ARCH, // 14 closed
Expand Down Expand Up @@ -194,7 +198,7 @@
//-------------------------------------
// Computed node quantities
//-------------------------------------
#define MAX_NODE_RESULTS 7
#define MAX_NODE_RESULTS 7
enum NodeResultType {
NODE_DEPTH, // water depth above invert
NODE_HEAD, // hydraulic head
Expand Down Expand Up @@ -411,7 +415,7 @@ enum CompatibilityType {

enum PumpCurveType {
TYPE1_PUMP, // flow varies stepwise with wet well volume
TYPE2_PUMP, // flow varies stepwise with inlet depth
TYPE2_PUMP, // flow varies stepwise with inlet depth
TYPE3_PUMP, // flow varies with head delivered
TYPE4_PUMP, // flow varies with inlet depth
IDEAL_PUMP}; // outflow equals inflow
Expand Down Expand Up @@ -480,3 +484,6 @@ enum NoneAllType {
NONE,
ALL,
SOME};


#endif //ENUMS_H
9 changes: 7 additions & 2 deletions src/solver/error.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
// Date: 03/20/14 (Build 5.1.001)
// 03/19/15 (Build 5.1.008)
// 08/05/15 (Build 5.1.010)
// 04/14/20 (Build 5.1.015)
// Author: L. Rossman
//
// Error messages
Expand All @@ -16,6 +17,8 @@
// Build 5.1.010:
// - Text of Error 318 for rainfall data files modified.
//
// Build 5.1.015:
// - Added new Error 140 for storage nodes.
//-----------------------------------------------------------------------------
#define _CRT_SECURE_NO_DEPRECATE

Expand Down Expand Up @@ -55,6 +58,8 @@
#define ERR138 \
"\n ERROR 138: Node %s has initial depth greater than maximum depth."
#define ERR139 "\n ERROR 139: Regulator %s is the outlet of a non-storage node."
#define ERR140 \
"\n ERROR 140: Storage node %s has negative volume at full depth." //(5.1.015)
#define ERR141 \
"\n ERROR 141: Outfall %s has more than 1 inlet link or an outlet link."
#define ERR143 "\n ERROR 143: Regulator %s has invalid cross-section shape."
Expand Down Expand Up @@ -200,7 +205,7 @@ char* ErrorMsgs[] =
ERR327, ERR329, ERR330, ERR331, ERR333, ERR335, ERR336, ERR337, ERR338,
ERR339, ERR341, ERR343, ERR345, ERR351, ERR353, ERR355, ERR357, ERR361,
ERR363, ERR401, ERR402, ERR403, ERR405, ERR501, ERR502, ERR503, ERR504,
ERR505, ERR506, ERR507, ERR508, ERR509, ERR510, ERR511, ERR512};
ERR505, ERR506, ERR507, ERR508, ERR509, ERR510, ERR511, ERR512, ERR140};

int ErrorCodes[] =
{ 0, 101, 103, 105, 107, 108, 109, 110, 111,
Expand All @@ -215,7 +220,7 @@ int ErrorCodes[] =
327, 329, 330, 331, 333, 335, 336, 337, 338,
339, 341, 343, 345, 351, 353, 355, 357, 361,
363, 401, 402, 403, 405, 501, 502, 503, 504,
505, 506, 507, 508, 509, 510, 511, 512};
505, 506, 507, 508, 509, 510, 511, 512, 140};

char ErrString[256];

Expand Down
Loading

0 comments on commit c2c0f4f

Please sign in to comment.