GCC Code Coverage Report


Directory: ./
Coverage: low: ≥ 0% medium: ≥ 75.0% high: ≥ 90.0%
Coverage Exec / Excl / Total
Lines: 54.5% 382 / 0 / 701
Functions: 40.9% 65 / 0 / 159
Branches: 70.1% 458 / 0 / 653

src/airflow/contam/PrjModelImpl.cpp
Line Branch Exec Source
1 /***********************************************************************************************************************
2 * OpenStudio(R), Copyright (c) Alliance for Energy Innovation, LLC.
3 * See also https://openstudio.net/license
4 ***********************************************************************************************************************/
5
6 #include "PrjModelImpl.hpp"
7 #include "PrjReader.hpp"
8 #include "SimFile.hpp"
9 #include <algorithm>
10
11 #include "../../utilities/core/StringHelpers.hpp"
12
13 namespace openstudio {
14 namespace contam {
15 namespace detail {
16
17 8 void IndexModelImpl::setDefaults() {
18 8 m_programName = "ContamW";
19 8 m_echo = 0;
20 8 m_skheight = 0;
21 8 m_skwidth = 0;
22 8 m_def_units = 0;
23 8 m_def_flows = 0;
24
1/1
✓ Branch 1 taken 8 times.
8 m_def_T = PRJFLOAT("0.0");
25 8 m_udefT = 0;
26
1/1
✓ Branch 1 taken 8 times.
16 m_rel_N = PRJFLOAT("0.0");
27
1/1
✓ Branch 1 taken 8 times.
8 m_wind_H = PRJFLOAT("0.0");
28 8 m_uwH = 0;
29
1/1
✓ Branch 1 taken 8 times.
16 m_wind_Ao = PRJFLOAT("0.0");
30
1/1
✓ Branch 1 taken 8 times.
16 m_wind_a = PRJFLOAT("0.0");
31
1/1
✓ Branch 1 taken 8 times.
8 m_scale = PRJFLOAT("0.0");
32 8 m_uScale = 0;
33 8 m_orgRow = 0;
34 8 m_orgCol = 0;
35 8 m_invYaxis = 0;
36 8 m_showGeom = 0;
37
1/1
✓ Branch 1 taken 8 times.
16 m_X0 = PRJFLOAT("0.0");
38
1/1
✓ Branch 1 taken 8 times.
16 m_Y0 = PRJFLOAT("0.0");
39
1/1
✓ Branch 1 taken 8 times.
16 m_Z0 = PRJFLOAT("0.0");
40
1/1
✓ Branch 1 taken 8 times.
8 m_angle = PRJFLOAT("0.0");
41 8 m_u_XYZ = 0;
42
1/1
✓ Branch 1 taken 8 times.
16 m_epsPath = PRJFLOAT("0.0");
43
1/1
✓ Branch 1 taken 8 times.
8 m_epsSpcs = PRJFLOAT("0.0");
44 8 m_useWPCwp = 0;
45 8 m_useWPCmf = 0;
46 8 m_wpctrig = 0;
47
1/1
✓ Branch 1 taken 8 times.
16 m_latd = PRJFLOAT("0.0");
48
1/1
✓ Branch 1 taken 8 times.
16 m_lgtd = PRJFLOAT("0.0");
49
1/1
✓ Branch 1 taken 8 times.
16 m_Tznr = PRJFLOAT("0.0");
50
1/1
✓ Branch 1 taken 8 times.
16 m_altd = PRJFLOAT("0.0");
51
1/1
✓ Branch 1 taken 8 times.
8 m_Tgrnd = PRJFLOAT("0.0");
52 8 m_utg = 0;
53 8 m_u_a = 0;
54 8 }
55
56
3/3
✓ Branch 11 taken 8 times.
✓ Branch 14 taken 8 times.
✓ Branch 38 taken 8 times.
8 IndexModelImpl::IndexModelImpl() {
57
1/1
✓ Branch 1 taken 8 times.
8 setDefaults();
58 8 m_valid = false;
59 8 }
60
61 ✗ IndexModelImpl::IndexModelImpl(openstudio::path path) {
62 ✗ setDefaults();
63 ✗ read(path);
64 ✗ }
65
66 ✗ IndexModelImpl::IndexModelImpl(std::string filename) {
67 ✗ setDefaults();
68 ✗ read(filename);
69 ✗ }
70
71 ✗ IndexModelImpl::IndexModelImpl(Reader& input) {
72 ✗ setDefaults();
73 ✗ read(input);
74 ✗ }
75
76 ✗ bool IndexModelImpl::read(openstudio::path path) {
77 ✗ setDefaults();
78 ✗ openstudio::filesystem::ifstream file(path);
79 ✗ m_valid = false;
80 ✗ if (file.is_open()) {
81 ✗ Reader input(file);
82 ✗ read(input);
83 ✗ }
84 ✗ return m_valid;
85 ✗ }
86
87 ✗ bool IndexModelImpl::read(std::string filename) {
88 ✗ return read(openstudio::toPath(filename));
89 }
90
91 6 bool IndexModelImpl::read(Reader& input) {
92 6 m_valid = false;
93 // Section 1: Project, Weather, Simulation, and Output Controls
94
1/1
✓ Branch 1 taken 6 times.
6 m_programName = input.readString();
95
1/1
✓ Branch 1 taken 6 times.
6 m_programVersion = input.readString();
96
1/1
✓ Branch 1 taken 6 times.
6 m_echo = input.read<int>();
97
1/1
✓ Branch 1 taken 6 times.
6 m_desc = input.readLine();
98
2/2
✓ Branch 1 taken 6 times.
✓ Branch 4 taken 6 times.
6 setSkheight(input.read<int>());
99
2/2
✓ Branch 1 taken 6 times.
✓ Branch 4 taken 6 times.
6 setSkwidth(input.read<int>());
100
2/2
✓ Branch 1 taken 6 times.
✓ Branch 4 taken 6 times.
6 setDef_units(input.read<int>());
101
2/2
✓ Branch 1 taken 6 times.
✓ Branch 4 taken 6 times.
6 setDef_flows(input.read<int>());
102
2/2
✓ Branch 1 taken 6 times.
✓ Branch 4 taken 6 times.
6 setDef_T(input.readNumber<std::string>());
103
2/2
✓ Branch 1 taken 6 times.
✓ Branch 4 taken 6 times.
6 setUdefT(input.read<int>());
104
2/2
✓ Branch 1 taken 6 times.
✓ Branch 4 taken 6 times.
6 setRel_N(input.readNumber<std::string>());
105
2/2
✓ Branch 1 taken 6 times.
✓ Branch 4 taken 6 times.
6 setWind_H(input.readNumber<std::string>());
106
2/2
✓ Branch 1 taken 6 times.
✓ Branch 4 taken 6 times.
6 setUwH(input.read<int>());
107
2/2
✓ Branch 1 taken 6 times.
✓ Branch 4 taken 6 times.
6 setWind_Ao(input.readNumber<std::string>());
108
2/2
✓ Branch 1 taken 6 times.
✓ Branch 4 taken 6 times.
6 setWind_a(input.readNumber<std::string>());
109
2/2
✓ Branch 1 taken 6 times.
✓ Branch 4 taken 6 times.
6 setScale(input.readNumber<std::string>());
110
2/2
✓ Branch 1 taken 6 times.
✓ Branch 4 taken 6 times.
6 setUScale(input.read<int>());
111
2/2
✓ Branch 1 taken 6 times.
✓ Branch 4 taken 6 times.
6 setOrgRow(input.read<int>());
112
2/2
✓ Branch 1 taken 6 times.
✓ Branch 4 taken 6 times.
6 setOrgCol(input.read<int>());
113
2/2
✓ Branch 1 taken 6 times.
✓ Branch 4 taken 6 times.
6 setInvYaxis(input.read<int>());
114
2/2
✓ Branch 1 taken 6 times.
✓ Branch 4 taken 6 times.
6 setShowGeom(input.read<int>());
115
1/1
✓ Branch 1 taken 6 times.
6 m_ssWeather.read(input);
116
1/1
✓ Branch 1 taken 6 times.
6 m_wptWeather.read(input);
117
1/1
✓ Branch 1 taken 6 times.
6 m_WTHpath = input.readLine();
118
1/1
✓ Branch 1 taken 6 times.
6 m_CTMpath = input.readLine();
119
1/1
✓ Branch 1 taken 6 times.
6 m_CVFpath = input.readLine();
120
1/1
✓ Branch 1 taken 6 times.
6 m_DVFpath = input.readLine();
121
1/1
✓ Branch 1 taken 6 times.
6 m_WPCfile = input.readLine();
122
1/1
✓ Branch 1 taken 6 times.
6 m_EWCfile = input.readLine();
123
1/1
✓ Branch 1 taken 6 times.
6 m_WPCdesc = input.readLine();
124
2/2
✓ Branch 1 taken 6 times.
✓ Branch 4 taken 6 times.
6 setX0(input.readNumber<std::string>());
125
2/2
✓ Branch 1 taken 6 times.
✓ Branch 4 taken 6 times.
6 setY0(input.readNumber<std::string>());
126
2/2
✓ Branch 1 taken 6 times.
✓ Branch 4 taken 6 times.
6 setZ0(input.readNumber<std::string>());
127
2/2
✓ Branch 1 taken 6 times.
✓ Branch 4 taken 6 times.
6 setAngle(input.readNumber<std::string>());
128
2/2
✓ Branch 1 taken 6 times.
✓ Branch 4 taken 6 times.
6 setU_XYZ(input.read<int>());
129
2/2
✓ Branch 1 taken 6 times.
✓ Branch 4 taken 6 times.
6 setEpsPath(input.readNumber<std::string>());
130
2/2
✓ Branch 1 taken 6 times.
✓ Branch 4 taken 6 times.
6 setEpsSpcs(input.readNumber<std::string>());
131
2/2
✓ Branch 1 taken 6 times.
✓ Branch 4 taken 6 times.
6 setTShift(input.readString());
132
2/2
✓ Branch 1 taken 6 times.
✓ Branch 4 taken 6 times.
6 setDStart(input.readString());
133
2/2
✓ Branch 1 taken 6 times.
✓ Branch 4 taken 6 times.
6 setDEnd(input.readString());
134
2/2
✓ Branch 1 taken 6 times.
✓ Branch 4 taken 6 times.
6 setUseWPCwp(input.read<int>());
135
2/2
✓ Branch 1 taken 6 times.
✓ Branch 4 taken 6 times.
6 setUseWPCmf(input.read<int>());
136
2/2
✓ Branch 1 taken 6 times.
✓ Branch 4 taken 6 times.
6 setWpctrig(input.read<int>());
137
2/2
✓ Branch 1 taken 6 times.
✓ Branch 4 taken 6 times.
6 setLatd(input.readNumber<std::string>());
138
2/2
✓ Branch 1 taken 6 times.
✓ Branch 4 taken 6 times.
6 setLgtd(input.readNumber<std::string>());
139
2/2
✓ Branch 1 taken 6 times.
✓ Branch 4 taken 6 times.
6 setTznr(input.readNumber<std::string>());
140
2/2
✓ Branch 1 taken 6 times.
✓ Branch 4 taken 6 times.
6 setAltd(input.readNumber<std::string>());
141
2/2
✓ Branch 1 taken 6 times.
✓ Branch 4 taken 6 times.
6 setTgrnd(input.readNumber<std::string>());
142
2/2
✓ Branch 1 taken 6 times.
✓ Branch 4 taken 6 times.
6 setUtg(input.read<int>());
143
2/2
✓ Branch 1 taken 6 times.
✓ Branch 4 taken 6 times.
6 setU_a(input.read<int>());
144
1/1
✓ Branch 1 taken 6 times.
6 m_rc.read(input); // Read the run control section
145
1/1
✓ Branch 1 taken 6 times.
6 input.read999();
146 // Section 2: Species and Contaminants
147
1/1
✓ Branch 1 taken 6 times.
6 std::vector<int> contaminants = input.readIntVector(false); // Might want to check that this matches the species data
148
2/2
✓ Branch 1 taken 6 times.
✓ Branch 4 taken 6 times.
12 m_species = input.readSectionVector<Species>("species");
149 // Section 3: Level and Icon Data
150
2/2
✓ Branch 1 taken 6 times.
✓ Branch 4 taken 6 times.
12 m_levels = input.readSectionVector<Level>("level");
151 // Section 4: Day Schedules
152
2/2
✓ Branch 1 taken 6 times.
✓ Branch 4 taken 6 times.
12 m_daySchedules = input.readSectionVector<DaySchedule>("day schedule");
153 // Section 5: Week Schedules
154
2/2
✓ Branch 1 taken 6 times.
✓ Branch 4 taken 6 times.
12 m_weekSchedules = input.readSectionVector<WeekSchedule>("week schedule");
155 // Section 6: Wind Pressure Profiles
156
2/2
✓ Branch 1 taken 6 times.
✓ Branch 4 taken 6 times.
6 m_windPressureProfiles = input.readSectionVector<WindPressureProfile>("wind pressure profiles");
157 // Section 7: Kinetic Reactions
158
1/1
✓ Branch 1 taken 6 times.
6 std::string kinr = input.readSection(); // Skip it
159
3/3
✓ Branch 1 taken 6 times.
✓ Branch 4 taken 6 times.
✓ Branch 7 taken 6 times.
12 m_unsupported["KineticReaction"] = kinr;
160 // Section 8a: Filter Elements
161
1/1
✓ Branch 1 taken 6 times.
6 std::string flte = input.readSection(); // Skip it
162
3/3
✓ Branch 1 taken 6 times.
✓ Branch 4 taken 6 times.
✓ Branch 7 taken 6 times.
12 m_unsupported["FilterElement"] = flte;
163 // Section 8b: Filters
164
1/1
✓ Branch 1 taken 6 times.
6 std::string filt = input.readSection(); // Skip it
165
3/3
✓ Branch 1 taken 6 times.
✓ Branch 4 taken 6 times.
✓ Branch 7 taken 6 times.
12 m_unsupported["Filter"] = filt;
166 // Section 9: Source/Sink Elements
167
1/1
✓ Branch 1 taken 6 times.
6 std::string cse = input.readSection(); // Skip it
168
3/3
✓ Branch 1 taken 6 times.
✓ Branch 4 taken 6 times.
✓ Branch 7 taken 6 times.
18 m_unsupported["SourceSink"] = cse;
169 // Section 10: Airflow Elements
170
2/2
✓ Branch 1 taken 6 times.
✓ Branch 4 taken 6 times.
6 m_airflowElements = input.readElementVector<AirflowElement>("airflow element");
171 // Section 11: Duct Elements
172
1/1
✓ Branch 1 taken 6 times.
6 std::string dfe = input.readSection(); // Skip it
173
3/3
✓ Branch 1 taken 6 times.
✓ Branch 4 taken 6 times.
✓ Branch 7 taken 6 times.
12 m_unsupported["DuctElement"] = dfe;
174 // Section 12a: Control Super Elements
175
1/1
✓ Branch 1 taken 6 times.
6 std::string selmt = input.readSection(); // Skip it
176
3/3
✓ Branch 1 taken 6 times.
✓ Branch 4 taken 6 times.
✓ Branch 7 taken 6 times.
18 m_unsupported["ControlSuperElements"] = selmt;
177 // Section 12b: Control Nodes
178 //std::string ctrl = input.readSection(); // Skip it
179 //m_unsupported["ControlNode"] = ctrl;
180
2/2
✓ Branch 1 taken 6 times.
✓ Branch 4 taken 6 times.
12 m_controlNodes = input.readElementVector<ControlNode>("control node");
181 // Section 13: Simple Air Handling System (AHS)
182
2/2
✓ Branch 1 taken 6 times.
✓ Branch 4 taken 6 times.
12 m_ahs = input.readSectionVector<Ahs>("ahs");
183 // Section 14: Zones
184
2/2
✓ Branch 1 taken 6 times.
✓ Branch 4 taken 6 times.
6 m_zones = input.readSectionVector<Zone>("zone");
185 // Section 15: Initial Zone Concentrations
186
1/1
✓ Branch 1 taken 6 times.
6 readZoneIc(input);
187 // Section 16: Airflow Paths
188
2/2
✓ Branch 1 taken 6 times.
✓ Branch 4 taken 6 times.
6 m_paths = input.readSectionVector<AirflowPath>("path");
189 // Section 17: Duct Junctions
190
1/1
✓ Branch 1 taken 6 times.
6 std::string jct = input.readSection(); // Skip it
191
3/3
✓ Branch 1 taken 6 times.
✓ Branch 4 taken 6 times.
✓ Branch 7 taken 6 times.
12 m_unsupported["DuctJunction"] = jct;
192 // Section 18: Initial Junction Concentrations
193
1/1
✓ Branch 1 taken 6 times.
6 std::string jctic = input.readSection(); // Skip it
194
3/3
✓ Branch 1 taken 6 times.
✓ Branch 4 taken 6 times.
✓ Branch 7 taken 6 times.
12 m_unsupported["JunctionIC"] = jctic;
195 // Section 19: Duct Segments
196
1/1
✓ Branch 1 taken 6 times.
6 std::string dct = input.readSection(); // Skip it
197
3/3
✓ Branch 1 taken 6 times.
✓ Branch 4 taken 6 times.
✓ Branch 7 taken 6 times.
12 m_unsupported["DuctSegment"] = dct;
198 // Section 20: Source/Sinks
199 //m_sourceSinks = input.readSectionVector<SourceSink>(std::string("source/sink"));
200
1/1
✓ Branch 1 taken 6 times.
6 std::string css = input.readSection(); // Skip it
201
3/3
✓ Branch 1 taken 6 times.
✓ Branch 4 taken 6 times.
✓ Branch 7 taken 6 times.
12 m_unsupported["SourceSink"] = css;
202 // Section 21: Occupancy Schedules
203
1/1
✓ Branch 1 taken 6 times.
6 std::string osch = input.readSection(); // Skip it
204
3/3
✓ Branch 1 taken 6 times.
✓ Branch 4 taken 6 times.
✓ Branch 7 taken 6 times.
12 m_unsupported["OccupancySchedule"] = osch;
205 // Section 22: Exposures
206
1/1
✓ Branch 1 taken 6 times.
6 std::string pexp = input.readSection(); // Skip it
207
3/3
✓ Branch 1 taken 6 times.
✓ Branch 4 taken 6 times.
✓ Branch 7 taken 6 times.
12 m_unsupported["Exposure"] = pexp;
208 // Section 23: Annotations
209
1/1
✓ Branch 1 taken 6 times.
6 std::string note = input.readSection(); // Skip it
210
3/3
✓ Branch 1 taken 6 times.
✓ Branch 4 taken 6 times.
✓ Branch 7 taken 6 times.
12 m_unsupported["Annotation"] = note;
211
1/1
✓ Branch 1 taken 6 times.
6 input.readEnd();
212 6 m_valid = true;
213 6 return true;
214 6 }
215
216 1 std::string IndexModelImpl::toString() {
217 1 std::string output;
218
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 1 time.
1 if (!m_valid) {
219 ✗ return output;
220 }
221 // Section 1: Project, Weather, Simulation, and Output Controls
222
7/7
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 7 taken 1 time.
✓ Branch 10 taken 1 time.
✓ Branch 13 taken 1 time.
✓ Branch 16 taken 1 time.
✓ Branch 19 taken 1 time.
1 output += m_programName + ' ' + m_programVersion + ' ' + ANY_TO_STR(m_echo) + '\n';
223
2/2
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
1 output += m_desc + '\n';
224
11/11
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 7 taken 1 time.
✓ Branch 10 taken 1 time.
✓ Branch 13 taken 1 time.
✓ Branch 16 taken 1 time.
✓ Branch 19 taken 1 time.
✓ Branch 22 taken 1 time.
✓ Branch 25 taken 1 time.
✓ Branch 28 taken 1 time.
✓ Branch 31 taken 1 time.
2 output += ANY_TO_STR(m_skheight) + ' ' + ANY_TO_STR(m_skwidth) + ' ' + ANY_TO_STR(m_def_units) + ' ' + ANY_TO_STR(m_def_flows) + ' '
225
14/14
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 7 taken 1 time.
✓ Branch 10 taken 1 time.
✓ Branch 13 taken 1 time.
✓ Branch 16 taken 1 time.
✓ Branch 19 taken 1 time.
✓ Branch 22 taken 1 time.
✓ Branch 25 taken 1 time.
✓ Branch 28 taken 1 time.
✓ Branch 31 taken 1 time.
✓ Branch 34 taken 1 time.
✓ Branch 37 taken 1 time.
✓ Branch 40 taken 1 time.
4 + ANY_TO_STR(m_def_T) + ' ' + ANY_TO_STR(m_udefT) + ' ' + ANY_TO_STR(m_rel_N) + ' ' + ANY_TO_STR(m_wind_H) + ' ' + ANY_TO_STR(m_uwH)
226
8/8
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 7 taken 1 time.
✓ Branch 10 taken 1 time.
✓ Branch 13 taken 1 time.
✓ Branch 16 taken 1 time.
✓ Branch 19 taken 1 time.
✓ Branch 22 taken 1 time.
3 + ' ' + ANY_TO_STR(m_wind_Ao) + ' ' + ANY_TO_STR(m_wind_a) + '\n';
227
11/11
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 7 taken 1 time.
✓ Branch 10 taken 1 time.
✓ Branch 13 taken 1 time.
✓ Branch 16 taken 1 time.
✓ Branch 19 taken 1 time.
✓ Branch 22 taken 1 time.
✓ Branch 25 taken 1 time.
✓ Branch 28 taken 1 time.
✓ Branch 31 taken 1 time.
2 output += ANY_TO_STR(m_scale) + ' ' + ANY_TO_STR(m_uScale) + ' ' + ANY_TO_STR(m_orgRow) + ' ' + ANY_TO_STR(m_orgCol) + ' '
228
7/7
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 7 taken 1 time.
✓ Branch 10 taken 1 time.
✓ Branch 13 taken 1 time.
✓ Branch 16 taken 1 time.
✓ Branch 19 taken 1 time.
3 + ANY_TO_STR(m_invYaxis) + ' ' + ANY_TO_STR(m_showGeom) + '\n';
229
2/2
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
1 output += m_ssWeather.write();
230
2/2
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
1 output += m_wptWeather.write();
231
2/2
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
1 output += m_WTHpath + '\n';
232
2/2
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
1 output += m_CTMpath + '\n';
233
2/2
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
1 output += m_CVFpath + '\n';
234
2/2
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
1 output += m_DVFpath + '\n';
235
2/2
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
1 output += m_WPCfile + '\n';
236
2/2
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
1 output += m_EWCfile + '\n';
237
2/2
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
1 output += m_WPCdesc + '\n';
238
15/15
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 7 taken 1 time.
✓ Branch 10 taken 1 time.
✓ Branch 13 taken 1 time.
✓ Branch 16 taken 1 time.
✓ Branch 19 taken 1 time.
✓ Branch 22 taken 1 time.
✓ Branch 25 taken 1 time.
✓ Branch 28 taken 1 time.
✓ Branch 31 taken 1 time.
✓ Branch 34 taken 1 time.
✓ Branch 37 taken 1 time.
✓ Branch 40 taken 1 time.
✓ Branch 43 taken 1 time.
1 output += ANY_TO_STR(m_X0) + ' ' + ANY_TO_STR(m_Y0) + ' ' + ANY_TO_STR(m_Z0) + ' ' + ANY_TO_STR(m_angle) + ' ' + ANY_TO_STR(m_u_XYZ) + '\n';
239
13/13
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 7 taken 1 time.
✓ Branch 10 taken 1 time.
✓ Branch 13 taken 1 time.
✓ Branch 16 taken 1 time.
✓ Branch 19 taken 1 time.
✓ Branch 22 taken 1 time.
✓ Branch 25 taken 1 time.
✓ Branch 28 taken 1 time.
✓ Branch 31 taken 1 time.
✓ Branch 34 taken 1 time.
✓ Branch 37 taken 1 time.
2 output += ANY_TO_STR(m_epsPath) + ' ' + ANY_TO_STR(m_epsSpcs) + ' ' + m_tShift + ' ' + m_dStart + ' ' + m_dEnd + ' ' + ANY_TO_STR(m_useWPCwp)
240
8/8
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 7 taken 1 time.
✓ Branch 10 taken 1 time.
✓ Branch 13 taken 1 time.
✓ Branch 16 taken 1 time.
✓ Branch 19 taken 1 time.
✓ Branch 22 taken 1 time.
3 + ' ' + ANY_TO_STR(m_useWPCmf) + ' ' + ANY_TO_STR(m_wpctrig) + '\n';
241
14/14
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 7 taken 1 time.
✓ Branch 10 taken 1 time.
✓ Branch 13 taken 1 time.
✓ Branch 16 taken 1 time.
✓ Branch 19 taken 1 time.
✓ Branch 22 taken 1 time.
✓ Branch 25 taken 1 time.
✓ Branch 28 taken 1 time.
✓ Branch 31 taken 1 time.
✓ Branch 34 taken 1 time.
✓ Branch 37 taken 1 time.
✓ Branch 40 taken 1 time.
2 output += ANY_TO_STR(m_latd) + ' ' + ANY_TO_STR(m_lgtd) + ' ' + ANY_TO_STR(m_Tznr) + ' ' + ANY_TO_STR(m_altd) + ' ' + ANY_TO_STR(m_Tgrnd) + ' '
242
7/7
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 7 taken 1 time.
✓ Branch 10 taken 1 time.
✓ Branch 13 taken 1 time.
✓ Branch 16 taken 1 time.
✓ Branch 19 taken 1 time.
3 + ANY_TO_STR(m_utg) + ' ' + ANY_TO_STR(m_u_a) + '\n';
243
2/2
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
1 output += m_rc.write();
244
1/1
✓ Branch 1 taken 1 time.
1 output += "-999\n";
245 // Section 2: Species and Contaminants
246
4/4
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 7 taken 1 time.
✓ Branch 10 taken 1 time.
2 output += writeArray(contaminants(), "contaminants:");
247
4/4
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 7 taken 1 time.
✓ Branch 10 taken 1 time.
2 output += writeSectionVector(m_species, "species:");
248 // Section 3: Level and Icon Data
249
4/4
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 7 taken 1 time.
✓ Branch 10 taken 1 time.
2 output += writeSectionVector(m_levels, "levels:");
250 // Section 4: Day Schedules
251
4/4
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 7 taken 1 time.
✓ Branch 10 taken 1 time.
2 output += writeSectionVector(m_daySchedules, "day-schedules:");
252 // Section 5: Week Schedules
253
4/4
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 7 taken 1 time.
✓ Branch 10 taken 1 time.
2 output += writeSectionVector(m_weekSchedules, "week-schedules:");
254 // Section 6: Wind Pressure Profiles
255
4/4
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 7 taken 1 time.
✓ Branch 10 taken 1 time.
1 output += writeSectionVector(m_windPressureProfiles, "wind pressure profiles:");
256 // Section 7: Kinetic Reactions
257
3/3
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 7 taken 1 time.
2 output += m_unsupported["KineticReaction"];
258 // Section 8a: Filter Elements
259
3/3
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 7 taken 1 time.
2 output += m_unsupported["FilterElement"];
260 // Section 8b: Filters
261
3/3
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 7 taken 1 time.
2 output += m_unsupported["Filter"];
262 // Section 9: Source/Sink Elements
263
3/3
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 7 taken 1 time.
3 output += m_unsupported["SourceSink"];
264 // Section 10: Airflow Elements
265
4/4
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 7 taken 1 time.
✓ Branch 10 taken 1 time.
1 output += writeSectionVector(m_airflowElements, "flow elements:");
266 // Section 11: Duct Elements
267
3/3
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 7 taken 1 time.
2 output += m_unsupported["DuctElement"];
268 // Section 12a: Control Super Elements
269
3/3
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 7 taken 1 time.
3 output += m_unsupported["ControlSuperElements"];
270 // Section 12b: Control Nodes
271 //output += m_unsupported["ControlNode"];
272
4/4
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 7 taken 1 time.
✓ Branch 10 taken 1 time.
2 output += writeSectionVector(m_controlNodes, "control nodes:");
273 // Section 13: Simple Air Handling System (AHS)
274
4/4
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 7 taken 1 time.
✓ Branch 10 taken 1 time.
2 output += writeSectionVector(m_ahs, "simple AHS:");
275 // Section 14: Zones
276
4/4
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 7 taken 1 time.
✓ Branch 10 taken 1 time.
1 output += writeSectionVector(m_zones, "zones:");
277 // Section 15: Initial Zone Concentrations
278
2/2
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
1 output += writeZoneIc();
279 // Section 16: Airflow Paths
280
4/4
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 7 taken 1 time.
✓ Branch 10 taken 1 time.
1 output += writeSectionVector(m_paths, "flow paths:");
281 // Section 17: Duct Junctions
282
3/3
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 7 taken 1 time.
2 output += m_unsupported["DuctJunction"];
283 // Section 18: Initial Junction Concentrations
284
3/3
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 7 taken 1 time.
2 output += m_unsupported["JunctionIC"];
285 // Section 19: Duct Segments
286
3/3
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 7 taken 1 time.
2 output += m_unsupported["DuctSegment"];
287 // Section 20: Source/Sinks
288
3/3
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 7 taken 1 time.
2 output += m_unsupported["SourceSink"];
289 // Section 21: Occupancy Schedules
290
3/3
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 7 taken 1 time.
2 output += m_unsupported["OccupancySchedule"];
291 // Section 22: Exposures
292
3/3
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 7 taken 1 time.
2 output += m_unsupported["Exposure"];
293 // Section 23: Annotations
294
3/3
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 7 taken 1 time.
2 output += m_unsupported["Annotation"];
295 // End of the PRJ file
296
1/1
✓ Branch 1 taken 1 time.
1 output += "* end project file.";
297 1 return output;
298 ✗ }
299
300 ✗ std::string IndexModelImpl::programName() const {
301 ✗ return m_programName;
302 }
303
304 ✗ void IndexModelImpl::setProgramName(const std::string& name) {
305 ✗ m_programName = name;
306 ✗ }
307
308 ✗ std::string IndexModelImpl::version() const {
309 ✗ return m_programVersion;
310 }
311
312 ✗ void IndexModelImpl::setVersion(const std::string& version) {
313 ✗ m_programVersion = version;
314 ✗ }
315
316 ✗ int IndexModelImpl::echo() const {
317 ✗ return m_echo;
318 }
319
320 ✗ void IndexModelImpl::setEcho(const int echo) {
321 ✗ m_echo = echo;
322 ✗ }
323
324 ✗ std::string IndexModelImpl::desc() const {
325 ✗ return m_desc;
326 }
327
328 6 void IndexModelImpl::setDesc(const std::string& prjdesc) {
329 6 m_desc = prjdesc;
330 6 }
331
332 ✗ int IndexModelImpl::skheight() const {
333 ✗ return m_skheight;
334 }
335
336 6 void IndexModelImpl::setSkheight(const int skheight) {
337 6 m_skheight = skheight;
338 6 }
339
340 ✗ int IndexModelImpl::skwidth() const {
341 ✗ return m_skwidth;
342 }
343
344 6 void IndexModelImpl::setSkwidth(const int skwidth) {
345 6 m_skwidth = skwidth;
346 6 }
347
348 ✗ int IndexModelImpl::def_units() const {
349 ✗ return m_def_units;
350 }
351
352 6 void IndexModelImpl::setDef_units(const int def_units) {
353 6 m_def_units = def_units;
354 6 }
355
356 ✗ int IndexModelImpl::def_flows() const {
357 ✗ return m_def_flows;
358 }
359
360 6 void IndexModelImpl::setDef_flows(const int def_flows) {
361 6 m_def_flows = def_flows;
362 6 }
363
364 1 double IndexModelImpl::def_T() const {
365 1 return openstudio::string_conversions::to<double>(m_def_T);
366 }
367
368 1 bool IndexModelImpl::setDef_T(const double def_T) {
369
1/1
✓ Branch 1 taken 1 time.
1 m_def_T = openstudio::string_conversions::number(def_T);
370 1 return true;
371 }
372
373 8 bool IndexModelImpl::setDef_T(const std::string& def_T) {
374 8 return assign_if_valid<double>(def_T, m_def_T);
375 }
376
377 ✗ int IndexModelImpl::udefT() const {
378 ✗ return m_udefT;
379 }
380
381 6 void IndexModelImpl::setUdefT(const int udefT) {
382 6 m_udefT = udefT;
383 6 }
384
385 ✗ double IndexModelImpl::rel_N() const {
386 ✗ return openstudio::string_conversions::to<double>(m_rel_N);
387 }
388
389 ✗ bool IndexModelImpl::setRel_N(const double rel_N) {
390 ✗ m_rel_N = openstudio::string_conversions::number(rel_N);
391 ✗ return true;
392 }
393
394 6 bool IndexModelImpl::setRel_N(const std::string& rel_N) {
395 6 return assign_if_valid<double>(rel_N, m_rel_N);
396 }
397
398 36 double IndexModelImpl::wind_H() const {
399 36 return openstudio::string_conversions::to<double>(m_wind_H);
400 }
401
402 ✗ bool IndexModelImpl::setWind_H(const double wind_H) {
403 ✗ m_wind_H = openstudio::string_conversions::number(wind_H);
404 ✗ return true;
405 }
406
407 10 bool IndexModelImpl::setWind_H(const std::string& wind_H) {
408 10 return assign_if_valid<double>(wind_H, m_wind_H);
409 }
410
411 ✗ int IndexModelImpl::uwH() const {
412 ✗ return m_uwH;
413 }
414
415 6 void IndexModelImpl::setUwH(const int uwH) {
416 6 m_uwH = uwH;
417 6 }
418
419 ✗ double IndexModelImpl::wind_Ao() const {
420 ✗ return openstudio::string_conversions::to<double>(m_wind_Ao);
421 }
422
423 ✗ bool IndexModelImpl::setWind_Ao(const double wind_Ao) {
424 ✗ m_wind_Ao = openstudio::string_conversions::number(wind_Ao);
425 ✗ return true;
426 }
427
428 6 bool IndexModelImpl::setWind_Ao(const std::string& wind_Ao) {
429 6 return assign_if_valid<double>(wind_Ao, m_wind_Ao);
430 }
431
432 ✗ double IndexModelImpl::wind_a() const {
433 ✗ return openstudio::string_conversions::to<double>(m_wind_a);
434 }
435
436 ✗ bool IndexModelImpl::setWind_a(const double wind_a) {
437 ✗ m_wind_a = openstudio::string_conversions::number(wind_a);
438 ✗ return true;
439 }
440
441 6 bool IndexModelImpl::setWind_a(const std::string& wind_a) {
442 6 return assign_if_valid<double>(wind_a, m_wind_a);
443 }
444
445 ✗ double IndexModelImpl::scale() const {
446 ✗ return openstudio::string_conversions::to<double>(m_scale);
447 }
448
449 ✗ bool IndexModelImpl::setScale(const double scale) {
450 ✗ m_scale = openstudio::string_conversions::number(scale);
451 ✗ return true;
452 }
453
454 6 bool IndexModelImpl::setScale(const std::string& scale) {
455 6 return assign_if_valid<double>(scale, m_scale);
456 }
457
458 ✗ int IndexModelImpl::uScale() const {
459 ✗ return m_uScale;
460 }
461
462 6 void IndexModelImpl::setUScale(const int uScale) {
463 6 m_uScale = uScale;
464 6 }
465
466 ✗ int IndexModelImpl::orgRow() const {
467 ✗ return m_orgRow;
468 }
469
470 6 void IndexModelImpl::setOrgRow(const int orgRow) {
471 6 m_orgRow = orgRow;
472 6 }
473
474 ✗ int IndexModelImpl::orgCol() const {
475 ✗ return m_orgCol;
476 }
477
478 6 void IndexModelImpl::setOrgCol(const int orgCol) {
479 6 m_orgCol = orgCol;
480 6 }
481
482 ✗ int IndexModelImpl::invYaxis() const {
483 ✗ return m_invYaxis;
484 }
485
486 6 void IndexModelImpl::setInvYaxis(const int invYaxis) {
487 6 m_invYaxis = invYaxis;
488 6 }
489
490 ✗ int IndexModelImpl::showGeom() const {
491 ✗ return m_showGeom;
492 }
493
494 6 void IndexModelImpl::setShowGeom(const int showGeom) {
495 6 m_showGeom = showGeom;
496 6 }
497
498 ✗ WeatherData IndexModelImpl::ssWeather() const {
499 ✗ return m_ssWeather;
500 }
501
502 ✗ void IndexModelImpl::setSsWeather(const WeatherData& ssWeather) {
503 ✗ m_ssWeather = ssWeather;
504 ✗ }
505
506 ✗ WeatherData IndexModelImpl::wptWeather() const {
507 ✗ return m_wptWeather;
508 }
509
510 ✗ void IndexModelImpl::setWptWeather(const WeatherData& wptWeather) {
511 ✗ m_wptWeather = wptWeather;
512 ✗ }
513
514 ✗ std::string IndexModelImpl::WTHpath() const {
515 ✗ return m_WTHpath;
516 }
517
518 ✗ void IndexModelImpl::setWTHpath(const std::string& WTHpath) {
519 ✗ m_WTHpath = WTHpath;
520 ✗ }
521
522 ✗ std::string IndexModelImpl::CTMpath() const {
523 ✗ return m_CTMpath;
524 }
525
526 ✗ void IndexModelImpl::setCTMpath(const std::string& CTMpath) {
527 ✗ m_CTMpath = CTMpath;
528 ✗ }
529
530 ✗ std::string IndexModelImpl::CVFpath() const {
531 ✗ return m_CVFpath;
532 }
533
534 ✗ void IndexModelImpl::setCVFpath(const std::string& CVFpath) {
535 ✗ m_CVFpath = CVFpath;
536 ✗ }
537
538 ✗ std::string IndexModelImpl::DVFpath() const {
539 ✗ return m_DVFpath;
540 }
541
542 ✗ void IndexModelImpl::setDVFpath(const std::string& DVFpath) {
543 ✗ m_DVFpath = DVFpath;
544 ✗ }
545
546 ✗ std::string IndexModelImpl::WPCfile() const {
547 ✗ return m_WPCfile;
548 }
549
550 ✗ void IndexModelImpl::setWPCfile(const std::string& WPCfile) {
551 ✗ m_WPCfile = WPCfile;
552 ✗ }
553
554 ✗ std::string IndexModelImpl::EWCfile() const {
555 ✗ return m_EWCfile;
556 }
557
558 ✗ void IndexModelImpl::setEWCfile(const std::string& EWCfile) {
559 ✗ m_EWCfile = EWCfile;
560 ✗ }
561
562 ✗ std::string IndexModelImpl::WPCdesc() const {
563 ✗ return m_WPCdesc;
564 }
565
566 ✗ void IndexModelImpl::setWPCdesc(const std::string& WPCdesc) {
567 ✗ m_WPCdesc = WPCdesc;
568 ✗ }
569
570 ✗ double IndexModelImpl::X0() const {
571 ✗ return openstudio::string_conversions::to<double>(m_X0);
572 }
573
574 ✗ bool IndexModelImpl::setX0(const double X0) {
575 ✗ m_X0 = openstudio::string_conversions::number(X0);
576 ✗ return true;
577 }
578
579 6 bool IndexModelImpl::setX0(const std::string& X0) {
580 6 return assign_if_valid<double>(X0, m_X0);
581 }
582
583 ✗ double IndexModelImpl::Y0() const {
584 ✗ return openstudio::string_conversions::to<double>(m_Y0);
585 }
586
587 ✗ bool IndexModelImpl::setY0(const double Y0) {
588 ✗ m_Y0 = openstudio::string_conversions::number(Y0);
589 ✗ return true;
590 }
591
592 6 bool IndexModelImpl::setY0(const std::string& Y0) {
593 6 return assign_if_valid<double>(Y0, m_Y0);
594 }
595
596 ✗ double IndexModelImpl::Z0() const {
597 ✗ return openstudio::string_conversions::to<double>(m_Z0);
598 }
599
600 ✗ bool IndexModelImpl::setZ0(const double Z0) {
601 ✗ m_Z0 = openstudio::string_conversions::number(Z0);
602 ✗ return true;
603 }
604
605 6 bool IndexModelImpl::setZ0(const std::string& Z0) {
606 6 return assign_if_valid<double>(Z0, m_Z0);
607 }
608
609 ✗ double IndexModelImpl::angle() const {
610 ✗ return openstudio::string_conversions::to<double>(m_angle);
611 }
612
613 ✗ bool IndexModelImpl::setAngle(const double angle) {
614 ✗ m_angle = openstudio::string_conversions::number(angle);
615 ✗ return true;
616 }
617
618 6 bool IndexModelImpl::setAngle(const std::string& angle) {
619 6 return assign_if_valid<double>(angle, m_angle);
620 }
621
622 ✗ int IndexModelImpl::u_XYZ() const {
623 ✗ return m_u_XYZ;
624 }
625
626 6 void IndexModelImpl::setU_XYZ(const int u_XYZ) {
627 6 m_u_XYZ = u_XYZ;
628 6 }
629
630 ✗ double IndexModelImpl::epsPath() const {
631 ✗ return openstudio::string_conversions::to<double>(m_epsPath);
632 }
633
634 ✗ bool IndexModelImpl::setEpsPath(const double epsPath) {
635 ✗ m_epsPath = openstudio::string_conversions::number(epsPath);
636 ✗ return true;
637 }
638
639 6 bool IndexModelImpl::setEpsPath(const std::string& epsPath) {
640 6 return assign_if_valid<double>(epsPath, m_epsPath);
641 }
642
643 ✗ double IndexModelImpl::epsSpcs() const {
644 ✗ return openstudio::string_conversions::to<double>(m_epsSpcs);
645 }
646
647 ✗ bool IndexModelImpl::setEpsSpcs(const double epsSpcs) {
648 ✗ m_epsSpcs = openstudio::string_conversions::number(epsSpcs);
649 ✗ return true;
650 }
651
652 6 bool IndexModelImpl::setEpsSpcs(const std::string& epsSpcs) {
653 6 return assign_if_valid<double>(epsSpcs, m_epsSpcs);
654 }
655
656 ✗ std::string IndexModelImpl::tShift() const {
657 ✗ return m_tShift;
658 }
659
660 6 void IndexModelImpl::setTShift(const std::string& tShift) {
661 6 m_tShift = tShift;
662 6 }
663
664 ✗ std::string IndexModelImpl::dStart() const {
665 ✗ return m_dStart;
666 }
667
668 6 void IndexModelImpl::setDStart(const std::string& dStart) {
669 6 m_dStart = dStart;
670 6 }
671
672 ✗ std::string IndexModelImpl::dEnd() const {
673 ✗ return m_dEnd;
674 }
675
676 6 void IndexModelImpl::setDEnd(const std::string& dEnd) {
677 6 m_dEnd = dEnd;
678 6 }
679
680 ✗ int IndexModelImpl::useWPCwp() const {
681 ✗ return m_useWPCwp;
682 }
683
684 6 void IndexModelImpl::setUseWPCwp(const int useWPCwp) {
685 6 m_useWPCwp = useWPCwp;
686 6 }
687
688 ✗ int IndexModelImpl::useWPCmf() const {
689 ✗ return m_useWPCmf;
690 }
691
692 6 void IndexModelImpl::setUseWPCmf(const int useWPCmf) {
693 6 m_useWPCmf = useWPCmf;
694 6 }
695
696 ✗ int IndexModelImpl::wpctrig() const {
697 ✗ return m_wpctrig;
698 }
699
700 6 void IndexModelImpl::setWpctrig(const int wpctrig) {
701 6 m_wpctrig = wpctrig;
702 6 }
703
704 ✗ double IndexModelImpl::latd() const {
705 ✗ return openstudio::string_conversions::to<double>(m_latd);
706 }
707
708 ✗ bool IndexModelImpl::setLatd(const double latd) {
709 ✗ m_latd = openstudio::string_conversions::number(latd);
710 ✗ return true;
711 }
712
713 6 bool IndexModelImpl::setLatd(const std::string& latd) {
714 6 return assign_if_valid<double>(latd, m_latd);
715 }
716
717 ✗ double IndexModelImpl::lgtd() const {
718 ✗ return openstudio::string_conversions::to<double>(m_lgtd);
719 }
720
721 ✗ bool IndexModelImpl::setLgtd(const double lgtd) {
722 ✗ m_lgtd = openstudio::string_conversions::number(lgtd);
723 ✗ return true;
724 }
725
726 6 bool IndexModelImpl::setLgtd(const std::string& lgtd) {
727 6 return assign_if_valid<double>(lgtd, m_lgtd);
728 }
729
730 ✗ double IndexModelImpl::Tznr() const {
731 ✗ return openstudio::string_conversions::to<double>(m_Tznr);
732 }
733
734 ✗ bool IndexModelImpl::setTznr(const double Tznr) {
735 ✗ m_Tznr = openstudio::string_conversions::number(Tznr);
736 ✗ return true;
737 }
738
739 6 bool IndexModelImpl::setTznr(const std::string& Tznr) {
740 6 return assign_if_valid<double>(Tznr, m_Tznr);
741 }
742
743 ✗ double IndexModelImpl::altd() const {
744 ✗ return openstudio::string_conversions::to<double>(m_altd);
745 }
746
747 ✗ bool IndexModelImpl::setAltd(const double altd) {
748 ✗ m_altd = openstudio::string_conversions::number(altd);
749 ✗ return true;
750 }
751
752 6 bool IndexModelImpl::setAltd(const std::string& altd) {
753 6 return assign_if_valid<double>(altd, m_altd);
754 }
755
756 ✗ double IndexModelImpl::Tgrnd() const {
757 ✗ return openstudio::string_conversions::to<double>(m_Tgrnd);
758 }
759
760 ✗ bool IndexModelImpl::setTgrnd(const double Tgrnd) {
761 ✗ m_Tgrnd = openstudio::string_conversions::number(Tgrnd);
762 ✗ return true;
763 }
764
765 6 bool IndexModelImpl::setTgrnd(const std::string& Tgrnd) {
766 6 return assign_if_valid<double>(Tgrnd, m_Tgrnd);
767 }
768
769 ✗ int IndexModelImpl::utg() const {
770 ✗ return m_utg;
771 }
772
773 6 void IndexModelImpl::setUtg(const int utg) {
774 6 m_utg = utg;
775 6 }
776
777 ✗ int IndexModelImpl::u_a() const {
778 ✗ return m_u_a;
779 }
780
781 6 void IndexModelImpl::setU_a(const int u_a) {
782 6 m_u_a = u_a;
783 6 }
784
785 5 RunControl IndexModelImpl::rc() const {
786 5 return m_rc;
787 }
788 ✗ void IndexModelImpl::setRc(const RunControl& rc) {
789 ✗ m_rc = rc;
790 ✗ }
791
792 8 std::vector<int> IndexModelImpl::contaminants() {
793 8 std::vector<int> active;
794 8 int nr = 1;
795
2/2
✓ Branch 4 taken 11 times.
✓ Branch 5 taken 8 times.
19 for (Species& species : m_species) {
796
1/1
✓ Branch 1 taken 11 times.
11 species.setNr(nr);
797
3/3
✓ Branch 1 taken 11 times.
✓ Branch 3 taken 2 times.
✓ Branch 4 taken 9 times.
11 if (species.sflag()) {
798
1/1
✓ Branch 1 taken 2 times.
2 active.push_back(nr);
799 }
800 11 nr++;
801 }
802 16 return active;
803 ✗ }
804
805 7 std::vector<Species> IndexModelImpl::species() const {
806 7 return m_species;
807 }
808
809 ✗ void IndexModelImpl::setSpecies(const std::vector<Species>& species) {
810 ✗ m_species = species;
811 ✗ }
812
813 2 void IndexModelImpl::addSpecies(Species& species) {
814 2 species.setNr(m_species.size() + 1);
815 2 m_species.push_back(species);
816 2 }
817
818 4 bool IndexModelImpl::removeSpecies(const Species& species) {
819 4 unsigned originalSize = m_species.size();
820
2/2
✓ Branch 5 taken 4 times.
✓ Branch 9 taken 4 times.
8 m_species.erase(std::remove_if(m_species.begin(), m_species.end(), [&](Species s) { return s == species; }), m_species.end());
821 // There's probably a better way to do this
822
2/2
✓ Branch 1 taken 2 times.
✓ Branch 2 taken 2 times.
4 if (m_species.size() != originalSize) {
823 2 renumberVector(m_species);
824 2 return true;
825 }
826 2 return false;
827 }
828
829 58 std::vector<Level> IndexModelImpl::levels() const {
830 58 return m_levels;
831 }
832
833 6 void IndexModelImpl::setLevels(const std::vector<Level>& levels) {
834 // This could use some validation, but we don't want to interfere too much in the loaded PRJ data
835 6 m_levels = levels;
836 6 }
837
838 6 void IndexModelImpl::addLevel(Level& level) {
839 6 double refHt = 0;
840
2/2
✓ Branch 1 taken 2 times.
✓ Branch 2 taken 4 times.
6 if (!m_levels.empty()) {
841 // Note that CONTAM stores heights in meters, so this next statement requires no conversion
842 2 refHt = m_levels[m_levels.size() - 1].refht() + m_levels[m_levels.size() - 1].delht();
843 }
844 6 level.setNr(m_levels.size() + 1);
845 6 level.setRefht(refHt);
846 6 m_levels.push_back(level);
847 6 }
848
849 ✗ std::vector<DaySchedule> IndexModelImpl::daySchedules() const {
850 ✗ return m_daySchedules;
851 }
852
853 ✗ void IndexModelImpl::setDaySchedules(const std::vector<DaySchedule>& daySchedules) {
854 ✗ m_daySchedules = daySchedules;
855 ✗ }
856
857 ✗ std::vector<WeekSchedule> IndexModelImpl::weekSchedules() const {
858 ✗ return m_weekSchedules;
859 }
860 ✗ void IndexModelImpl::setWeekSchedules(const std::vector<WeekSchedule>& weekSchedules) {
861 ✗ m_weekSchedules = weekSchedules;
862 ✗ }
863
864 ✗ std::vector<WindPressureProfile> IndexModelImpl::windPressureProfiles() const {
865 ✗ return m_windPressureProfiles;
866 }
867 ✗ void IndexModelImpl::setWindPressureProfiles(const std::vector<WindPressureProfile>& windPressureProfiles) {
868 ✗ m_windPressureProfiles = windPressureProfiles;
869 ✗ }
870
871 30 std::vector<Ahs> IndexModelImpl::ahs() const {
872 30 return m_ahs;
873 }
874
875 ✗ void IndexModelImpl::setAhs(const std::vector<Ahs>& ahs) {
876 ✗ m_ahs = ahs;
877 ✗ }
878
879 3 void IndexModelImpl::addAhs(Ahs& ahs) {
880 3 ahs.setNr(m_ahs.size() + 1);
881 3 m_ahs.push_back(ahs);
882 3 }
883
884 60 std::vector<Zone> IndexModelImpl::zones() const {
885 60 return m_zones;
886 }
887
888 ✗ void IndexModelImpl::setZones(const std::vector<Zone>& zones) {
889 ✗ m_zones = zones;
890 ✗ }
891
892 18 void IndexModelImpl::addZone(Zone& zone) {
893 18 zone.setNr(m_zones.size() + 1);
894 18 m_zones.push_back(zone);
895 18 }
896
897 6 bool IndexModelImpl::valid() const {
898 6 return m_valid;
899 }
900
901 26 std::vector<AirflowPath> IndexModelImpl::airflowPaths() const {
902 26 return m_paths;
903 }
904
905 ✗ void IndexModelImpl::setAirflowPaths(const std::vector<AirflowPath>& paths) {
906 ✗ m_paths = paths;
907 ✗ }
908
909 69 void IndexModelImpl::addAirflowPath(AirflowPath& path) {
910 69 path.setNr(m_paths.size() + 1);
911 69 m_paths.push_back(path);
912 69 }
913
914 6 void IndexModelImpl::readZoneIc(Reader& input) {
915 6 unsigned int nn = input.readUInt();
916
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 6 times.
6 if (nn != 0) {
917 ✗ unsigned int nctm = contaminants().size();
918 ✗ if (nn != nctm * m_zones.size()) {
919 ✗ LOG_FREE_AND_THROW("openstudio.contam.ForwardTranslator", "Mismatch between number of zones, contaminants, and initial conditions");
920 }
921 ✗ for (unsigned int i = 0; i < m_zones.size(); i++) {
922 ✗ unsigned int nr = input.readUInt();
923 ✗ if (nr != i + 1) {
924 ✗ LOG_FREE_AND_THROW("openstudio.contam.ForwardTranslator",
925 "Mismatch between zone IC number and zone number at line " << input.lineNumber());
926 }
927 ✗ std::vector<std::string> ic;
928 ✗ for (unsigned int j = 0; j < nctm; j++) {
929 ✗ ic.push_back(input.readNumber<std::string>());
930 }
931 ✗ m_zones[i].setIc(ic);
932 ✗ }
933 }
934
2/2
✓ Branch 1 taken 6 times.
✓ Branch 4 taken 6 times.
6 input.read999("Failed to find zone IC section termination");
935 6 }
936
937 1 std::string IndexModelImpl::writeZoneIc(int start) {
938 1 int offset = 1;
939
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 1 time.
1 if (start != 0) {
940 ✗ offset = 1 - start;
941 }
942
1/1
✓ Branch 1 taken 1 time.
1 int ncontaminants = contaminants().size();
943 1 int nctm = ncontaminants * (m_zones.size() - start);
944
2/2
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
1 std::string string = ANY_TO_STR(nctm) + " ! initial zone concentrations:\n";
945
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 1 time.
1 if (nctm != 0) {
946 ✗ for (unsigned i = start; i < m_zones.size(); i++) {
947 ✗ string += ANY_TO_STR(i + offset);
948 ✗ for (unsigned j = 0; j < (unsigned)ncontaminants; j++) {
949 ✗ string += ' ' + ANY_TO_STR(m_zones[i].ic(j));
950 }
951 ✗ string += '\n';
952 }
953 }
954
1/1
✓ Branch 1 taken 1 time.
2 return string + "-999\n";
955 1 }
956
957 24 int IndexModelImpl::airflowElementNrByName(std::string name) const {
958
1/2
✓ Branch 1 taken 234 times.
✗ Branch 2 not taken.
234 for (unsigned i = 0; i < m_airflowElements.size(); i++) {
959
3/3
✓ Branch 3 taken 234 times.
✓ Branch 7 taken 24 times.
✓ Branch 8 taken 210 times.
234 if (m_airflowElements[i]->name() == name) {
960 24 return m_airflowElements[i]->nr();
961 }
962 }
963 ✗ return 0;
964 }
965
966 1 std::vector<std::vector<int>> IndexModelImpl::zoneExteriorFlowPaths() {
967
1/1
✓ Branch 2 taken 1 time.
1 std::vector<std::vector<int>> paths(m_zones.size());
968
969
2/2
✓ Branch 1 taken 26 times.
✓ Branch 2 taken 1 time.
27 for (unsigned int i = 0; i < m_paths.size(); i++) {
970
3/3
✓ Branch 2 taken 26 times.
✓ Branch 4 taken 1 time.
✓ Branch 5 taken 25 times.
26 if (m_paths[i].pzn() == -1) {
971
1/1
✓ Branch 2 taken 1 time.
1 int nr = m_paths[i].pzm();
972
3/6
✓ Branch 0 taken 1 time.
✗ Branch 1 not taken.
✓ Branch 3 taken 1 time.
✗ Branch 4 not taken.
✓ Branch 5 taken 1 time.
✗ Branch 6 not taken.
1 if (nr > 0 && (unsigned int)nr <= m_zones.size()) {
973
2/2
✓ Branch 3 taken 1 time.
✓ Branch 6 taken 1 time.
1 paths[nr - 1].push_back(-m_paths[i].nr()); // This flow path is negative for flow into zone
974 }
975
3/3
✓ Branch 2 taken 25 times.
✓ Branch 4 taken 13 times.
✓ Branch 5 taken 12 times.
25 } else if (m_paths[i].pzm() == -1) {
976
1/1
✓ Branch 2 taken 13 times.
13 int nr = m_paths[i].pzn();
977
3/6
✓ Branch 0 taken 13 times.
✗ Branch 1 not taken.
✓ Branch 3 taken 13 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 13 times.
✗ Branch 6 not taken.
13 if (nr > 0 && (unsigned int)nr <= m_zones.size()) {
978
2/2
✓ Branch 3 taken 13 times.
✓ Branch 6 taken 13 times.
13 paths[nr - 1].push_back(m_paths[i].nr()); // This flow path is positive for flow into zone
979 }
980 }
981 }
982 1 return paths;
983 ✗ }
984
985 ✗ std::vector<TimeSeries> IndexModelImpl::zoneInfiltration(SimFile* sim) {
986 // This should probably include a lot more checks of things and is written in
987 // somewhat strange way to avoid taking too much advantage of the specifics
988 // of the text form outputs.
989 ✗ std::vector<TimeSeries> results;
990 ✗ std::vector<std::vector<int>> paths = zoneExteriorFlowPaths();
991 ✗ unsigned int ntimes = sim->dateTimes().size();
992 ✗ for (unsigned int i = 0; i < m_zones.size(); i++) {
993 // This is lame, but I can't tell for sure if the values of a Vector are actually zero.
994 ✗ Vector inf = createVector(std::vector<double>(ntimes, 0));
995 ✗ for (unsigned int j = 0; j < paths[i].size(); j++) {
996 ✗ if (paths[i][j] > 0) // Positive values are infiltration
997 {
998 ✗ boost::optional<openstudio::TimeSeries> optFlow = sim->pathFlow(paths[i][j]);
999 ✗ if (optFlow) {
1000 ✗ Vector flow = optFlow.get().values();
1001 ✗ for (unsigned int k = 0; k < ntimes; k++) {
1002 ✗ if (flow[k] > 0) {
1003 ✗ inf[k] += flow[k];
1004 }
1005 }
1006 ✗ } else {
1007 // Perhaps a warning? This shouldn't really happen unless someone has excluded a path from the
1008 // results file for some reason - which is unlikely to be accidental. So there must be a good reason
1009 // for getting here, and for now we won't issue a warning.
1010 }
1011 ✗ } else // Negative values are infiltration
1012 {
1013 ✗ boost::optional<openstudio::TimeSeries> optFlow = sim->pathFlow(paths[i][j]);
1014 ✗ if (optFlow) {
1015 ✗ Vector flow = optFlow.get().values();
1016 ✗ for (unsigned int k = 0; k < ntimes; k++) {
1017 ✗ if (flow[k] < 0) {
1018 ✗ inf[k] -= flow[k];
1019 }
1020 }
1021 ✗ } else {
1022 // See above comment
1023 }
1024 ✗ }
1025 }
1026 ✗ results.push_back(openstudio::TimeSeries(sim->dateTimes(), inf, "kg/s"));
1027 ✗ }
1028 ✗ return results;
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
1089 } // namespace detail
1090 } // namespace contam
1091 } // namespace openstudio
1092