MCPcopy Create free account
hub / github.com/NatLabRockies/OpenStudio / pathInfiltration

Method pathInfiltration

src/airflow/contam/PrjModelImpl.cpp:1031–1087  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1029 }
1030
1031 std::vector<TimeSeries> IndexModelImpl::pathInfiltration(std::vector<int> pathNrs, SimFile* sim) {
1032 // This should probably include a lot more checks of things and is written in
1033 // somewhat strange way to avoid taking too much advantage of the specifics
1034 // of the text form outputs.
1035 std::vector<TimeSeries> results;
1036 std::vector<std::vector<int>> paths = zoneExteriorFlowPaths();
1037 unsigned int ntimes = 1;
1038 std::vector<DateTime> dateTimes = sim->dateTimes();
1039 if (sim->dateTimes().size() != 1) {
1040 ntimes = sim->dateTimes().size() - 1;
1041 dateTimes = std::vector<DateTime>(dateTimes.begin() + 1, dateTimes.end());
1042 }
1043 for (unsigned int i = 0; i < pathNrs.size(); i++) {
1044 Vector inf = createVector(std::vector<double>(ntimes, 0.0));
1045 if (pathNrs[i] <= 0 || (unsigned)pathNrs[i] > m_paths.size()) {
1046 // Possibly should issue a warning here, the path number is out of range
1047 } else {
1048 contam::AirflowPath path = m_paths[pathNrs[i] - 1];
1049 if (path.pzn() == -1) {
1050 // This flow path is negative for flow into zone
1051 boost::optional<openstudio::TimeSeries> optFlow = sim->pathFlow(path.nr());
1052 if (optFlow) {
1053 Vector flow = optFlow.get().values();
1054 for (unsigned int k = 0; k < ntimes; k++) {
1055 if (flow[k] < 0) {
1056 inf[k] = -flow[k];
1057 }
1058 }
1059 } else {
1060 // Perhaps a warning? This shouldn't really happen unless someone has excluded a path from the
1061 // results file for some reason - which is unlikely to be accidental. So there must be a good reason
1062 // for getting here, and for now we won't issue a warning.
1063 }
1064 } else if (path.pzm() == -1) {
1065 // This flow path is positive for flow into zone
1066 boost::optional<openstudio::TimeSeries> optFlow = sim->pathFlow(path.nr());
1067 if (optFlow) {
1068 Vector flow = optFlow.get().values();
1069 for (unsigned int k = 0; k < ntimes; k++) {
1070 if (flow[k] > 0) {
1071 inf[k] = flow[k];
1072 }
1073 }
1074 } else {
1075 // Perhaps a warning? This shouldn't really happen unless someone has excluded a path from the
1076 // results file for some reason - which is unlikely to be accidental. So there must be a good reason
1077 // for getting here, and for now we won't issue a warning.
1078 }
1079 } else {
1080 // Another situation that might need a warning, since the path is not connected to the ambient
1081 }
1082 }
1083 // Save the time series
1084 results.push_back(openstudio::TimeSeries(dateTimes, inf, "kg/s"));
1085 }
1086 return results;
1087 }
1088

Callers

nothing calls this directly

Calls 13

createVectorFunction · 0.85
beginMethod · 0.80
pathFlowMethod · 0.80
TimeSeriesClass · 0.50
dateTimesMethod · 0.45
sizeMethod · 0.45
endMethod · 0.45
pznMethod · 0.45
nrMethod · 0.45
valuesMethod · 0.45
getMethod · 0.45
pzmMethod · 0.45

Tested by

no test coverage detected