@@ -287,7 +287,7 @@ namespace AirflowNetwork {
287
287
288
288
if (AirflowNetworkFanActivated && distribution_simulated) {
289
289
if (ValidateDistributionSystemFlag) {
290
- validate_distribution ();
290
+ finalize_distribution ();
291
291
validate_fan_flowrate();
292
292
ValidateDistributionSystemFlag = false;
293
293
if (simulation_control.autosize_ducts) {
@@ -3923,7 +3923,7 @@ namespace AirflowNetwork {
3923
3923
DisSysNodeData(i).node_name = Alphas(2); // Name of associated EnergyPlus node
3924
3924
DisSysNodeData(i).EPlusType = Alphas(3); // Name of associated EnergyPlus type
3925
3925
DisSysNodeData(i).Height = Numbers(1); // Nodal height
3926
- DisSysNodeData(i).EPlusNodeNum = 0; // EPlus node number
3926
+ DisSysNodeData(i).node_number = 0; // EPlus node number
3927
3927
// verify EnergyPlus object type
3928
3928
if (Util::SameString(Alphas(3), "AirLoopHVAC:ZoneMixer") || Util::SameString(Alphas(3), "AirLoopHVAC:ZoneSplitter") ||
3929
3929
Util::SameString(Alphas(3), "AirLoopHVAC:OutdoorAirSystem") || Util::SameString(Alphas(3), "OAMixerOutdoorAirStreamNode") ||
@@ -4261,7 +4261,7 @@ namespace AirflowNetwork {
4261
4261
AirflowNetworkNodeData(i).NodeTypeNum = 0;
4262
4262
AirflowNetworkNodeData(i).EPlusZoneNum = 0;
4263
4263
AirflowNetworkNodeData(i).NodeHeight = DisSysNodeData(i - NumOfNodesMultiZone).Height;
4264
- AirflowNetworkNodeData(i).EPlusNodeNum = DisSysNodeData(i - NumOfNodesMultiZone).EPlusNodeNum ;
4264
+ AirflowNetworkNodeData(i).EPlusNodeNum = DisSysNodeData(i - NumOfNodesMultiZone).node_number ;
4265
4265
// Get mixer information
4266
4266
if (Util::SameString(DisSysNodeData(i - NumOfNodesMultiZone).EPlusType, "AirLoopHVAC:ZoneMixer")) {
4267
4267
AirflowNetworkNodeData(i).EPlusTypeNum = NodeType::MIX;
@@ -9992,17 +9992,19 @@ namespace AirflowNetwork {
9992
9992
OpenFactorMult = 1.0;
9993
9993
} else if (DelEnthal >= UpperValInOutEnthalDiff) {
9994
9994
OpenFactorMult = LimValVentOpenFacMult;
9995
- } else {
9996
- OpenFactorMult =
9997
- LimValVentOpenFacMult + ((UpperValInOutEnthalDiff - DelEnthal) / (UpperValInOutEnthalDiff - LowerValInOutEnthalDiff)) *
9998
- (1 - LimValVentOpenFacMult);
9995
+ }
9996
+ else {
9997
+ OpenFactorMult =
9998
+ LimValVentOpenFacMult + ((UpperValInOutEnthalDiff - DelEnthal) / (UpperValInOutEnthalDiff - LowerValInOutEnthalDiff)) *
9999
+ (1 - LimValVentOpenFacMult);
9999
10000
}
10000
10001
OpenFactor *= OpenFactorMult;
10001
10002
m_state.dataSurface->SurfWinVentingOpenFactorMultRep(SurfNum) = OpenFactorMult;
10002
10003
}
10003
- } else {
10004
- OpenFactor = 0.0;
10005
- m_state.dataSurface->SurfWinVentingOpenFactorMultRep(SurfNum) = -1.0;
10004
+ }
10005
+ else {
10006
+ OpenFactor = 0.0;
10007
+ m_state.dataSurface->SurfWinVentingOpenFactorMultRep(SurfNum) = -1.0;
10006
10008
}
10007
10009
}
10008
10010
@@ -10022,13 +10024,16 @@ namespace AirflowNetwork {
10022
10024
m_state.dataThermalComforts->ThermalComfortData(PeopleInd).TComfASH55) {
10023
10025
OpenFactor = MultizoneSurfaceData(i).Factor;
10024
10026
m_state.dataSurface->SurfWinVentingOpenFactorMultRep(SurfNum) = 1.0;
10025
- } else {
10027
+ }
10028
+ else {
10026
10029
OpenFactor = 0.0;
10027
10030
}
10028
- } else {
10031
+ }
10032
+ else {
10029
10033
OpenFactor = 0.0;
10030
10034
}
10031
- } else {
10035
+ }
10036
+ else {
10032
10037
OpenFactor = 0.0;
10033
10038
}
10034
10039
}
@@ -10041,13 +10046,16 @@ namespace AirflowNetwork {
10041
10046
m_state.dataThermalComforts->ThermalComfortData(PeopleInd).TComfCEN15251) {
10042
10047
OpenFactor = MultizoneSurfaceData(i).Factor;
10043
10048
m_state.dataSurface->SurfWinVentingOpenFactorMultRep(SurfNum) = 1.0;
10044
- } else {
10049
+ }
10050
+ else {
10045
10051
OpenFactor = 0.0;
10046
10052
}
10047
- } else {
10053
+ }
10054
+ else {
10048
10055
OpenFactor = 0.0;
10049
10056
}
10050
- } else {
10057
+ }
10058
+ else {
10051
10059
OpenFactor = 0.0;
10052
10060
}
10053
10061
}
@@ -10078,7 +10086,26 @@ namespace AirflowNetwork {
10078
10086
}
10079
10087
}
10080
10088
10081
- void Solver::validate_distribution()
10089
+ bool Solver::validate_network()
10090
+ {
10091
+ bool result = true;
10092
+ // Technically, the nodes could be verified at input time with a bunch of string comparisons on the names,
10093
+ // but this will likely be faster and should get the same result
10094
+ std::vector<int> nodes_already_in_use;
10095
+ for (auto& node : DisSysNodeData) {
10096
+ if (node.node_number)
10097
+ if (std::find(nodes_already_in_use.begin(), nodes_already_in_use.end(), node.node_number) == nodes_already_in_use.end()) {
10098
+ // Node number already in use
10099
+ ShowWarningError(m_state, format("validate_network: Node \"{}\" (node number {}) is used more than once as an AirflowNetwork distribution node, verify that this matches the modeling intent", node.node_name, node.node_number));
10100
+ result = false;
10101
+ } else {
10102
+ nodes_already_in_use.push_back(node.node_number);
10103
+ }
10104
+ }
10105
+ return result;
10106
+ }
10107
+
10108
+ void Solver::finalize_distribution()
10082
10109
{
10083
10110
10084
10111
// SUBROUTINE INFORMATION:
@@ -10088,9 +10115,14 @@ namespace AirflowNetwork {
10088
10115
// RE-ENGINEERED na
10089
10116
10090
10117
// PURPOSE OF THIS SUBROUTINE:
10091
- // This subroutine validates the inputs of distribution system, since node data from a primary airloop
10092
- // are not available in the first call during reading input data of airflownetwork objects.
10093
- // Note: this routine shouldn't be called more than once
10118
+ // This subroutine finalizes the inputs of distribution system, since node data from a primary airloop
10119
+ // are not available in the first call during reading input data of AirflowNetwork objects.
10120
+ // Note: this routine shouldn't be called more than once, which is enforced with the distribution_is_final
10121
+ // flag. Some of the validation may be moved to the validate_network function.
10122
+
10123
+ if (distribution_is_final) {
10124
+ return;
10125
+ }
10094
10126
10095
10127
// Using/Aliasing
10096
10128
using BranchNodeConnections::GetNodeConnectionType;
@@ -10148,7 +10180,7 @@ namespace AirflowNetwork {
10148
10180
"The entered name is " + DisSysNodeData(i).node_name + " in an AirflowNetwork:Distribution:Node object.");
10149
10181
ErrorsFound = true;
10150
10182
}
10151
- DisSysNodeData(i).EPlusNodeNum = j;
10183
+ DisSysNodeData(i).node_number = j;
10152
10184
AirflowNetworkNodeData(NumOfNodesMultiZone + i).EPlusNodeNum = j;
10153
10185
AirflowNetworkNodeData(NumOfNodesMultiZone + i).AirLoopNum = DisSysNodeData(i).AirLoopNum;
10154
10186
NodeFound(j) = true;
@@ -10168,7 +10200,7 @@ namespace AirflowNetwork {
10168
10200
ErrorsFound = true;
10169
10201
}
10170
10202
}
10171
- if (DisSysNodeData(i).EPlusNodeNum == 0) {
10203
+ if (DisSysNodeData(i).node_number == 0) {
10172
10204
ShowSevereError(m_state,
10173
10205
format(RoutineName) +
10174
10206
"Primary Air Loop Node is not found in AIRFLOWNETWORK:DISTRIBUTION:NODE = " + DisSysNodeData(i).Name);
@@ -11007,6 +11039,9 @@ namespace AirflowNetwork {
11007
11039
}
11008
11040
if (NumOfFans > 1) break;
11009
11041
}
11042
+
11043
+ distribution_is_final = true;
11044
+
11010
11045
if (NumOfFans > 1) {
11011
11046
ShowSevereError(m_state,
11012
11047
format(RoutineName) + "An AirLoop branch, " + m_state.dataAirSystemsData->PrimaryAirSystems(1).Branch(BranchNum).Name +
0 commit comments