Skip to content

Commit 62ce7ef

Browse files
Merge pull request #1312 from NREL/trough_tes
Fix minor bugs in packed bed TES model.
2 parents 21650f6 + f50eb6c commit 62ce7ef

File tree

1 file changed

+12
-6
lines changed

1 file changed

+12
-6
lines changed

tcs/csp_solver_packedbed_tes.cpp

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -832,16 +832,21 @@ bool C_csp_packedbed_tes::charge(double timestep /*s*/, double T_amb /*K*/, doub
832832
// Charge INLET
833833
if (i == 0)
834834
{
835+
double T_in_prev = T_prev_vec_subtime[i]; // Replace T_htf_in with current node previous timestep
836+
/*if (m_dot_htf_in > 0)
837+
T_in_dummy = T_htf_hot_in;*/
835838
T_calc_vec[i] = (T_prev_vec_subtime[0] + (alpha * T_htf_hot_in)
836-
+ (beta * (T_prev_vec_subtime[i + 1] - (2.0 * T_prev_vec_subtime[i]) + T_htf_hot_in)))
839+
+ (beta * (T_prev_vec_subtime[i + 1] - (2.0 * T_prev_vec_subtime[i]) + T_in_prev)))
837840
/ (1.0 + alpha);
838841
}
839842

840843
// Charge OUTLET
841844
else if (i == m_n_xstep)
842845
{
846+
847+
double T_out_prev = T_prev_vec_subtime[i - 1]; // Replace T_prev_vec_subtime[i - 2] with current node previous timestep
843848
T_calc_vec[i] = (T_prev_vec_subtime[i] + (alpha * T_calc_vec[i - 1])
844-
+ (beta * (T_prev_vec_subtime[i] - 2.0 * T_prev_vec_subtime[i - 1] + T_prev_vec_subtime[i - 2])))
849+
+ (beta * (T_prev_vec_subtime[i - 1] - T_prev_vec_subtime[i])))
845850
/ (1.0 + alpha);
846851
}
847852
else
@@ -905,7 +910,7 @@ bool C_csp_packedbed_tes::charge(double timestep /*s*/, double T_amb /*K*/, doub
905910
double cp_fluid_avg = mc_external_htfProps.Cp_ave(m_T_cold_des, m_T_hot_des) * 1.E3; //[J/kg-K]
906911
for (double T_out : T_out_vec)
907912
{
908-
q_dot_ch_from_htf += m_dot_htf_in * cp_fluid_avg * (T_htf_hot_in - T_out) * 1.E-3 * (dt / timestep); // [MWt]
913+
q_dot_ch_from_htf += m_dot_htf_in * cp_fluid_avg * (T_htf_hot_in - T_out) * 1.E-6 * (dt / timestep); // [MWt]
909914
}
910915

911916
return true;
@@ -952,15 +957,16 @@ bool C_csp_packedbed_tes::discharge(double timestep /*s*/, double T_amb /*K*/, d
952957
if (i == 0)
953958
{
954959
T_calc_vec[i] = (T_prev_vec_subtime[i] + (alpha * T_calc_vec[i + 1])
955-
+ (beta * (T_prev_vec_subtime[i] - 2.0 * T_prev_vec_subtime[i + 1] + T_prev_vec_subtime[i + 2])))
960+
+ (beta * (T_prev_vec_subtime[i + 1] - T_prev_vec_subtime[i])))
956961
/ (1.0 + alpha);
957962
}
958963

959964
// Discharge INLET
960965
else if (i == m_n_xstep)
961966
{
967+
double T_in_prev = T_prev_vec_subtime[i]; // Replace T_htf_in with current node previous timestep
962968
T_calc_vec[i] = (T_prev_vec_subtime[i] + (alpha * T_htf_cold_in)
963-
+ (beta * (T_prev_vec_subtime[i - 1] - (2.0 * T_prev_vec_subtime[i]) + T_htf_cold_in)))
969+
+ (beta * (T_prev_vec_subtime[i - 1] - (2.0 * T_prev_vec_subtime[i]) + T_in_prev)))
964970
/ (1.0 + alpha);
965971
}
966972

@@ -1011,7 +1017,7 @@ bool C_csp_packedbed_tes::discharge(double timestep /*s*/, double T_amb /*K*/, d
10111017
double cp_fluid_avg = mc_external_htfProps.Cp_ave(m_T_cold_des, m_T_hot_des) * 1.E3; //[J/kg-K]
10121018
for (double T_out : T_out_vec)
10131019
{
1014-
q_dot_dc_to_htf += m_dot_htf_in * cp_fluid_avg * (T_out - T_htf_cold_in) * 1.E-3 * (dt / timestep); // [MWt]
1020+
q_dot_dc_to_htf += m_dot_htf_in * cp_fluid_avg * (T_out - T_htf_cold_in) * 1.E-6 * (dt / timestep); // [MWt]
10151021
}
10161022

10171023
// Average Hot Temperature in Tank

0 commit comments

Comments
 (0)