@@ -11596,169 +11596,179 @@ void VRFCondenserEquipment::CalcVRFCondenser_FluidTCtrl(EnergyPlusData &state)
11596
11596
GetSatEnthalpyRefrig(state, this->RefrigerantName, this->IUCondensingTemp, 1.0, RefrigerantIndex, RoutineName); // Quality=1
11597
11597
h_IU_cond_in = h_IU_cond_in_low;
11598
11598
11599
- Label23:;
11600
- m_ref_IU_cond = 0;
11601
- h_IU_cond_out_ave = 0;
11602
- SC_IU_merged = 0;
11599
+ bool condition_c = (Q_c_OU * C_cap_operation) <= CompEvaporatingCAPSpdMin;
11600
+ bool condition_d = (std::abs(h_comp_out - h_comp_out_new) > Tolerance * h_comp_out) && (h_IU_cond_in < h_IU_cond_in_up);
11601
+ do {
11602
+ m_ref_IU_cond = 0;
11603
+ h_IU_cond_out_ave = 0;
11604
+ SC_IU_merged = 0;
11603
11605
11604
- // Calculate total refrigerant flow rate
11605
- if (Q_h_TU_PL > CompEvaporatingCAPSpdMax + CompEvaporatingPWRSpdMax) {
11606
- // Required load is beyond the max system capacity
11606
+ // Calculate total refrigerant flow rate
11607
+ if (Q_h_TU_PL > CompEvaporatingCAPSpdMax + CompEvaporatingPWRSpdMax) {
11608
+ // Required load is beyond the max system capacity
11607
11609
11608
- h_IU_cond_out = GetSatEnthalpyRefrig(
11609
- state,
11610
- this->RefrigerantName,
11611
- GetSatTemperatureRefrig(state, this->RefrigerantName, max(min(Pcond, RefPHigh), RefPLow), RefrigerantIndex, RoutineName) - 5.0,
11612
- 0.0,
11613
- RefrigerantIndex,
11614
- RoutineName); // Quality=0
11615
- h_IU_cond_out_ave = h_IU_cond_out;
11616
- SC_IU_merged = 5;
11617
- TU_HeatingLoad_actual = min(TU_HeatingLoad, CompEvaporatingCAPSpdMax + CompEvaporatingPWRSpdMax);
11618
- m_ref_IU_cond = TU_HeatingLoad_actual / (h_IU_cond_in - h_IU_cond_out);
11610
+ h_IU_cond_out = GetSatEnthalpyRefrig(
11611
+ state,
11612
+ this->RefrigerantName,
11613
+ GetSatTemperatureRefrig(state, this->RefrigerantName, max(min(Pcond, RefPHigh), RefPLow), RefrigerantIndex, RoutineName) - 5.0,
11614
+ 0.0,
11615
+ RefrigerantIndex,
11616
+ RoutineName); // Quality=0
11617
+ h_IU_cond_out_ave = h_IU_cond_out;
11618
+ SC_IU_merged = 5;
11619
+ TU_HeatingLoad_actual = min(TU_HeatingLoad, CompEvaporatingCAPSpdMax + CompEvaporatingPWRSpdMax);
11620
+ m_ref_IU_cond = TU_HeatingLoad_actual / (h_IU_cond_in - h_IU_cond_out);
11619
11621
11620
- } else {
11621
- for (NumTU = 1; NumTU <= NumTUInList; NumTU++) {
11622
- if (state.dataHVACVarRefFlow->TerminalUnitList(TUListNum).TotalHeatLoad(NumTU) > 0) {
11623
- TUIndex = state.dataHVACVarRefFlow->TerminalUnitList(TUListNum).ZoneTUPtr(NumTU);
11624
- HeatCoilIndex = state.dataHVACVarRefFlow->VRFTU(TUIndex).HeatCoilIndex;
11625
- h_IU_cond_out_i = GetSatEnthalpyRefrig(
11622
+ } else {
11623
+ for (NumTU = 1; NumTU <= NumTUInList; NumTU++) {
11624
+ if (state.dataHVACVarRefFlow->TerminalUnitList(TUListNum).TotalHeatLoad(NumTU) > 0) {
11625
+ TUIndex = state.dataHVACVarRefFlow->TerminalUnitList(TUListNum).ZoneTUPtr(NumTU);
11626
+ HeatCoilIndex = state.dataHVACVarRefFlow->VRFTU(TUIndex).HeatCoilIndex;
11627
+ h_IU_cond_out_i = GetSatEnthalpyRefrig(
11628
+ state,
11629
+ this->RefrigerantName,
11630
+ GetSatTemperatureRefrig(state, this->RefrigerantName, max(min(Pcond, RefPHigh), RefPLow), RefrigerantIndex, RoutineName) -
11631
+ state.dataDXCoils->DXCoil(HeatCoilIndex).ActualSC,
11632
+ 0.0,
11633
+ RefrigerantIndex,
11634
+ RoutineName); // Quality=0
11635
+ m_ref_IU_cond_i =
11636
+ (state.dataHVACVarRefFlow->TerminalUnitList(TUListNum).TotalHeatLoad(NumTU) <= 0.0)
11637
+ ? 0.0
11638
+ : (state.dataHVACVarRefFlow->TerminalUnitList(TUListNum).TotalHeatLoad(NumTU) / (h_IU_cond_in - h_IU_cond_out_i));
11639
+ m_ref_IU_cond = m_ref_IU_cond + m_ref_IU_cond_i;
11640
+ h_IU_cond_out_ave = h_IU_cond_out_ave + m_ref_IU_cond_i * h_IU_cond_out_i;
11641
+ SC_IU_merged = SC_IU_merged + m_ref_IU_cond_i * state.dataDXCoils->DXCoil(HeatCoilIndex).ActualSC;
11642
+ }
11643
+ }
11644
+ if (m_ref_IU_cond > 0) {
11645
+ h_IU_cond_out_ave = h_IU_cond_out_ave / m_ref_IU_cond; // h_merge
11646
+ SC_IU_merged = SC_IU_merged / m_ref_IU_cond;
11647
+ } else {
11648
+ h_IU_cond_out_ave = GetSatEnthalpyRefrig(
11626
11649
state,
11627
11650
this->RefrigerantName,
11628
11651
GetSatTemperatureRefrig(state, this->RefrigerantName, max(min(Pcond, RefPHigh), RefPLow), RefrigerantIndex, RoutineName) -
11629
- state.dataDXCoils->DXCoil(HeatCoilIndex).ActualSC ,
11652
+ 5.0 ,
11630
11653
0.0,
11631
11654
RefrigerantIndex,
11632
11655
RoutineName); // Quality=0
11633
- m_ref_IU_cond_i =
11634
- (state.dataHVACVarRefFlow->TerminalUnitList(TUListNum).TotalHeatLoad(NumTU) <= 0.0)
11635
- ? 0.0
11636
- : (state.dataHVACVarRefFlow->TerminalUnitList(TUListNum).TotalHeatLoad(NumTU) / (h_IU_cond_in - h_IU_cond_out_i));
11637
- m_ref_IU_cond = m_ref_IU_cond + m_ref_IU_cond_i;
11638
- h_IU_cond_out_ave = h_IU_cond_out_ave + m_ref_IU_cond_i * h_IU_cond_out_i;
11639
- SC_IU_merged = SC_IU_merged + m_ref_IU_cond_i * state.dataDXCoils->DXCoil(HeatCoilIndex).ActualSC;
11656
+ SC_IU_merged = 5;
11657
+ m_ref_IU_cond = TU_HeatingLoad / (h_IU_cond_in - h_IU_cond_out_ave);
11640
11658
}
11641
11659
}
11642
- if (m_ref_IU_cond > 0) {
11643
- h_IU_cond_out_ave = h_IU_cond_out_ave / m_ref_IU_cond; // h_merge
11644
- SC_IU_merged = SC_IU_merged / m_ref_IU_cond;
11645
- } else {
11646
- h_IU_cond_out_ave = GetSatEnthalpyRefrig(
11647
- state,
11648
- this->RefrigerantName,
11649
- GetSatTemperatureRefrig(state, this->RefrigerantName, max(min(Pcond, RefPHigh), RefPLow), RefrigerantIndex, RoutineName) - 5.0,
11650
- 0.0,
11651
- RefrigerantIndex,
11652
- RoutineName); // Quality=0
11653
- SC_IU_merged = 5;
11654
- m_ref_IU_cond = TU_HeatingLoad / (h_IU_cond_in - h_IU_cond_out_ave);
11655
- }
11656
- }
11657
11660
11658
- // *Calculate piping loss
11659
- this->VRFOU_PipeLossH(
11660
- state, m_ref_IU_cond, max(min(Pcond, RefPHigh), RefPLow), h_IU_cond_in, OutdoorDryBulb, Pipe_Q_h, Pipe_DeltP_h, h_comp_out);
11661
+ // *Calculate piping loss
11662
+ this->VRFOU_PipeLossH(
11663
+ state, m_ref_IU_cond, max(min(Pcond, RefPHigh), RefPLow), h_IU_cond_in, OutdoorDryBulb, Pipe_Q_h, Pipe_DeltP_h, h_comp_out);
11661
11664
11662
- Pdischarge = max(Pcond + Pipe_DeltP_h, Pcond); // affected by piping loss
11663
- Tdischarge = GetSatTemperatureRefrig(state, this->RefrigerantName, max(min(Pdischarge, RefPHigh), RefPLow), RefrigerantIndex, RoutineName);
11665
+ Pdischarge = max(Pcond + Pipe_DeltP_h, Pcond); // affected by piping loss
11666
+ Tdischarge =
11667
+ GetSatTemperatureRefrig(state, this->RefrigerantName, max(min(Pdischarge, RefPHigh), RefPLow), RefrigerantIndex, RoutineName);
11668
+
11669
+ // Evaporative capacity ranges_Min
11670
+ CapMinPe = min(Pdischarge - this->CompMaxDeltaP, RefMinPe);
11671
+ CapMinTe = GetSatTemperatureRefrig(state, this->RefrigerantName, max(min(CapMinPe, RefPHigh), RefPLow), RefrigerantIndex, RoutineName);
11672
+ CompEvaporatingCAPSpdMin = this->CoffEvapCap * this->RatedEvapCapacity * CurveValue(state, this->OUCoolingCAPFT(1), Tdischarge, CapMinTe);
11673
+ CompEvaporatingPWRSpdMin = this->RatedCompPower * CurveValue(state, this->OUCoolingPWRFT(1), Tdischarge, CapMinTe);
11674
+
11675
+ Q_h_TU_PL = TU_HeatingLoad + Pipe_Q_h;
11676
+ Q_c_OU = max(0.0, Q_h_TU_PL - CompEvaporatingPWRSpdMin);
11677
+
11678
+ // *Calculate capacity modification factor
11679
+ RefTSat = GetSatTemperatureRefrig(state, this->RefrigerantName, max(min(CapMinPe, RefPHigh), RefPLow), RefrigerantIndex, RoutineName);
11680
+ h_comp_in = GetSupHeatEnthalpyRefrig(state,
11681
+ this->RefrigerantName,
11682
+ max(RefTSat, CapMinTe + this->SH),
11683
+ max(min(CapMinPe, RefPHigh), RefPLow),
11684
+ RefrigerantIndex,
11685
+ RoutineName);
11686
+ C_cap_operation = this->VRFOU_CapModFactor(state,
11687
+ h_comp_in,
11688
+ h_IU_cond_out_ave,
11689
+ max(min(CapMinPe, RefPHigh), RefPLow),
11690
+ CapMinTe + this->SH,
11691
+ CapMinTe + 8,
11692
+ this->IUCondensingTemp - 5);
11693
+ condition_c = (Q_c_OU * C_cap_operation) <= CompEvaporatingCAPSpdMin;
11694
+ if (condition_c) {
11695
+ // Required heating load is smaller than the min heating capacity
11696
+
11697
+ if (Q_c_OU == 0) {
11698
+ // Q_h_TU_PL is less than or equal to CompEvaporatingPWRSpdMin
11699
+ CyclingRatio = Q_h_TU_PL / CompEvaporatingPWRSpdMin;
11700
+ this->EvaporatingTemp = OutdoorDryBulb;
11701
+ } else {
11702
+ // Q_h_TU_PL is greater than CompEvaporatingPWRSpdMin
11703
+ CyclingRatio = Q_c_OU * C_cap_operation / CompEvaporatingCAPSpdMin;
11704
+ this->EvaporatingTemp = max(CapMinTe, RefTLow);
11705
+ }
11706
+
11707
+ double CyclingRatioFrac = 0.85 + 0.15 * CyclingRatio;
11708
+ double HPRTF = CyclingRatio / CyclingRatioFrac;
11709
+ Ncomp = CompEvaporatingPWRSpdMin * HPRTF;
11710
+ CompSpdActual = this->CompressorSpeed(1);
11664
11711
11665
- // Evaporative capacity ranges_Min
11666
- CapMinPe = min(Pdischarge - this->CompMaxDeltaP, RefMinPe);
11667
- CapMinTe = GetSatTemperatureRefrig(state, this->RefrigerantName, max(min(CapMinPe, RefPHigh), RefPLow), RefrigerantIndex, RoutineName);
11668
- CompEvaporatingCAPSpdMin = this->CoffEvapCap * this->RatedEvapCapacity * CurveValue(state, this->OUCoolingCAPFT(1), Tdischarge, CapMinTe);
11669
- CompEvaporatingPWRSpdMin = this->RatedCompPower * CurveValue(state, this->OUCoolingPWRFT(1), Tdischarge, CapMinTe);
11670
-
11671
- Q_h_TU_PL = TU_HeatingLoad + Pipe_Q_h;
11672
- Q_c_OU = max(0.0, Q_h_TU_PL - CompEvaporatingPWRSpdMin);
11673
-
11674
- // *Calculate capacity modification factor
11675
- RefTSat = GetSatTemperatureRefrig(state, this->RefrigerantName, max(min(CapMinPe, RefPHigh), RefPLow), RefrigerantIndex, RoutineName);
11676
- h_comp_in = GetSupHeatEnthalpyRefrig(
11677
- state, this->RefrigerantName, max(RefTSat, CapMinTe + this->SH), max(min(CapMinPe, RefPHigh), RefPLow), RefrigerantIndex, RoutineName);
11678
- C_cap_operation = this->VRFOU_CapModFactor(state,
11679
- h_comp_in,
11680
- h_IU_cond_out_ave,
11681
- max(min(CapMinPe, RefPHigh), RefPLow),
11682
- CapMinTe + this->SH,
11683
- CapMinTe + 8,
11684
- this->IUCondensingTemp - 5);
11685
-
11686
- if ((Q_c_OU * C_cap_operation) <= CompEvaporatingCAPSpdMin) {
11687
- // Required heating load is smaller than the min heating capacity
11688
-
11689
- if (Q_c_OU == 0) {
11690
- // Q_h_TU_PL is less than or equal to CompEvaporatingPWRSpdMin
11691
- CyclingRatio = Q_h_TU_PL / CompEvaporatingPWRSpdMin;
11692
- this->EvaporatingTemp = OutdoorDryBulb;
11693
11712
} else {
11694
- // Q_h_TU_PL is greater than CompEvaporatingPWRSpdMin
11695
- CyclingRatio = Q_c_OU * C_cap_operation / CompEvaporatingCAPSpdMin;
11696
- this->EvaporatingTemp = max(CapMinTe, RefTLow);
11697
- }
11713
+ // Required heating load is greater than or equal to the min heating capacity
11698
11714
11699
- double CyclingRatioFrac = 0.85 + 0.15 * CyclingRatio;
11700
- double HPRTF = CyclingRatio / CyclingRatioFrac;
11701
- Ncomp = CompEvaporatingPWRSpdMin * HPRTF;
11702
- CompSpdActual = this->CompressorSpeed(1);
11715
+ // Iteration_Ncomp: Perform iterations to calculate Ncomp (Label20)
11716
+ Counter = 1;
11717
+ bool converged_20;
11718
+ do {
11719
+ Ncomp_new = Ncomp;
11720
+ Q_c_OU = max(0.0, Q_h_TU_PL - Ncomp);
11703
11721
11704
- } else {
11705
- // Required heating load is greater than or equal to the min heating capacity
11722
+ // *VRF OU Te calculations
11723
+ m_air = this->OUAirFlowRate * RhoAir;
11724
+ SH_OU = this->SH;
11725
+ this->VRFOU_TeTc(
11726
+ state, HXOpMode::EvapMode, Q_c_OU, SH_OU, m_air, OutdoorDryBulb, OutdoorHumRat, OutdoorPressure, Tfs, this->EvaporatingTemp);
11727
+ this->SH = SH_OU;
11728
+
11729
+ // *VRF OU Compressor Simulation at heating mode: Specify the compressor speed and power consumption
11730
+ this->VRFOU_CalcCompH(state,
11731
+ TU_HeatingLoad,
11732
+ this->EvaporatingTemp,
11733
+ Tdischarge,
11734
+ h_IU_cond_out_ave,
11735
+ this->IUCondensingTemp,
11736
+ CapMinTe,
11737
+ Tfs,
11738
+ Pipe_Q_h,
11739
+ Q_c_OU,
11740
+ CompSpdActual,
11741
+ Ncomp_new);
11706
11742
11707
- // Iteration_Ncomp: Perform iterations to calculate Ncomp (Label20)
11708
- Counter = 1;
11709
- bool converged_20;
11710
- do {
11711
- Ncomp_new = Ncomp;
11712
- Q_c_OU = max(0.0, Q_h_TU_PL - Ncomp);
11713
-
11714
- // *VRF OU Te calculations
11715
- m_air = this->OUAirFlowRate * RhoAir;
11716
- SH_OU = this->SH;
11717
- this->VRFOU_TeTc(
11718
- state, HXOpMode::EvapMode, Q_c_OU, SH_OU, m_air, OutdoorDryBulb, OutdoorHumRat, OutdoorPressure, Tfs, this->EvaporatingTemp);
11719
- this->SH = SH_OU;
11720
-
11721
- // *VRF OU Compressor Simulation at heating mode: Specify the compressor speed and power consumption
11722
- this->VRFOU_CalcCompH(state,
11723
- TU_HeatingLoad,
11724
- this->EvaporatingTemp,
11725
- Tdischarge,
11726
- h_IU_cond_out_ave,
11727
- this->IUCondensingTemp,
11728
- CapMinTe,
11729
- Tfs,
11730
- Pipe_Q_h,
11731
- Q_c_OU,
11732
- CompSpdActual,
11733
- Ncomp_new);
11734
-
11735
- converged_20 = (std::abs(Ncomp_new - Ncomp) <= (Tolerance * Ncomp)) || (Counter >= 30);
11736
- Counter = Counter + 1;
11737
- if (!converged_20) {
11738
- Ncomp = Ncomp_new;
11739
- }
11740
- } while (!converged_20);
11741
-
11742
- // Update h_comp_out in iteration Label23
11743
- P_comp_in = GetSatPressureRefrig(state, this->RefrigerantName, this->EvaporatingTemp, RefrigerantIndex, RoutineName);
11744
- RefTSat = GetSatTemperatureRefrig(state, this->RefrigerantName, max(min(P_comp_in, RefPHigh), RefPLow), RefrigerantIndex, RoutineName);
11745
- h_comp_in_new = GetSupHeatEnthalpyRefrig(state,
11746
- this->RefrigerantName,
11747
- max(RefTSat, this->SH + this->EvaporatingTemp),
11748
- max(min(P_comp_in, RefPHigh), RefPLow),
11749
- RefrigerantIndex,
11750
- RoutineName);
11751
- h_comp_out_new = Ncomp_new / m_ref_IU_cond + h_comp_in_new;
11743
+ converged_20 = (std::abs(Ncomp_new - Ncomp) <= (Tolerance * Ncomp)) || (Counter >= 30);
11744
+ Counter = Counter + 1;
11745
+ if (!converged_20) {
11746
+ Ncomp = Ncomp_new;
11747
+ }
11748
+ } while (!converged_20);
11752
11749
11753
- if ((std::abs(h_comp_out - h_comp_out_new) > Tolerance * h_comp_out) && (h_IU_cond_in < h_IU_cond_in_up)) {
11754
- h_IU_cond_in = h_IU_cond_in + 0.1 * (h_IU_cond_in_up - h_IU_cond_in_low);
11755
- goto Label23;
11756
- }
11757
- if (h_IU_cond_in > h_IU_cond_in_up) {
11758
- h_IU_cond_in = 0.5 * (h_IU_cond_in_up + h_IU_cond_in_low);
11750
+ // Update h_comp_out in iteration Label23
11751
+ P_comp_in = GetSatPressureRefrig(state, this->RefrigerantName, this->EvaporatingTemp, RefrigerantIndex, RoutineName);
11752
+ RefTSat =
11753
+ GetSatTemperatureRefrig(state, this->RefrigerantName, max(min(P_comp_in, RefPHigh), RefPLow), RefrigerantIndex, RoutineName);
11754
+ h_comp_in_new = GetSupHeatEnthalpyRefrig(state,
11755
+ this->RefrigerantName,
11756
+ max(RefTSat, this->SH + this->EvaporatingTemp),
11757
+ max(min(P_comp_in, RefPHigh), RefPLow),
11758
+ RefrigerantIndex,
11759
+ RoutineName);
11760
+ h_comp_out_new = Ncomp_new / m_ref_IU_cond + h_comp_in_new;
11761
+
11762
+ condition_d = (std::abs(h_comp_out - h_comp_out_new) > Tolerance * h_comp_out) && (h_IU_cond_in < h_IU_cond_in_up);
11763
+ if (condition_d) {
11764
+ h_IU_cond_in = h_IU_cond_in + 0.1 * (h_IU_cond_in_up - h_IU_cond_in_low);
11765
+ }
11766
+ if (h_IU_cond_in > h_IU_cond_in_up) {
11767
+ h_IU_cond_in = 0.5 * (h_IU_cond_in_up + h_IU_cond_in_low);
11768
+ }
11769
+ Ncomp = Ncomp_new;
11759
11770
}
11760
- Ncomp = Ncomp_new;
11761
- }
11771
+ } while (!condition_c && condition_d);
11762
11772
11763
11773
// Key outputs of this subroutine
11764
11774
this->CompActSpeed = max(CompSpdActual, 0.0);
0 commit comments