Skip to content

Commit 259464b

Browse files
committed
Merge branch 'develop' of https://github.com/NREL/ssc into itc_basis_updates
2 parents e2e26da + 018055f commit 259464b

File tree

521 files changed

+116420
-105983
lines changed

Some content is hidden

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

521 files changed

+116420
-105983
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

.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: 27 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,6 +37,13 @@ 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()
@@ -39,7 +58,6 @@ Project(sam_simulation_core VERSION 1.0.0 LANGUAGES CXX C)
3958
#####################################################################################################################
4059
set(CMAKE_VERBOSE_MAKEFILE ON)
4160
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
42-
set(CMAKE_CXX_STANDARD 11)
4361

4462
function(set_no_warnings target)
4563
get_target_property(MAIN_CFLAGS ${target} COMPILE_FLAGS)
@@ -76,7 +94,11 @@ function(set_default_compile_options target)
7694
set(MAIN_CFLAGS "")
7795
endif()
7896
set(MAIN_CFLAGS "${MAIN_CFLAGS} -D__64BIT__")
79-
set_property(TARGET ${target} PROPERTY CXX_STANDARD 11)
97+
if (MSVC)
98+
set_property(TARGET ${target} PROPERTY CXX_STANDARD 20)
99+
else()
100+
set_property(TARGET ${target} PROPERTY CXX_STANDARD 17)
101+
endif()
80102
set_property(TARGET ${target} PROPERTY CXX_STANDARD_REQUIRED ON)
81103
if(MSVC)
82104
set(MAIN_CFLAGS "${MAIN_CFLAGS} /bigobj /MP")
@@ -120,7 +142,7 @@ function(set_tools_compile_options target)
120142
if (APPLE)
121143
set(MAIN_CFLAGS "${MAIN_CFLAGS} -D__WXOSX__")
122144
endif()
123-
set(MAIN_CFLAGS "${MAIN_CFLAGS} -Wall -Wno-deprecated -Wno-unknown-pragmas -Wno-overloaded-virtual -fno-common -std=c++11")
145+
set(MAIN_CFLAGS "${MAIN_CFLAGS} -Wall -Wno-deprecated -Wno-unknown-pragmas -Wno-overloaded-virtual -fno-common")
124146
set(MAIN_CFLAGS "${MAIN_CFLAGS} -DLK_USE_WXWIDGETS")
125147
endif(MSVC)
126148
set_target_properties(${target} PROPERTIES COMPILE_FLAGS ${MAIN_CFLAGS})
@@ -151,11 +173,11 @@ add_subdirectory(tcs)
151173
add_subdirectory(ssc)
152174

153175
if (NOT SAM_SKIP_TOOLS)
154-
add_subdirectory(sdktool)
176+
add_subdirectory(sdktool)
155177
endif()
156178

157179
if (NOT SAM_SKIP_TESTS)
158-
add_subdirectory(test)
180+
add_subdirectory(test)
159181
endif()
160182

161183
if(CMAKE_BUILD_TYPE STREQUAL "Debug"

code_attic/cmod_tcstrough_physical_csp_solver.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@ OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
3030
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
3131
*/
3232

33+
#define _HAS_STD_BYTE 0
34+
3335
// Trough CSP - physical model
3436
#include "core.h"
3537
#include "tckernel.h"

code_attic/cmod_trough_physical_iph_old.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@ OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
3030
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
3131
*/
3232

33+
#define _HAS_STD_BYTE 0
34+
3335
// Trough CSP - physical model
3436
#include "core.h"
3537
//#include "tckernel.h"

lpsolve/colamd.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -855,7 +855,7 @@ PRIVATE int clear_mark
855855

856856
PRIVATE void print_report
857857
(
858-
char *method,
858+
const char *method,
859859
int stats [COLAMD_STATS]
860860
) ;
861861

@@ -3051,7 +3051,7 @@ PRIVATE int clear_mark /* return the new value for tag_mark */
30513051

30523052
PRIVATE void print_report
30533053
(
3054-
char *method,
3054+
const char *method,
30553055
int stats [COLAMD_STATS]
30563056
)
30573057
{

0 commit comments

Comments
 (0)