Skip to content

Commit d4fc26c

Browse files
committed
add new cmod to check udpc table parameters
1 parent e0f79c5 commit d4fc26c

File tree

7 files changed

+88
-0
lines changed

7 files changed

+88
-0
lines changed

build_android/Makefile-ssc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ TARGET=ssc_${ARCH}.a
3737
OBJECTS = \
3838
cmod_singlediode.o \
3939
cmod_ui_tes_calcs.o \
40+
cmod_ui_udpc_checks.o \
4041
csp_common.o \
4142
cmod_lcoefcr.o \
4243
cmod_thirdpartyownership.o \

build_ios/Makefile-ssc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ TARGET=ssc_${ARCH}.a
2727
OBJECTS = \
2828
cmod_singlediode.o \
2929
cmod_ui_tes_calcs.o \
30+
cmod_ui_udpc_checks.o \
3031
csp_common.o \
3132
cmod_lcoefcr.o \
3233
cmod_thirdpartyownership.o \

build_linux/Makefile-ssc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ TARGET = ssc.so
1414
OBJECTS = \
1515
cmod_singlediode.o \
1616
cmod_ui_tes_calcs.o \
17+
cmod_ui_udpc_checks.o \
1718
csp_common.o \
1819
cmod_lcoefcr.o \
1920
cmod_thirdpartyownership.o \

build_osx/Makefile-ssc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ TARGET = ssc.dylib
1313
OBJECTS = \
1414
cmod_singlediode.o \
1515
cmod_ui_tes_calcs.o \
16+
cmod_ui_udpc_checks.o \
1617
csp_common.o \
1718
cmod_lcoefcr.o \
1819
cmod_thirdpartyownership.o \

build_vs2017/ssc_vs2017.vcxproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,7 @@
8383
<ClCompile Include="..\ssc\cmod_trough_physical.cpp" />
8484
<ClCompile Include="..\ssc\cmod_trough_physical_iph.cpp" />
8585
<ClCompile Include="..\ssc\cmod_ui_tes_calcs.cpp" />
86+
<ClCompile Include="..\ssc\cmod_ui_udpc_checks.cpp" />
8687
<ClCompile Include="..\ssc\cmod_user_htf_comparison.cpp" />
8788
<ClCompile Include="..\ssc\cmod_utilityrate.cpp" />
8889
<ClCompile Include="..\ssc\cmod_utilityrate2.cpp" />

ssc/cmod_ui_udpc_checks.cpp

Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
/**
2+
BSD-3-Clause
3+
Copyright 2019 Alliance for Sustainable Energy, LLC
4+
Redistribution and use in source and binary forms, with or without modification, are permitted provided
5+
that the following conditions are met :
6+
1. Redistributions of source code must retain the above copyright notice, this list of conditions
7+
and the following disclaimer.
8+
2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions
9+
and the following disclaimer in the documentation and/or other materials provided with the distribution.
10+
3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse
11+
or promote products derived from this software without specific prior written permission.
12+
13+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
14+
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
15+
ARE DISCLAIMED.IN NO EVENT SHALL THE COPYRIGHT HOLDER, CONTRIBUTORS, UNITED STATES GOVERNMENT OR UNITED STATES
16+
DEPARTMENT OF ENERGY, NOR ANY OF THEIR EMPLOYEES, BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
17+
OR CONSEQUENTIAL DAMAGES(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
18+
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
19+
WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
20+
OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
21+
*/
22+
23+
#include "core.h"
24+
#include "csp_solver_pc_Rankine_indirect_224.h"
25+
26+
static var_info _cm_vtab_ui_udpc_checks[] = {
27+
28+
/* VARTYPE DATATYPE NAME LABEL UNITS META GROUP REQUIRED_IF CONSTRAINTS UI_HINTS*/
29+
{ SSC_INPUT, SSC_MATRIX, "ud_ind_od", "Off design user-defined power cycle performance as function of T_htf, m_dot_htf [ND], and T_amb", "", "", "User Defined Power Cycle", "?=[[0]]", "", ""},
30+
31+
{ SSC_OUTPUT, SSC_NUMBER, "n_T_htf_pars", "Number of HTF parametrics", "-", "", "", "*", "", "" },
32+
{ SSC_OUTPUT, SSC_NUMBER, "T_htf_low", "HTF design temperature", "C", "", "", "*", "", "" },
33+
{ SSC_OUTPUT, SSC_NUMBER, "T_htf_des", "HTF design temperature", "C", "", "", "*", "", "" },
34+
{ SSC_OUTPUT, SSC_NUMBER, "T_htf_high", "HTF design temperature", "C", "", "", "*", "", "" },
35+
36+
37+
var_info_invalid };
38+
39+
class cm_ui_udpc_checks : public compute_module
40+
{
41+
public:
42+
43+
cm_ui_udpc_checks()
44+
{
45+
add_var_info(_cm_vtab_ui_udpc_checks);
46+
}
47+
48+
void exec() override
49+
{
50+
int n_T_htf_pars, n_T_amb_pars, n_m_dot_pars;
51+
n_T_htf_pars = n_T_amb_pars = n_m_dot_pars = -1;
52+
double m_dot_low, m_dot_des, m_dot_high, T_htf_low, T_htf_des, T_htf_high, T_amb_low, T_amb_des, T_amb_high;
53+
m_dot_low = m_dot_des = m_dot_high = T_htf_low = T_htf_des = T_htf_high = T_amb_low = T_amb_des = T_amb_high = std::numeric_limits<double>::quiet_NaN();
54+
55+
util::matrix_t<double> cmbd_ind = as_matrix("ud_ind_od");
56+
util::matrix_t<double> T_htf_ind, m_dot_ind, T_amb_ind;
57+
58+
try
59+
{
60+
split_ind_tbl(cmbd_ind, T_htf_ind, m_dot_ind, T_amb_ind,
61+
n_T_htf_pars, n_T_amb_pars, n_m_dot_pars,
62+
m_dot_low, m_dot_des, m_dot_high,
63+
T_htf_low, T_htf_des, T_htf_high,
64+
T_amb_low, T_amb_des, T_amb_high);
65+
}
66+
catch (C_csp_exception &csp_exception)
67+
{
68+
n_T_htf_pars = n_T_amb_pars = n_m_dot_pars = -1;
69+
m_dot_low = m_dot_des = m_dot_high = T_htf_low = T_htf_des = T_htf_high = T_amb_low = T_amb_des = T_amb_high = std::numeric_limits<double>::quiet_NaN();
70+
}
71+
72+
assign("n_T_htf_pars", (ssc_number_t)n_T_htf_pars);
73+
assign("T_htf_low", (ssc_number_t)T_htf_low);
74+
assign("T_htf_des", (ssc_number_t)T_htf_des);
75+
assign("T_htf_high", (ssc_number_t)T_htf_high);
76+
77+
return;
78+
}
79+
};
80+
81+
DEFINE_MODULE_ENTRY(ui_udpc_checks, "Calculates the levels and number of paramteric runs for 3 udpc ind variables", 0)

ssc/sscapi.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,7 @@ extern module_entry_info
146146
cm_entry_sco2_air_cooler,
147147
cm_entry_user_htf_comparison,
148148
cm_entry_ui_tes_calcs,
149+
cm_entry_ui_udpc_checks,
149150
cm_entry_cb_mspt_system_costs,
150151
cm_entry_cb_construction_financing,
151152
cm_entry_cb_empirical_hce_heat_loss,
@@ -237,6 +238,7 @@ static module_entry_info *module_table[] = {
237238
&cm_entry_sco2_air_cooler,
238239
&cm_entry_user_htf_comparison,
239240
&cm_entry_ui_tes_calcs,
241+
&cm_entry_ui_udpc_checks,
240242
&cm_entry_cb_mspt_system_costs,
241243
&cm_entry_cb_construction_financing,
242244
&cm_entry_cb_empirical_hce_heat_loss,

0 commit comments

Comments
 (0)