-
Notifications
You must be signed in to change notification settings - Fork 116
Expand file tree
/
Copy pathcmod_trough_physical_iph_old.cpp
More file actions
1028 lines (886 loc) · 105 KB
/
cmod_trough_physical_iph_old.cpp
File metadata and controls
1028 lines (886 loc) · 105 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
/*
BSD 3-Clause License
Copyright (c) Alliance for Energy Innovation, LLC. See also https://github.com/NREL/ssc/blob/develop/LICENSE
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
3. Neither the name of the copyright holder nor the names of its
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#define _HAS_STD_BYTE 0
// Trough CSP - physical model
#include "core.h"
//#include "tckernel.h"
#include "lib_util.h"
// for adjustment factors
#include "common.h"
//#include "lib_weatherfile.h"
#include "csp_solver_core.h"
#include "csp_solver_trough_collector_receiver.h"
#include "csp_solver_pc_heat_sink.h"
#include "csp_solver_two_tank_tes.h"
#include "csp_solver_tou_block_schedules.h"
#include "csp_dispatch.h"
#include "cmod_csp_common_eqns.h"
#include <ctime>
#include <algorithm>
#include <iterator>
static var_info _cm_vtab_trough_physical_process_heat[] = {
// weather reader inputs
// VARTYPE DATATYPE NAME LABEL UNITS META GROUP REQUIRED_IF CONSTRAINTS UI_HINTS
{ SSC_INPUT, SSC_STRING, "file_name", "Local weather file with path", "none", "", "weather", "?", "LOCAL_FILE", "" },
{ SSC_INPUT, SSC_TABLE, "solar_resource_data", "Weather resource data in memory", "", "", "weather", "?", "", "" },
{ SSC_INPUT, SSC_NUMBER, "track_mode", "Tracking mode", "none", "", "weather", "*", "", "" },
{ SSC_INPUT, SSC_NUMBER, "tilt", "Tilt angle of surface/axis", "none", "", "weather", "*", "", "" },
{ SSC_INPUT, SSC_NUMBER, "azimuth", "Azimuth angle of surface/axis", "none", "", "weather", "*", "", "" },
//{ SSC_INPUT, SSC_NUMBER, "system_capacity", "Nameplate capacity", "kW", "", "trough", "*", "", "" },
// System Design
{ SSC_INPUT, SSC_NUMBER, "I_bn_des", "Solar irradiation at design", "C", "", "solar_field", "*", "", "" },
{ SSC_INPUT, SSC_NUMBER, "T_loop_in_des", "Design loop inlet temperature", "C", "", "solar_field", "*", "", "" },
{ SSC_INPUT, SSC_NUMBER, "T_loop_out", "Target loop outlet temperature", "C", "", "solar_field", "*", "", "" },
{ SSC_INPUT, SSC_NUMBER, "q_pb_design", "Design heat input to power block", "MWt", "", "controller", "*", "", "" },
{ SSC_INPUT, SSC_NUMBER, "tshours", "Equivalent full-load thermal storage hours", "hr", "", "system_design", "*", "", "" },
// solar field (type 250) inputs
// VARTYPE DATATYPE NAME LABEL UNITS META GROUP REQUIRED_IF CONSTRAINTS UI_HINTS
{ SSC_INPUT, SSC_NUMBER, "nSCA", "Number of SCAs in a loop", "none", "", "solar_field", "*", "", "" },
{ SSC_INPUT, SSC_NUMBER, "nHCEt", "Number of HCE types", "none", "", "solar_field", "*", "", "" },
{ SSC_INPUT, SSC_NUMBER, "nColt", "Number of collector types", "none", "constant=4", "solar_field", "*", "", "" },
{ SSC_INPUT, SSC_NUMBER, "nHCEVar", "Number of HCE variants per type", "none", "", "solar_field", "*", "", "" },
{ SSC_INPUT, SSC_NUMBER, "nLoops", "Number of loops in the field", "none", "", "solar_field", "*", "", "" },
{ SSC_INPUT, SSC_NUMBER, "eta_pump", "HTF pump efficiency", "none", "", "solar_field", "*", "", "" },
{ SSC_INPUT, SSC_NUMBER, "HDR_rough", "Header pipe roughness", "m", "", "solar_field", "*", "", "" },
{ SSC_INPUT, SSC_NUMBER, "theta_stow", "Stow angle", "deg", "", "solar_field", "*", "", "" },
{ SSC_INPUT, SSC_NUMBER, "theta_dep", "Deploy angle", "deg", "", "solar_field", "*", "", "" },
{ SSC_INPUT, SSC_NUMBER, "Row_Distance", "Spacing between rows (centerline to centerline)", "m", "", "solar_field", "*", "", "" },
{ SSC_INPUT, SSC_NUMBER, "FieldConfig", "Number of subfield headers", "none", "", "solar_field", "*", "", "" },
{ SSC_INPUT, SSC_NUMBER, "is_model_heat_sink_piping", "Should model consider piping through heat sink?", "none", "", "solar_field", "*", "", "" },
{ SSC_INPUT, SSC_NUMBER, "L_heat_sink_piping", "Length of piping (full mass flow) through heat sink (if applicable)", "none", "", "solar_field", "*", "", "" },
{ SSC_INPUT, SSC_NUMBER, "m_dot_htfmin", "Minimum loop HTF flow rate", "kg/s", "", "solar_field", "*", "", "" },
{ SSC_INPUT, SSC_NUMBER, "m_dot_htfmax", "Maximum loop HTF flow rate", "kg/s", "", "solar_field", "*", "", "" },
{ SSC_INPUT, SSC_NUMBER, "Fluid", "Field HTF fluid ID number", "none", "", "solar_field", "*", "", "" },
{ SSC_INPUT, SSC_NUMBER, "wind_stow_speed", "Trough wind stow speed", "m/s", "", "solar_field", "?=50", "", "" },
{ SSC_INPUT, SSC_MATRIX, "field_fl_props", "User defined field fluid property data", "-", "", "controller", "*", "", "" },
{ SSC_INPUT, SSC_NUMBER, "T_fp", "Freeze protection temperature (heat trace activation temperature)", "none", "", "solar_field", "*", "", "" },
//{ SSC_INPUT, SSC_NUMBER, "V_hdr_max", "Maximum HTF velocity in the header at design", "W/m2", "", "solar_field", "*", "", "" },
//{ SSC_INPUT, SSC_NUMBER, "V_hdr_min", "Minimum HTF velocity in the header at design", "m/s", "", "solar_field", "*", "", "" },
{ SSC_INPUT, SSC_NUMBER, "Pipe_hl_coef", "Loss coefficient from the header, runner pipe, and non-HCE piping", "m/s", "", "solar_field", "*", "", "" },
{ SSC_INPUT, SSC_NUMBER, "SCA_drives_elec", "Tracking power, in Watts per SCA drive", "W/m2-K", "", "solar_field", "*", "", "" },
//{ SSC_INPUT, SSC_NUMBER, "fthrok", "Flag to allow partial defocusing of the collectors", "W/SCA", "", "solar_field", "*", "INTEGER", "" },
//{ SSC_INPUT, SSC_NUMBER, "fthrctrl", "Defocusing strategy", "none", "", "solar_field", "*", "", "" },
{ SSC_INPUT, SSC_NUMBER, "water_usage_per_wash", "Water usage per wash", "L/m2_aper", "", "solar_field", "*", "", "" },
{ SSC_INPUT, SSC_NUMBER, "washing_frequency", "Mirror washing frequency", "-/year", "", "solar_field", "*", "", "" },
{ SSC_INPUT, SSC_NUMBER, "accept_mode", "Acceptance testing mode?", "0/1", "no/yes", "solar_field", "*", "", "" },
{ SSC_INPUT, SSC_NUMBER, "accept_init", "In acceptance testing mode - require steady-state startup", "none", "", "solar_field", "*", "", "" },
{ SSC_INPUT, SSC_NUMBER, "accept_loc", "In acceptance testing mode - temperature sensor location", "1/2", "hx/loop", "solar_field", "*", "", "" },
{ SSC_INPUT, SSC_NUMBER, "mc_bal_hot", "Heat capacity of the balance of plant on the hot side", "kWht/K-MWt", "none", "solar_field", "*", "", "" },
{ SSC_INPUT, SSC_NUMBER, "mc_bal_cold", "Heat capacity of the balance of plant on the cold side", "kWht/K-MWt", "", "solar_field", "*", "", "" },
{ SSC_INPUT, SSC_NUMBER, "mc_bal_sca", "Non-HTF heat capacity associated with each SCA - per meter basis", "Wht/K-m", "", "solar_field", "*", "", "" },
{ SSC_INPUT, SSC_ARRAY, "W_aperture", "The collector aperture width (Total structural area used for shadowing)", "m", "", "solar_field", "*", "", "" },
{ SSC_INPUT, SSC_ARRAY, "A_aperture", "Reflective aperture area of the collector", "m2", "", "solar_field", "*", "", "" },
{ SSC_INPUT, SSC_ARRAY, "TrackingError", "User-defined tracking error derate", "none", "", "solar_field", "*", "", "" },
{ SSC_INPUT, SSC_ARRAY, "GeomEffects", "User-defined geometry effects derate", "none", "", "solar_field", "*", "", "" },
{ SSC_INPUT, SSC_ARRAY, "Rho_mirror_clean", "User-defined clean mirror reflectivity", "none", "", "solar_field", "*", "", "" },
{ SSC_INPUT, SSC_ARRAY, "Dirt_mirror", "User-defined dirt on mirror derate", "none", "", "solar_field", "*", "", "" },
{ SSC_INPUT, SSC_ARRAY, "Error", "User-defined general optical error derate ", "none", "", "solar_field", "*", "", "" },
{ SSC_INPUT, SSC_ARRAY, "Ave_Focal_Length", "Average focal length of the collector ", "m", "", "solar_field", "*", "", "" },
{ SSC_INPUT, SSC_ARRAY, "L_SCA", "Length of the SCA ", "m", "", "solar_field", "*", "", "" },
{ SSC_INPUT, SSC_ARRAY, "L_aperture", "Length of a single mirror/HCE unit", "m", "", "solar_field", "*", "", "" },
{ SSC_INPUT, SSC_ARRAY, "ColperSCA", "Number of individual collector sections in an SCA ", "none", "", "solar_field", "*", "", "" },
{ SSC_INPUT, SSC_ARRAY, "Distance_SCA", "Piping distance between SCA's in the field", "m", "", "solar_field", "*", "", "" },
{ SSC_INPUT, SSC_MATRIX, "IAM_matrix", "IAM coefficients, matrix for 4 collectors", "none", "", "solar_field", "*", "", "" },
{ SSC_INPUT, SSC_MATRIX, "HCE_FieldFrac", "Fraction of the field occupied by this HCE type ", "none", "", "solar_field", "*", "", "" },
{ SSC_INPUT, SSC_MATRIX, "D_2", "Inner absorber tube diameter", "m", "", "solar_field", "*", "", "" },
{ SSC_INPUT, SSC_MATRIX, "D_3", "Outer absorber tube diameter", "m", "", "solar_field", "*", "", "" },
{ SSC_INPUT, SSC_MATRIX, "D_4", "Inner glass envelope diameter ", "m", "", "solar_field", "*", "", "" },
{ SSC_INPUT, SSC_MATRIX, "D_5", "Outer glass envelope diameter ", "m", "", "solar_field", "*", "", "" },
{ SSC_INPUT, SSC_MATRIX, "D_p", "Diameter of the absorber flow plug (optional) ", "m", "", "solar_field", "*", "", "" },
{ SSC_INPUT, SSC_MATRIX, "Flow_type", "Flow type through the absorber", "none", "", "solar_field", "*", "", "" },
{ SSC_INPUT, SSC_MATRIX, "Rough", "Roughness of the internal surface ", "m", "", "solar_field", "*", "", "" },
{ SSC_INPUT, SSC_MATRIX, "alpha_env", "Envelope absorptance ", "none", "", "solar_field", "*", "", "" },
{ SSC_INPUT, SSC_MATRIX, "epsilon_3_11", "Absorber emittance for receiver type 1 variation 1", "none", "", "solar_field", "*", "", "" },
{ SSC_INPUT, SSC_MATRIX, "epsilon_3_12", "Absorber emittance for receiver type 1 variation 2", "none", "", "solar_field", "*", "", "" },
{ SSC_INPUT, SSC_MATRIX, "epsilon_3_13", "Absorber emittance for receiver type 1 variation 3", "none", "", "solar_field", "*", "", "" },
{ SSC_INPUT, SSC_MATRIX, "epsilon_3_14", "Absorber emittance for receiver type 1 variation 4", "none", "", "solar_field", "*", "", "" },
{ SSC_INPUT, SSC_MATRIX, "epsilon_3_21", "Absorber emittance for receiver type 2 variation 1", "none", "", "solar_field", "*", "", "" },
{ SSC_INPUT, SSC_MATRIX, "epsilon_3_22", "Absorber emittance for receiver type 2 variation 2", "none", "", "solar_field", "*", "", "" },
{ SSC_INPUT, SSC_MATRIX, "epsilon_3_23", "Absorber emittance for receiver type 2 variation 3", "none", "", "solar_field", "*", "", "" },
{ SSC_INPUT, SSC_MATRIX, "epsilon_3_24", "Absorber emittance for receiver type 2 variation 4", "none", "", "solar_field", "*", "", "" },
{ SSC_INPUT, SSC_MATRIX, "epsilon_3_31", "Absorber emittance for receiver type 3 variation 1", "none", "", "solar_field", "*", "", "" },
{ SSC_INPUT, SSC_MATRIX, "epsilon_3_32", "Absorber emittance for receiver type 3 variation 2", "none", "", "solar_field", "*", "", "" },
{ SSC_INPUT, SSC_MATRIX, "epsilon_3_33", "Absorber emittance for receiver type 3 variation 3", "none", "", "solar_field", "*", "", "" },
{ SSC_INPUT, SSC_MATRIX, "epsilon_3_34", "Absorber emittance for receiver type 3 variation 4", "none", "", "solar_field", "*", "", "" },
{ SSC_INPUT, SSC_MATRIX, "epsilon_3_41", "Absorber emittance for receiver type 4 variation 1", "none", "", "solar_field", "*", "", "" },
{ SSC_INPUT, SSC_MATRIX, "epsilon_3_42", "Absorber emittance for receiver type 4 variation 2", "none", "", "solar_field", "*", "", "" },
{ SSC_INPUT, SSC_MATRIX, "epsilon_3_43", "Absorber emittance for receiver type 4 variation 3", "none", "", "solar_field", "*", "", "" },
{ SSC_INPUT, SSC_MATRIX, "epsilon_3_44", "Absorber emittance for receiver type 4 variation 4", "none", "", "solar_field", "*", "", "" },
{ SSC_INPUT, SSC_MATRIX, "alpha_abs", "Absorber absorptance ", "none", "", "solar_field", "*", "", "" },
{ SSC_INPUT, SSC_MATRIX, "Tau_envelope", "Envelope transmittance", "none", "", "solar_field", "*", "", "" },
{ SSC_INPUT, SSC_MATRIX, "EPSILON_4", "Inner glass envelope emissivities (Pyrex) ", "none", "", "solar_field", "*", "", "" },
{ SSC_INPUT, SSC_MATRIX, "EPSILON_5", "Outer glass envelope emissivities (Pyrex) ", "none", "", "solar_field", "*", "", "" },
{ SSC_INPUT, SSC_MATRIX, "GlazingIntactIn", "Glazing intact (broken glass) flag {1=true, else=false}", "none", "", "solar_field", "*", "", "" },
{ SSC_INPUT, SSC_MATRIX, "P_a", "Annulus gas pressure", "torr", "", "solar_field", "*", "", "" },
{ SSC_INPUT, SSC_MATRIX, "AnnulusGas", "Annulus gas type (1=air, 26=Ar, 27=H2)", "none", "", "solar_field", "*", "", "" },
{ SSC_INPUT, SSC_MATRIX, "AbsorberMaterial", "Absorber material type", "none", "", "solar_field", "*", "", "" },
{ SSC_INPUT, SSC_MATRIX, "Shadowing", "Receiver bellows shadowing loss factor", "none", "", "solar_field", "*", "", "" },
{ SSC_INPUT, SSC_MATRIX, "Dirt_HCE", "Loss due to dirt on the receiver envelope", "none", "", "solar_field", "*", "", "" },
{ SSC_INPUT, SSC_MATRIX, "Design_loss", "Receiver heat loss at design", "W/m", "", "solar_field", "*", "", "" },
// Heat Sink
{ SSC_INPUT, SSC_NUMBER, "pb_pump_coef", "Pumping power to move 1kg of HTF through PB loop", "kW/kg", "", "controller", "*", "", "" },
// TES parameters - general
{ SSC_INPUT, SSC_NUMBER, "init_hot_htf_percent", "Initial fraction of avail. vol that is hot", "%", "", "TES", "*", "", "" },
{ SSC_INPUT, SSC_NUMBER, "h_tank", "Total height of tank (height of HTF when tank is full", "m", "", "TES", "*", "", "" },
{ SSC_INPUT, SSC_NUMBER, "cold_tank_max_heat", "Rated heater capacity for cold tank heating", "MW", "", "TES", "*", "", "" },
{ SSC_INPUT, SSC_NUMBER, "u_tank", "Loss coefficient from the tank", "W/m2-K", "", "TES", "*", "", "" },
{ SSC_INPUT, SSC_NUMBER, "tank_pairs", "Number of equivalent tank pairs", "-", "", "TES", "*", "INTEGER", "" },
{ SSC_INPUT, SSC_NUMBER, "cold_tank_Thtr", "Minimum allowable cold tank HTF temp", "C", "", "TES", "*", "", "" },
// TES parameters - 2 tank
{ SSC_INPUT, SSC_NUMBER, "h_tank_min", "Minimum allowable HTF height in storage tank", "m", "", "TES_2tank", "*", "", "" },
{ SSC_INPUT, SSC_NUMBER, "hot_tank_Thtr", "Minimum allowable hot tank HTF temp", "C", "", "TES_2tank", "*", "", "" },
{ SSC_INPUT, SSC_NUMBER, "hot_tank_max_heat", "Rated heater capacity for hot tank heating", "MW", "", "TES_2tank", "*", "", "" },
// TOU
{ SSC_INPUT, SSC_MATRIX, "weekday_schedule", "12x24 CSP operation Time-of-Use Weekday schedule", "-", "", "tou", "*", "", "" },
{ SSC_INPUT, SSC_MATRIX, "weekend_schedule", "12x24 CSP operation Time-of-Use Weekend schedule", "-", "", "tou", "*", "", "" },
{ SSC_INPUT, SSC_MATRIX, "dispatch_sched_weekday", "12x24 PPA pricing Weekday schedule", "", "", "tou", "?=1", "", "" },
{ SSC_INPUT, SSC_MATRIX, "dispatch_sched_weekend", "12x24 PPA pricing Weekend schedule", "", "", "tou", "?=1", "", "" },
{ SSC_INPUT, SSC_NUMBER, "is_tod_pc_target_also_pc_max", "Is the TOD target cycle heat input also the max cycle heat input?", "", "", "tou", "?=0", "", "" },
{ SSC_INPUT, SSC_NUMBER, "is_dispatch", "Allow dispatch optimization?", /*TRUE=1*/ "-", "", "tou", "?=0", "", "" },
{ SSC_INPUT, SSC_NUMBER, "is_write_ampl_dat", "Write AMPL data files for dispatch run", "-", "", "tou", "?=0", "", "" },
{ SSC_INPUT, SSC_NUMBER, "is_ampl_engine", "Run dispatch optimization with external AMPL engine", "-", "", "tou", "?=0", "", "" },
{ SSC_INPUT, SSC_STRING, "ampl_data_dir", "AMPL data file directory", "-", "", "tou", "?=''", "", "" },
{ SSC_INPUT, SSC_STRING, "ampl_exec_call", "System command to run AMPL code", "-", "", "tou", "?='ampl sdk_solution.run'", "", "" },
{ SSC_INPUT, SSC_NUMBER, "disp_frequency", "Frequency for dispatch optimization calculations", "hour", "", "tou", "is_dispatch=1", "", "" },
{ SSC_INPUT, SSC_NUMBER, "disp_steps_per_hour", "Time steps per hour for dispatch optimization calculations", "-", "", "tou", "?=1", "", "" },
{ SSC_INPUT, SSC_NUMBER, "disp_horizon", "Time horizon for dispatch optimization", "hour", "", "tou", "is_dispatch=1", "", "" },
{ SSC_INPUT, SSC_NUMBER, "disp_max_iter", "Max. no. dispatch optimization iterations", "-", "", "tou", "is_dispatch=1", "", "" },
{ SSC_INPUT, SSC_NUMBER, "disp_timeout", "Max. dispatch optimization solve duration", "s", "", "tou", "is_dispatch=1", "", "" },
{ SSC_INPUT, SSC_NUMBER, "disp_mip_gap", "Dispatch optimization solution tolerance", "-", "", "tou", "is_dispatch=1", "", "" },
{ SSC_INPUT, SSC_NUMBER, "disp_spec_presolve", "Dispatch optimization presolve heuristic", "-", "", "tou", "?=-1", "", "" },
{ SSC_INPUT, SSC_NUMBER, "disp_spec_bb", "Dispatch optimization B&B heuristic", "-", "", "tou", "?=-1", "", "" },
{ SSC_INPUT, SSC_NUMBER, "disp_reporting", "Dispatch optimization reporting level", "-", "", "tou", "?=-1", "", "" },
{ SSC_INPUT, SSC_NUMBER, "disp_spec_scaling", "Dispatch optimization scaling heuristic", "-", "", "tou", "?=-1", "", "" },
{ SSC_INPUT, SSC_NUMBER, "disp_time_weighting", "Dispatch optimization future time discounting factor", "-", "", "tou", "?=0.99", "", "" },
{ SSC_INPUT, SSC_NUMBER, "disp_rsu_cost_rel", "Receiver startup cost", "$/MWt/start", "", "tou", "is_dispatch=1", "", "" },
{ SSC_INPUT, SSC_NUMBER, "disp_csu_cost_rel", "Heat sink startup cost", "$/MWe-cycle/start", "", "tou", "is_dispatch=1", "", "" },
{ SSC_INPUT, SSC_NUMBER, "disp_pen_ramping", "Dispatch heat production change penalty", "$/MWt-change", "", "tou", "is_dispatch=1", "", "" },
{ SSC_INPUT, SSC_NUMBER, "disp_inventory_incentive", "Dispatch storage terminal inventory incentive multiplier", "", "", "System Control", "?=0.0", "", "" },
{ SSC_INPUT, SSC_NUMBER, "q_rec_standby", "Receiver standby energy consumption", "kWt", "", "tou", "?=9e99", "", "" },
{ SSC_INPUT, SSC_NUMBER, "q_rec_heattrace", "Receiver heat trace energy consumption during startup", "kWe-hr", "", "tou", "?=0.0", "", "" },
{ SSC_INPUT, SSC_NUMBER, "is_wlim_series", "Use time-series net heat generation limits", "", "", "tou", "?=0", "", "" },
{ SSC_INPUT, SSC_ARRAY, "wlim_series", "Time series net heat generation limits", "kWt", "", "tou", "is_wlim_series=1", "", "" },
{ SSC_INPUT, SSC_ARRAY, "f_turb_tou_periods", "Dispatch logic for heat sink load fraction", "-", "", "tou", "*", "", "" },
{ SSC_INPUT, SSC_NUMBER, "ppa_multiplier_model", "PPA multiplier model", "0/1", "0=diurnal,1=timestep","tou", "?=0", "INTEGER,MIN=0", "" },
{ SSC_INPUT, SSC_ARRAY, "dispatch_factors_ts", "Dispatch payment factor array", "", "", "tou", "", "", "" },
{ SSC_INPUT, SSC_ARRAY, "dispatch_tod_factors", "TOD factors for periods 1 through 9", "",
"We added this array input after SAM 2022.12.21 to replace the functionality of former single value inputs dispatch_factor1 through dispatch_factor9", "Time of Delivery Factors", "is_dispatch=1&sim_type=1","", "SIMULATION_PARAMETER" },
{ SSC_INPUT, SSC_NUMBER, "is_dispatch_series", "Use time-series dispatch factors", "", "", "tou", "?=1", "", "" },
{ SSC_INPUT, SSC_ARRAY, "dispatch_series", "Time series dispatch factors", "", "", "tou", "", "", "" },
{ SSC_INPUT, SSC_ARRAY, "timestep_load_fractions", "Turbine load fraction for each timestep, alternative to block dispatch", "", "", "tou", "?", "", "" },
// System
{ SSC_INPUT, SSC_NUMBER, "pb_fixed_par", "Fraction of rated gross power constantly consumed", "MWe/MWcap", "", "system", "*", "", "" },
{ SSC_INPUT, SSC_ARRAY, "bop_array", "Balance of plant parasitic power fraction, mult frac and const, linear and quad coeff", "", "", "system", "*", "", "" },
{ SSC_INPUT, SSC_ARRAY, "aux_array", "Auxiliary heater, mult frac and const, linear and quad coeff", "", "", "system", "*", "", "" },
// Newly added
{ SSC_INPUT, SSC_NUMBER, "calc_design_pipe_vals", "Calculate temps and pressures at design conditions for runners and headers", "none", "", "solar_field", "*", "", "" },
{ SSC_INPUT, SSC_NUMBER, "V_hdr_cold_max", "Maximum HTF velocity in the cold headers at design", "m/s", "", "solar_field", "*", "", "" },
{ SSC_INPUT, SSC_NUMBER, "V_hdr_cold_min", "Minimum HTF velocity in the cold headers at design", "m/s", "", "solar_field", "*", "", "" },
{ SSC_INPUT, SSC_NUMBER, "V_hdr_hot_max", "Maximum HTF velocity in the hot headers at design", "m/s", "", "solar_field", "*", "", "" },
{ SSC_INPUT, SSC_NUMBER, "V_hdr_hot_min", "Minimum HTF velocity in the hot headers at design", "m/s", "", "solar_field", "*", "", "" },
{ SSC_INPUT, SSC_NUMBER, "N_max_hdr_diams", "Maximum number of diameters in each of the hot and cold headers", "none", "", "solar_field", "*", "", "" },
{ SSC_INPUT, SSC_NUMBER, "L_rnr_pb", "Length of runner pipe in power block", "m", "", "powerblock", "*", "", "" },
{ SSC_INPUT, SSC_NUMBER, "L_rnr_per_xpan", "Threshold length of straight runner pipe without an expansion loop", "m", "", "solar_field", "*", "", "" },
{ SSC_INPUT, SSC_NUMBER, "L_xpan_hdr", "Compined perpendicular lengths of each header expansion loop", "m", "", "solar_field", "*", "", "" },
{ SSC_INPUT, SSC_NUMBER, "L_xpan_rnr", "Compined perpendicular lengths of each runner expansion loop", "m", "", "solar_field", "*", "", "" },
{ SSC_INPUT, SSC_NUMBER, "Min_rnr_xpans", "Minimum number of expansion loops per single-diameter runner section", "none", "", "solar_field", "*", "", "" },
{ SSC_INPUT, SSC_NUMBER, "northsouth_field_sep", "North/south separation between subfields. 0 = SCAs are touching", "m", "", "solar_field", "*", "", "" },
{ SSC_INPUT, SSC_NUMBER, "N_hdr_per_xpan", "Number of collector loops per expansion loop", "none", "", "solar_field", "*", "", "" },
{ SSC_INPUT, SSC_NUMBER, "offset_xpan_hdr", "Location of first header expansion loop. 1 = after first collector loop", "none", "", "solar_field", "*", "", "" },
{ SSC_INPUT, SSC_MATRIX, "K_cpnt", "Interconnect component minor loss coefficients, row=intc, col=cpnt", "none", "", "solar_field", "*", "", "" },
{ SSC_INPUT, SSC_MATRIX, "D_cpnt", "Interconnect component diameters, row=intc, col=cpnt", "none", "", "solar_field", "*", "", "" },
{ SSC_INPUT, SSC_MATRIX, "L_cpnt", "Interconnect component lengths, row=intc, col=cpnt", "none", "", "solar_field", "*", "", "" },
{ SSC_INPUT, SSC_MATRIX, "Type_cpnt", "Interconnect component type, row=intc, col=cpnt", "none", "", "solar_field", "*", "", "" },
{ SSC_INPUT, SSC_NUMBER, "custom_sf_pipe_sizes", "Use custom solar field pipe diams, wallthks, and lengths", "none", "", "solar_field", "*", "", "" },
{ SSC_INPUT, SSC_MATRIX, "sf_rnr_diams", "Custom runner diameters", "m", "", "solar_field", "*", "", "" },
{ SSC_INPUT, SSC_MATRIX, "sf_rnr_wallthicks", "Custom runner wall thicknesses", "m", "", "solar_field", "*", "", "" },
{ SSC_INPUT, SSC_MATRIX, "sf_rnr_lengths", "Custom runner lengths", "m", "", "solar_field", "*", "", "" },
{ SSC_INPUT, SSC_MATRIX, "sf_hdr_diams", "Custom header diameters", "m", "", "solar_field", "*", "", "" },
{ SSC_INPUT, SSC_MATRIX, "sf_hdr_wallthicks", "Custom header wall thicknesses", "m", "", "solar_field", "*", "", "" },
{ SSC_INPUT, SSC_MATRIX, "sf_hdr_lengths", "Custom header lengths", "m", "", "solar_field", "*", "", "" },
{ SSC_INPUT, SSC_NUMBER, "tanks_in_parallel", "Tanks are in parallel, not in series, with solar field", "-", "", "controller", "*", "", "" },
//{ SSC_INPUT, SSC_NUMBER, "has_hot_tank_bypass", "Bypass valve connects field outlet to cold tank", "-", "", "controller", "*", "", "" },
//{ SSC_INPUT, SSC_NUMBER, "T_tank_hot_inlet_min", "Minimum hot tank htf inlet temperature", "C", "", "controller", "*", "", "" },
//{ SSC_INPUT, SSC_NUMBER, "tes_pump_coef", "Pumping power to move 1kg of HTF through tes loop", "kW/(kg/s)", "", "controller", "*", "", "" },
//{ SSC_INPUT, SSC_NUMBER, "V_tes_des", "Design-point velocity to size the TES pipe diameters", "m/s", "", "controller", "*", "", "" },
//{ SSC_INPUT, SSC_NUMBER, "custom_tes_p_loss", "TES pipe losses are based on custom lengths and coeffs", "-", "", "controller", "*", "", "" },
//{ SSC_INPUT, SSC_MATRIX, "k_tes_loss_coeffs", "Minor loss coeffs for the coll, gen, and bypass loops", "-", "", "controller", "*", "", "" },
//{ SSC_INPUT, SSC_NUMBER, "custom_sgs_pipe_sizes", "Use custom SGS pipe diams, wallthks, and lengths", "-", "", "controller", "*", "", "" },
//{ SSC_INPUT, SSC_MATRIX, "sgs_diams", "Custom SGS diameters", "m", "", "controller", "*", "", "" },
//{ SSC_INPUT, SSC_MATRIX, "sgs_wallthicks", "Custom SGS wall thicknesses", "m", "", "controller", "*", "", "" },
//{ SSC_INPUT, SSC_MATRIX, "sgs_lengths", "Custom SGS lengths", "m", "", "controller", "*", "", "" },
//{ SSC_INPUT, SSC_NUMBER, "DP_SGS", "Pressure drop within the steam generator", "bar", "", "controller", "*", "", "" },
// Needed for auto-updating dependent inputs
{ SSC_INPUT, SSC_NUMBER, "specified_solar_multiple", "specified_solar_multiple", "-", "", "controller", "*", "", "" },
{ SSC_INPUT, SSC_NUMBER, "non_solar_field_land_area_multiplier", "non_solar_field_land_area_multiplier", "-", "", "controller", "*", "", "" },
{ SSC_INPUT, SSC_ARRAY, "trough_loop_control", "trough_loop_control", "-", "", "controller", "*", "", "" },
{ SSC_INPUT, SSC_NUMBER, "disp_wlim_maxspec", "disp_wlim_maxspec", "-", "", "controller", "*", "", "" },
// *************************************************************************************************
// OUTPUTS
// *************************************************************************************************
// Simulation Kernel
{ SSC_OUTPUT, SSC_ARRAY, "time_hr", "Time at end of timestep", "hr", "", "Solver", "*", "", "" },
// Weather Reader
{ SSC_OUTPUT, SSC_ARRAY, "month", "Resource Month", "", "", "weather", "*", "", "" },
{ SSC_OUTPUT, SSC_ARRAY, "hour_day", "Resource Hour of Day", "", "", "weather", "*", "", "" },
{ SSC_OUTPUT, SSC_ARRAY, "solazi", "Resource Solar Azimuth", "deg", "", "weather", "*", "", "" },
{ SSC_OUTPUT, SSC_ARRAY, "solzen", "Resource Solar Zenith", "deg", "", "weather", "*", "", "" },
{ SSC_OUTPUT, SSC_ARRAY, "beam", "Resource Beam normal irradiance", "W/m2", "", "weather", "*", "", "" },
{ SSC_OUTPUT, SSC_ARRAY, "tdry", "Resource Dry bulb temperature", "C", "", "weather", "*", "", "" },
{ SSC_OUTPUT, SSC_ARRAY, "twet", "Resource Wet bulb temperature", "C", "", "weather", "*", "", "" },
{ SSC_OUTPUT, SSC_ARRAY, "wspd", "Resource Wind Speed", "m/s", "", "weather", "*", "", "" },
{ SSC_OUTPUT, SSC_ARRAY, "pres", "Resource Pressure", "mbar", "", "weather", "*", "", "" },
// Solar field
{ SSC_OUTPUT, SSC_ARRAY, "Theta_ave", "Field collector solar incidence angle", "deg", "", "trough_field", "*", "", "" },
{ SSC_OUTPUT, SSC_ARRAY, "CosTh_ave", "Field collector cosine efficiency", "", "", "trough_field", "*", "", "" },
{ SSC_OUTPUT, SSC_ARRAY, "IAM_ave", "Field collector incidence angle modifier", "", "", "trough_field", "*", "", "" },
{ SSC_OUTPUT, SSC_ARRAY, "RowShadow_ave", "Field collector row shadowing loss", "", "", "trough_field", "*", "", "" },
{ SSC_OUTPUT, SSC_ARRAY, "EndLoss_ave", "Field collector optical end loss", "", "", "trough_field", "*", "", "" },
{ SSC_OUTPUT, SSC_ARRAY, "dni_costh", "Field collector DNI-cosine product", "W/m2", "", "trough_field", "*", "", "" },
{ SSC_OUTPUT, SSC_ARRAY, "EqOpteff", "Field optical efficiency before defocus", "", "", "trough_field", "*", "", "" },
{ SSC_OUTPUT, SSC_ARRAY, "SCAs_def", "Field fraction of focused SCAs", "", "", "trough_field", "*", "", "" },
{ SSC_OUTPUT, SSC_ARRAY, "q_inc_sf_tot", "Field thermal power incident", "MWt", "", "trough_field", "*", "", "" },
{ SSC_OUTPUT, SSC_ARRAY, "qinc_costh", "Field thermal power incident after cosine", "MWt", "", "trough_field", "*", "", "" },
{ SSC_OUTPUT, SSC_ARRAY, "q_dot_rec_inc", "Receiver thermal power incident", "MWt", "", "trough_field", "*", "", "" },
{ SSC_OUTPUT, SSC_ARRAY, "q_dot_rec_thermal_loss", "Receiver thermal losses", "MWt", "", "trough_field", "*", "", "" },
{ SSC_OUTPUT, SSC_ARRAY, "q_dot_rec_abs", "Receiver thermal power absorbed", "MWt", "", "trough_field", "*", "", "" },
{ SSC_OUTPUT, SSC_ARRAY, "q_dot_piping_loss", "Field piping thermal losses", "MWt", "", "trough_field", "*", "", "" },
{ SSC_OUTPUT, SSC_ARRAY, "e_dot_field_int_energy", "Field change in material/htf internal energy", "MWt", "", "trough_field", "*", "", "" },
{ SSC_OUTPUT, SSC_ARRAY, "q_dot_htf_sf_out", "Field thermal power leaving in HTF", "MWt", "", "trough_field", "*", "", "" },
{ SSC_OUTPUT, SSC_ARRAY, "q_dot_freeze_prot", "Field freeze protection required", "MWt", "", "trough_field", "*", "", "" },
{ SSC_OUTPUT, SSC_ARRAY, "m_dot_loop", "Receiver mass flow rate", "kg/s", "", "trough_field", "*", "", "" },
{ SSC_OUTPUT, SSC_ARRAY, "m_dot_field_recirc", "Field total mass flow recirculated", "kg/s", "", "trough_field", "*", "", "" },
{ SSC_OUTPUT, SSC_ARRAY, "m_dot_field_delivered","Field total mass flow delivered", "kg/s", "", "trough_field", "*", "", "" },
{ SSC_OUTPUT, SSC_ARRAY, "T_field_cold_in", "Field timestep-averaged inlet temperature", "C", "", "trough_field", "*", "", "" },
{ SSC_OUTPUT, SSC_ARRAY, "T_rec_cold_in", "Loop timestep-averaged inlet temperature", "C", "", "trough_field", "*", "", "" },
{ SSC_OUTPUT, SSC_ARRAY, "T_rec_hot_out", "Loop timestep-averaged outlet temperature", "C", "", "trough_field", "*", "", "" },
{ SSC_OUTPUT, SSC_ARRAY, "T_field_hot_out", "Field timestep-averaged outlet temperature", "C", "", "trough_field", "*", "", "" },
{ SSC_OUTPUT, SSC_ARRAY, "deltaP_field", "Field pressure drop", "bar", "", "trough_field", "*", "", "" },
{ SSC_OUTPUT, SSC_ARRAY, "W_dot_sca_track", "Field collector tracking power", "MWe", "", "trough_field", "*", "", "" },
{ SSC_OUTPUT, SSC_ARRAY, "W_dot_field_pump","Field htf pumping power", "MWe", "", "trough_field", "*", "", "" },
// Heat Sink
{ SSC_OUTPUT, SSC_ARRAY, "q_dot_to_heat_sink", "Heat sink thermal power", "MWt", "", "Heat_Sink", "*", "", "" },
{ SSC_OUTPUT, SSC_ARRAY, "W_dot_pc_pump", "Heat sink pumping power", "MWe", "", "Heat_Sink", "*", "", "" },
{ SSC_OUTPUT, SSC_ARRAY, "m_dot_htf_heat_sink","Heat sink HTF mass flow", "kg/s", "", "Heat_Sink", "*", "", "" },
{ SSC_OUTPUT, SSC_ARRAY, "T_heat_sink_in", "Heat sink HTF inlet temp", "C", "", "Heat_Sink", "*", "", "" },
{ SSC_OUTPUT, SSC_ARRAY, "T_heat_sink_out", "Heat sink HTF outlet temp", "C", "", "Heat_Sink", "*", "", "" },
// Thermal energy storage outputs
{ SSC_OUTPUT, SSC_ARRAY, "tank_losses", "TES thermal losses", "MWt", "", "TES", "*", "", "" },
{ SSC_OUTPUT, SSC_ARRAY, "q_tes_heater", "TES freeze protection power", "MWe", "", "TES", "*", "", "" },
{ SSC_OUTPUT, SSC_ARRAY, "T_tes_hot", "TES hot temperature", "C", "", "TES", "*", "", "" },
{ SSC_OUTPUT, SSC_ARRAY, "T_tes_cold", "TES cold temperature", "C", "", "TES", "*", "", "" },
{ SSC_OUTPUT, SSC_ARRAY, "mass_tes_cold", "TES cold tank mass (end)", "kg", "", "TES", "*", "", "" },
{ SSC_OUTPUT, SSC_ARRAY, "mass_tes_hot", "TES hot tank mass (end)", "kg", "", "TES", "*", "", "" },
{ SSC_OUTPUT, SSC_ARRAY, "q_dc_tes", "TES discharge thermal power", "MWt", "", "TES", "*", "", "" },
{ SSC_OUTPUT, SSC_ARRAY, "q_ch_tes", "TES charge thermal power", "MWt", "", "TES", "*", "", "" },
{ SSC_OUTPUT, SSC_ARRAY, "e_ch_tes", "TES charge state", "MWht", "", "TES", "*", "", "" },
{ SSC_OUTPUT, SSC_ARRAY, "m_dot_cr_to_tes_hot", "Mass flow: field to hot TES", "kg/s", "", "TES", "*", "", "" },
{ SSC_OUTPUT, SSC_ARRAY, "m_dot_tes_hot_out", "Mass flow: TES hot out", "kg/s", "", "TES", "*", "", "" },
{ SSC_OUTPUT, SSC_ARRAY, "m_dot_pc_to_tes_cold", "Mass flow: cycle to cold TES", "kg/s", "", "TES", "*", "", "" },
{ SSC_OUTPUT, SSC_ARRAY, "m_dot_tes_cold_out", "Mass flow: TES cold out", "kg/s", "", "TES", "*", "", "" },
{ SSC_OUTPUT, SSC_ARRAY, "m_dot_field_to_cycle", "Mass flow: field to cycle", "kg/s", "", "TES", "*", "", "" },
{ SSC_OUTPUT, SSC_ARRAY, "m_dot_cycle_to_field", "Mass flow: cycle to field", "kg/s", "", "TES", "*", "", "" },
//{ SSC_OUTPUT, SSC_ARRAY, "m_dot_tes_dc", "TES discharge mass flow rate", "kg/s", "", "TES", "*", "", "" },
//{ SSC_OUTPUT, SSC_ARRAY, "m_dot_tes_ch", "TES charge mass flow rate", "kg/s", "", "TES", "*", "", "" },
// SYSTEM
{ SSC_OUTPUT, SSC_ARRAY, "W_dot_parasitic_tot", "System total electrical parasitic", "MWe", "", "Heat_Sink", "*", "", "" },
// Controller
{ SSC_OUTPUT, SSC_ARRAY, "op_mode_1", "1st operating mode", "", "", "Solver", "*", "", "" },
{ SSC_OUTPUT, SSC_ARRAY, "op_mode_2", "2nd op. mode, if applicable", "", "", "Solver", "*", "", "" },
{ SSC_OUTPUT, SSC_ARRAY, "op_mode_3", "3rd op. mode, if applicable", "", "", "Solver", "*", "", "" },
{ SSC_OUTPUT, SSC_ARRAY, "m_dot_balance", "Relative mass flow balance error", "", "", "Controller", "*", "", "" },
{ SSC_OUTPUT, SSC_ARRAY, "q_balance", "Relative energy balance error", "", "", "Controller", "*", "", "" },
// Annual Outputs
{ SSC_OUTPUT, SSC_NUMBER, "annual_energy", "Annual Net Thermal Energy Production w/ avail derate", "kWt-hr", "", "Post-process", "*", "", "" },
{ SSC_OUTPUT, SSC_NUMBER, "annual_gross_energy", "Annual Gross Thermal Energy Production w/ avail derate", "kWt-hr", "", "Post-process", "*", "", "" },
{ SSC_OUTPUT, SSC_NUMBER, "annual_thermal_consumption", "Annual thermal freeze protection required", "kWt-hr", "", "Post-process", "*", "", "" },
{ SSC_OUTPUT, SSC_NUMBER, "annual_electricity_consumption", "Annual electricity consumption w/ avail derate", "kWe-hr", "", "Post-process", "*", "", "" },
{ SSC_OUTPUT, SSC_NUMBER, "annual_total_water_use", "Total Annual Water Usage", "m^3", "", "Post-process", "*", "", "" },
{ SSC_OUTPUT, SSC_NUMBER, "annual_field_freeze_protection", "Annual thermal power for field freeze protection", "kWt-hr", "", "Post-process", "*", "", "" },
{ SSC_OUTPUT, SSC_NUMBER, "annual_tes_freeze_protection", "Annual thermal power for TES freeze protection", "kWt-hr", "", "Post-process", "*", "", "" },
{ SSC_OUTPUT, SSC_NUMBER, "capacity_factor", "Capacity factor", "%", "", "Post-process", "*", "", "" },
{ SSC_OUTPUT, SSC_NUMBER, "kwh_per_kw", "First year kWh/kW", "kWht/kWt", "", "Post-process", "*", "", "" },
{ SSC_OUTPUT, SSC_NUMBER, "solar_multiple_actual", "Actual solar multiple of system", "-", "", "Post-process", "*", "", "" },
var_info_invalid };
class cm_trough_physical_process_heat : public compute_module
{
public:
cm_trough_physical_process_heat()
{
add_var_info( _cm_vtab_trough_physical_process_heat );
add_var_info(vtab_adjustment_factors);
add_var_info(vtab_technology_outputs);
}
void exec( )
{
//***************************************************************************
//***************************************************************************
// Weather reader
C_csp_weatherreader weather_reader;
if (is_assigned("file_name")) {
weather_reader.m_weather_data_provider = make_shared<weatherfile>(as_string("file_name"));
if (weather_reader.m_weather_data_provider->has_message()) log(weather_reader.m_weather_data_provider->message(), SSC_WARNING);
}
if (is_assigned("solar_resource_data")) {
weather_reader.m_weather_data_provider = make_shared<weatherdata>(lookup("solar_resource_data"));
if (weather_reader.m_weather_data_provider->has_message()) log(weather_reader.m_weather_data_provider->message(), SSC_WARNING);
}
weather_reader.m_filename = as_string("file_name");
weather_reader.m_trackmode = 0;
weather_reader.m_tilt = 0.0;
weather_reader.m_azimuth = 0.0;
// Initialize to get weather file info
weather_reader.init();
if (weather_reader.has_error()) throw exec_error("trough_physical_iph", weather_reader.get_error());
// Set up ssc output arrays
// Set steps per hour
double nhourssim = 8760.0; //[hr] Number of hours to simulate
C_csp_solver::S_sim_setup sim_setup;
sim_setup.m_sim_time_start = 0.0; //[s] starting first hour of year
sim_setup.m_sim_time_end = nhourssim*3600.0; //[s] full year simulation
size_t steps_per_hour = 1; //[-]
size_t n_wf_records = weather_reader.m_weather_data_provider->nrecords();
steps_per_hour = n_wf_records / 8760; //[-]
size_t n_steps_fixed = steps_per_hour*8760; //[-]
sim_setup.m_report_step = 3600.0 / (double)steps_per_hour; //[s]
//***************************************************************************
//***************************************************************************
C_csp_trough_collector_receiver c_trough;
c_trough.m_nSCA = as_integer("nSCA"); //[-] Number of SCA's in a loop
c_trough.m_nHCEt = as_integer("nHCEt"); //[-] Number of HCE types
c_trough.m_nColt = as_integer("nColt"); //[-] Number of collector types
c_trough.m_nHCEVar = as_integer("nHCEVar"); //[-] Number of HCE variants per t
c_trough.m_nLoops = as_integer("nLoops"); //[-] Number of loops in the field
c_trough.m_FieldConfig = as_integer("FieldConfig"); //[-] Number of subfield headers
c_trough.m_L_power_block_piping = as_double("L_heat_sink_piping"); //[m] Length of piping (full mass flow) through heat sink (if applicable)
c_trough.m_include_fixed_power_block_runner = as_boolean("is_model_heat_sink_piping"); //[-] Should model consider piping through heat sink?
c_trough.m_eta_pump = as_double("eta_pump"); //[-] HTF pump efficiency
c_trough.m_Fluid = as_integer("Fluid"); //[-] Field HTF fluid number
//c_trough.m_fthrok = as_integer("fthrok"); //[-] Flag to allow partial defocusing of the collectors
c_trough.m_fthrctrl = 2; //[-] Defocusing strategy; hardcode = 2 for now
c_trough.m_accept_loc = as_integer("accept_loc"); //[-] In acceptance testing mode - temperature sensor location (1=hx,2=loop)
c_trough.m_HDR_rough = as_double("HDR_rough"); //[m] Header pipe roughness
c_trough.m_theta_stow = as_double("theta_stow"); //[deg] stow angle
c_trough.m_theta_dep = as_double("theta_dep"); //[deg] deploy angle
c_trough.m_Row_Distance = as_double("Row_Distance"); //[m] Spacing between rows (centerline to centerline)
double T_loop_in_des = as_double("T_loop_in_des"); //[C] Design loop inlet temperature, converted to K in init
c_trough.m_T_loop_in_des = T_loop_in_des; //[C] Design loop inlet temperature, converted to K in init
double T_loop_out_des = as_double("T_loop_out"); //[C] Target loop outlet temperature, converted to K in init
c_trough.m_T_loop_out_des = T_loop_out_des; //[C] Target loop outlet temperature, converted to K in init
double T_startup = 0.67*T_loop_in_des + 0.33*T_loop_out_des; //[C]
c_trough.m_T_startup = T_startup; //[C] The required temperature (converted to K in init) of the system before the power block can be switched on
c_trough.m_m_dot_htfmin = as_double("m_dot_htfmin"); //[kg/s] Minimum loop HTF flow rate
c_trough.m_m_dot_htfmax = as_double("m_dot_htfmax"); //[kg/s] Maximum loop HTF flow rate
c_trough.m_field_fl_props = as_matrix("field_fl_props"); //[-] User-defined field HTF properties
c_trough.m_T_fp = as_double("T_fp"); //[C] Freeze protection temperature (heat trace activation temperature), convert to K in init
c_trough.m_I_bn_des = as_double("I_bn_des"); //[W/m^2] Solar irradiation at design
c_trough.m_V_hdr_cold_max = as_double("V_hdr_cold_max"); //[m/s] Maximum HTF velocity in the cold header at design
c_trough.m_V_hdr_cold_min = as_double("V_hdr_cold_min"); //[m/s] Minimum HTF velocity in the cold header at design
c_trough.m_V_hdr_hot_max = as_double("V_hdr_hot_max"); //[m/s] Maximum HTF velocity in the hot header at design
c_trough.m_V_hdr_hot_min = as_double("V_hdr_hot_min"); //[m/s] Minimum HTF velocity in the hot header at design
c_trough.m_Pipe_hl_coef = as_double("Pipe_hl_coef"); //[W/m2-K] Loss coefficient from the header, runner pipe, and non-HCE piping
c_trough.m_SCA_drives_elec = as_double("SCA_drives_elec"); //[W/SCA] Tracking power, in Watts per SCA drive
c_trough.m_ColTilt = as_double("tilt"); //[deg] Collector tilt angle (0 is horizontal, 90deg is vertical)
c_trough.m_ColAz = as_double("azimuth"); //[deg] Collector azimuth angle
c_trough.m_wind_stow_speed = as_double("wind_stow_speed"); //[m/s] Wind speed at and above which the collectors will be stowed
c_trough.m_accept_mode = as_integer("accept_mode"); //[-] Acceptance testing mode? (1=yes, 0=no)
c_trough.m_accept_init = as_boolean("accept_init"); //[-] In acceptance testing mode - require steady-state startup
c_trough.m_solar_mult = as_double("solar_mult"); //[-] Solar Multiple (set during verify() using cmod_csp_trough_eqns.cpp)
c_trough.m_mc_bal_hot_per_MW = as_double("mc_bal_hot"); //[kWht/K-MWt] The heat capacity of the balance of plant on the hot side
c_trough.m_mc_bal_cold_per_MW = as_double("mc_bal_cold"); //[kWht/K-MWt] The heat capacity of the balance of plant on the cold side
c_trough.m_mc_bal_sca = as_double("mc_bal_sca"); //[Wht/K-m] Non-HTF heat capacity associated with each SCA - per meter basis
//[m] The collector aperture width (Total structural area.. used for shadowing)
size_t nval_W_aperture = 0;
ssc_number_t *W_aperture = as_array("W_aperture", &nval_W_aperture);
c_trough.m_W_aperture.resize(nval_W_aperture);
for (size_t i = 0; i < nval_W_aperture; i++)
c_trough.m_W_aperture[i] = (double)W_aperture[i];
//[m^2] Reflective aperture area of the collector
size_t nval_A_aperture = 0;
ssc_number_t *A_aperture = as_array("A_aperture", &nval_A_aperture);
c_trough.m_A_aperture.resize(nval_A_aperture);
for (size_t i = 0; i < nval_A_aperture; i++)
c_trough.m_A_aperture[i] = (double)A_aperture[i];
//[-] Tracking error derate
size_t nval_TrackingError = 0;
ssc_number_t *TrackingError = as_array("TrackingError", &nval_TrackingError);
c_trough.m_TrackingError.resize(nval_TrackingError);
for (size_t i = 0; i < nval_TrackingError; i++)
c_trough.m_TrackingError[i] = (double)TrackingError[i];
//[-] Geometry effects derate
size_t nval_GeomEffects = 0;
ssc_number_t *GeomEffects = as_array("GeomEffects", &nval_GeomEffects);
c_trough.m_GeomEffects.resize(nval_GeomEffects);
for (size_t i = 0; i < nval_GeomEffects; i++)
c_trough.m_GeomEffects[i] = (double)GeomEffects[i];
//[-] Clean mirror reflectivity
size_t nval_Rho_mirror_clean = 0;
ssc_number_t *Rho_mirror_clean = as_array("Rho_mirror_clean", &nval_Rho_mirror_clean);
c_trough.m_Rho_mirror_clean.resize(nval_Rho_mirror_clean);
for (size_t i = 0; i < nval_Rho_mirror_clean; i++)
c_trough.m_Rho_mirror_clean[i] = (double)Rho_mirror_clean[i];
//[-] Dirt on mirror derate
size_t nval_Dirt_mirror = 0;
ssc_number_t *Dirt_mirror = as_array("Dirt_mirror", &nval_Dirt_mirror);
c_trough.m_Dirt_mirror.resize(nval_Dirt_mirror);
for (size_t i = 0; i < nval_Dirt_mirror; i++)
c_trough.m_Dirt_mirror[i] = (double)Dirt_mirror[i];
//[-] General optical error derate
size_t nval_Error = 0;
ssc_number_t *Error = as_array("Error", &nval_Error);
c_trough.m_Error.resize(nval_Error);
for (size_t i = 0; i < nval_Error; i++)
c_trough.m_Error[i] = (double)Error[i];
//[m] The average focal length of the collector
size_t nval_Ave_Focal_Length = 0;
ssc_number_t *Ave_Focal_Length = as_array("Ave_Focal_Length", &nval_Ave_Focal_Length);
c_trough.m_Ave_Focal_Length.resize(nval_Ave_Focal_Length);
for (size_t i = 0; i < nval_Ave_Focal_Length; i++)
c_trough.m_Ave_Focal_Length[i] = (double)Ave_Focal_Length[i];
//[m] The length of the SCA
size_t nval_L_SCA = 0;
ssc_number_t *L_SCA = as_array("L_SCA", &nval_L_SCA);
c_trough.m_L_SCA.resize(nval_L_SCA);
for (size_t i = 0; i < nval_L_SCA; i++)
c_trough.m_L_SCA[i] = (double)L_SCA[i];
//[m] The length of a single mirror/HCE unit
size_t nval_L_aperture = 0;
ssc_number_t *L_aperture = as_array("L_aperture", &nval_L_aperture);
c_trough.m_L_aperture.resize(nval_L_aperture);
for (size_t i = 0; i < nval_L_aperture; i++)
c_trough.m_L_aperture[i] = (double)L_aperture[i];
//[-] The number of individual collector sections in an SCA
size_t nval_ColperSCA = 0;
ssc_number_t *ColperSCA = as_array("ColperSCA", &nval_ColperSCA);
c_trough.m_ColperSCA.resize(nval_ColperSCA);
for (size_t i = 0; i < nval_ColperSCA; i++)
c_trough.m_ColperSCA[i] = (double)ColperSCA[i];
//[m] Piping distance between SCA's in the field
size_t nval_Distance_SCA = 0;
ssc_number_t *Distance_SCA = as_array("Distance_SCA", &nval_Distance_SCA);
c_trough.m_Distance_SCA.resize(nval_Distance_SCA);
for (size_t i = 0; i < nval_Distance_SCA; i++)
c_trough.m_Distance_SCA[i] = (double)Distance_SCA[i];
c_trough.m_IAM_matrix = as_matrix("IAM_matrix"); //[-] IAM coefficients, matrix for 4 collectors
// Why are these matrices - can't they be arrays?
c_trough.m_HCE_FieldFrac = as_matrix("HCE_FieldFrac"); //[-] Fraction of the field occupied by this HCE type
c_trough.m_D_2 = as_matrix("D_2"); //[m] Inner absorber tube diameter
c_trough.m_D_3 = as_matrix("D_3"); //[m] Outer absorber tube diameter
c_trough.m_D_4 = as_matrix("D_4"); //[m] Inner glass envelope diameter
c_trough.m_D_5 = as_matrix("D_5"); //[m] Outer glass envelope diameter
c_trough.m_D_p = as_matrix("D_p"); //[m] Diameter of the absorber flow plug (optional)
c_trough.m_Flow_type = as_matrix("Flow_type"); //[-] Flow type through the absorber
c_trough.m_Rough = as_matrix("Rough"); //[m] Roughness of the internal surface
c_trough.m_alpha_env = as_matrix("alpha_env"); //[-] Envelope absorptance
// **********************************************************
// Emittance vs. temperature profile for each receiver type and variation
c_trough.m_epsilon_3_11 = as_matrix_transpose("epsilon_3_11"); //[-] Absorber emittance for receiver type 1 variation 1
c_trough.m_epsilon_3_12 = as_matrix_transpose("epsilon_3_12"); //[-] Absorber emittance for receiver type 1 variation 2
c_trough.m_epsilon_3_13 = as_matrix_transpose("epsilon_3_13"); //[-] Absorber emittance for receiver type 1 variation 3
c_trough.m_epsilon_3_14 = as_matrix_transpose("epsilon_3_14"); //[-] Absorber emittance for receiver type 1 variation 4
c_trough.m_epsilon_3_21 = as_matrix_transpose("epsilon_3_21"); //[-] Absorber emittance for receiver type 2 variation 1
c_trough.m_epsilon_3_22 = as_matrix_transpose("epsilon_3_22"); //[-] Absorber emittance for receiver type 2 variation 2
c_trough.m_epsilon_3_23 = as_matrix_transpose("epsilon_3_23"); //[-] Absorber emittance for receiver type 2 variation 3
c_trough.m_epsilon_3_24 = as_matrix_transpose("epsilon_3_24"); //[-] Absorber emittance for receiver type 2 variation 4
c_trough.m_epsilon_3_31 = as_matrix_transpose("epsilon_3_31"); //[-] Absorber emittance for receiver type 3 variation 1
c_trough.m_epsilon_3_32 = as_matrix_transpose("epsilon_3_32"); //[-] Absorber emittance for receiver type 3 variation 2
c_trough.m_epsilon_3_33 = as_matrix_transpose("epsilon_3_33"); //[-] Absorber emittance for receiver type 3 variation 3
c_trough.m_epsilon_3_34 = as_matrix_transpose("epsilon_3_34"); //[-] Absorber emittance for receiver type 3 variation 4
c_trough.m_epsilon_3_41 = as_matrix_transpose("epsilon_3_41"); //[-] Absorber emittance for receiver type 4 variation 1
c_trough.m_epsilon_3_42 = as_matrix_transpose("epsilon_3_42"); //[-] Absorber emittance for receiver type 4 variation 2
c_trough.m_epsilon_3_43 = as_matrix_transpose("epsilon_3_43"); //[-] Absorber emittance for receiver type 4 variation 3
c_trough.m_epsilon_3_44 = as_matrix_transpose("epsilon_3_44"); //[-] Absorber emittance for receiver type 4 variation 4
c_trough.m_alpha_abs = as_matrix("alpha_abs"); //[-] Absorber absorptance
c_trough.m_Tau_envelope = as_matrix("Tau_envelope"); //[-] Envelope transmittance
c_trough.m_EPSILON_4 = as_matrix("EPSILON_4"); //[-] Inner glass envelope emissivities
c_trough.m_EPSILON_5 = as_matrix("EPSILON_5"); //[-] Outer glass envelope emissivities
// c_trough.m_GlazingIntact = (as_matrix("GlazingIntactIn") > 0); //[-] Glazing intact (broken glass) flag {1=true, else=false}
util::matrix_t<double> glazing_intact_double = as_matrix("GlazingIntactIn"); //[-] Is the glazing intact?
int n_gl_row = (int)glazing_intact_double.nrows();
int n_gl_col = (int)glazing_intact_double.ncols();
c_trough.m_GlazingIntact.resize(n_gl_row, n_gl_col);
for (int i = 0; i < n_gl_row; i++)
{
for (int j = 0; j < n_gl_col; j++)
{
c_trough.m_GlazingIntact(i, j) = (glazing_intact_double(i, j) > 0);
}
}
// Calculated during verify() using cmod_csp_trough_eqns.cpp:
c_trough.m_SCAInfoArray = as_matrix("scainfoarray"); //[-] Receiver (,1) and collector (,2) type for each assembly in loop
size_t SCADefocusArraySize = -1;
ssc_number_t* SCADefocusArray = as_array("scadefocusarray", &SCADefocusArraySize); //[-] Collector defocus order
std::copy(SCADefocusArray, SCADefocusArray + SCADefocusArraySize, back_inserter(c_trough.m_SCADefocusArray)); // convert matrix_t and set to vector
c_trough.m_P_a = as_matrix("P_a"); //[torr] Annulus gas pressure
c_trough.m_AnnulusGas = as_matrix("AnnulusGas"); //[-] Annulus gas type (1=air, 26=Ar, 27=H2)
c_trough.m_AbsorberMaterial = as_matrix("AbsorberMaterial"); //[-] Absorber material type
c_trough.m_Shadowing = as_matrix("Shadowing"); //[-] Receiver bellows shadowing loss factor
c_trough.m_Dirt_HCE = as_matrix("Dirt_HCE"); //[-] Loss due to dirt on the receiver envelope
c_trough.m_Design_loss = as_matrix("Design_loss"); //[-] Receiver heat loss at design
c_trough.m_calc_design_pipe_vals = as_boolean("calc_design_pipe_vals"); //[-] Should the HTF state be calculated at design conditions
c_trough.m_L_rnr_pb = as_double("L_rnr_pb"); //[m] Length of hot or cold runner pipe around the power block
c_trough.m_N_max_hdr_diams = as_double("N_max_hdr_diams"); //[-] Maximum number of allowed diameters in each of the hot and cold headers
c_trough.m_L_rnr_per_xpan = as_double("L_rnr_per_xpan"); //[m] Threshold length of straight runner pipe without an expansion loop
c_trough.m_L_xpan_hdr = as_double("L_xpan_hdr"); //[m] Combined length in meters of the two perpendicular segments of a header expansion loop
c_trough.m_L_xpan_rnr = as_double("L_xpan_rnr"); //[m] Combined length in meters of the two perpendicular segments of a runner expansion loop
c_trough.m_Min_rnr_xpans = as_double("Min_rnr_xpans"); //[-] Minimum number of expansion loops per single-diameter runner section
c_trough.m_northsouth_field_sep = as_double("northsouth_field_sep"); //[m] Shortest north/south distance between SCAs in different subfields
c_trough.m_N_hdr_per_xpan = as_double("N_hdr_per_xpan"); //[-] Number of collector loops per header expansion loops. 1 = expansion loop between every collector loop
c_trough.m_offset_xpan_hdr = as_double("offset_xpan_hdr"); //[-] Location of first header expansion loop. 1 = after first collector loop
c_trough.m_K_cpnt = as_matrix("K_cpnt"); //[-] Minor loss coefficients of the components in each loop interconnect
c_trough.m_D_cpnt = as_matrix("D_cpnt"); //[m] Inner diameters of the components in each loop interconnect
c_trough.m_L_cpnt = as_matrix("L_cpnt"); //[m] Lengths of the components in each loop interconnect
c_trough.m_Type_cpnt = as_matrix("Type_cpnt"); //[-] Type of component in each loop interconnect [0=fitting | 1=pipe | 2=flex_hose]
c_trough.m_custom_sf_pipe_sizes = as_boolean("custom_sf_pipe_sizes"); //[-] Should the field pipe diameters, wall thickness and lengths be imported instead of calculated
c_trough.m_sf_rnr_diams = as_matrix("sf_rnr_diams"); //[m] Imported runner diameters, used if custom_sf_pipe_sizes is true
c_trough.m_sf_rnr_wallthicks = as_matrix("sf_rnr_wallthicks"); //[m] Imported runner wall thicknesses, used if custom_sf_pipe_sizes is true
c_trough.m_sf_rnr_lengths = as_matrix("sf_rnr_lengths"); //[m] Imported runner lengths, used if custom_sf_pipe_sizes is true
c_trough.m_sf_hdr_diams = as_matrix("sf_hdr_diams"); //[m] Imported header diameters, used if custom_sf_pipe_sizes is true
c_trough.m_sf_hdr_wallthicks = as_matrix("sf_hdr_wallthicks"); //[m] Imported header wall thicknesses, used if custom_sf_pipe_sizes is true
c_trough.m_sf_hdr_lengths = as_matrix("sf_hdr_lengths"); //[m] Imported header lengths, used if custom_sf_pipe_sizes is true
// Allocate trough outputs
c_trough.mc_reported_outputs.assign(C_csp_trough_collector_receiver::E_THETA_AVE, allocate("Theta_ave", n_steps_fixed), n_steps_fixed);
c_trough.mc_reported_outputs.assign(C_csp_trough_collector_receiver::E_COSTH_AVE, allocate("CosTh_ave", n_steps_fixed), n_steps_fixed);
c_trough.mc_reported_outputs.assign(C_csp_trough_collector_receiver::E_IAM_AVE, allocate("IAM_ave", n_steps_fixed), n_steps_fixed);
c_trough.mc_reported_outputs.assign(C_csp_trough_collector_receiver::E_ROWSHADOW_AVE, allocate("RowShadow_ave", n_steps_fixed), n_steps_fixed);
c_trough.mc_reported_outputs.assign(C_csp_trough_collector_receiver::E_ENDLOSS_AVE, allocate("EndLoss_ave", n_steps_fixed), n_steps_fixed);
c_trough.mc_reported_outputs.assign(C_csp_trough_collector_receiver::E_DNI_COSTH, allocate("dni_costh", n_steps_fixed), n_steps_fixed);
c_trough.mc_reported_outputs.assign(C_csp_trough_collector_receiver::E_EQUIV_OPT_ETA_TOT, allocate("EqOpteff", n_steps_fixed), n_steps_fixed);
c_trough.mc_reported_outputs.assign(C_csp_trough_collector_receiver::E_DEFOCUS, allocate("SCAs_def", n_steps_fixed), n_steps_fixed);
c_trough.mc_reported_outputs.assign(C_csp_trough_collector_receiver::E_Q_DOT_INC_SF_TOT, allocate("q_inc_sf_tot", n_steps_fixed), n_steps_fixed);
c_trough.mc_reported_outputs.assign(C_csp_trough_collector_receiver::E_Q_DOT_INC_SF_COSTH, allocate("qinc_costh", n_steps_fixed), n_steps_fixed);
c_trough.mc_reported_outputs.assign(C_csp_trough_collector_receiver::E_Q_DOT_REC_INC, allocate("q_dot_rec_inc", n_steps_fixed), n_steps_fixed);
c_trough.mc_reported_outputs.assign(C_csp_trough_collector_receiver::E_Q_DOT_REC_THERMAL_LOSS, allocate("q_dot_rec_thermal_loss", n_steps_fixed), n_steps_fixed);
c_trough.mc_reported_outputs.assign(C_csp_trough_collector_receiver::E_Q_DOT_REC_ABS, allocate("q_dot_rec_abs", n_steps_fixed), n_steps_fixed);
c_trough.mc_reported_outputs.assign(C_csp_trough_collector_receiver::E_Q_DOT_PIPING_LOSS, allocate("q_dot_piping_loss", n_steps_fixed), n_steps_fixed);
c_trough.mc_reported_outputs.assign(C_csp_trough_collector_receiver::E_E_DOT_INTERNAL_ENERGY, allocate("e_dot_field_int_energy", n_steps_fixed), n_steps_fixed);
c_trough.mc_reported_outputs.assign(C_csp_trough_collector_receiver::E_Q_DOT_HTF_OUT, allocate("q_dot_htf_sf_out", n_steps_fixed), n_steps_fixed);
c_trough.mc_reported_outputs.assign(C_csp_trough_collector_receiver::E_Q_DOT_FREEZE_PROT, allocate("q_dot_freeze_prot", n_steps_fixed), n_steps_fixed);
c_trough.mc_reported_outputs.assign(C_csp_trough_collector_receiver::E_M_DOT_LOOP, allocate("m_dot_loop", n_steps_fixed), n_steps_fixed);
c_trough.mc_reported_outputs.assign(C_csp_trough_collector_receiver::E_M_DOT_FIELD_RECIRC, allocate("m_dot_field_recirc", n_steps_fixed), n_steps_fixed);
c_trough.mc_reported_outputs.assign(C_csp_trough_collector_receiver::E_M_DOT_FIELD_DELIVERED, allocate("m_dot_field_delivered", n_steps_fixed), n_steps_fixed);
c_trough.mc_reported_outputs.assign(C_csp_trough_collector_receiver::E_T_FIELD_COLD_IN, allocate("T_field_cold_in", n_steps_fixed), n_steps_fixed);
c_trough.mc_reported_outputs.assign(C_csp_trough_collector_receiver::E_T_REC_COLD_IN, allocate("T_rec_cold_in", n_steps_fixed), n_steps_fixed);
c_trough.mc_reported_outputs.assign(C_csp_trough_collector_receiver::E_T_REC_HOT_OUT, allocate("T_rec_hot_out", n_steps_fixed), n_steps_fixed);
c_trough.mc_reported_outputs.assign(C_csp_trough_collector_receiver::E_T_FIELD_HOT_OUT, allocate("T_field_hot_out", n_steps_fixed), n_steps_fixed);
c_trough.mc_reported_outputs.assign(C_csp_trough_collector_receiver::E_PRESSURE_DROP, allocate("deltaP_field", n_steps_fixed), n_steps_fixed); //[bar]
c_trough.mc_reported_outputs.assign(C_csp_trough_collector_receiver::E_W_DOT_SCA_TRACK, allocate("W_dot_sca_track", n_steps_fixed), n_steps_fixed); //[MWe]
c_trough.mc_reported_outputs.assign(C_csp_trough_collector_receiver::E_W_DOT_PUMP, allocate("W_dot_field_pump", n_steps_fixed), n_steps_fixed); //[MWe]
// ********************************
// ********************************
// Now add the Heat Sink as a power cycle class
// ********************************
// ********************************
// Heat Sink
size_t n_f_turbine = 0;
ssc_number_t* p_f_turbine = as_array("f_turb_tou_periods", &n_f_turbine); // heat sink, not turbine
double f_turbine_max = 1.0;
for (size_t i = 0; i < n_f_turbine; i++) {
f_turbine_max = max(f_turbine_max, p_f_turbine[i]);
}
C_pc_heat_sink c_heat_sink;
c_heat_sink.ms_params.m_T_htf_hot_des = as_double("T_loop_out"); //[C] FIELD design outlet temperature
c_heat_sink.ms_params.m_T_htf_cold_des = as_double("T_loop_in_des"); //[C] FIELD design inlet temperature
c_heat_sink.ms_params.m_q_dot_des = as_double("q_pb_design"); //[MWt] HEAT SINK design thermal power (could have field solar multiple...)
// 9.18.2016 twn: assume for now there's no pressure drop though heat sink
c_heat_sink.ms_params.m_htf_pump_coef = as_double("pb_pump_coef"); //[kWe/kg/s]
c_heat_sink.ms_params.m_max_frac = f_turbine_max;
c_heat_sink.ms_params.m_pc_fl = as_integer("Fluid");
c_heat_sink.ms_params.m_pc_fl_props = as_matrix("field_fl_props");
// Allocate heat sink outputs
c_heat_sink.mc_reported_outputs.assign(C_pc_heat_sink::E_Q_DOT_HEAT_SINK, allocate("q_dot_to_heat_sink", n_steps_fixed), n_steps_fixed);
c_heat_sink.mc_reported_outputs.assign(C_pc_heat_sink::E_W_DOT_PUMPING, allocate("W_dot_pc_pump", n_steps_fixed), n_steps_fixed);
c_heat_sink.mc_reported_outputs.assign(C_pc_heat_sink::E_M_DOT_HTF, allocate("m_dot_htf_heat_sink", n_steps_fixed), n_steps_fixed);
c_heat_sink.mc_reported_outputs.assign(C_pc_heat_sink::E_T_HTF_IN, allocate("T_heat_sink_in", n_steps_fixed), n_steps_fixed);
c_heat_sink.mc_reported_outputs.assign(C_pc_heat_sink::E_T_HTF_OUT, allocate("T_heat_sink_out", n_steps_fixed), n_steps_fixed);
// ********************************
// ********************************
// Now add the storage class
// ********************************
// ********************************
C_csp_two_tank_tes storage(
c_trough.m_Fluid, //[-]
c_trough.m_field_fl_props, //[-]
c_trough.m_Fluid, //[-]
c_trough.m_field_fl_props, //[-]
c_heat_sink.ms_params.m_q_dot_des / 1.0, //[MWt]
as_double("solar_mult"), //[-]
c_heat_sink.ms_params.m_q_dot_des / 1.0 * as_double("tshours"), //[hr]
true,
as_double("h_tank"), //[m]
0.0,
as_double("u_tank"), //[W/m^2-K]
as_integer("tank_pairs"), //[-]
as_double("hot_tank_Thtr"), //[C]
as_double("hot_tank_max_heat"), //[MWt]
as_double("cold_tank_Thtr"), //[C]
as_double("cold_tank_max_heat"), //[MWt]
0.0, // MSPT assumes direct storage, so no user input here: hardcode = 0.0
T_loop_in_des, //[C]
T_loop_out_des, //[C]
T_loop_out_des, //[C]
T_loop_in_des, //[C]
as_double("h_tank_min"), //[m]
as_double("init_hot_htf_percent"), //[-]
as_double("pb_pump_coef"), //[kWe/kg/s]
as_boolean("tanks_in_parallel"), //[-]
1.85, //[m/s]
false // for now, to get 'tanks_in_parallel' to work
);
// Set storage outputs
storage.mc_reported_outputs.assign(C_csp_two_tank_tes::E_Q_DOT_LOSS, allocate("tank_losses", n_steps_fixed), n_steps_fixed);
storage.mc_reported_outputs.assign(C_csp_two_tank_tes::E_W_DOT_HEATER, allocate("q_tes_heater", n_steps_fixed), n_steps_fixed);
storage.mc_reported_outputs.assign(C_csp_two_tank_tes::E_TES_T_HOT, allocate("T_tes_hot", n_steps_fixed), n_steps_fixed);
storage.mc_reported_outputs.assign(C_csp_two_tank_tes::E_TES_T_COLD, allocate("T_tes_cold", n_steps_fixed), n_steps_fixed);
storage.mc_reported_outputs.assign(C_csp_two_tank_tes::E_MASS_COLD_TANK, allocate("mass_tes_cold", n_steps_fixed), n_steps_fixed);
storage.mc_reported_outputs.assign(C_csp_two_tank_tes::E_MASS_HOT_TANK, allocate("mass_tes_hot", n_steps_fixed), n_steps_fixed);
// ********************************
// ********************************
// TOU
// ********************************
// ********************************
C_csp_tou_block_schedules tou;
//tou.setup_block_uniform_tod();
C_csp_tou_block_schedules::S_params *tou_params = &tou.ms_params;
tou_params->mc_csp_ops.mc_weekdays = as_matrix("weekday_schedule");
tou_params->mc_csp_ops.mc_weekends = as_matrix("weekend_schedule");
tou_params->mc_pricing.mc_weekdays = as_matrix("dispatch_sched_weekday");
tou_params->mc_pricing.mc_weekends = as_matrix("dispatch_sched_weekend");
if (tou_params->mc_pricing.mc_weekdays.ncells() == 1) {
// Resize default value from var table to proper dimensions
tou_params->mc_pricing.mc_weekdays = util::matrix_t<double>(12, 24, 1.0);
}
if (tou_params->mc_pricing.mc_weekends.ncells() == 1) {
// Resize default value from var table to proper dimensions
tou_params->mc_pricing.mc_weekends = util::matrix_t<double>(12, 24, 1.0);
}
tou.mc_dispatch_params.m_is_tod_pc_target_also_pc_max = as_boolean("is_tod_pc_target_also_pc_max");
tou.mc_dispatch_params.m_is_block_dispatch = !as_boolean("is_dispatch"); //mw
tou.mc_dispatch_params.m_use_rule_1 = true;
tou.mc_dispatch_params.m_standby_off_buffer = 2.0;
tou.mc_dispatch_params.m_use_rule_2 = false;
tou.mc_dispatch_params.m_q_dot_rec_des_mult = -1.23;
tou.mc_dispatch_params.m_f_q_dot_pc_overwrite = -1.23;
//size_t n_f_turbine = 0;
//ssc_number_t *p_f_turbine = as_array("f_turb_tou_periods", &n_f_turbine); // heat sink, not turbine
tou_params->mc_csp_ops.mvv_tou_arrays[C_block_schedule_csp_ops::TURB_FRAC].resize(n_f_turbine, 0.0);
//tou_params->mv_t_frac.resize(n_f_turbine, 0.0);
for (size_t i = 0; i < n_f_turbine; i++)
tou_params->mc_csp_ops.mvv_tou_arrays[C_block_schedule_csp_ops::TURB_FRAC][i] = (double)p_f_turbine[i];
// Load fraction by time step:
bool is_load_fraction_by_timestep = is_assigned("timestep_load_fractions");
tou_params->mc_csp_ops.mv_is_diurnal = !(is_load_fraction_by_timestep);
if (is_load_fraction_by_timestep) {
size_t N_load_fractions;
ssc_number_t* load_fractions = as_array("timestep_load_fractions", &N_load_fractions);
std::copy(load_fractions, load_fractions + N_load_fractions, std::back_inserter(tou_params->mc_csp_ops.timestep_load_fractions));
}
// Time-of-Delivery factors by time step:
bool is_tod_by_timestep = (as_integer("ppa_multiplier_model") == 1);
tou_params->mc_pricing.mv_is_diurnal = !(is_tod_by_timestep);
if (is_tod_by_timestep)
{
size_t nmultipliers;
ssc_number_t *multipliers = as_array("dispatch_factors_ts", &nmultipliers);
tou_params->mc_pricing.mvv_tou_arrays[C_block_schedule_pricing::MULT_PRICE].resize(nmultipliers, 0.0);
for (size_t ii = 0; ii < nmultipliers; ii++)
tou_params->mc_pricing.mvv_tou_arrays[C_block_schedule_pricing::MULT_PRICE][ii] = multipliers[ii];
}
else // standard diuranal input
{
if (is_assigned("dispatch_tod_factors")) {
auto dispatch_tod_factors = as_vector_double("dispatch_tod_factors");
if (dispatch_tod_factors.size() != 9)
throw exec_error("trough_physical_process_heat", util::format("\n\nDispatch TOD factors has %d periods instead of the expected 9.\n", (int)dispatch_tod_factors.size()));
tou_params->mc_pricing.mvv_tou_arrays[C_block_schedule_pricing::MULT_PRICE].resize(9, 0.0);
for (size_t i = 0; i < 9; i++)
tou_params->mc_pricing.mvv_tou_arrays[C_block_schedule_pricing::MULT_PRICE][i] = dispatch_tod_factors[i];
}
else {
tou_params->mc_pricing.mvv_tou_arrays[C_block_schedule_pricing::MULT_PRICE].resize(9, 1.0);
}
}
// System parameters
C_csp_solver::S_csp_system_params system;
system.m_pb_fixed_par = as_double("pb_fixed_par");
size_t nval_bop_array = 0;
ssc_number_t *bop_array = as_array("bop_array", &nval_bop_array);
if (nval_bop_array != 5) throw exec_error("trough_physical_process_heat", "Should be 5 elements in bop_array, has " + util::to_string((int)nval_bop_array) + ".");
system.m_bop_par = bop_array[0]; //as_double("bop_par");
system.m_bop_par_f = bop_array[1]; //as_double("bop_par_f");
system.m_bop_par_0 = bop_array[2]; //as_double("bop_par_0");
system.m_bop_par_1 = bop_array[3]; //as_double("bop_par_1");
system.m_bop_par_2 = bop_array[4]; //as_double("bop_par_2");
system.m_is_field_freeze_protection_electric = false;
// *****************************************************
// System dispatch
// Dispatch not available yet for IPH (no signal to use to incentivize production)
csp_dispatch_opt dispatch;
dispatch.solver_params.dispatch_optimize = false;
// Instantiate Solver
C_csp_solver csp_solver(weather_reader,
c_trough,
c_heat_sink,
storage,
tou,
dispatch,
system,
NULL,
nullptr,
ssc_cmod_update,
(void*)(this));
// Set solver reporting outputs
csp_solver.mc_reported_outputs.assign(C_csp_solver::C_solver_outputs::TIME_FINAL, allocate("time_hr", n_steps_fixed), n_steps_fixed);
csp_solver.mc_reported_outputs.assign(C_csp_solver::C_solver_outputs::MONTH, allocate("month", n_steps_fixed), n_steps_fixed);
csp_solver.mc_reported_outputs.assign(C_csp_solver::C_solver_outputs::HOUR_DAY, allocate("hour_day", n_steps_fixed), n_steps_fixed);
csp_solver.mc_reported_outputs.assign(C_csp_solver::C_solver_outputs::SOLAZ, allocate("solazi", n_steps_fixed), n_steps_fixed);
csp_solver.mc_reported_outputs.assign(C_csp_solver::C_solver_outputs::SOLZEN, allocate("solzen", n_steps_fixed), n_steps_fixed);
csp_solver.mc_reported_outputs.assign(C_csp_solver::C_solver_outputs::BEAM, allocate("beam", n_steps_fixed), n_steps_fixed);
csp_solver.mc_reported_outputs.assign(C_csp_solver::C_solver_outputs::TDRY, allocate("tdry", n_steps_fixed), n_steps_fixed);
csp_solver.mc_reported_outputs.assign(C_csp_solver::C_solver_outputs::TWET, allocate("twet", n_steps_fixed), n_steps_fixed);
csp_solver.mc_reported_outputs.assign(C_csp_solver::C_solver_outputs::WSPD, allocate("wspd", n_steps_fixed), n_steps_fixed);
csp_solver.mc_reported_outputs.assign(C_csp_solver::C_solver_outputs::PRES, allocate("pres", n_steps_fixed), n_steps_fixed);
csp_solver.mc_reported_outputs.assign(C_csp_solver::C_solver_outputs::TES_Q_DOT_DC, allocate("q_dc_tes", n_steps_fixed), n_steps_fixed);
csp_solver.mc_reported_outputs.assign(C_csp_solver::C_solver_outputs::TES_Q_DOT_CH, allocate("q_ch_tes", n_steps_fixed), n_steps_fixed);
csp_solver.mc_reported_outputs.assign(C_csp_solver::C_solver_outputs::TES_E_CH_STATE, allocate("e_ch_tes", n_steps_fixed), n_steps_fixed);
csp_solver.mc_reported_outputs.assign(C_csp_solver::C_solver_outputs::M_DOT_CR_TO_TES_HOT, allocate("m_dot_cr_to_tes_hot", n_steps_fixed), n_steps_fixed);
csp_solver.mc_reported_outputs.assign(C_csp_solver::C_solver_outputs::M_DOT_TES_HOT_OUT, allocate("m_dot_tes_hot_out", n_steps_fixed), n_steps_fixed);
csp_solver.mc_reported_outputs.assign(C_csp_solver::C_solver_outputs::M_DOT_PC_TO_TES_COLD, allocate("m_dot_pc_to_tes_cold", n_steps_fixed), n_steps_fixed);
csp_solver.mc_reported_outputs.assign(C_csp_solver::C_solver_outputs::M_DOT_TES_COLD_OUT, allocate("m_dot_tes_cold_out", n_steps_fixed), n_steps_fixed);
csp_solver.mc_reported_outputs.assign(C_csp_solver::C_solver_outputs::M_DOT_FIELD_TO_CYCLE, allocate("m_dot_field_to_cycle", n_steps_fixed), n_steps_fixed);
csp_solver.mc_reported_outputs.assign(C_csp_solver::C_solver_outputs::M_DOT_CYCLE_TO_FIELD, allocate("m_dot_cycle_to_field", n_steps_fixed), n_steps_fixed);
//csp_solver.mc_reported_outputs.assign(C_csp_solver::C_solver_outputs::TES_M_DOT_DC, allocate("m_dot_tes_dc", n_steps_fixed), n_steps_fixed);
//csp_solver.mc_reported_outputs.assign(C_csp_solver::C_solver_outputs::TES_M_DOT_CH, allocate("m_dot_tes_ch", n_steps_fixed), n_steps_fixed);
csp_solver.mc_reported_outputs.assign(C_csp_solver::C_solver_outputs::W_DOT_NET, allocate("W_dot_parasitic_tot", n_steps_fixed), n_steps_fixed);
csp_solver.mc_reported_outputs.assign(C_csp_solver::C_solver_outputs::OP_MODE_1, allocate("op_mode_1", n_steps_fixed), n_steps_fixed);
csp_solver.mc_reported_outputs.assign(C_csp_solver::C_solver_outputs::OP_MODE_2, allocate("op_mode_2", n_steps_fixed), n_steps_fixed);
csp_solver.mc_reported_outputs.assign(C_csp_solver::C_solver_outputs::OP_MODE_3, allocate("op_mode_3", n_steps_fixed), n_steps_fixed);
csp_solver.mc_reported_outputs.assign(C_csp_solver::C_solver_outputs::ERR_M_DOT, allocate("m_dot_balance", n_steps_fixed), n_steps_fixed);
csp_solver.mc_reported_outputs.assign(C_csp_solver::C_solver_outputs::ERR_Q_DOT, allocate("q_balance", n_steps_fixed), n_steps_fixed);
int out_type = -1;
std::string out_msg = "";
try
{
// Initialize Solver
csp_solver.init();
}
catch( C_csp_exception &csp_exception )
{
// Report warning before exiting with error
while( csp_solver.mc_csp_messages.get_message(&out_type, &out_msg) )
{
log(out_msg, out_type);
}
throw exec_error("trough_physical_iph", csp_exception.m_error_message);
}
// If no exception, then report messages
while (csp_solver.mc_csp_messages.get_message(&out_type, &out_msg))
{
log(out_msg, out_type);
}
try
{
// Simulate !
csp_solver.Ssimulate(sim_setup);
}
catch( C_csp_exception &csp_exception )
{
// Report warning before exiting with error
while( csp_solver.mc_csp_messages.get_message(&out_type, &out_msg) )
{
log(out_msg);
}
throw exec_error("trough_physical_iph", csp_exception.m_error_message);
}
// If no exception, then report messages
while( csp_solver.mc_csp_messages.get_message(&out_type, &out_msg) )
{
log(out_msg, out_type);
}
assign("solar_multiple_actual", as_double("solar_mult")); // calculated during verify() using cmod_csp_trough_eqns.cpp
size_t count;
ssc_number_t *p_time_final_hr = as_array("time_hr", &count);
if(count != n_steps_fixed)
throw exec_error("trough_physical_iph", "The number of fixed steps does not match the length of output data arrays");
ssc_number_t *p_q_dot_heat_sink = as_array("q_dot_to_heat_sink", &count);
if(count != n_steps_fixed)
throw exec_error("trough_physical_iph", "The number of fixed steps does not match the length of output data arrays");
// 'adjustment_factors' class stores factors in hourly array, so need to index as such
adjustment_factors haf(this, "adjust");
if( !haf.setup(n_steps_fixed) )
throw exec_error("trough_physical_iph", "failed to setup adjustment factors: " + haf.error());
ssc_number_t *p_gen = allocate("gen", n_steps_fixed);
ssc_number_t *p_W_dot_par_tot_haf = allocate("W_dot_par_tot_haf", n_steps_fixed);
ssc_number_t *p_q_dot_defocus_est = allocate("q_dot_defocus_est", n_steps_fixed);
ssc_number_t *p_W_dot_parasitic_tot = as_array("W_dot_parasitic_tot", &count);
if (count != n_steps_fixed)
throw exec_error("trough_physical_iph", "The number of fixed steps does not match the length of output data arrays1");
ssc_number_t *p_SCAs_def = as_array("SCAs_def", &count);
if (count != n_steps_fixed)
throw exec_error("trough_physical_iph", "The number of fixed steps does not match the length of output data arrays2");
ssc_number_t *p_q_dot_htf_sf_out = as_array("q_dot_htf_sf_out", &count);
if (count != n_steps_fixed)
throw exec_error("trough_physical_iph", "The number of fixed steps does not match the length of output data arrays3");
//ssc_number_t *p_m_dot_tes_dc = as_array("m_dot_tes_dc", &count);
//if (count != n_steps_fixed)
// throw exec_error("trough_physical_iph", "The number of fixed steps for 'm_dot_tes_dc' does not match the length of output data arrays");
//
//ssc_number_t *p_m_dot_tes_ch = as_array("m_dot_tes_ch", &count);
//if (count != n_steps_fixed)
// throw exec_error("trough_physical_iph", "The number of fixed steps for 'm_dot_tes_ch' does not match the length of output data arrays");
for(size_t i = 0; i < n_steps_fixed; i++)
{
size_t hour = (size_t)ceil(p_time_final_hr[i]);
p_gen[i] = (ssc_number_t)(p_q_dot_heat_sink[i] * haf(hour) * 1.E3); //[kWt]
p_W_dot_parasitic_tot[i] *= -1.0; //[kWe] Label is total parasitics, so change to a positive value
p_W_dot_par_tot_haf[i] = (ssc_number_t)(p_W_dot_parasitic_tot[i] * haf(hour) * 1.E3); //[kWe]
p_q_dot_defocus_est[i] = (ssc_number_t)(1.0 - p_SCAs_def[i])*p_q_dot_htf_sf_out[i]; //[MWt]
//p_m_dot_tes_dc[i] = (ssc_number_t)(p_m_dot_tes_dc[i] / 3600.0); //[kg/s] convert from kg/hr
//p_m_dot_tes_ch[i] = (ssc_number_t)(p_m_dot_tes_ch[i] / 3600.0); //[kg/s] convert from kg/hr
}
// Monthly outputs
ssc_number_t* p_annual_energy_dist_time = gen_heatmap(this, steps_per_hour);