Skip to content

Commit 9dfd506

Browse files
committed
use "beam", "glob" and "diff" for weather readers
1 parent 596403e commit 9dfd506

File tree

3 files changed

+60
-60
lines changed

3 files changed

+60
-60
lines changed

ssc/cmod_irradproc.cpp

+7-7
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,8 @@ static var_info _cm_vtab_irradproc[] = {
3434
{ SSC_INPUT, SSC_NUMBER, "irrad_mode", "Irradiance input mode", "0/1/2", "Beam+Diff,Global+Beam, Global+Diff", "Irradiance Processor", "?=0", "INTEGER,MIN=0,MAX=2", ""},
3535

3636
{ SSC_INPUT, SSC_ARRAY, "beam", "Beam normal irradiance", "W/m2", "", "Irradiance Processor", "irrad_mode~2", "", "" },
37-
{ SSC_INPUT, SSC_ARRAY, "diffuse", "Diffuse horizontal irradiance", "W/m2", "", "Irradiance Processor", "irrad_mode~1", "LENGTH_EQUAL=beam", "" },
38-
{ SSC_INPUT, SSC_ARRAY, "global", "Global horizontal irradiance", "W/m2", "", "Irradiance Processor", "irrad_mode~0", "LENGTH_EQUAL=beam", "" },
37+
{ SSC_INPUT, SSC_ARRAY, "diff", "Diffuse horizontal irradiance", "W/m2", "", "Irradiance Processor", "irrad_mode~1", "LENGTH_EQUAL=beam", "" },
38+
{ SSC_INPUT, SSC_ARRAY, "glob", "Global horizontal irradiance", "W/m2", "", "Irradiance Processor", "irrad_mode~0", "LENGTH_EQUAL=beam", "" },
3939

4040
{ SSC_INPUT, SSC_ARRAY, "albedo", "Ground reflectance (time depend.)","frac", "0..1", "Irradiance Processor", "?", "LENGTH_EQUAL=beam", "" },
4141
{ SSC_INPUT, SSC_NUMBER, "albedo_const", "Ground reflectance (single value)","frac", "0..1", "Irradiance Processor", "?=0.2", "", "" },
@@ -103,19 +103,19 @@ class cm_irradproc : public compute_module
103103
{
104104
beam = as_array("beam", &count);
105105
if (count < 2) throw general_error("need at least 2 data points in irradproc");
106-
diff = as_array("diffuse", &count);
106+
diff = as_array("diff", &count);
107107
}
108108
else if (irrad_mode == 1) //global and beam
109109
{
110110
beam = as_array("beam", &count);
111111
if (count < 2) throw general_error("need at least 2 data points in irradproc");
112-
glob = as_array("global", &count);
112+
glob = as_array("glob", &count);
113113
}
114114
else //global and diffuse
115115
{
116-
diff = as_array("diffuse", &count);
116+
diff = as_array("diff", &count);
117117
if (count < 2) throw general_error("need at least 2 data points in irradproc");
118-
glob = as_array("global", &count);
118+
glob = as_array("glob", &count);
119119
}
120120

121121
ssc_number_t* year = as_array("year", &count);
@@ -217,7 +217,7 @@ class cm_irradproc : public compute_module
217217
delt = t_cur - t_prev;
218218
}
219219

220-
// double precsion issue (15 digits IEEE 754) encountered by Anthony Lopez 4/29/13 for
220+
// double precsion issue (15 digits IEEE 754) encountered by Anthony Lopez 4/29/13 for
221221
// minutes other than 15,30,45 and 60
222222
if (fabs(delt - 1.0) < 1e-14) delt = 1.0;
223223

ssc/cmod_tcsgeneric_solar.cpp

+25-25
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,22 @@
11
/**
22
BSD-3-Clause
33
Copyright 2019 Alliance for Sustainable Energy, LLC
4-
Redistribution and use in source and binary forms, with or without modification, are permitted provided
4+
Redistribution and use in source and binary forms, with or without modification, are permitted provided
55
that the following conditions are met :
6-
1. Redistributions of source code must retain the above copyright notice, this list of conditions
6+
1. Redistributions of source code must retain the above copyright notice, this list of conditions
77
and the following disclaimer.
8-
2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions
8+
2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions
99
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
10+
3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse
1111
or promote products derived from this software without specific prior written permission.
1212
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
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
2020
OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
2121
*/
2222

@@ -38,8 +38,8 @@ static var_info _cm_vtab_tcsgeneric_solar[] = {
3838

3939

4040
// TOU
41-
{ SSC_INPUT, SSC_MATRIX, "weekday_schedule", "12x24 Time of Use Values for week days", "", "", "tou_translator", "*", "", "" },
42-
{ SSC_INPUT, SSC_MATRIX, "weekend_schedule", "12x24 Time of Use Values for week end days", "", "", "tou_translator", "*", "", "" },
41+
{ SSC_INPUT, SSC_MATRIX, "weekday_schedule", "12x24 Time of Use Values for week days", "", "", "tou_translator", "*", "", "" },
42+
{ SSC_INPUT, SSC_MATRIX, "weekend_schedule", "12x24 Time of Use Values for week end days", "", "", "tou_translator", "*", "", "" },
4343

4444
// Generic solar model (type 260) inputs
4545
// VARTYPE DATATYPE NAME LABEL UNITS META GROUP REQUIRED_IF CONSTRAINTS UI_HINTS
@@ -59,7 +59,7 @@ static var_info _cm_vtab_tcsgeneric_solar[] = {
5959
{ SSC_INPUT, SSC_ARRAY, "sfhlQ_coefs", "Irr-based solar field thermal loss adjustment coefficients", "1/MWt", "", "type_260", "*", "", "" },
6060
{ SSC_INPUT, SSC_ARRAY, "sfhlT_coefs", "Temp.-based solar field thermal loss adjustment coefficients", "1/C", "", "type_260", "*", "", "" },
6161
{ SSC_INPUT, SSC_ARRAY, "sfhlV_coefs", "Wind-based solar field thermal loss adjustment coefficients", "1/(m/s)", "", "type_260", "*", "", "" },
62-
62+
6363
{ SSC_INPUT, SSC_NUMBER, "qsf_des", "Solar field thermal production at design", "MWt", "", "type_260", "*", "", "" },
6464
{ SSC_INPUT, SSC_NUMBER, "w_des", "Design power cycle gross output", "MWe", "", "type_260", "*", "", "" },
6565
{ SSC_INPUT, SSC_NUMBER, "eta_des", "Design power cycle gross efficiency", "none", "", "type_260", "*", "", "" },
@@ -76,7 +76,7 @@ static var_info _cm_vtab_tcsgeneric_solar[] = {
7676
{ SSC_INPUT, SSC_ARRAY, "Wpar_prodQ_coefs", "Part-load production parasitic adjustment coefs.", "1/MWe", "", "type_260", "*", "", "" },
7777
{ SSC_INPUT, SSC_ARRAY, "Wpar_prodT_coefs", "Temp.-based production parasitic adjustment coefs.", "1/C", "", "type_260", "*", "", "" },
7878
{ SSC_INPUT, SSC_ARRAY, "Wpar_prodD_coefs", "DNI-based production parasitic adjustment coefs.", "m2/W", "", "type_260", "*", "", "" },
79-
79+
8080
{ SSC_INPUT, SSC_NUMBER, "hrs_tes", "Equivalent full-load hours of storage", "hours", "", "type_260", "*", "", "" },
8181
{ SSC_INPUT, SSC_NUMBER, "f_charge", "Storage charging energy derate", "none", "", "type_260", "*", "", "" },
8282
{ SSC_INPUT, SSC_NUMBER, "f_disch", "Storage discharging energy derate", "none", "", "type_260", "*", "", "" },
@@ -114,15 +114,15 @@ static var_info _cm_vtab_tcsgeneric_solar[] = {
114114
{ SSC_OUTPUT, SSC_ARRAY, "solazi", "Resource Solar Azimuth", "deg", "", "weather", "*", "LENGTH=8760", "" },
115115
{ SSC_OUTPUT, SSC_ARRAY, "solzen", "Resource Solar Zenith", "deg", "", "weather", "*", "LENGTH=8760", "" },
116116
{ SSC_OUTPUT, SSC_ARRAY, "beam", "Resource Beam normal irradiance", "W/m2", "", "weather", "*", "LENGTH=8760", "" },
117-
{ SSC_OUTPUT, SSC_ARRAY, "global", "Resource Global horizontal irradiance", "W/m2", "", "weather", "*", "LENGTH=8760", "" },
117+
{ SSC_OUTPUT, SSC_ARRAY, "glob", "Resource Global horizontal irradiance", "W/m2", "", "weather", "*", "LENGTH=8760", "" },
118118
{ SSC_OUTPUT, SSC_ARRAY, "diff", "Resource Diffuse horizontal irradiance", "W/m2", "", "weather", "*", "LENGTH=8760", "" },
119119
{ SSC_OUTPUT, SSC_ARRAY, "tdry", "Resource Dry bulb temperature", "C", "", "weather", "*", "LENGTH=8760", "" },
120120
{ SSC_OUTPUT, SSC_ARRAY, "twet", "Resource Wet bulb temperature", "C", "", "weather", "*", "LENGTH=8760", "" },
121121
{ SSC_OUTPUT, SSC_ARRAY, "wspd", "Resource Wind Speed", "m/s", "", "weather", "*", "LENGTH=8760", "" },
122122
{ SSC_OUTPUT, SSC_ARRAY, "pres", "Resource Pressure", "mbar", "", "weather", "*", "LENGTH=8760", "" },
123123

124124
//{ SSC_OUTPUT, SSC_ARRAY, "irr_used", "Irradiation value used in simulation", "W/m2", "", "Outputs", "*", "LENGTH=8760", "" },
125-
125+
126126
//solar field
127127
{ SSC_OUTPUT, SSC_ARRAY, "eta_opt_sf", "Field collector optical efficiency", "none", "", "Outputs", "*", "LENGTH=8760", "" },
128128
{ SSC_OUTPUT, SSC_ARRAY, "q_inc", "Field thermal power incident", "MWt", "", "Outputs", "*", "LENGTH=8760", "" },
@@ -131,23 +131,23 @@ static var_info _cm_vtab_tcsgeneric_solar[] = {
131131
{ SSC_OUTPUT, SSC_ARRAY, "f_sfhl_vwind", "Field thermal power wind-based loss correction", "none", "", "Outputs", "*", "LENGTH=8760", "" },
132132
{ SSC_OUTPUT, SSC_ARRAY, "q_hl_sf", "Field thermal power loss total", "MWt", "", "Outputs", "*", "LENGTH=8760", "" },
133133
{ SSC_OUTPUT, SSC_ARRAY, "q_sf", "Field thermal power total produced", "MWt", "", "Outputs", "*", "LENGTH=8760", "" },
134-
134+
135135
//thermal storage
136136
{ SSC_OUTPUT, SSC_ARRAY, "q_to_tes", "TES thermal energy into storage", "MWt", "", "Outputs", "*", "LENGTH=8760", "" },
137137
{ SSC_OUTPUT, SSC_ARRAY, "q_from_tes", "TES thermal energy from storage", "MWt", "", "Outputs", "*", "LENGTH=8760", "" },
138138
{ SSC_OUTPUT, SSC_ARRAY, "e_in_tes", "TES thermal energy available", "MWht", "", "Outputs", "*", "LENGTH=8760", "" },
139139
{ SSC_OUTPUT, SSC_ARRAY, "q_hl_tes", "TES thermal losses from tank(s)", "MWt", "", "Outputs", "*", "LENGTH=8760", "" },
140-
140+
141141
//power block
142142
{ SSC_OUTPUT, SSC_ARRAY, "eta_cycle", "Cycle efficiency (gross)", "", "", "Outputs", "*", "LENGTH=8760", "" },
143143
{ SSC_OUTPUT, SSC_ARRAY, "f_effpc_qtpb", "Cycle efficiency load-based correction", "", "", "Outputs", "*", "LENGTH=8760", "" },
144144
{ SSC_OUTPUT, SSC_ARRAY, "f_effpc_tamb", "Cycle efficiency temperature-based correction", "", "", "Outputs", "*", "LENGTH=8760", "" },
145-
145+
146146
{ SSC_OUTPUT, SSC_ARRAY, "enet", "Cycle electrical power output (net)", "MWe", "", "Outputs", "*", "LENGTH=8760", "" },
147147
{ SSC_OUTPUT, SSC_ARRAY, "w_gr", "Cycle electrical power output (gross)", "MWe", "", "Outputs", "*", "LENGTH=8760", "" },
148148
{ SSC_OUTPUT, SSC_ARRAY, "w_gr_solar", "Cycle electrical power output (gross, solar share)", "MWe", "", "Outputs", "*", "LENGTH=8760", "" },
149149
{ SSC_OUTPUT, SSC_ARRAY, "w_gr_fossil", "Cycle electrical power output (gross, fossil share)", "MWe", "", "Outputs", "*", "LENGTH=8760", "" },
150-
150+
151151
{ SSC_OUTPUT, SSC_ARRAY, "q_to_pb", "Cycle thermal power input", "MWt", "", "Outputs", "*", "LENGTH=8760", "" },
152152
{ SSC_OUTPUT, SSC_ARRAY, "q_startup", "Cycle thermal startup energy", "MWt", "", "Outputs", "*", "LENGTH=8760", "" },
153153
{ SSC_OUTPUT, SSC_ARRAY, "q_dump_tesfull", "Cycle thermal energy dumped - TES is full", "MWt", "", "Outputs", "*", "LENGTH=8760", "" },
@@ -165,7 +165,7 @@ static var_info _cm_vtab_tcsgeneric_solar[] = {
165165
{ SSC_OUTPUT, SSC_ARRAY, "w_par_tot", "Total parasitic losses", "MWh", "", "Outputs", "*", "LENGTH=8760", "" },
166166
{ SSC_OUTPUT, SSC_ARRAY, "w_par_online", "Online parasitics", "MWh", "", "Outputs", "*", "LENGTH=8760", "" },
167167
{ SSC_OUTPUT, SSC_ARRAY, "w_par_offline", "Offline parasitics", "MWh", "", "Outputs", "*", "LENGTH=8760", "" },
168-
168+
169169
// { SSC_OUTPUT, SSC_ARRAY, "hourly_energy", "Hourly Energy", "kWh", "", "Outputs", "*", "LENGTH=8760", "" },
170170

171171
// monthly outputs
@@ -238,7 +238,7 @@ class cm_tcsgeneric_solar : public tcKernel
238238
int weather = 0;
239239
if(debug_mode) weather = add_unit("trnsys_weatherreader", "TRNSYS weather reader");
240240
else weather = add_unit("weatherreader", "TCS weather reader");
241-
241+
242242
// Add time-of-use reader
243243
int tou = add_unit("tou_translator", "Time of Use Translator");
244244
//Add Physical Solar Field Model
@@ -343,7 +343,7 @@ class cm_tcsgeneric_solar : public tcKernel
343343

344344
// Connect the units
345345
bool bConnected = connect(weather, "beam", type260_genericsolar, "ibn");
346-
bConnected &= connect(weather, "global", type260_genericsolar, "itoth");
346+
bConnected &= connect(weather, "glob", type260_genericsolar, "itoth");
347347
bConnected &= connect(weather, "poa_beam", type260_genericsolar, "ibh");
348348
bConnected &= connect(weather, "tdry", type260_genericsolar, "tdb");
349349
bConnected &= connect(weather, "twet", type260_genericsolar, "twb");
@@ -362,7 +362,7 @@ class cm_tcsgeneric_solar : public tcKernel
362362
// check if all connections worked
363363
if ( !bConnected )
364364
throw exec_error( "tcsgeneric_solar", util::format("there was a problem connecting outputs of one unit to inputs of another for the simulation.") );
365-
365+
366366
size_t hours = 8760;
367367

368368
//Load the solar field adjustment factors

0 commit comments

Comments
 (0)