/
csp_solver_trough_collector_receiver.cpp
6705 lines (5623 loc) · 282 KB
/
csp_solver_trough_collector_receiver.cpp
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 Sustainable Energy, 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.
*/
#include <math.h>
#include "csp_solver_trough_collector_receiver.h"
#include "tcstype.h"
#include "sam_csp_util.h"
#include "interconnect.h"
#include "Toolbox.h"
using namespace std;
static C_csp_reported_outputs::S_output_info S_output_info[] =
{
{C_csp_trough_collector_receiver::E_THETA_AVE, C_csp_reported_outputs::TS_WEIGHTED_AVE},
{C_csp_trough_collector_receiver::E_COSTH_AVE, C_csp_reported_outputs::TS_WEIGHTED_AVE},
{C_csp_trough_collector_receiver::E_IAM_AVE, C_csp_reported_outputs::TS_WEIGHTED_AVE},
{C_csp_trough_collector_receiver::E_ROWSHADOW_AVE, C_csp_reported_outputs::TS_WEIGHTED_AVE},
{C_csp_trough_collector_receiver::E_ENDLOSS_AVE, C_csp_reported_outputs::TS_WEIGHTED_AVE},
{C_csp_trough_collector_receiver::E_DNI_COSTH, C_csp_reported_outputs::TS_WEIGHTED_AVE},
{C_csp_trough_collector_receiver::E_EQUIV_OPT_ETA_TOT, C_csp_reported_outputs::TS_WEIGHTED_AVE},
{C_csp_trough_collector_receiver::E_DEFOCUS, C_csp_reported_outputs::TS_WEIGHTED_AVE},
{C_csp_trough_collector_receiver::E_Q_DOT_INC_SF_TOT, C_csp_reported_outputs::TS_WEIGHTED_AVE},
{C_csp_trough_collector_receiver::E_Q_DOT_INC_SF_COSTH, C_csp_reported_outputs::TS_WEIGHTED_AVE},
{C_csp_trough_collector_receiver::E_Q_DOT_REC_INC, C_csp_reported_outputs::TS_WEIGHTED_AVE},
{C_csp_trough_collector_receiver::E_Q_DOT_REC_THERMAL_LOSS, C_csp_reported_outputs::TS_WEIGHTED_AVE},
{C_csp_trough_collector_receiver::E_Q_DOT_REC_ABS, C_csp_reported_outputs::TS_WEIGHTED_AVE},
{C_csp_trough_collector_receiver::E_Q_DOT_PIPING_LOSS, C_csp_reported_outputs::TS_WEIGHTED_AVE},
{C_csp_trough_collector_receiver::E_E_DOT_INTERNAL_ENERGY, C_csp_reported_outputs::TS_WEIGHTED_AVE},
{C_csp_trough_collector_receiver::E_Q_DOT_HTF_OUT, C_csp_reported_outputs::TS_WEIGHTED_AVE},
{C_csp_trough_collector_receiver::E_Q_DOT_FREEZE_PROT, C_csp_reported_outputs::TS_WEIGHTED_AVE},
{C_csp_trough_collector_receiver::E_M_DOT_LOOP, C_csp_reported_outputs::TS_WEIGHTED_AVE},
{C_csp_trough_collector_receiver::E_IS_RECIRCULATING, C_csp_reported_outputs::TS_WEIGHTED_AVE},
{C_csp_trough_collector_receiver::E_M_DOT_FIELD_RECIRC, C_csp_reported_outputs::TS_WEIGHTED_AVE},
{C_csp_trough_collector_receiver::E_M_DOT_FIELD_DELIVERED, C_csp_reported_outputs::TS_WEIGHTED_AVE},
{C_csp_trough_collector_receiver::E_T_FIELD_COLD_IN, C_csp_reported_outputs::TS_WEIGHTED_AVE},
{C_csp_trough_collector_receiver::E_T_REC_COLD_IN, C_csp_reported_outputs::TS_WEIGHTED_AVE},
{C_csp_trough_collector_receiver::E_T_REC_HOT_OUT, C_csp_reported_outputs::TS_WEIGHTED_AVE},
{C_csp_trough_collector_receiver::E_T_FIELD_HOT_OUT, C_csp_reported_outputs::TS_WEIGHTED_AVE},
{C_csp_trough_collector_receiver::E_PRESSURE_DROP, C_csp_reported_outputs::TS_WEIGHTED_AVE},
{C_csp_trough_collector_receiver::E_W_DOT_SCA_TRACK, C_csp_reported_outputs::TS_WEIGHTED_AVE},
{C_csp_trough_collector_receiver::E_W_DOT_PUMP, C_csp_reported_outputs::TS_WEIGHTED_AVE},
csp_info_invalid
};
C_csp_trough_collector_receiver::C_csp_trough_collector_receiver()
{
mc_reported_outputs.construct(S_output_info);
// Set maximum timestep from parent class member data
m_max_step = 60.0*60.0; //[s]: [m] * [s/m]
m_step_recirc = 10.0*60.0; //[s]
//Commonly used values, conversions, etc...
m_r2d = 180. / CSP::pi;
m_d2r = CSP::pi / 180.;
m_mtoinch = 39.3700787; //[m] -> [in]
m_T_htf_prop_min = 275.0; //[K]
m_W_dot_sca_tracking_nom = std::numeric_limits<double>::quiet_NaN();
// set initial values for all parameters to prevent possible misuse
m_nSCA = -1;
m_nHCEt = -1;
m_nColt = -1;
m_nHCEVar = -1;
m_nLoops = -1;
m_FieldConfig = -1;
m_include_fixed_power_block_runner = true;
m_L_power_block_piping = std::numeric_limits<double>::quiet_NaN();
m_eta_pump = std::numeric_limits<double>::quiet_NaN();
m_HDR_rough = std::numeric_limits<double>::quiet_NaN();
m_theta_stow = std::numeric_limits<double>::quiet_NaN();
m_theta_dep = std::numeric_limits<double>::quiet_NaN();
m_Row_Distance = std::numeric_limits<double>::quiet_NaN();
m_T_startup = std::numeric_limits<double>::quiet_NaN();
m_m_dot_htfmin = std::numeric_limits<double>::quiet_NaN();
m_m_dot_htfmax = std::numeric_limits<double>::quiet_NaN();
m_T_loop_in_des = std::numeric_limits<double>::quiet_NaN();
m_T_loop_out_des = std::numeric_limits<double>::quiet_NaN();
m_Fluid = -1;
m_m_dot_design = std::numeric_limits<double>::quiet_NaN();
m_m_dot_loop_des = std::numeric_limits<double>::quiet_NaN();
m_T_fp = std::numeric_limits<double>::quiet_NaN();
m_I_bn_des = std::numeric_limits<double>::quiet_NaN();
m_V_hdr_cold_max = std::numeric_limits<double>::quiet_NaN();
m_V_hdr_cold_min = std::numeric_limits<double>::quiet_NaN();
m_V_hdr_hot_max = std::numeric_limits<double>::quiet_NaN();
m_V_hdr_hot_min = std::numeric_limits<double>::quiet_NaN();
m_V_hdr_max = std::numeric_limits<double>::quiet_NaN();
m_V_hdr_min = std::numeric_limits<double>::quiet_NaN();
m_Pipe_hl_coef = std::numeric_limits<double>::quiet_NaN();
m_SCA_drives_elec = std::numeric_limits<double>::quiet_NaN();
m_fthrok = -1;
m_fthrctrl = -1;
m_ColTilt = std::numeric_limits<double>::quiet_NaN();
m_ColAz = std::numeric_limits<double>::quiet_NaN();
m_wind_stow_speed = std::numeric_limits<double>::quiet_NaN();
m_accept_mode = -1;
m_accept_init = false;
m_accept_loc = -1;
m_is_using_input_gen = false;
m_custom_sf_pipe_sizes = false;
m_solar_mult = std::numeric_limits<double>::quiet_NaN();
m_mc_bal_hot = std::numeric_limits<double>::quiet_NaN();
m_mc_bal_cold = std::numeric_limits<double>::quiet_NaN();
m_mc_bal_hot_per_MW = std::numeric_limits<double>::quiet_NaN();
m_mc_bal_cold_per_MW = std::numeric_limits<double>::quiet_NaN();
m_mc_bal_sca = std::numeric_limits<double>::quiet_NaN();
m_defocus = std::numeric_limits<double>::quiet_NaN();
m_latitude = std::numeric_limits<double>::quiet_NaN();
m_longitude = std::numeric_limits<double>::quiet_NaN();
m_TCS_T_sys_h = std::numeric_limits<double>::quiet_NaN();
m_TCS_T_sys_c = std::numeric_limits<double>::quiet_NaN();
m_TCS_T_sys_h_converged = std::numeric_limits<double>::quiet_NaN();
m_TCS_T_sys_c_converged = std::numeric_limits<double>::quiet_NaN();
// ************************************************************************
// CSP Solver Temperature Tracking
// Temperatures from the most recent converged() operation
m_T_sys_c_t_end_converged = std::numeric_limits<double>::quiet_NaN(); //[K]
m_T_sys_h_t_end_converged = std::numeric_limits<double>::quiet_NaN(); //[K]
// Temperatures from the most recent timstep (in the event that a method solves multiple, shorter timesteps
m_T_sys_c_t_end_last = std::numeric_limits<double>::quiet_NaN(); //[K] Temperature (bulk) of cold runners & headers at end of previous timestep
m_T_sys_h_t_end_last = std::numeric_limits<double>::quiet_NaN(); //[K]
// Latest temperature solved during present call to this class
m_T_sys_c_t_end = std::numeric_limits<double>::quiet_NaN(); //[K]
m_T_sys_c_t_int = std::numeric_limits<double>::quiet_NaN(); //[K]
m_T_sys_h_t_end = std::numeric_limits<double>::quiet_NaN(); //[K]
m_T_sys_h_t_int = std::numeric_limits<double>::quiet_NaN(); //[K]
m_Q_field_losses_total_subts = std::numeric_limits<double>::quiet_NaN(); //[MJ]
m_c_htf_ave_ts_ave_temp = std::numeric_limits<double>::quiet_NaN(); //[J/kg-K]
m_q_dot_sca_loss_summed_subts = std::numeric_limits<double>::quiet_NaN(); //[MWt]
m_q_dot_sca_abs_summed_subts = std::numeric_limits<double>::quiet_NaN(); //[MWt]
m_q_dot_sca_refl_summed_subts = std::numeric_limits<double>::quiet_NaN(); //[MWt]
m_q_dot_xover_loss_summed_subts = std::numeric_limits<double>::quiet_NaN(); //[MWt]
m_q_dot_HR_cold_loss_subts = std::numeric_limits<double>::quiet_NaN(); //[MWt]
m_q_dot_HR_hot_loss_subts = std::numeric_limits<double>::quiet_NaN(); //[MWt]
m_E_dot_sca_summed_subts = std::numeric_limits<double>::quiet_NaN(); //[MWt]
m_E_dot_xover_summed_subts = std::numeric_limits<double>::quiet_NaN(); //[MWt]
m_E_dot_HR_cold_subts = std::numeric_limits<double>::quiet_NaN(); //[MWt]
m_E_dot_HR_hot_subts = std::numeric_limits<double>::quiet_NaN(); //[MWt]
m_q_dot_htf_to_sink_subts = std::numeric_limits<double>::quiet_NaN(); //[MWt]
// ************************************************************************
// ************************************************************************
// Full Timestep Outputs
m_T_sys_c_t_int_fullts = std::numeric_limits<double>::quiet_NaN(); //[K]
m_T_htf_c_rec_in_t_int_fullts = std::numeric_limits<double>::quiet_NaN(); //[K]
m_T_htf_h_rec_out_t_int_fullts = std::numeric_limits<double>::quiet_NaN(); //[K]
m_T_sys_h_t_int_fullts = std::numeric_limits<double>::quiet_NaN(); //[K]
m_q_dot_sca_loss_summed_fullts = std::numeric_limits<double>::quiet_NaN(); //[MWt]
m_q_dot_sca_abs_summed_fullts = std::numeric_limits<double>::quiet_NaN(); //[MWt]
m_q_dot_sca_refl_summed_fullts = std::numeric_limits<double>::quiet_NaN(); //[MWt]
m_q_dot_xover_loss_summed_fullts = std::numeric_limits<double>::quiet_NaN(); //[MWt]
m_q_dot_HR_cold_loss_fullts = std::numeric_limits<double>::quiet_NaN(); //[MWt]
m_q_dot_HR_hot_loss_fullts = std::numeric_limits<double>::quiet_NaN(); //[MWt]
m_E_dot_sca_summed_fullts = std::numeric_limits<double>::quiet_NaN(); //[MWt]
m_E_dot_xover_summed_fullts = std::numeric_limits<double>::quiet_NaN(); //[MWt]
m_E_dot_HR_cold_fullts = std::numeric_limits<double>::quiet_NaN(); //[MWt]
m_E_dot_HR_hot_fullts = std::numeric_limits<double>::quiet_NaN(); //[MWt]
m_q_dot_htf_to_sink_fullts = std::numeric_limits<double>::quiet_NaN(); //[MWt]
m_q_dot_freeze_protection = std::numeric_limits<double>::quiet_NaN(); //[MWt]
m_dP_total = std::numeric_limits<double>::quiet_NaN(); //[bar]
m_W_dot_pump = std::numeric_limits<double>::quiet_NaN(); //[MWe]
m_is_m_dot_recirc = false;
m_W_dot_sca_tracking = std::numeric_limits<double>::quiet_NaN(); //[MWe]
m_EqOpteff = std::numeric_limits<double>::quiet_NaN();
m_m_dot_htf_tot = std::numeric_limits<double>::quiet_NaN();
m_Theta_ave = std::numeric_limits<double>::quiet_NaN();
m_CosTh_ave = std::numeric_limits<double>::quiet_NaN();
m_IAM_ave = std::numeric_limits<double>::quiet_NaN();
m_RowShadow_ave = std::numeric_limits<double>::quiet_NaN();
m_EndLoss_ave = std::numeric_limits<double>::quiet_NaN();
m_dni_costh = std::numeric_limits<double>::quiet_NaN();
m_c_htf_ave = std::numeric_limits<double>::quiet_NaN();
m_control_defocus = std::numeric_limits<double>::quiet_NaN();
m_component_defocus = std::numeric_limits<double>::quiet_NaN();
m_q_dot_inc_sf_tot = std::numeric_limits<double>::quiet_NaN();
for (int i = 0; i < 5; i++)
m_T_save[i] = std::numeric_limits<double>::quiet_NaN();
mv_reguess_args.resize(3);
std::fill(mv_reguess_args.begin(), mv_reguess_args.end(), std::numeric_limits<double>::quiet_NaN());
m_AnnulusGasMat.fill(NULL);
m_AbsorberPropMat.fill(NULL);
}
C_csp_trough_collector_receiver::~C_csp_trough_collector_receiver()
{
for(int i=0; i<m_AbsorberPropMat.nrows(); i++){
for(int j=0; j<m_AbsorberPropMat.ncols(); j++){
delete m_AbsorberPropMat(i,j);
delete m_AnnulusGasMat(i,j);
}
}
}
void C_csp_trough_collector_receiver::init(const C_csp_collector_receiver::S_csp_cr_init_inputs init_inputs,
C_csp_collector_receiver::S_csp_cr_solved_params & solved_params)
{
// If solar multiple is not yet calculated
if (m_is_solar_mult_designed == false)
this->design_solar_mult();
// double some_calc = m_nSCA + m_nHCEt;
/*
--Initialization call--
Do any setup required here.
Get the values of the inputs and parameters
*/
//Initialize air properties -- used in reeiver calcs
m_airProps.SetFluid(HTFProperties::Air);
// Save init_inputs to member data
m_latitude = init_inputs.m_latitude; //[deg]
m_longitude = init_inputs.m_longitude; //[deg]
m_shift = init_inputs.m_shift; //[deg]
m_latitude *= m_d2r; //[rad] convert from [deg]
m_longitude *= m_d2r; //[rad] convert from [deg]
m_shift *= m_d2r; //[rad] convert from [deg]
m_P_field_in = 17 / 1.e-5; //Assumed inlet htf pressure for property lookups (DP_tot_max = 16 bar + 1 atm) [Pa]
// Adjust parameters
m_ColTilt = m_ColTilt*m_d2r; //[rad] Collector tilt angle (0 is horizontal, 90deg is vertical), convert from [deg]
m_ColAz = m_ColAz*m_d2r; //[rad] Collector azimuth angle, convert from [deg]
// Check m_IAM matrix against number of collectors: m_nColt
m_n_r_iam_matrix = (int)m_IAM_matrix.nrows();
m_n_c_iam_matrix = (int)m_IAM_matrix.ncols();
if (m_n_c_iam_matrix < 3)
{
throw(C_csp_exception("There must be at least 3 incident angle modifier coefficients", "Trough collector solver"));
}
if (m_n_r_iam_matrix < m_nColt)
{
m_error_msg = util::format("The number of groups of m_IAM coefficients (%d) is less than the number of collector types in this simulation (%d)", m_n_r_iam_matrix, m_nColt);
throw(C_csp_exception(m_error_msg, "Trough collector solver"));
}
// Check that for each collector, at least 3 coefficients are != 0.0
for (int i = 0; i < m_nColt; i++)
{
for (int j = 0; j < 3; j++)
{
if (m_IAM_matrix(i, j) == 0.0)
{
m_error_msg = util::format("For %d collectors and groups of m_IAM coefficients, each group of m_IAM coefficients must begin with at least 3 non-zero values. There are only %d non-zero coefficients for collector %d", m_nColt, j, i + 1);
throw(C_csp_exception(m_error_msg, "Trough collector solver"));
//message(TCS_ERROR, "For %d collectors and groups of m_IAM coefficients, each group of m_IAM coefficients must begin with at least 3 non-zero values. There are only %d non-zero coefficients for collector %d", m_nColt, j, i + 1);
//return -1;
}
}
}
// ******************************************************************
//Organize the emittance tables here
m_epsilon_3.init(4, 4);
m_epsilon_3.addTable(&m_epsilon_3_11); //HCE #1
m_epsilon_3.addTable(&m_epsilon_3_12);
m_epsilon_3.addTable(&m_epsilon_3_13);
m_epsilon_3.addTable(&m_epsilon_3_14);
m_epsilon_3.addTable(&m_epsilon_3_21); //HCE #2
m_epsilon_3.addTable(&m_epsilon_3_22);
m_epsilon_3.addTable(&m_epsilon_3_23);
m_epsilon_3.addTable(&m_epsilon_3_24);
m_epsilon_3.addTable(&m_epsilon_3_31); //HCE #3
m_epsilon_3.addTable(&m_epsilon_3_32);
m_epsilon_3.addTable(&m_epsilon_3_33);
m_epsilon_3.addTable(&m_epsilon_3_34);
m_epsilon_3.addTable(&m_epsilon_3_41); //HCE #4
m_epsilon_3.addTable(&m_epsilon_3_42);
m_epsilon_3.addTable(&m_epsilon_3_43);
m_epsilon_3.addTable(&m_epsilon_3_44);
//Unit conversions
m_theta_stow *= m_d2r;
m_theta_stow = max(m_theta_stow, 1.e-6);
m_theta_dep *= m_d2r;
m_theta_dep = max(m_theta_dep, 1.e-6);
m_T_startup += 273.15; //[K] convert from C
m_T_loop_in_des += 273.15; //[K] convert from C
m_T_loop_out_des += 273.15; //[K] convert from C
m_T_fp += 273.15; //[K] convert from C
m_mc_bal_sca *= 3.6e3; //[Wht/K-m] -> [J/K-m]
/*--- Do any initialization calculations here ---- */
//Allocate space for the loop simulation objects
m_TCS_T_htf_in.resize(m_nSCA);
m_TCS_T_htf_out.resize(m_nSCA);
m_TCS_T_htf_ave.resize(m_nSCA);
m_q_loss.resize(m_nHCEVar);
m_q_abs.resize(m_nHCEVar);
m_DP_tube.resize(m_nSCA);
m_E_int_loop.resize(m_nSCA);
m_E_accum.resize(m_nSCA);
m_E_avail.resize(m_nSCA);
m_q_loss_SCAtot.resize(m_nSCA);
m_q_abs_SCAtot.resize(m_nSCA);
m_q_SCA.resize(m_nSCA);
m_q_SCA_control_df.resize(m_nSCA);
m_q_1abs_tot.resize(m_nSCA);
m_q_1abs.resize(m_nHCEVar);
m_q_reflect_tot.resize(m_nSCA);
m_q_reflect.resize(m_nHCEVar);
m_q_i.resize(m_nColt);
m_IAM.resize(m_nColt);
m_ColOptEff.resize(m_nColt, m_nSCA);
m_EndGain.resize(m_nColt, m_nSCA);
m_EndLoss.resize(m_nColt, m_nSCA);
m_RowShadow.resize(m_nColt);
//Allocate space for transient variables
m_TCS_T_htf_ave_last.resize(m_nSCA);
m_TCS_T_htf_ave_converged.resize(m_nSCA);
// Resize CSP Solver Temp Tracking Vectors
m_T_htf_out_t_end_converged.resize(m_nSCA);
m_T_htf_out_t_end_last.resize(m_nSCA);
m_T_htf_in_t_int.resize(m_nSCA);
m_T_htf_out_t_end.resize(m_nSCA);
m_T_htf_out_t_int.resize(m_nSCA);
// Initialize interconnects
m_interconnects.reserve(m_K_cpnt.nrows()); // m_K_cpnt.nrows() = number of interconnects
m_rough_cpnt.resize(m_K_cpnt.nrows(), m_K_cpnt.ncols());
m_u_cpnt.resize_fill(m_K_cpnt.nrows(), m_K_cpnt.ncols(), m_Pipe_hl_coef);
m_mc_cpnt.resize(m_K_cpnt.nrows(), m_K_cpnt.ncols());
for (std::size_t i = 0; i < m_mc_cpnt.ncells(); i++) {
m_mc_cpnt[i] = m_mc_bal_sca * m_L_cpnt[i];
m_rough_cpnt[i] = m_HDR_rough / m_D_cpnt[i];
}
for (std::size_t i = 0; i < m_K_cpnt.nrows(); i++) {
m_interconnects.push_back(interconnect(&m_htfProps, m_K_cpnt.row(i).data(), m_D_cpnt.row(i).data(), m_L_cpnt.row(i).data(),
m_rough_cpnt.row(i).data(), m_u_cpnt.row(i).data(), m_mc_cpnt.row(i).data(), m_Type_cpnt.row(i).data(), m_K_cpnt.ncols()));
}
// **************************************
//Set up annulus gas and absorber property matrices
m_AnnulusGasMat.resize(m_nHCEt, m_nHCEVar);
m_AbsorberPropMat.resize(m_nHCEt, m_nHCEVar);
for (int i = 0; i<m_nHCEt; i++){
for (int j = 0; j<m_nHCEVar; j++){
//Set up a matrix of annulus gas properties
m_AnnulusGasMat.at(i, j) = new HTFProperties();
m_AnnulusGasMat.at(i, j)->SetFluid((int)m_AnnulusGas.at(i, j));
//Set up a matrix of absorber prop materials
m_AbsorberPropMat(i, j) = new AbsorberProps();
m_AbsorberPropMat(i, j)->setMaterial((int)m_AbsorberMaterial.at(i, j));
}
}
//Initialize values
m_defocus_old = 0.;
m_ncall = -1;
// for test start
init_fieldgeom();
// for test end
// Calculate tracking parasitics for when trough is on sun
m_W_dot_sca_tracking_nom = m_SCA_drives_elec*(double)(m_nSCA*m_nLoops)/1.E6; //[MWe]
// Set solved parameters
solved_params.m_T_htf_cold_des = m_T_loop_in_des; //[K]
solved_params.m_q_dot_rec_des = m_q_design_actual/1.E6; //[MWt]
solved_params.m_A_aper_total = m_Ap_tot; //[m^2]
// Calculate other design parameters
if (m_calc_design_pipe_vals == true) {
// Save original settings
int accept_mode_orig = m_accept_mode;
bool accept_init_orig = m_accept_init;
int accept_loc_orig = m_accept_loc;
bool is_using_input_gen_orig = m_is_using_input_gen;
m_accept_mode = 1; // flag so solar zenith from weather is used instead of calc'd
m_accept_init = false; // running at steady-state but keeping false to avoid side effects
m_accept_loc = 1; // don't just model a single loop
m_is_using_input_gen = false; // use parameter values set below instead
C_csp_weatherreader::S_outputs weatherValues;
weatherValues.m_lat = init_inputs.m_latitude;
weatherValues.m_lon = init_inputs.m_longitude;
weatherValues.m_tz = init_inputs.m_tz;
weatherValues.m_shift = init_inputs.m_shift;
weatherValues.m_elev = init_inputs.m_elev;
weatherValues.m_year = 2009;
weatherValues.m_month = 6;
weatherValues.m_day = 21;
weatherValues.m_hour = 12;
weatherValues.m_minute = 0;
weatherValues.m_beam = m_I_bn_des;
weatherValues.m_tdry = 30;
weatherValues.m_tdew = 30 - 10;
weatherValues.m_wspd = 5;
weatherValues.m_pres = 1013;
weatherValues.m_solazi = m_ColAz;
weatherValues.m_solzen = m_ColTilt;
C_csp_solver_htf_1state htfInletState;
//htfInletState.m_m_dot = m_m_dot_design;
//htfInletState.m_pres = 101.3;
//htfInletState.m_qual = 0;
htfInletState.m_temp = m_T_loop_in_des - 273.15;
double defocus = 1;
C_csp_solver_sim_info troughInfo;
troughInfo.ms_ts.m_time_start = 14817600.;
troughInfo.ms_ts.m_step = 5.*60.; // 5-minute timesteps
troughInfo.ms_ts.m_time = troughInfo.ms_ts.m_time_start + troughInfo.ms_ts.m_step;
troughInfo.m_tou = 1.;
C_csp_collector_receiver::S_csp_cr_out_solver troughOutputs;
steady_state(weatherValues, htfInletState, std::numeric_limits<double>::quiet_NaN(), defocus, troughOutputs, troughInfo);
solved_params.m_T_htf_hot_des = m_T_field_out;
solved_params.m_dP_sf = troughOutputs.m_dP_sf;
// Restore original settings
m_accept_mode = accept_mode_orig;
m_accept_init = accept_init_orig;
m_accept_loc = accept_loc_orig;
m_is_using_input_gen = is_using_input_gen_orig;
}
// Set previous operating mode
m_operating_mode_converged = C_csp_collector_receiver::OFF; //[-] 0 = requires startup, 1 = starting up, 2 = running
return;
}
bool C_csp_trough_collector_receiver::init_fieldgeom()
{
/*
Call this method once when call() is first invoked. The calculations require location information that
is provided by the weatherreader class and not set until after init() and before the first call().
*/
//Calculate the total field aperture area
m_Ap_tot = 0.;
for (int i = 0; i<m_nSCA; i++)
{
int ct = (int)m_SCAInfoArray.at(i, 1);
m_Ap_tot += m_A_aperture[ct - 1];
}
//Calculate the cross-sectional flow area of the receiver piping
m_D_h.resize(m_nHCEt, m_nHCEVar);
m_A_cs.resize(m_nHCEt, m_nHCEVar);
for (int i = 0; i < m_nHCEt; i++)
{
for (int j = 0; j < m_nHCEVar; j++)
{
if (m_Flow_type.at(i, j) == 2)
{
m_D_h.at(i, j) = m_D_2.at(i, j) - m_D_p.at(i, j);
}
else
{
m_D_h.at(i, j) = m_D_2.at(i, j);
m_D_p.at(i, j) = 0.;
}
m_A_cs.at(i, j) = CSP::pi* (m_D_2.at(i, j)*m_D_2.at(i, j) - m_D_p.at(i, j)*m_D_p.at(i, j)) / 4.; //[m2] The cross-sectional flow area
}
}
m_Ap_tot *= float(m_nLoops);
//Calculate header diameters here based on min/max velocities
//output file with calculated header diameter "header_diam.out"
m_nfsec = m_FieldConfig; //MJW 1.12.11 allow the user to specify the number of field sections
//Check to make sure the number of field sections is an even number
if(m_nfsec % 2 != 0 && m_nfsec != 1)
{
m_error_msg = util::format("Number of field subsections must be an even number or 1");
throw(C_csp_exception(m_error_msg, "Trough collector solver"));
}
/*
The number of header sections (tee-conns.) per field section is equal to the total number of loops divided
by the number of distinct headers. Since two loops are connected to the same header section,
the total number of header sections is then divided by 2.
*/
m_nhdrsec = (int)ceil(float(m_nLoops) / float(m_nfsec * 2));
//the estimated mass flow rate at design
//tn 4.25.11 using m_Ap_tot instead of A_loop. Change location of m_opteff_des
// TMB 12.7.23 Calculated in design_solar_mult()
//m_m_dot_design = (m_Ap_tot*m_I_bn_des*m_opteff_des - loss_tot*float(m_nLoops)) / (m_c_htf_ave*(m_T_loop_out_des - m_T_loop_in_des));
double m_dot_max = m_m_dot_htfmax * m_nLoops;
double m_dot_min = m_m_dot_htfmin * m_nLoops;
m_q_design_ideal = m_m_dot_design * m_c_htf_ave * (m_T_loop_out_des - m_T_loop_in_des); //[Wt]
if (m_m_dot_design > m_dot_max) {
const char *msg = "The calculated field design mass flow rate of %.2f kg/s is greater than the maximum defined by the max single loop flow rate and number of loops (%.2f kg/s). "
"The design mass flow rate is reset to the latter.";
m_error_msg = util::format(msg, m_m_dot_design, m_dot_max);
mc_csp_messages.add_message(C_csp_messages::NOTICE, m_error_msg);
m_m_dot_design = m_dot_max;
}
else if (m_m_dot_design < m_dot_min) {
const char *msg = "The calculated field design mass flow rate of %.2f kg/s is less than the minimum defined by the min single loop flow rate and number of loops (%.2f kg/s). "
"The design mass flow rate is reset to the latter.";
m_error_msg = util::format(msg, m_m_dot_design, m_dot_min);
mc_csp_messages.add_message(C_csp_messages::NOTICE, m_error_msg);
m_m_dot_design = m_dot_min;
}
m_m_dot_loop_des = m_m_dot_design/(double)m_nLoops; //[kg/s]
//mjw 1.16.2011 Design field thermal power
//m_q_design = m_m_dot_design * m_c_htf_ave * (m_T_loop_out_des - m_T_loop_in_des); //[Wt]
m_q_design_actual = m_m_dot_design * m_c_htf_ave * (m_T_loop_out_des - m_T_loop_in_des); //[Wt]
//mjw 1.16.2011 Convert the thermal inertia terms here
m_mc_bal_hot = m_mc_bal_hot_per_MW * 3.6 * m_q_design_actual; //[J/K]
m_mc_bal_cold = m_mc_bal_cold_per_MW * 3.6 * m_q_design_actual; //[J/K]
//need to provide fluid density
double rho_cold = m_htfProps.dens(m_T_loop_in_des, 10.e5); //kg/m3
double rho_hot = m_htfProps.dens(m_T_loop_out_des, 10.e5); //kg/m3
double rho_ave = m_htfProps.dens((m_T_loop_out_des + m_T_loop_in_des) / 2.0, 10.e5); //kg/m3
//Calculate the header design
m_nrunsec = (int)floor(float(m_nfsec) / 4.0) + 1; //The number of unique runner diameters
m_D_runner.resize(2 * m_nrunsec);
m_WallThk_runner.resize(2 * m_nrunsec);
m_L_runner.resize(2 * m_nrunsec);
m_m_dot_rnr_dsn.resize(2 * m_nrunsec);
m_V_rnr_dsn.resize(2 * m_nrunsec);
m_N_rnr_xpans.resize(2 * m_nrunsec); //calculated number of expansion loops in the runner section
m_DP_rnr.resize(2 * m_nrunsec);
m_P_rnr.resize(2 * m_nrunsec);
m_T_rnr.resize(2 * m_nrunsec);
m_P_rnr_dsn = m_P_rnr;
m_T_rnr_dsn = m_T_rnr;
m_D_hdr.resize(2 * m_nhdrsec);
m_WallThk_hdr.resize(2 * m_nhdrsec);
m_L_hdr.resize(2 * m_nhdrsec);
m_N_hdr_xpans.resize(2 * m_nhdrsec);
m_m_dot_hdr_dsn.resize(2 * m_nhdrsec);
m_V_hdr_dsn.resize(2 * m_nhdrsec);
m_DP_hdr.resize(2 * m_nhdrsec);
m_P_hdr.resize(2 * m_nhdrsec);
m_T_hdr.resize(2 * m_nhdrsec);
m_P_hdr_dsn = m_P_hdr;
m_T_hdr_dsn = m_T_hdr;
m_DP_loop.resize(2 * m_nSCA + 3);
m_P_loop.resize(2 * m_nSCA + 3);
m_T_loop.resize(2 * m_nSCA + 3);
m_P_loop_dsn = m_P_loop;
m_T_loop_dsn = m_T_loop;
if (m_custom_sf_pipe_sizes) {
if (m_sf_rnr_diams.ncells() == 2 * m_nrunsec && m_sf_rnr_wallthicks.ncells() == 2 * m_nrunsec && m_sf_rnr_lengths.ncells() == 2 * m_nrunsec &&
m_sf_hdr_diams.ncells() == 2 * m_nhdrsec && m_sf_hdr_wallthicks.ncells() == 2 * m_nhdrsec && m_sf_hdr_lengths.ncells() == 2 * m_nhdrsec) {
m_D_runner.assign(m_sf_rnr_diams, m_sf_rnr_diams.ncells());
m_WallThk_runner.assign(m_sf_rnr_wallthicks, m_sf_rnr_wallthicks.ncells());
m_L_runner.assign(m_sf_rnr_lengths, m_sf_rnr_lengths.ncells());
m_D_hdr.assign(m_sf_hdr_diams, m_sf_hdr_diams.ncells());
m_WallThk_hdr.assign(m_sf_hdr_wallthicks, m_sf_hdr_wallthicks.ncells());
m_L_hdr.assign(m_sf_hdr_lengths, m_sf_hdr_lengths.ncells());
}
else {
throw(C_csp_exception("The number of custom solar field pipe sections is not correct.", "Trough collector solver"));
}
}
std::string summary;
// Use legacy m_V_hdr_max and/or m_V_hdr_min if you need to
if ((std::isnan(m_V_hdr_cold_max) || std::isnan(m_V_hdr_hot_max)) && !std::isnan(m_V_hdr_max)) {
m_V_hdr_cold_max = m_V_hdr_hot_max = m_V_hdr_max;
}
if ((std::isnan(m_V_hdr_cold_min) || std::isnan(m_V_hdr_hot_min)) && !std::isnan(m_V_hdr_min)) {
m_V_hdr_cold_min = m_V_hdr_hot_min = m_V_hdr_min;
}
rnr_and_hdr_design(m_nhdrsec, m_nfsec, m_nrunsec, rho_cold, rho_hot, m_V_hdr_cold_max, m_V_hdr_cold_min,
m_V_hdr_hot_max, m_V_hdr_hot_min, m_N_max_hdr_diams, m_m_dot_design, m_D_hdr, m_D_runner,
m_m_dot_rnr_dsn, m_m_dot_hdr_dsn, m_V_rnr_dsn, m_V_hdr_dsn, &summary, m_custom_sf_pipe_sizes);
mc_csp_messages.add_message(C_csp_messages::NOTICE, summary);
if (!m_custom_sf_pipe_sizes) {
// Calculate pipe wall thicknesses
for (int i = 0; i < m_D_runner.size(); i++) {
m_WallThk_runner[i] = CSP::WallThickness(m_D_runner[i]);
}
for (int i = 0; i < m_D_hdr.size(); i++) {
m_WallThk_hdr[i] = CSP::WallThickness(m_D_hdr[i]);
}
}
// Do one-time calculations for system geometry.
// Determine header section lengths, including expansion loops
if (size_hdr_lengths(m_Row_Distance, m_nhdrsec, m_offset_xpan_hdr, m_N_hdr_per_xpan, m_L_xpan_hdr, m_L_hdr, m_N_hdr_xpans, m_custom_sf_pipe_sizes)) {
throw(C_csp_exception("header length sizing failed", "Trough collector solver"));
}
// Determine runner section lengths, including expansion loops
if (size_rnr_lengths(m_nfsec, m_L_rnr_pb, m_nrunsec, m_SCAInfoArray.at(0, 1), m_northsouth_field_sep,
m_L_SCA, m_Min_rnr_xpans, m_Distance_SCA, m_nSCA, m_L_rnr_per_xpan, m_L_xpan_rnr, m_L_runner, m_N_rnr_xpans, m_custom_sf_pipe_sizes)) {
throw(C_csp_exception("runner length sizing failed", "Trough collector solver"));
}
double v_from_sgs = 0.0; double v_to_sgs = 0.0;
for (int i = 0; i < m_nrunsec; i++)
{
v_from_sgs = v_from_sgs + 2.*m_L_runner[i] * CSP::pi*pow(m_D_runner[i], 2) / 4.; // volume of the runner going away from sgs
v_to_sgs = v_to_sgs + 2.*m_L_runner[2 * m_nrunsec - i - 1] * CSP::pi*pow(m_D_runner[2 * m_nrunsec - i - 1], 2) / 4.; // ...and going to the sgs
}
//-------piping from header into and out of the HCE's
double v_loop_tot = 0.;
for (int j = 0; j < m_nHCEVar; j++)
{
for (int i = 0; i < m_nSCA; i++)
{
int CT = (int)m_SCAInfoArray.at(i, 1) - 1; //Collector type
int HT = (int)m_SCAInfoArray.at(i, 0) - 1; //HCE type
//v_loop_bal = v_loop_bal + m_Distance_SCA(CT)*m_A_cs(HT,j)*m_HCE_FieldFrac(HT,j)*float(m_nLoops)
v_loop_tot += (m_L_SCA[CT] + m_Distance_SCA[CT])*m_A_cs(HT, j)*m_HCE_FieldFrac(HT, j)*float(m_nLoops);
}
}
//mjw 1.13.2011 Add on volume for the crossover piping
//v_loop_tot = v_loop_tot + m_Row_Distance*m_A_cs(m_SCAInfoArray(m_nSCA/2,1),1)*float(m_nLoops)
v_loop_tot += m_Row_Distance*m_A_cs((int)m_SCAInfoArray(max(2, m_nSCA) / 2 - 1, 0), 0)*float(m_nLoops); //TN 6/20: need to solve for m_nSCA = 1
//-------field header loop
double v_header_cold = 0.0, v_header_hot = 0.0;
for (int i = 0; i < m_nhdrsec; i++)
{
//Also calculate the hot and cold header volume for later use. 4.25 is for header expansion bends
v_header_cold += CSP::pi*m_D_hdr[i] * m_D_hdr[i] / 4.*m_L_hdr[i]*float(m_nfsec);
v_header_hot += CSP::pi*m_D_hdr[i + m_nhdrsec] * m_D_hdr[i + m_nhdrsec] / 4.*m_L_hdr[i + m_nhdrsec]*float(m_nfsec);
}
//Add on inlet/outlet from the header to the loop. Assume header to loop inlet ~= 10 [m] (Kelley/Kearney)
v_header_cold += 20.*m_A_cs(0, 0)*float(m_nLoops);
v_header_hot += 20.*m_A_cs(0, 0)*float(m_nLoops);
//Calculate the HTF volume associated with pumps and the SGS
double v_sgs = Pump_SGS(rho_ave, m_m_dot_design, m_solar_mult);
//Calculate the hot and cold balance-of-plant volumes
m_v_hot = v_header_hot + v_to_sgs;
m_v_cold = v_header_cold + v_from_sgs;
//Write the volume totals to the piping diameter file
summary.clear();
summary.append("\n----------------------------------------------\n"
"Plant HTF volume information:\n"
"----------------------------------------------\n");
#ifdef _MSC_VER
#define MySnprintf _snprintf
#else
#define MySnprintf snprintf
#endif
#define TSTRLEN 512
char tstr[TSTRLEN];
MySnprintf(tstr, TSTRLEN,
"Cold header pipe volume: %10.4le m3\n"
"Hot header pipe volume: %10.4le m3\n"
"Volume per loop: %10.4le m3\n"
"Total volume in all loops: %10.4le m3\n"
"Total solar field volume: %10.4le m3\n"
"Pump / SGS system volume: %10.4le m3\n"
"---------------------------\n"
"Total plant HTF volume: %10.4le m3\n",
m_v_cold, m_v_hot, v_loop_tot / double(m_nLoops), v_loop_tot,
(m_v_hot + m_v_cold + v_loop_tot), v_sgs, (m_v_hot + m_v_cold + v_loop_tot + v_sgs));
summary.append(tstr);
mc_csp_messages.add_message(C_csp_messages::NOTICE, summary);
//Include the pump/SGS volume with the header
m_v_hot = m_v_hot + v_sgs / 2.;
m_v_cold = m_v_cold + v_sgs / 2.;
/* ----- Set initial storage values ------ */
double T_field_ini = 0.5*(m_T_fp + m_T_loop_in_des); //[K]
// TCS Temperature Tracking
m_TCS_T_sys_c_converged = m_TCS_T_sys_c_last = T_field_ini; //[K]
m_TCS_T_sys_h_converged = m_TCS_T_sys_h_last = T_field_ini; //[K]
//cc--> Note that stored(3) -> Iter is no longer used in the TRNSYS code. It is omitted here.
for (int i = 0; i < m_nSCA; i++)
{
m_TCS_T_htf_ave_converged[i] = m_TCS_T_htf_ave_last[i] = T_field_ini; //[K]
}
// *********************************************
// CSP Solver Temperature Tracking
m_T_sys_c_t_end_converged = m_T_sys_c_t_end_last = T_field_ini; //[K]
m_T_sys_h_t_end_converged = m_T_sys_h_t_end_last = T_field_ini; //[K]
for(int i = 0; i < m_nSCA; i++)
{
m_T_htf_out_t_end_converged[i] = m_T_htf_out_t_end_last[i] = T_field_ini; //[K]
}
// Calculate Design Point Outputs
double T_avg = 0.5 * (m_T_loop_in_des + m_T_loop_out_des);
m_field_htf_cp_avg_des = m_htfProps.Cp(T_avg + 273.15); //[kJ/kg-K]
// *********************************************
if (m_accept_init)
m_ss_init_complete = false;
else
m_ss_init_complete = true;
return true;
}
C_csp_collector_receiver::E_csp_cr_modes C_csp_trough_collector_receiver::get_operating_state()
{
return m_operating_mode_converged; //[-]
}
double C_csp_trough_collector_receiver::get_startup_time()
{
// Note: C_csp_trough_collector_receiver::startup() is called after this function
return m_rec_su_delay * 3600.; // sec
}
double C_csp_trough_collector_receiver::get_startup_energy()
{
// Note: C_csp_trough_collector_receiver::startup() is called after this function
return m_rec_qf_delay * m_q_design_actual * 1.e-6; // MWh
}
double C_csp_trough_collector_receiver::get_pumping_parasitic_coef()
{
double T_amb_des = 42. + 273.15;
double T_avg = (m_T_loop_in_des + m_T_loop_out_des) / 2.;
double P_field_in = m_P_rnr_dsn[1];
double dT_avg_SCA = (m_T_loop_out_des - m_T_loop_in_des) / m_nSCA;
std::vector<double> T_in_SCA, T_out_SCA;
for (size_t i = 0; i < m_nSCA; i++) {
T_in_SCA.push_back(m_T_loop_in_des + dT_avg_SCA * i);
T_out_SCA.push_back(m_T_loop_in_des + dT_avg_SCA * (i + 1));
}
double dP_field = field_pressure_drop(T_amb_des, m_m_dot_design, P_field_in, T_in_SCA, T_out_SCA);
return m_W_dot_pump / (m_q_design_actual * 1.e-6);
}
double C_csp_trough_collector_receiver::get_min_power_delivery()
{
double c_htf_ave = m_htfProps.Cp_ave(m_T_loop_in_des, m_T_startup) * 1000.; //[J/kg-K] Specific heat
return m_m_dot_htfmin * m_nLoops * c_htf_ave * (m_T_startup - m_T_loop_in_des) * 1.e-6; // [MWt]
}
double C_csp_trough_collector_receiver::get_max_power_delivery(double T_cold_in /*C*/)
{
double T_in = T_cold_in + 273.15; // [K]
double T_out = m_T_loop_out_des; // [K]
double c_htf_ave = m_htfProps.Cp_ave(T_in, T_out) * 1000.; // [J/kg-K]
return m_m_dot_htfmax * m_nLoops * c_htf_ave * (T_out - T_in) * 1.e-6; // [MWt]
}
double C_csp_trough_collector_receiver::get_tracking_power()
{
if (m_is_solar_mult_designed == false)
return std::numeric_limits<double>::quiet_NaN();
return m_SCA_drives_elec * 1.e-6 * m_nSCA * m_nLoops; //MWe
}
double C_csp_trough_collector_receiver::get_col_startup_power()
{
// Note: C_csp_trough_collector_receiver::startup() is called after this function
return m_p_start * 1.e-3 * m_nSCA * m_nLoops; //MWe-hr
}
void C_csp_trough_collector_receiver::get_design_parameters(C_csp_collector_receiver::S_csp_cr_solved_params & solved_params)
{
return;
}
int C_csp_trough_collector_receiver::loop_energy_balance_T_t_end(const C_csp_weatherreader::S_outputs &weather,
double T_htf_cold_in /*C*/, double m_dot_htf_loop /*kg/s*/,
const C_csp_solver_sim_info &sim_info)
{
if( m_accept_loc == 1 )
m_m_dot_htf_tot = m_dot_htf_loop*float(m_nLoops);
else
m_m_dot_htf_tot = m_dot_htf_loop;
// First calculate the cold header temperature, which will serve as the loop inlet temperature
double rho_hdr_cold = m_htfProps.dens(m_TCS_T_sys_c_last, 1.);
double rho_hdr_hot = m_htfProps.dens(m_TCS_T_sys_h_last, 1.);
double c_hdr_cold_last = m_htfProps.Cp(m_TCS_T_sys_c_last)*1000.0; //mjw 1.6.2011 Adding mc_bal to the cold header inertia
double T_db = weather.m_tdry + 273.15; //[K] Dry bulb temperature, convert from C
double T_dp = weather.m_twet + 273.15; //[K] Dew point temperature, convert from C
// Calculate effective sky temperature
double hour = fmod(sim_info.ms_ts.m_time / 3600.0, 24.0); //[hr] Hour of day
double T_sky; //[K] Effective sky temperature
if( T_dp > -300.0 )
T_sky = CSP::skytemp(T_db, T_dp, hour); //[K] Effective sky temperature
else
T_sky = T_db - 20.0;
Intc_hl = 0.0;
if( m_accept_loc == E_piping_config::FIELD )
{
m_TCS_T_sys_c = (m_TCS_T_sys_c_last - T_htf_cold_in)*exp(-(m_dot_htf_loop*float(m_nLoops)) / (m_v_cold*rho_hdr_cold + m_mc_bal_cold / c_hdr_cold_last)*sim_info.ms_ts.m_step) + T_htf_cold_in;
//Consider heat loss from cold piping
//Runner
m_Runner_hl_cold = 0.0;
m_Runner_hl_cold_tot = 0.0;
m_T_rnr[0] = m_TCS_T_sys_c;
m_c_hdr_cold = m_htfProps.Cp(m_TCS_T_sys_c)*1000.0; //mjw 1.6.2011 Adding mc_bal to the cold header inertia
for( int i = 0; i < m_nrunsec; i++ )
{
if (i != 0) {
m_T_rnr[i] = m_T_rnr[i - 1] - m_Runner_hl_cold / (m_dot_runner(m_m_dot_htf_tot, m_nfsec, i - 1)*m_c_hdr_cold);
}
m_Runner_hl_cold = m_L_runner[i] * CSP::pi*m_D_runner[i] * m_Pipe_hl_coef*(m_T_rnr[i] - T_db); //[W]
m_Runner_hl_cold_tot += 2.*m_Runner_hl_cold;
}
//Header
m_Header_hl_cold = 0.0;
m_Header_hl_cold_tot = 0.0;
m_T_hdr[0] = m_T_rnr[m_nrunsec - 1] - m_Runner_hl_cold / (m_dot_runner(m_m_dot_htf_tot, m_nfsec, m_nrunsec - 1)*m_c_hdr_cold); // T's for farthest headers
for( int i = 0; i < m_nhdrsec; i++ )
{
if (i != 0) {
m_T_hdr[i] = m_T_hdr[i - 1] - m_Header_hl_cold / (m_dot_header(m_m_dot_htf_tot, m_nfsec, m_nLoops, i - 1)*m_c_hdr_cold);
}
m_Header_hl_cold = m_Row_Distance * m_D_hdr[i] * CSP::pi*m_Pipe_hl_coef*(m_T_hdr[i] - T_db); //[W]
m_Header_hl_cold_tot += m_nfsec * m_Header_hl_cold;
}
m_T_loop_in = m_T_hdr[m_nhdrsec - 1] - m_Header_hl_cold / (m_dot_header(m_m_dot_htf_tot, m_nfsec, m_nLoops, m_nhdrsec - 1)*m_c_hdr_cold);
}
else // m_accept_loc == 2, only modeling loop
{
m_TCS_T_htf_in[0] = T_htf_cold_in; //[C]
m_TCS_T_sys_c = m_TCS_T_htf_in[0]; //[C]
}
double P_intc_in = m_P_field_in;
m_T_loop[0] = m_T_loop_in;
IntcOutputs intc_state = m_interconnects[0].State(m_dot_htf_loop * 2, m_T_loop[0], T_db, P_intc_in);
m_T_loop[1] = intc_state.temp_out;
intc_state = m_interconnects[1].State(m_dot_htf_loop, m_T_loop[1], T_db, intc_state.pressure_out);
m_TCS_T_htf_in[0] = intc_state.temp_out;
// Reset vectors that are populated in following for(i..nSCA) loop
m_q_abs_SCAtot.assign(m_q_abs_SCAtot.size(), 0.0);
m_q_loss_SCAtot.assign(m_q_loss_SCAtot.size(), 0.0);
m_q_1abs_tot.assign(m_q_1abs_tot.size(), 0.0);
m_q_reflect_tot.assign(m_q_reflect_tot.size(), 0.0);
m_E_avail.assign(m_E_avail.size(), 0.0);
m_E_accum.assign(m_E_accum.size(), 0.0);
m_E_int_loop.assign(m_E_int_loop.size(), 0.0);
// And single values...
m_EqOpteff = 0.0;
//---------------------
for( int i = 0; i<m_nSCA; i++ )
{
m_q_loss.assign(m_q_loss.size(), 0.0); //[W/m]
m_q_abs.assign(m_q_abs.size(), 0.0); //[W/m]
m_q_1abs.assign(m_q_1abs.size(), 0.0); //[W/m]
m_q_reflect.assign(m_q_reflect.size(), 0.0);//[W/m]
int HT = (int)m_SCAInfoArray(i, 0) - 1; //[-] HCE type
int CT = (int)m_SCAInfoArray(i, 1) - 1; //[-] Collector type
double c_htf_i = 0.0;
double rho_htf_i = 0.0;
for( int j = 0; j<m_nHCEVar; j++ )
{
//Check to see if the field fraction for this HCE is zero. if so, don't bother calculating for this variation
if( m_HCE_FieldFrac(HT, j) == 0.0 )
continue;
double c_htf_j, rho_htf_j;
c_htf_j = rho_htf_j = std::numeric_limits<double>::quiet_NaN();
EvacReceiver(m_TCS_T_htf_in[i], m_dot_htf_loop, T_db, T_sky, weather.m_wspd, weather.m_pres*100.0, m_q_SCA[i], HT, j, CT, i, false, m_ncall, sim_info.ms_ts.m_time / 3600.0,
//outputs
m_q_loss[j], m_q_abs[j], m_q_1abs[j], c_htf_j, rho_htf_j, m_q_reflect[j]);
// Check for NaN
if( m_q_abs[j] != m_q_abs[j] )
{
return E_loop_energy_balance_exit::NaN;
}
m_q_abs_SCAtot[i] += m_q_abs[j] * m_L_actSCA[CT] * m_HCE_FieldFrac(HT, j); //[W] Heat absorbed by HTF, weighted, for SCA
m_q_loss_SCAtot[i] += m_q_loss[j] * m_L_actSCA[CT] * m_HCE_FieldFrac(HT, j); //[W] Total heat losses, weighted, for SCA
m_q_1abs_tot[i] += m_q_1abs[j] * m_HCE_FieldFrac(HT, j); //[W/m] Thermal losses from the absorber surface
m_q_reflect_tot[i] += m_q_reflect[j] * m_L_actSCA[CT] * m_HCE_FieldFrac(HT, j); //[W] Total reflective loss
c_htf_i += c_htf_j*m_HCE_FieldFrac(HT, j); //[kJ/kg-K]
rho_htf_i += rho_htf_j*m_HCE_FieldFrac(HT, j);
//keep track of the total equivalent optical efficiency
m_EqOpteff += m_ColOptEff(CT, i)*m_Shadowing(HT, j)*m_Dirt_HCE(HT, j)*m_alpha_abs(HT, j)*m_Tau_envelope(HT, j)*(m_L_actSCA[CT] / m_L_tot)*m_HCE_FieldFrac(HT, j);;
} //m_nHCEVar loop
//Calculate the specific heat for the node
c_htf_i *= 1000.0; //[J/kg-K]
//Calculate the average node outlet temperature, including transient effects
double m_node = rho_htf_i * m_A_cs(HT, 1)*m_L_actSCA[CT];
//MJW 12.14.2010 The first term should represent the difference between the previous average temperature and the new
//average temperature. Thus, the heat addition in the first term should be divided by 2 rather than include the whole magnitude
//of the heat addition.
//mjw & tn 5.1.11: There was an error in the assumption about average and outlet temperature
m_TCS_T_htf_out[i] = m_q_abs_SCAtot[i] / (m_dot_htf_loop*c_htf_i) + m_TCS_T_htf_in[i] +
2.0 * (m_TCS_T_htf_ave_last[i] - m_TCS_T_htf_in[i] - m_q_abs_SCAtot[i] / (2.0 * m_dot_htf_loop * c_htf_i)) *
exp(-2. * m_dot_htf_loop * c_htf_i * sim_info.ms_ts.m_step / (m_node * c_htf_i + m_mc_bal_sca * m_L_actSCA[CT]));
//Recalculate the average temperature for the SCA
m_TCS_T_htf_ave[i] = (m_TCS_T_htf_in[i] + m_TCS_T_htf_out[i]) / 2.0;