@@ -832,16 +832,21 @@ bool C_csp_packedbed_tes::charge(double timestep /*s*/, double T_amb /*K*/, doub
832
832
// Charge INLET
833
833
if (i == 0 )
834
834
{
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;*/
835
838
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 )))
837
840
/ (1.0 + alpha);
838
841
}
839
842
840
843
// Charge OUTLET
841
844
else if (i == m_n_xstep)
842
845
{
846
+
847
+ double T_out_prev = T_prev_vec_subtime[i - 1 ]; // Replace T_prev_vec_subtime[i - 2] with current node previous timestep
843
848
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])))
845
850
/ (1.0 + alpha);
846
851
}
847
852
else
@@ -905,7 +910,7 @@ bool C_csp_packedbed_tes::charge(double timestep /*s*/, double T_amb /*K*/, doub
905
910
double cp_fluid_avg = mc_external_htfProps.Cp_ave (m_T_cold_des, m_T_hot_des) * 1 .E3 ; // [J/kg-K]
906
911
for (double T_out : T_out_vec)
907
912
{
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]
909
914
}
910
915
911
916
return true ;
@@ -952,15 +957,16 @@ bool C_csp_packedbed_tes::discharge(double timestep /*s*/, double T_amb /*K*/, d
952
957
if (i == 0 )
953
958
{
954
959
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])))
956
961
/ (1.0 + alpha);
957
962
}
958
963
959
964
// Discharge INLET
960
965
else if (i == m_n_xstep)
961
966
{
967
+ double T_in_prev = T_prev_vec_subtime[i]; // Replace T_htf_in with current node previous timestep
962
968
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 )))
964
970
/ (1.0 + alpha);
965
971
}
966
972
@@ -1011,7 +1017,7 @@ bool C_csp_packedbed_tes::discharge(double timestep /*s*/, double T_amb /*K*/, d
1011
1017
double cp_fluid_avg = mc_external_htfProps.Cp_ave (m_T_cold_des, m_T_hot_des) * 1 .E3 ; // [J/kg-K]
1012
1018
for (double T_out : T_out_vec)
1013
1019
{
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]
1015
1021
}
1016
1022
1017
1023
// Average Hot Temperature in Tank
0 commit comments