Skip to content

Commit fc74b17

Browse files
committed
Merge branch 'develop' into particle_gen3_csp
2 parents b4c91c6 + af536ea commit fc74b17

File tree

1,209 files changed

+147365
-110348
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

1,209 files changed

+147365
-110348
lines changed

.github/workflows/ci.yml

Lines changed: 52 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ env:
88
# Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.)
99
BUILD_TYPE: Release
1010
GTEST_REF: b85864c64758dec007208e56af933fc3f52044ee
11+
ORTOOLS_VER: "9.14"
12+
ORTOOLS_RELEASE: "6206"
1113

1214
jobs:
1315
build-on-ubuntu:
@@ -27,7 +29,17 @@ jobs:
2729
echo "GTEST=$GTEST" >> $GITHUB_ENV
2830
SSCDIR=$GITHUB_WORKSPACE/ssc
2931
echo "SSCDIR=$SSCDIR" >> $GITHUB_ENV
32+
ORTOOLSDIR=$GITHUB_WORKSPACE/or-tools_x86_64_Ubuntu-24.04_cpp_v$ORTOOLS_VER.$ORTOOLS_RELEASE
33+
echo "ORTOOLSDIR=$ORTOOLSDIR" >> $GITHUB_ENV
3034
35+
- name: Download OR-Tools
36+
if: steps.cached-ortools-restore.outputs.cache-hit != 'true'
37+
shell: bash
38+
run: |
39+
curl -L https://github.com/google/or-tools/releases/download/v$ORTOOLS_VER/or-tools_amd64_ubuntu-24.04_cpp_v$ORTOOLS_VER.$ORTOOLS_RELEASE.tar.gz -o or-tools-$ORTOOLS_VER.tar.gz
40+
tar xvzf or-tools-$ORTOOLS_VER.tar.gz
41+
42+
3143
- name: Get cached GTest
3244
uses: actions/cache@v4
3345
id: cachedgtest
@@ -49,27 +61,23 @@ jobs:
4961
export
5062
mkdir ${GTEST}/build
5163
cd ${GTEST}/build
52-
cmake -DCMAKE_CXX_FLAGS=-std=c++11 ..
64+
cmake -DCMAKE_CXX_FLAGS=-std=c++17 ..
5365
make
54-
66+
5567
- name: Checkout SSC
5668
uses: actions/checkout@v4
5769
with:
5870
path: ssc
5971

60-
- name: Configure CMake
61-
# Configure cmake to build ssc tests but not tools
62-
run: |
63-
mkdir ${SSCDIR}/build
64-
cd ${SSCDIR}/build
65-
cmake .. -DCMAKE_BUILD_TYPE=Release -DSAM_SKIP_TOOLS=1
66-
67-
- name: Build
68-
# Build your program with the given configuration
72+
- name: Build SSC
73+
shell: bash
6974
run: |
70-
cd ${SSCDIR}/build
75+
# Downloaded OR-Tools has CoinOR enabled
76+
mkdir $SSCDIR/build
77+
cd $SSCDIR/build
78+
cmake -DCMAKE_CONFIGURATION_TYPES="Release" -DENABLE_COVERAGE=1 -DSAM_SKIP_AUTOGEN=0 -DSAMAPI_EXPORT=1 -DSAM_SKIP_TOOLS=1 -DSAMPRIVATE=1 -DUSE_XPRESS=0 -DUSE_COINOR=1 -DCMAKE_SYSTEM_VERSION=10.0 -DCMAKE_SYSTEM_PREFIX_PATH=${ORTOOLSDIR} -Dabsl_DIR=${ORTOOLSDIR}\lib\cmake\absl" -Dutf8_range_DIR=${ORTOOLSDIR}\lib\cmake\utf8_range" ..
7179
make -j4
72-
80+
7381
- name: Test
7482
# Turn off fast fail for when the landbosse tests write to cerr
7583
run: |
@@ -118,13 +126,22 @@ jobs:
118126
echo "GTEST=$GTEST" >> $GITHUB_ENV
119127
SSCDIR=$GITHUB_WORKSPACE/ssc
120128
echo "SSCDIR=$SSCDIR" >> $GITHUB_ENV
129+
ORTOOLSDIR=$GITHUB_WORKSPACE/or-tools_x86_64_macOS-15.5_cpp_v$ORTOOLS_VER.$ORTOOLS_RELEASE
130+
echo "ORTOOLSDIR=$ORTOOLSDIR" >> $GITHUB_ENV
121131
132+
- name: Download OR-Tools
133+
if: steps.cached-ortools-restore.outputs.cache-hit != 'true'
134+
shell: bash
135+
run: |
136+
curl -L https://github.com/google/or-tools/releases/download/v$ORTOOLS_VER/or-tools_x86_64_macOS-15.5_cpp_v$ORTOOLS_VER.$ORTOOLS_RELEASE.tar.gz -o or-tools-$ORTOOLS_VER.tar.gz
137+
tar xvzf or-tools-$ORTOOLS_VER.tar.gz
138+
122139
- name: Get cached GTest
123140
uses: actions/cache@v4
124141
id: cachedgtest
125142
with:
126143
path: ${{env.GTEST}}/
127-
key: gtest-${{ matrix.os }}
144+
key: ortools-${{ matrix.os }}
128145
- name: Clone Gtest
129146
if: steps.cachedgtest.outputs.cache-hit != 'true'
130147
uses: actions/checkout@v4
@@ -139,7 +156,7 @@ jobs:
139156
export
140157
mkdir ${GTEST}/build
141158
cd ${GTEST}/build
142-
cmake -DCMAKE_CXX_FLAGS=-std=c++11 ..
159+
cmake -DCMAKE_CXX_FLAGS=-std=c++17 ..
143160
make
144161
145162
- name: Checkout SSC
@@ -152,7 +169,7 @@ jobs:
152169
run: |
153170
mkdir ${SSCDIR}/build
154171
cd ${SSCDIR}/build
155-
cmake .. -DCMAKE_BUILD_TYPE=Release -DSAM_SKIP_TOOLS=1 -DSAMAPI_EXPORT=0
172+
cmake .. -DCMAKE_BUILD_TYPE=Release -DSAM_SKIP_TOOLS=1 -DSAMAPI_EXPORT=0 -DCMAKE_INSTALL_PREFIX=${ORTOOLSDIR}
156173
157174
- name: Build
158175
# Build your program with the given configuration
@@ -211,6 +228,8 @@ jobs:
211228
runs-on: windows-latest
212229

213230
steps:
231+
- uses: actions/checkout@v4
232+
214233
- name: Setup cmake
215234
uses: jwlawson/actions-setup-cmake@v2
216235
with:
@@ -225,7 +244,17 @@ jobs:
225244
echo "GTEST=$GTEST" >> $GITHUB_ENV
226245
SSCDIR=$GITHUB_WORKSPACE/ssc
227246
echo "SSCDIR=$SSCDIR" >> $GITHUB_ENV
228-
247+
ORTOOLSDIR=$GITHUB_WORKSPACE/or-tools_x64_VisualStudio2022_cpp_v$ORTOOLS_VER.$ORTOOLS_RELEASE
248+
echo "ORTOOLSDIR=$ORTOOLSDIR" >> $GITHUB_ENV
249+
250+
251+
- name: Download OR-Tools
252+
if: steps.cached-ortools-restore.outputs.cache-hit != 'true'
253+
shell: bash
254+
run: |
255+
curl -L https://github.com/google/or-tools/releases/download/v$ORTOOLS_VER/or-tools_x64_VisualStudio2022_cpp_v$ORTOOLS_VER.$ORTOOLS_RELEASE.zip -o or-tools-$ORTOOLS_VER.zip
256+
7z x or-tools-$ORTOOLS_VER.zip
257+
229258
- name: Get cached GTest
230259
uses: actions/cache@v4
231260
id: cachedgtest
@@ -245,7 +274,6 @@ jobs:
245274
if: steps.cachedgtest.outputs.cache-hit != 'true'
246275
shell: bash
247276
run: |
248-
export
249277
mkdir ${GTEST}/build
250278
cd ${GTEST}/build
251279
cmake -Dgtest_force_shared_crt=ON ..
@@ -256,19 +284,18 @@ jobs:
256284
with:
257285
path: ssc
258286

259-
- name: Configure CMake
287+
- name: Build SSC
260288
shell: bash
261-
# Configure cmake to build ssc tests but not tools
262289
run: |
263-
mkdir ${SSCDIR}/build
264-
cd ${SSCDIR}/build
265-
cmake .. -DSAM_SKIP_TOOLS=1 -DCMAKE_CONFIGURATION_TYPES="Release"
266-
cmake --build . --config Release -j4
290+
# Downloaded OR-Tools has CoinOR enabled
291+
mkdir $SSCDIR/build
292+
cd $SSCDIR/build
293+
cmake -G "Visual Studio 17 2022" -DCMAKE_CONFIGURATION_TYPES="Release" -DSAM_SKIP_AUTOGEN=0 -DSAMAPI_EXPORT=1 -DSAM_SKIP_TOOLS=1 -DSAMPRIVATE=1 -DUSE_XPRESS=0 -DUSE_COINOR=1 -DCMAKE_SYSTEM_VERSION=10.0 -DCMAKE_SYSTEM_PREFIX_PATH=${ORTOOLSDIR} -Dabsl_DIR=${ORTOOLSDIR}\lib\cmake\absl" -Dutf8_range_DIR=${ORTOOLSDIR}\lib\cmake\utf8_range" ..
294+
cmake --build . --config Release -j4 --target Test
267295
cp ssc/Release/* test/Release
268296
269297
- name: Test
270298
shell: bash
271-
# Turn off fast fail for when the landbosse tests write to cerr
272299
run: |
273300
cd ${SSCDIR}/build/test/Release
274301
LOG_FILE=${SSCDIR}/build/test/gtest.log

.github/workflows/coverage.yml

Lines changed: 44 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ env:
88
# Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.)
99
BUILD_TYPE: Debug
1010
GTEST_REF: b85864c64758dec007208e56af933fc3f52044ee
11+
ORTOOLS_VER: "9.14"
1112

1213
jobs:
1314
coveralls-on-ubuntu:
@@ -30,13 +31,49 @@ jobs:
3031
echo "GTEST=$GTEST" >> $GITHUB_ENV
3132
SSCDIR=$GITHUB_WORKSPACE/ssc
3233
echo "SSCDIR=$SSCDIR" >> $GITHUB_ENV
34+
ORTOOLSDIR=$GITHUB_WORKSPACE/or-tools-$ORTOOLS_VER/install_release
35+
echo "ORTOOLSDIR=$ORTOOLSDIR" >> $GITHUB_ENV
36+
3337
3438
- name: Install OS dependencies
3539
run: |
3640
sudo apt-get update --fix-missing
3741
sudo apt-get install -y \
3842
lcov
3943
44+
- name: Restore cached OR-Tools
45+
id: cached-ortools-restore
46+
uses: actions/cache/restore@v4
47+
with:
48+
key: ortools-${{env.ORTOOLS_VER}}-linux-debug
49+
path: ${{env.ORTOOLSDIR}}/
50+
51+
- name: Download OR-Tools
52+
if: steps.cached-ortools-restore.outputs.cache-hit != 'true'
53+
shell: bash
54+
run: |
55+
curl -L https://github.com/google/or-tools/releases/download/v$ORTOOLS_VER/or-tools-$ORTOOLS_VER.tar.gz -o or-tools-$ORTOOLS_VER.tar.gz
56+
tar xvzf or-tools-$ORTOOLS_VER.tar.gz
57+
58+
- name: build OR-Tools
59+
if: steps.cached-ortools-restore.outputs.cache-hit != 'true'
60+
shell: bash
61+
run: |
62+
mkdir ${ORTOOLSDIR}
63+
cd or-tools-$ORTOOLS_VER
64+
mkdir build
65+
cmake -S . -B build -DCMAKE_BUILD_TYPE=Debug -DBUILD_DEPS=ON -DUSE_COINOR=ON -DUSE_GLPK=ON -DBUILD_EXAMPLES=OFF -DBUILD_SAMPLES=OFF -DBUILD_DOC=OFF -DINSTALL_DOC=OFF -DCMAKE_INSTALL_PREFIX=${ORTOOLSDIR}
66+
cmake --build build --config Debug --target all -j4 -v
67+
cmake --build build --config Debug --target install -v
68+
69+
- name: Always save OR-Tools build
70+
id: cached-ortools-save
71+
if: always() && steps.cached-ortools-restore.outputs.cache-hit != 'true'
72+
uses: actions/cache/save@v4
73+
with:
74+
key: ${{ steps.cached-ortools-restore.outputs.cache-primary-key }}
75+
path: ${{env.ORTOOLSDIR}}/
76+
4077

4178
- name: Get cached GTest
4279
uses: actions/cache@v4
@@ -59,25 +96,21 @@ jobs:
5996
export
6097
mkdir ${GTEST}/build
6198
cd ${GTEST}/build
62-
cmake -DCMAKE_CXX_FLAGS=-std=c++11 ..
99+
cmake -DCMAKE_CXX_FLAGS=-std=c++17 ..
63100
make
64101
65102
- name: Checkout SSC
66103
uses: actions/checkout@v4
67104
with:
68105
path: ssc
69106

70-
- name: Configure CMake
71-
# Configure cmake to build ssc tests but not tools
72-
run: |
73-
mkdir ${SSCDIR}/build
74-
cd ${SSCDIR}/build
75-
cmake .. -DCMAKE_BUILD_TYPE=Debug -DENABLE_COVERAGE=1 -DSAM_SKIP_TOOLS=1
76-
77-
- name: Build
78-
# Build your program with the given configuration
107+
- name: Build SSC
108+
shell: bash
79109
run: |
80-
cd ${SSCDIR}/build
110+
# Downloaded OR-Tools has CoinOR enabled
111+
mkdir $SSCDIR/build
112+
cd $SSCDIR/build
113+
cmake -DCMAKE_BUILD_TYPE=Debug -DENABLE_COVERAGE=1 -DSAM_SKIP_TOOLS=1 -DUSE_XPRESS=0 -DUSE_COINOR=1 -DCMAKE_SYSTEM_VERSION=10.0 -DCMAKE_SYSTEM_PREFIX_PATH=${ORTOOLSDIR} -Dabsl_DIR=${ORTOOLSDIR}\lib\cmake\absl" -Dutf8_range_DIR=${ORTOOLSDIR}\lib\cmake\utf8_range" ..
81114
make -j4
82115
83116
- name: Test

.github/workflows/release.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,4 +46,4 @@ jobs:
4646
git add '${{ github.workspace }}/ssc/test/elapsed_time_release'
4747
git commit -m "Update Test Elapsed Time CSVs for new Release"
4848
git push origin update_test_times
49-
gh pr create -B develop -H update_test_times --title 'Merge update_test_times into develop' --body 'Created by Github action'
49+
gh pr create -B develop -H update_test_times --title 'Merge update_test_times into develop' --body 'As part of automated release process, run the SSC tests and update the test times CSV. This allows tracking of the test times across releases, and for comparison of feature branchs' test times to that of the latest release.\n\nCreated via release.yml by Github action'

.gitignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,8 @@ bld/
3333
build/
3434
cmake-build-debug/
3535
cmake-build-release/
36+
CMakeFiles
37+
CMakeCache.txt
3638
test/Test
3739

3840
# Visual Studio 2015 cache/options directory
@@ -344,6 +346,7 @@ build_osx/Test
344346
build_linux/Test
345347
build_linux/config.status
346348
linux_test\.txt
349+
build2
347350

348351
nlopt/config.h
349352
nlopt/config.status
@@ -360,3 +363,5 @@ ssc/ssc\.exp
360363
ssc/sscd\.exp
361364

362365
build_android/lib_oldssc.zip
366+
367+
or-tools

CMakeLists.txt

Lines changed: 36 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,18 @@ option(SAM_SKIP_TESTS "Skips building tests" OFF)
1616

1717
option(SAMAPI_EXPORT "Export of ssc binaries to the SAM_api directory; for Unix, compile ssc libraries for SAM_api" ON)
1818

19+
include(CMakeDependentOption)
20+
21+
CMAKE_DEPENDENT_OPTION(BUILD_DEPS "Build OR-Tools dependencies" ON "NOT SKIP_ORTOOLS" OFF)
22+
CMAKE_DEPENDENT_OPTION(USE_COINOR "Use the COIN-OR solver" OFF "NOT SKIP_ORTOOLS" OFF)
23+
CMAKE_DEPENDENT_OPTION(USE_HIGHS "Use the HiGHS solver" OFF "NOT SKIP_ORTOOLS" OFF)
24+
CMAKE_DEPENDENT_OPTION(BUILD_EXAMPLES "Build examples" OFF "NOT SKIP_ORTOOLS" OFF)
25+
CMAKE_DEPENDENT_OPTION(BUILD_SAMPLES "Build samples" OFF "NOT SKIP_ORTOOLS" OFF)
26+
CMAKE_DEPENDENT_OPTION(INSTALL_DOC "Install doc" OFF "NOT SKIP_ORTOOLS" OFF)
27+
CMAKE_DEPENDENT_OPTION(USE_COINOR "Use COINOR solvers" OFF "NOT SKIP_ORTOOLS" OFF)
28+
CMAKE_DEPENDENT_OPTION(USE_XPRESS "Adds support for the XPRESS Solver" OFF "NOT SKIP_ORTOOLS" OFF)
29+
30+
1931
#
2032
# If project isn't system_advisor_model and SAM_SKIP_TOOLS=1,
2133
# environment vars LK_LIB and LKD_LIB can be used to specify where to find those libraries
@@ -25,12 +37,28 @@ if(APPLE)
2537
set(CMAKE_OSX_DEPLOYMENT_TARGET "12" CACHE STRING "Minimum OS X deployment version")
2638
endif()
2739

40+
if (UNIX AND NOT CMAKE_C_COMPILER)
41+
set(CMAKE_C_COMPILER gcc)
42+
set(CMAKE_CXX_COMPILER g++)
43+
endif()
44+
45+
set(CMAKE_CXX_STANDARD 20)
46+
2847
if ( NOT APPLE)
2948
set(CURL_DIR build_resources/libcurl_ssl_x64)
3049
endif()
3150

3251
Project(sam_simulation_core VERSION 1.0.0 LANGUAGES CXX C)
3352

53+
if(MSVC)
54+
set(CMAKE_CONFIGURATION_TYPES "Debug;Release" CACHE STRING "Debug and Release Builds Configured" FORCE)
55+
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /std:c++20")
56+
# for linking to Release build of ortools
57+
set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreadedDLL")
58+
# Get the current debug flags and remove the /D_DEBUG option.
59+
string(REPLACE "/D_DEBUG" "" CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG}")
60+
endif()
61+
3462

3563
#####################################################################################################################
3664
#
@@ -39,7 +67,6 @@ Project(sam_simulation_core VERSION 1.0.0 LANGUAGES CXX C)
3967
#####################################################################################################################
4068
set(CMAKE_VERBOSE_MAKEFILE ON)
4169
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
42-
set(CMAKE_CXX_STANDARD 11)
4370

4471
function(set_no_warnings target)
4572
get_target_property(MAIN_CFLAGS ${target} COMPILE_FLAGS)
@@ -76,7 +103,11 @@ function(set_default_compile_options target)
76103
set(MAIN_CFLAGS "")
77104
endif()
78105
set(MAIN_CFLAGS "${MAIN_CFLAGS} -D__64BIT__")
79-
set_property(TARGET ${target} PROPERTY CXX_STANDARD 11)
106+
if (MSVC)
107+
set_property(TARGET ${target} PROPERTY CXX_STANDARD 20)
108+
else()
109+
set_property(TARGET ${target} PROPERTY CXX_STANDARD 17)
110+
endif()
80111
set_property(TARGET ${target} PROPERTY CXX_STANDARD_REQUIRED ON)
81112
if(MSVC)
82113
set(MAIN_CFLAGS "${MAIN_CFLAGS} /bigobj /MP")
@@ -120,7 +151,7 @@ function(set_tools_compile_options target)
120151
if (APPLE)
121152
set(MAIN_CFLAGS "${MAIN_CFLAGS} -D__WXOSX__")
122153
endif()
123-
set(MAIN_CFLAGS "${MAIN_CFLAGS} -Wall -Wno-deprecated -Wno-unknown-pragmas -Wno-overloaded-virtual -fno-common -std=c++11")
154+
set(MAIN_CFLAGS "${MAIN_CFLAGS} -Wall -Wno-deprecated -Wno-unknown-pragmas -Wno-overloaded-virtual -fno-common")
124155
set(MAIN_CFLAGS "${MAIN_CFLAGS} -DLK_USE_WXWIDGETS")
125156
endif(MSVC)
126157
set_target_properties(${target} PROPERTIES COMPILE_FLAGS ${MAIN_CFLAGS})
@@ -151,11 +182,11 @@ add_subdirectory(tcs)
151182
add_subdirectory(ssc)
152183

153184
if (NOT SAM_SKIP_TOOLS)
154-
add_subdirectory(sdktool)
185+
add_subdirectory(sdktool)
155186
endif()
156187

157188
if (NOT SAM_SKIP_TESTS)
158-
add_subdirectory(test)
189+
add_subdirectory(test)
159190
endif()
160191

161192
if(CMAKE_BUILD_TYPE STREQUAL "Debug"

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
BSD 3-Clause License
22

3-
Copyright (c) 2017, 2022 Alliance for Sustainable Energy, LLC
3+
Copyright (c) 2017, 2022 Alliance for Energy Innovation, LLC
44
All rights reserved.
55

66
Redistribution and use in source and binary forms, with or without

0 commit comments

Comments
 (0)