-
Notifications
You must be signed in to change notification settings - Fork 26
Expand file tree
/
Copy pathtest_validation.rb
More file actions
2434 lines (2384 loc) · 209 KB
/
test_validation.rb
File metadata and controls
2434 lines (2384 loc) · 209 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
# frozen_string_literal: true
require_relative '../resources/minitest_helper'
require 'openstudio'
require 'fileutils'
require_relative '../measure.rb'
require 'csv'
require_relative '../resources/xmlhelper.rb'
require_relative '../resources/xmlvalidator.rb'
require_relative 'util.rb'
class HPXMLtoOpenStudioValidationTest < Minitest::Test
def setup
@root_path = File.absolute_path(File.join(File.dirname(__FILE__), '..', '..'))
@sample_files_path = File.join(@root_path, 'workflow', 'sample_files')
schema_path = File.absolute_path(File.join(@root_path, 'HPXMLtoOpenStudio', 'resources', 'hpxml_schema', 'HPXML.xsd'))
@schema_validator = XMLValidator.get_xml_validator(schema_path)
@schematron_path = File.join(@root_path, 'HPXMLtoOpenStudio', 'resources', 'hpxml_schematron', 'EPvalidator.sch')
@schematron_validator = XMLValidator.get_xml_validator(@schematron_path)
@tmp_hpxml_path = File.join(File.dirname(__FILE__), 'tmp.xml')
@tmp_csv_path = File.join(@sample_files_path, 'tmp.csv')
@default_schedules_csv_data = Defaults.get_schedules_csv_data()
end
def teardown
cleanup_output_files([@tmp_hpxml_path, @tmp_csv_path])
end
def test_validation_of_schematron_doc
# Check that the schematron file is valid
schematron_schema_path = File.absolute_path(File.join(@root_path, 'HPXMLtoOpenStudio', 'resources', 'hpxml_schematron', 'iso-schematron.xsd'))
schematron_schema_validator = XMLValidator.get_xml_validator(schematron_schema_path)
_test_schema_validation(@schematron_path, schematron_schema_validator)
end
# Test for consistent use of errors/warnings
def test_role_attributes_in_schematron_doc
puts
puts 'Checking for correct role attributes...'
schematron_doc = XMLHelper.parse_file(@schematron_path)
# check that every assert element has a role attribute
XMLHelper.get_elements(schematron_doc, '/sch:schema/sch:pattern/sch:rule/sch:assert').each do |assert_element|
assert_test = XMLHelper.get_attribute_value(assert_element, 'test').gsub('h:', '')
role_attribute = XMLHelper.get_attribute_value(assert_element, 'role')
if role_attribute.nil?
fail "No attribute \"role='ERROR'\" found for assertion test: #{assert_test}"
end
assert_equal('ERROR', role_attribute)
end
# check that every report element has a role attribute
XMLHelper.get_elements(schematron_doc, '/sch:schema/sch:pattern/sch:rule/sch:report').each do |report_element|
report_test = XMLHelper.get_attribute_value(report_element, 'test').gsub('h:', '')
role_attribute = XMLHelper.get_attribute_value(report_element, 'role')
if role_attribute.nil?
fail "No attribute \"role='WARN'\" found for report test: #{report_test}"
end
assert_equal('WARN', role_attribute)
end
end
# Test errors are correctly triggered during the XSD schema or Schematron validation
def test_schema_schematron_error_messages
# Test case => Error message(s)
all_expected_errors = { 'boiler-invalid-afue' => ['Expected AnnualHeatingEfficiency[Units="AFUE"]/Value to be less than or equal to 1'],
'clothes-dryer-location' => ['A location is specified as "garage" but no surfaces were found adjacent to this space type.'],
'clothes-washer-location' => ['A location is specified as "garage" but no surfaces were found adjacent to this space type.'],
'cooking-range-location' => ['A location is specified as "garage" but no surfaces were found adjacent to this space type.'],
'dehumidifier-fraction-served' => ['Expected sum(FractionDehumidificationLoadServed) to be less than or equal to 1 [context: /HPXML/Building/BuildingDetails, id: "MyBuilding"]'],
'dhw-frac-load-served' => ['Expected sum(FractionDHWLoadServed) to be 1 [context: /HPXML/Building/BuildingDetails, id: "MyBuilding"]'],
'dhw-invalid-ef-tank' => ['Expected EnergyFactor to be less than 1 [context: /HPXML/Building/BuildingDetails/Systems/WaterHeating/WaterHeatingSystem[WaterHeaterType="storage water heater"], id: "WaterHeatingSystem1"]'],
'dhw-invalid-uef-tank-heat-pump' => ['Expected UniformEnergyFactor to be greater than 1 [context: /HPXML/Building/BuildingDetails/Systems/WaterHeating/WaterHeatingSystem[WaterHeaterType="heat pump water heater"], id: "WaterHeatingSystem1"]'],
'dishwasher-location' => ['A location is specified as "garage" but no surfaces were found adjacent to this space type.'],
'duct-leakage-cfm25' => ["The value '-2.0' is less than the minimum value allowed",
"The value '-3.0' is less than the minimum value allowed"],
'duct-leakage-cfm50' => ["The value '-2.0' is less than the minimum value allowed",
"The value '-3.0' is less than the minimum value allowed"],
'duct-leakage-percent' => ['Expected Value to be less than 1 [context: /HPXML/Building/BuildingDetails/Systems/HVAC/HVACDistribution/DistributionSystemType/AirDistribution/DuctLeakageMeasurement/DuctLeakage[Units="Percent"], id: "HVACDistribution1"]'],
'duct-location' => ['A location is specified as "garage" but no surfaces were found adjacent to this space type.'],
'duct-location-unconditioned-space' => ["Expected DuctLocation to be 'conditioned space' or 'basement - conditioned' or 'basement - unconditioned' or 'crawlspace - vented' or 'crawlspace - unvented' or 'crawlspace - conditioned' or 'attic - vented' or 'attic - unvented' or 'garage' or 'exterior wall' or 'under slab' or 'roof deck' or 'outside' or 'other housing unit' or 'other heated space' or 'other multifamily buffer space' or 'other non-freezing space' or 'manufactured home belly' [context: /HPXML/Building/BuildingDetails/Systems/HVAC/HVACDistribution/DistributionSystemType/AirDistribution/Ducts, id: \"Ducts1\"]",
"Expected DuctLocation to be 'conditioned space' or 'basement - conditioned' or 'basement - unconditioned' or 'crawlspace - vented' or 'crawlspace - unvented' or 'crawlspace - conditioned' or 'attic - vented' or 'attic - unvented' or 'garage' or 'exterior wall' or 'under slab' or 'roof deck' or 'outside' or 'other housing unit' or 'other heated space' or 'other multifamily buffer space' or 'other non-freezing space' or 'manufactured home belly' [context: /HPXML/Building/BuildingDetails/Systems/HVAC/HVACDistribution/DistributionSystemType/AirDistribution/Ducts, id: \"Ducts2\"]"],
'emissions-electricity-schedule' => ['Expected NumberofHeaderRows to be greater than or equal to 0',
'Expected ColumnNumber to be greater than or equal to 1'],
'enclosure-attic-missing-roof' => ['There must be at least one roof adjacent to "attic - unvented". [context: /HPXML/Building/BuildingDetails/Enclosure[*/*[InteriorAdjacentTo="attic - unvented" or ExteriorAdjacentTo="attic - unvented"]], id: "MyBuilding"]'],
'enclosure-basement-missing-exterior-foundation-wall' => ['There must be at least one exterior wall or foundation wall adjacent to "basement - unconditioned". [context: /HPXML/Building/BuildingDetails/Enclosure[*/*[InteriorAdjacentTo="basement - unconditioned" or ExteriorAdjacentTo="basement - unconditioned"]], id: "MyBuilding"]'],
'enclosure-basement-missing-slab' => ['There must be at least one slab adjacent to "basement - unconditioned". [context: /HPXML/Building/BuildingDetails/Enclosure[*/*[InteriorAdjacentTo="basement - unconditioned" or ExteriorAdjacentTo="basement - unconditioned"]], id: "MyBuilding"]'],
'enclosure-floor-area-exceeds-cfa' => ['Expected ConditionedFloorArea to be greater than or equal to the sum of conditioned slab/floor areas. [context: /HPXML/Building/BuildingDetails/BuildingSummary/BuildingConstruction, id: "MyBuilding"]'],
'enclosure-floor-area-exceeds-cfa2' => ['Expected ConditionedFloorArea to be greater than or equal to the sum of conditioned slab/floor areas. [context: /HPXML/Building/BuildingDetails/BuildingSummary/BuildingConstruction, id: "MyBuilding"]'],
'enclosure-garage-missing-exterior-wall' => ['There must be at least one exterior wall or foundation wall adjacent to "garage". [context: /HPXML/Building/BuildingDetails/Enclosure[*/*[InteriorAdjacentTo="garage" or ExteriorAdjacentTo="garage"]], id: "MyBuilding"]'],
'enclosure-garage-missing-roof-ceiling' => ['There must be at least one roof or ceiling adjacent to "garage". [context: /HPXML/Building/BuildingDetails/Enclosure[*/*[InteriorAdjacentTo="garage" or ExteriorAdjacentTo="garage"]], id: "MyBuilding"]'],
'enclosure-garage-missing-slab' => ['There must be at least one slab adjacent to "garage". [context: /HPXML/Building/BuildingDetails/Enclosure[*/*[InteriorAdjacentTo="garage" or ExteriorAdjacentTo="garage"]], id: "MyBuilding"]'],
'enclosure-conditioned-missing-ceiling-roof' => ['There must be at least one ceiling or roof adjacent to conditioned space. [context: /HPXML/Building/BuildingDetails/Enclosure[*/*[InteriorAdjacentTo="conditioned space"]], id: "MyBuilding"]',
'There must be at least one floor adjacent to "attic - unvented". [context: /HPXML/Building/BuildingDetails/Enclosure[*/*[InteriorAdjacentTo="attic - unvented" or ExteriorAdjacentTo="attic - unvented"]], id: "MyBuilding"]'],
'enclosure-conditioned-missing-exterior-wall' => ['There must be at least one exterior wall adjacent to conditioned space. [context: /HPXML/Building/BuildingDetails/Enclosure[*/*[InteriorAdjacentTo="conditioned space"]], id: "MyBuilding"]'],
'enclosure-conditioned-missing-floor-slab' => ['There must be at least one floor or slab adjacent to conditioned space. [context: /HPXML/Building/BuildingDetails/Enclosure[*/*[InteriorAdjacentTo="conditioned space"]], id: "MyBuilding"]'],
'frac-sensible-latent-fuel-load-values' => ['Expected extension/FracSensible to be greater than or equal to 0 [context: /HPXML/Building/BuildingDetails/MiscLoads/FuelLoad[extension/FracSensible | extension/FracLatent], id: "FuelLoad1"]',
'Expected extension/FracLatent to be greater than or equal to 0 [context: /HPXML/Building/BuildingDetails/MiscLoads/FuelLoad[extension/FracSensible | extension/FracLatent], id: "FuelLoad1"]'],
'frac-sensible-latent-fuel-load-presence' => ['Expected extension/FracLatent [context: /HPXML/Building/BuildingDetails/MiscLoads/FuelLoad[extension/FracSensible | extension/FracLatent], id: "FuelLoad1"]'],
'frac-sensible-latent-plug-load-values' => ['Expected extension/FracSensible to be greater than or equal to 0 [context: /HPXML/Building/BuildingDetails/MiscLoads/PlugLoad[extension/FracSensible | extension/FracLatent], id: "PlugLoad1"]',
'Expected extension/FracLatent to be greater than or equal to 0 [context: /HPXML/Building/BuildingDetails/MiscLoads/PlugLoad[extension/FracSensible | extension/FracLatent], id: "PlugLoad1"]'],
'frac-sensible-latent-plug-load-presence' => ['Expected extension/FracSensible [context: /HPXML/Building/BuildingDetails/MiscLoads/PlugLoad[extension/FracSensible | extension/FracLatent], id: "PlugLoad1"'],
'frac-total-fuel-load' => ['Expected sum of extension/FracSensible and extension/FracLatent to be less than or equal to 1 [context: /HPXML/Building/BuildingDetails/MiscLoads/FuelLoad[extension/FracSensible | extension/FracLatent], id: "FuelLoad1"]'],
'frac-total-plug-load' => ['Expected sum of extension/FracSensible and extension/FracLatent to be less than or equal to 1 [context: /HPXML/Building/BuildingDetails/MiscLoads/PlugLoad[extension/FracSensible | extension/FracLatent], id: "PlugLoad2"]'],
'furnace-invalid-afue' => ['Expected AnnualHeatingEfficiency[Units="AFUE"]/Value to be less than or equal to 1'],
'generator-number-of-bedrooms-served' => ['Expected NumberofBedroomsServed to be greater than ../../../../BuildingSummary/BuildingConstruction/NumberofBedrooms [context: /HPXML/Building/BuildingDetails/Systems/extension/Generators/Generator[IsSharedSystem="true"], id: "Generator1"]'],
'generator-output-greater-than-consumption' => ['Expected AnnualConsumptionkBtu to be greater than AnnualOutputkWh*3412 [context: /HPXML/Building/BuildingDetails/Systems/extension/Generators/Generator, id: "Generator1"]'],
'heat-pump-backup-sizing' => ["Expected HeatPumpBackupSizingMethodology to be 'emergency' or 'supplemental'"],
'heat-pump-separate-backup-inputs' => ['Expected no BackupAnnualHeatingEfficiency',
'Expected no BackupHeatingCapacity',
'Expected no extension/BackupHeatingAutosizingFactor'],
'heat-pump-capacity-17f-value' => ['Expected HeatingCapacity17F to be less than or equal to HeatingCapacity'],
'heat-pump-capacity-17f-presence' => ['Expected HeatingCapacity if HeatingCapacity17F is specified'],
'heat-pump-lockout-temperatures' => ['Expected CompressorLockoutTemperature to be less than or equal to BackupHeatingLockoutTemperature'],
'heat-pump-multiple-backup-systems' => ['Expected at most one HeatPump/BackupSystem [context: /HPXML/Building/BuildingDetails, id: "MyBuilding"]'],
'hvac-detailed-performance-bad-odbs' => ['Expected PerformanceDataPoint/OutdoorTemperature to be 47, 17, 5, or <5',
'Expected PerformanceDataPoint/OutdoorTemperature to be 82, 95, or >95'],
'hvac-detailed-performance-inconsistent-capacities' => ['Expected ../../HeatingCapacity to be equal to Capacity',
'Expected ../../HeatingCapacity17F to be equal to Capacity',
'Expected ../../CoolingCapacity to be equal to Capacity'],
'hvac-detailed-performance-inconsistent-capacity-fractions' => ['Expected CapacityFractionOfNominal to be 1.0',
'Expected CapacityFractionOfNominal to be 1.0'],
'hvac-detailed-performance-incomplete-pair' => ['Cooling detailed performance data for outdoor temperature > 95.0 is incomplete; there must be exactly one minimum and one maximum capacity datapoint.',
'Heating detailed performance data for outdoor temperature < 5.0 is incomplete; there must be exactly one minimum and one maximum capacity datapoint.'],
'hvac-detailed-performance-invalid-data' => ['Cooling detailed performance data for outdoor temperature = 82.0 is invalid; Power (capacity / COP) at minimum capacity must be less than power at maximum capacity.',
'Cooling detailed performance data for outdoor temperature = 95.0 is invalid; Minimum capacity must be less than maximum capacity.',
'Cooling detailed performance data for outdoor temperature = 95.0 is invalid; Minimum capacity must be less than or equal to nominal capacity.',
'Heating detailed performance data for outdoor temperature = 47.0 is invalid; Power (capacity / COP) at minimum capacity must be less than power at maximum capacity.',
'Heating detailed performance data for outdoor temperature = 47.0 is invalid; Power (capacity / COP) at minimum capacity must be less than or equal to power at nominal capacity.',
'Heating detailed performance data for outdoor temperature = 5.0 is invalid; Minimum capacity must be less than maximum capacity.'],
'hvac-distribution-return-duct-leakage-missing' => ['Expected DuctLeakageMeasurement[DuctType="return"]/DuctLeakage[(Units="CFM25" or Units="CFM50" or Units="Percent") and TotalOrToOutside="to outside"] [context: /HPXML/Building/BuildingDetails/Systems/HVAC/HVACDistribution/DistributionSystemType/AirDistribution[AirDistributionType[text()="regular velocity" or text()="gravity"]], id: "HVACDistribution1"]'],
'hvac-frac-load-served' => ['Expected sum(FractionHeatLoadServed) to be less than or equal to 1 [context: /HPXML/Building/BuildingDetails, id: "MyBuilding"]',
'Expected sum(FractionCoolLoadServed) to be less than or equal to 1 [context: /HPXML/Building/BuildingDetails, id: "MyBuilding"]'],
'hvac-gshp-invalid-bore-config' => ["Expected BorefieldConfiguration to be 'Rectangle' or 'Open Rectangle' or 'C' or 'L' or 'U' or 'Lopsided U' [context: /HPXML/Building/BuildingDetails/Systems/HVAC/HVACPlant/GeothermalLoop, id: \"GeothermalLoop1\"]"],
'hvac-gshp-invalid-bore-depth-low' => ['Expected BoreholesOrTrenches/Length to be greater than or equal to 80 [context: /HPXML/Building/BuildingDetails/Systems/HVAC/HVACPlant/GeothermalLoop, id: "GeothermalLoop1"]'],
'hvac-gshp-invalid-bore-depth-high' => ['Expected BoreholesOrTrenches/Length to be less than or equal to 500 [context: /HPXML/Building/BuildingDetails/Systems/HVAC/HVACPlant/GeothermalLoop, id: "GeothermalLoop1"]'],
'hvac-gshp-autosized-count-not-rectangle' => ["Expected BoreholesOrTrenches/Count if extension/BorefieldConfiguration is not 'Rectangle' [context: /HPXML/Building/BuildingDetails/Systems/HVAC/HVACPlant/GeothermalLoop, id: \"GeothermalLoop1\"]"],
'hvac-invalid-fan-model-type' => ["Expected extension/FanMotorType to be 'PSC' or 'BPM'"],
'hvac-invalid-eer' => ['Expected EER to be less than SEER.'],
'hvac-invalid-eer2' => ['Expected EER2 to be less than or equal to SEER2.'],
'hvac-location-heating-system' => ['A location is specified as "basement - unconditioned" but no surfaces were found adjacent to this space type.'],
'hvac-location-cooling-system' => ['A location is specified as "basement - unconditioned" but no surfaces were found adjacent to this space type.'],
'hvac-location-heat-pump' => ['A location is specified as "basement - unconditioned" but no surfaces were found adjacent to this space type.'],
'hvac-msac-not-var-speed' => ["Expected CompressorType to be 'variable speed'"],
'hvac-mshp-not-var-speed' => ["Expected CompressorType to be 'variable speed'"],
'hvac-research-features-timestep-ten-mins' => ['Expected Timestep to be 1 if OnOffThermostatDeadbandTemperature is specified',
'Expected Timestep to be 1 if HeatPumpBackupCapacityIncrement is specified'],
'hvac-research-features-timestep-missing' => ['Expected Timestep to be 1 if OnOffThermostatDeadbandTemperature is specified',
'Expected Timestep to be 1 if HeatPumpBackupCapacityIncrement is specified'],
'hvac-research-features-onoff-thermostat-heat-load-fraction-partial' => ['Expected sum(FractionHeatLoadServed) to be equal to 1'],
'hvac-research-features-onoff-thermostat-cool-load-fraction-partial' => ['Expected sum(FractionCoolLoadServed) to be equal to 1'],
'hvac-research-features-onoff-thermostat-negative-value' => ['Expected OnOffThermostatDeadbandTemperature to be greater than 0'],
'hvac-research-features-onoff-thermostat-two-heat-pumps' => ['Expected at most one cooling system for each Building',
'Expected at most one heating system for each Building'],
'hvac-sizing-humidity-setpoint' => ['Expected ManualJInputs/HumiditySetpoint to be less than 1'],
'hvac-sizing-daily-temp-range' => ["Expected ManualJInputs/DailyTemperatureRange to be 'low' or 'medium' or 'high'"],
'hvac-negative-crankcase-heater-watts' => ['Expected extension/CrankcaseHeaterPowerWatts to be greater than or equal to 0.'],
'incomplete-integrated-heating' => ['Expected IntegratedHeatingSystemFractionHeatLoadServed'],
'invalid-airflow-defect-ratio' => ['Expected extension/AirflowDefectRatio to be 0'],
'invalid-airflow-rates' => ['Expected extension/HeatingDesignAirflowCFM to be greater than or equal to 0',
'Expected extension/CoolingDesignAirflowCFM to be greater than or equal to 0'],
'invalid-assembly-effective-rvalue' => ["Element 'AssemblyEffectiveRValue': [facet 'minExclusive'] The value '0.0' must be greater than '0'."],
'invalid-battery-capacities-ah' => ['Expected UsableCapacity to be less than NominalCapacity'],
'invalid-battery-capacities-kwh' => ['Expected UsableCapacity to be less than NominalCapacity'],
'invalid-calendar-year-low' => ['Expected CalendarYear to be greater than or equal to 1600'],
'invalid-calendar-year-high' => ['Expected CalendarYear to be less than or equal to 9999'],
'invalid-clothes-dryer-cef' => ["Element 'CombinedEnergyFactor': [facet 'minExclusive'] The value '0.0' must be greater than '0'."],
'invalid-clothes-washer-imef' => ["Element 'IntegratedModifiedEnergyFactor': [facet 'minExclusive'] The value '0.0' must be greater than '0'."],
'invalid-cfis-addtl-runtime-mode' => ["Expected CFISControls/AdditionalRuntimeOperatingMode to be 'air handler fan'"],
'invalid-dishwasher-ler' => ["Element 'LabelElectricRate': [facet 'minExclusive'] The value '0.0' must be greater than '0'."],
'invalid-duct-area-fractions' => ['Expected sum(Ducts/FractionDuctArea) for DuctType="supply" to be 1 [context: /HPXML/Building/BuildingDetails/Systems/HVAC/HVACDistribution/DistributionSystemType/AirDistribution, id: "HVACDistribution1"]',
'Expected sum(Ducts/FractionDuctArea) for DuctType="return" to be 1 [context: /HPXML/Building/BuildingDetails/Systems/HVAC/HVACDistribution/DistributionSystemType/AirDistribution, id: "HVACDistribution1"]'],
'invalid-facility-type' => ['Expected ../../../BuildingSummary/BuildingConstruction[ResidentialFacilityType=("single-family attached" or "apartment unit")] [context: /HPXML/Building/BuildingDetails/Systems/WaterHeating/WaterHeatingSystem[IsSharedSystem="true"], id: "WaterHeatingSystem1"]',
'Expected ../../BuildingSummary/BuildingConstruction[ResidentialFacilityType=("single-family attached" or "apartment unit")] [context: /HPXML/Building/BuildingDetails/Appliances/ClothesWasher[IsSharedAppliance="true"], id: "ClothesWasher1"]',
'Expected ../../BuildingSummary/BuildingConstruction[ResidentialFacilityType=("single-family attached" or "apartment unit")] [context: /HPXML/Building/BuildingDetails/Appliances/ClothesDryer[IsSharedAppliance="true"], id: "ClothesDryer1"]',
'Expected ../../BuildingSummary/BuildingConstruction[ResidentialFacilityType=("single-family attached" or "apartment unit")] [context: /HPXML/Building/BuildingDetails/Appliances/Dishwasher[IsSharedAppliance="true"], id: "Dishwasher1"]',
'There are references to "other housing unit" but ResidentialFacilityType is not "single-family attached" or "apartment unit".',
'There are references to "other heated space" but ResidentialFacilityType is not "single-family attached" or "apartment unit".'],
'invalid-foundation-wall-properties' => ['Expected DepthBelowGrade to be less than or equal to Height [context: /HPXML/Building/BuildingDetails/Enclosure/FoundationWalls/FoundationWall[not(SystemIdentifier/@sameas and /HPXML/SoftwareInfo/extension/WholeSFAorMFBuildingSimulation[text()="true"])], id: "FoundationWall1"]',
'Expected DistanceToBottomOfInsulation to be greater than or equal to DistanceToTopOfInsulation [context: /HPXML/Building/BuildingDetails/Enclosure/FoundationWalls/FoundationWall/Insulation/Layer[InstallationType="continuous - exterior" or InstallationType="continuous - interior"], id: "FoundationWall1Insulation"]',
'Expected DistanceToBottomOfInsulation to be less than or equal to ../../Height [context: /HPXML/Building/BuildingDetails/Enclosure/FoundationWalls/FoundationWall/Insulation/Layer[InstallationType="continuous - exterior" or InstallationType="continuous - interior"], id: "FoundationWall1Insulation"]'],
'invalid-ground-conductivity' => ["The value '0.0' must be greater than '0'"],
'invalid-ground-diffusivity' => ['Expected extension/Diffusivity to be greater than 0'],
'invalid-heat-pump-capacity-fraction-17F' => ['Expected extension/HeatingCapacityFraction17F to be less than 1'],
'invalid-heat-pump-capacity-fraction-17F-2' => ['Expected extension/HeatingCapacityFraction17F to be greater than or equal to 0'],
'invalid-hvac-installation-quality' => ['Expected extension/AirflowDefectRatio to be greater than or equal to -0.9 [context: /HPXML/Building/BuildingDetails/Systems/HVAC/HVACPlant/HeatPump[HeatPumpType="air-to-air"], id: "HeatPump1"]',
'Expected extension/ChargeDefectRatio to be greater than or equal to -0.9 [context: /HPXML/Building/BuildingDetails/Systems/HVAC/HVACPlant/HeatPump[HeatPumpType="air-to-air"], id: "HeatPump1"]'],
'invalid-hvac-installation-quality2' => ['Expected extension/AirflowDefectRatio to be less than or equal to 9 [context: /HPXML/Building/BuildingDetails/Systems/HVAC/HVACPlant/HeatPump[HeatPumpType="air-to-air"], id: "HeatPump1"]',
'Expected extension/ChargeDefectRatio to be less than or equal to 9 [context: /HPXML/Building/BuildingDetails/Systems/HVAC/HVACPlant/HeatPump[HeatPumpType="air-to-air"], id: "HeatPump1"]'],
'invalid-id2' => ["Element 'SystemIdentifier': The attribute 'id' is required but missing."],
'invalid-input-parameters' => ["Element 'Transaction': [facet 'enumeration'] The value 'modify' is not an element of the set {'create', 'update'}.",
"Element 'SiteType': [facet 'enumeration'] The value 'mountain' is not an element of the set {'rural', 'suburban', 'urban'}.",
"Element 'Year': [facet 'enumeration'] The value '2020' is not an element of the set {'2024', '2021', '2018', '2015', '2012', '2009', '2006', '2003'}.",
"Element 'Azimuth': [facet 'maxExclusive'] The value '365' must be less than '360'.",
"Element 'RadiantBarrierGrade': [facet 'maxInclusive'] The value '4' is greater than the maximum value allowed ('3').",
"Element 'EnergyFactor': [facet 'maxInclusive'] The value '5.1' is greater than the maximum value allowed ('5')."],
'invalid-insulation-top' => ["Element 'DistanceToTopOfInsulation': [facet 'minInclusive'] The value '-0.5' is less than the minimum value allowed ('0')."],
'invalid-integrated-heating' => ['Expected no IntegratedHeatingSystemFuel'],
'invalid-lighting-groups' => ['Expected ../LightingGroup[LightingType[CompactFluorescent] and Location="interior"]/FractionofUnitsInLocation or Load[Units="kWh/year"]/Value but not both',
'Expected ../LightingGroup[LightingType[CompactFluorescent] and Location="interior"]/FractionofUnitsInLocation or Load[Units="kWh/year"]/Value but not both',
'Expected ../LightingGroup[LightingType[CompactFluorescent] and Location="exterior"]/FractionofUnitsInLocation or Load[Units="kWh/year"]/Value but not both',
'Expected ../LightingGroup[LightingType[CompactFluorescent] and Location="exterior"]/FractionofUnitsInLocation or Load[Units="kWh/year"]/Value but not both',
'Expected ../LightingGroup[LightingType[CompactFluorescent] and Location="garage"]/FractionofUnitsInLocation or Load[Units="kWh/year"]/Value but not both',
'Expected ../LightingGroup[LightingType[CompactFluorescent] and Location="garage"]/FractionofUnitsInLocation or Load[Units="kWh/year"]/Value but not both'],
'invalid-lighting-groups2' => ['Expected ../LightingGroup[LightingType[CompactFluorescent] and Location="interior"]/FractionofUnitsInLocation or Load[Units="kWh/year"]/Value but not both',
'Expected ../LightingGroup[LightingType[CompactFluorescent] and Location="interior"]/FractionofUnitsInLocation or Load[Units="kWh/year"]/Value but not both',
'Expected ../LightingGroup[LightingType[CompactFluorescent] and Location="interior"]/FractionofUnitsInLocation or Load[Units="kWh/year"]/Value but not both',
'Expected ../LightingGroup[LightingType[CompactFluorescent] and Location="interior"]/FractionofUnitsInLocation or Load[Units="kWh/year"]/Value but not both',
'Expected ../LightingGroup[LightingType[CompactFluorescent] and Location="exterior"]/FractionofUnitsInLocation or Load[Units="kWh/year"]/Value but not both',
'Expected ../LightingGroup[LightingType[CompactFluorescent] and Location="exterior"]/FractionofUnitsInLocation or Load[Units="kWh/year"]/Value but not both',
'Expected ../LightingGroup[LightingType[CompactFluorescent] and Location="exterior"]/FractionofUnitsInLocation or Load[Units="kWh/year"]/Value but not both',
'Expected ../LightingGroup[LightingType[CompactFluorescent] and Location="exterior"]/FractionofUnitsInLocation or Load[Units="kWh/year"]/Value but not both',
'Expected ../LightingGroup[LightingType[CompactFluorescent] and Location="garage"]/FractionofUnitsInLocation or Load[Units="kWh/year"]/Value but not both',
'Expected ../LightingGroup[LightingType[CompactFluorescent] and Location="garage"]/FractionofUnitsInLocation or Load[Units="kWh/year"]/Value but not both',
'Expected ../LightingGroup[LightingType[CompactFluorescent] and Location="garage"]/FractionofUnitsInLocation or Load[Units="kWh/year"]/Value but not both',
'Expected ../LightingGroup[LightingType[CompactFluorescent] and Location="garage"]/FractionofUnitsInLocation or Load[Units="kWh/year"]/Value but not both'],
'invalid-natvent-availability' => ['Expected extension/NaturalVentilationAvailabilityDaysperWeek to be less than or equal to 7'],
'invalid-natvent-availability2' => ['Expected extension/NaturalVentilationAvailabilityDaysperWeek to be greater than or equal to 0'],
'invalid-number-of-bedrooms-served-pv' => ['Expected extension/NumberofBedroomsServed to be greater than ../../../BuildingSummary/BuildingConstruction/NumberofBedrooms [context: /HPXML/Building/BuildingDetails/Systems/Photovoltaics/PVSystem[IsSharedSystem="true"], id: "PVSystem1"]'],
'invalid-number-of-bedrooms-served-recirc' => ['Expected NumberofBedroomsServed to be greater than ../../../../../BuildingSummary/BuildingConstruction/NumberofBedrooms [context: /HPXML/Building/BuildingDetails/Systems/WaterHeating/HotWaterDistribution/extension/SharedRecirculation, id: "HotWaterDistribution1"]'],
'invalid-number-of-bedrooms-served-water-heater' => ['Expected extension/NumberofBedroomsServed to be greater than ../../../BuildingSummary/BuildingConstruction/NumberofBedrooms [context: /HPXML/Building/BuildingDetails/Systems/WaterHeating/WaterHeatingSystem[IsSharedSystem="true"], id: "WaterHeatingSystem1"]'],
'invalid-number-of-conditioned-floors' => ['Expected NumberofConditionedFloors to be greater than or equal to NumberofConditionedFloorsAboveGrade [context: /HPXML/Building/BuildingDetails/BuildingSummary/BuildingConstruction, id: "MyBuilding"]'],
'invalid-number-of-conditioned-floors-above-grade' => ['Expected NumberofConditionedFloorsAboveGrade to be greater than 0 [context: /HPXML/Building/BuildingDetails/BuildingSummary/BuildingConstruction, id: "MyBuilding"]'],
'invalid-pilot-light-heating-system' => ['Expected ../../HeatingSystemFuel to not be "electricity"'],
'invalid-shared-vent-in-unit-flowrate' => ['Expected RatedFlowRate to be greater than extension/InUnitFlowRate [context: /HPXML/Building/BuildingDetails/Systems/MechanicalVentilation/VentilationFans/VentilationFan[UsedForWholeBuildingVentilation="true" and IsSharedSystem="true"], id: "VentilationFan1"]'],
'invalid-timestep' => ['Expected Timestep to be 60, 30, 20, 15, 12, 10, 6, 5, 4, 3, 2, or 1'],
'invalid-timezone-utcoffset-low' => ["Element 'UTCOffset': [facet 'minInclusive'] The value '-13.0' is less than the minimum value allowed ('-12')."],
'invalid-timezone-utcoffset-high' => ["Element 'UTCOffset': [facet 'maxInclusive'] The value '15.0' is greater than the maximum value allowed ('14')."],
'invalid-ventilation-fan' => ['Expected UsedForWholeBuildingVentilation="true" or UsedForLocalVentilation="true" or UsedForSeasonalCoolingLoadReduction="true" or UsedForGarageVentilation="true" but not multiple'],
'invalid-ventilation-recovery' => ['Expected no TotalRecoveryEfficiency',
'Expected no SensibleRecoveryEfficiency'],
'invalid-water-heater-heating-capacity' => ['Expected HeatingCapacity to be greater than 0.'],
'invalid-water-heater-heating-capacity2' => ['Expected HeatingCapacity to be greater than 0.'],
'invalid-water-heater-stratified-tank-model' => ['Expected no extension/TankModelType'],
'invalid-whole-sfa-or-mf-building-sim' => ['Expected WholeSFAorMFBuildingSimulation to not be "true" if ResidentialFacilityType is "single-family detached" or "manufactured home"'],
'invalid-window-height' => ['Expected DistanceToBottomOfWindow to be greater than DistanceToTopOfWindow [context: /HPXML/Building/BuildingDetails/Enclosure/Windows/Window/Overhangs[number(Depth) > 0], id: "Window2"]'],
'leakiness-description-missing-year-built' => ['Expected BuildingSummary/BuildingConstruction/YearBuilt'],
'lighting-fractions' => ['Expected sum(LightingGroup/FractionofUnitsInLocation) for Location="interior" to be less than or equal to 1 [context: /HPXML/Building/BuildingDetails/Lighting, id: "MyBuilding"]'],
'manufactured-home-reference-duct' => ['There are references to "manufactured home belly" or "manufactured home underbelly" but ResidentialFacilityType is not "manufactured home".',
'A location is specified as "manufactured home belly" but no surfaces were found adjacent to the "manufactured home underbelly" space type.'],
'manufactured-home-reference-water-heater' => ['There are references to "manufactured home belly" or "manufactured home underbelly" but ResidentialFacilityType is not "manufactured home".',
'A location is specified as "manufactured home belly" but no surfaces were found adjacent to the "manufactured home underbelly" space type.',
"Expected Location to be 'conditioned space' or 'basement - unconditioned' or 'basement - conditioned' or 'attic - unvented' or 'attic - vented' or 'garage' or 'crawlspace - unvented' or 'crawlspace - vented' or 'crawlspace - conditioned' or 'other exterior' or 'other housing unit' or 'other heated space' or 'other multifamily buffer space' or 'other non-freezing space'"],
'manufactured-home-reference-floor' => ['There are references to "manufactured home belly" or "manufactured home underbelly" but ResidentialFacilityType is not "manufactured home".',
'There must be at least one ceiling adjacent to "crawlspace - vented".'],
'missing-attached-to-space-wall' => ['Expected AttachedToSpace'],
'missing-attached-to-space-slab' => ['Expected AttachedToSpace'],
'missing-attached-to-zone' => ['Expected AttachedToZone'],
'missing-cfis-supplemental-fan' => ['Expected CFISControls/SupplementalFan'],
'missing-distribution-cfa-served' => ['Expected ../../../ConditionedFloorAreaServed if Ducts without DuctSurfaceArea are specified [context: /HPXML/Building/BuildingDetails/Systems/HVAC/HVACDistribution/DistributionSystemType/AirDistribution/Ducts[not(DuctSurfaceArea)], id: "Ducts1"]',
'Expected ../../../ConditionedFloorAreaServed if Ducts without DuctSurfaceArea are specified [context: /HPXML/Building/BuildingDetails/Systems/HVAC/HVACDistribution/DistributionSystemType/AirDistribution/Ducts[not(DuctSurfaceArea)], id: "Ducts2"]',
'Expected ../../../ConditionedFloorAreaServed if Ducts without DuctSurfaceArea are specified [context: /HPXML/Building/BuildingDetails/Systems/HVAC/HVACDistribution/DistributionSystemType/AirDistribution/Ducts[not(DuctSurfaceArea)], id: "Ducts3"]',
'Expected ../../../ConditionedFloorAreaServed if Ducts without DuctSurfaceArea are specified [context: /HPXML/Building/BuildingDetails/Systems/HVAC/HVACDistribution/DistributionSystemType/AirDistribution/Ducts[not(DuctSurfaceArea)], id: "Ducts4"]'],
'missing-duct-area' => ['Expected FractionDuctArea or DuctSurfaceArea if Ducts with DuctLocation are specified [context: /HPXML/Building/BuildingDetails/Systems/HVAC/HVACDistribution/DistributionSystemType/AirDistribution/Ducts[DuctLocation], id: "Ducts2"]'],
'missing-duct-location' => ['Expected no FractionDuctArea if Ducts without DuctLocation are specified [context: /HPXML/Building/BuildingDetails/Systems/HVAC/HVACDistribution/DistributionSystemType/AirDistribution/Ducts[not(DuctLocation)], id: "Ducts2"]'],
'missing-elements' => ['Expected NumberofConditionedFloors [context: /HPXML/Building/BuildingDetails/BuildingSummary/BuildingConstruction, id: "MyBuilding"]',
'Expected ConditionedFloorArea [context: /HPXML/Building/BuildingDetails/BuildingSummary/BuildingConstruction, id: "MyBuilding"]'],
'missing-epw-filepath-and-zipcode' => ['Expected Site/Address/ZipCode or BuildingDetails/ClimateandRiskZones/WeatherStation/extension/EPWFilePath'],
'missing-hpwh-containment-volume' => ['Expected HPWHContainmentVolume if HPWHInConfinedSpaceWithoutMitigation="true" [context: /HPXML/Building/BuildingDetails/Systems/WaterHeating/WaterHeatingSystem/extension[HPWHInConfinedSpaceWithoutMitigation="true"], id: "WaterHeatingSystem1"]'],
'missing-inverter-idref' => ['Expected AttachedToInverter if multiple Inverters are specified [context: /HPXML/Building/BuildingDetails/Systems/Photovoltaics/PVSystem[count(../Inverter) > 1], id: "PVSystem1"]',
'Expected AttachedToInverter if multiple Inverters are specified [context: /HPXML/Building/BuildingDetails/Systems/Photovoltaics/PVSystem[count(../Inverter) > 1], id: "PVSystem2"]'],
'missing-skylight-floor' => ['Expected ../../AttachedToFloor'],
'multifamily-common-space-extra-inputs' => ['Expected only SystemIdentifier to be specified when sameas attribute used',
'Expected only SystemIdentifier to be specified when sameas attribute used',
'Expected only SystemIdentifier to be specified when sameas attribute used',
'Expected only SystemIdentifier to be specified when sameas attribute used'],
'multifamily-common-space-whole-sfa-or-mf-building-sim-false' => ['Expected ExteriorAdjacentTo'],
'multifamily-reference-appliance' => ['There are references to "other housing unit" but ResidentialFacilityType is not "single-family attached" or "apartment unit".'],
'multifamily-reference-duct' => ['There are references to "other multifamily buffer space" but ResidentialFacilityType is not "single-family attached" or "apartment unit".'],
'multifamily-reference-surface' => ['There are references to "other heated space" but ResidentialFacilityType is not "single-family attached" or "apartment unit".'],
'multifamily-reference-water-heater' => ['There are references to "other non-freezing space" but ResidentialFacilityType is not "single-family attached" or "apartment unit".'],
'negative-autosizing-factors' => ['Expected CoolingAutosizingFactor to be greater than 0',
'Expected HeatingAutosizingFactor to be greater than 0',
'Expected BackupHeatingAutosizingFactor to be greater than 0'],
'negative-hpwh-containment-volume' => ['Expected HPWHContainmentVolume to be greater than 0.'],
'panel-zero-total-breaker-spaces' => ["Element 'RatedTotalSpaces': [facet 'minExclusive'] The value '0' must be greater than '0'."],
'panel-without-required-system' => ['Expected AttachedToComponent'],
'panel-with-unrequired-system' => ['Expected no AttachedToComponent'],
'panel-without-load-type' => ['Expected LoadType'],
'panel-insufficient-voltage' => ["Expected ../../../ElectricPanel/Voltage to be '240' [context: /HPXML/Building/BuildingDetails/Systems/ElectricPanels/ElectricPanel/BranchCircuits/BranchCircuit, id: \"BranchCircuit1\"]"],
'panel-zero-meter-based' => ['Expected extension/ElectricPanelBaselinePeakPower to be greater than 0 [context: /HPXML/Building/BuildingDetails/BuildingSummary, id: "MyBuilding"]'],
'refrigerator-location' => ['A location is specified as "garage" but no surfaces were found adjacent to this space type.'],
'refrigerator-schedule' => ['Expected not both schedule fractions/multipliers and schedule coefficients'],
'solar-fraction-one' => ['Expected SolarFraction to be less than or equal to 0.99 [context: /HPXML/Building/BuildingDetails/Systems/SolarThermal/SolarThermalSystem, id: "SolarThermalSystem1"]'],
'sum-space-floor-area' => ['Expected sum(Zones/Zone[ZoneType="conditioned"]/Spaces/Space/FloorArea) to be equal to BuildingSummary/BuildingConstruction/ConditionedFloorArea'],
'sum-space-floor-area2' => ['Expected sum(Zones/Zone[ZoneType="conditioned"]/Spaces/Space/FloorArea) to be equal to BuildingSummary/BuildingConstruction/ConditionedFloorArea'],
'vehicle-ev-multiple-BEV' => ['Expected at most one Vehicle/VehicleType/BatteryElectricVehicle [context: /HPXML/Building/BuildingDetails/Systems/Vehicles, id: "MyBuilding"]'],
'vehicle-ev-invalid-fuel-economy-units' => ["Expected ../../FuelEconomyCombined/Units to be 'kWh/mile' or 'mile/kWh' or 'mpge' [context: /HPXML/Building/BuildingDetails/Systems/Vehicles/Vehicle/VehicleType/BatteryElectricVehicle, id: \"Vehicle1\"]"],
'water-heater-location' => ['A location is specified as "crawlspace - vented" but no surfaces were found adjacent to this space type.'],
'water-heater-location-other' => ["Expected Location to be 'conditioned space' or 'basement - unconditioned' or 'basement - conditioned' or 'attic - unvented' or 'attic - vented' or 'garage' or 'crawlspace - unvented' or 'crawlspace - vented' or 'crawlspace - conditioned' or 'other exterior' or 'other housing unit' or 'other heated space' or 'other multifamily buffer space' or 'other non-freezing space'"],
'water-heater-recovery-efficiency' => ['Expected RecoveryEfficiency to be greater than EnergyFactor'],
'wrong-infiltration-method-blower-door' => ['Expected Enclosure/AirInfiltration/AirInfiltrationMeasurement[BuildingAirLeakage/AirLeakage | EffectiveLeakageArea | SpecificLeakageArea]'],
'wrong-infiltration-method-default-table' => ['Expected Enclosure/AirInfiltration/AirInfiltrationMeasurement[LeakinessDescription]'] }
all_expected_errors.each_with_index do |(error_case, expected_errors), i|
puts "[#{i + 1}/#{all_expected_errors.size}] Testing #{error_case}..."
# Create HPXML object
case error_case
when 'boiler-invalid-afue'
hpxml, hpxml_bldg = _create_hpxml('base-hvac-boiler-oil-only.xml')
hpxml_bldg.heating_systems[0].heating_efficiency_afue *= 100.0
when 'clothes-dryer-location'
hpxml, hpxml_bldg = _create_hpxml('base.xml')
hpxml_bldg.clothes_dryers[0].location = HPXML::LocationGarage
when 'clothes-washer-location'
hpxml, hpxml_bldg = _create_hpxml('base.xml')
hpxml_bldg.clothes_washers[0].location = HPXML::LocationGarage
when 'cooking-range-location'
hpxml, hpxml_bldg = _create_hpxml('base.xml')
hpxml_bldg.cooking_ranges[0].location = HPXML::LocationGarage
when 'dehumidifier-fraction-served'
hpxml, hpxml_bldg = _create_hpxml('base-appliances-dehumidifier-multiple.xml')
hpxml_bldg.dehumidifiers[-1].fraction_served = 0.6
when 'dhw-frac-load-served'
hpxml, hpxml_bldg = _create_hpxml('base-dhw-multiple.xml')
hpxml_bldg.water_heating_systems[0].fraction_dhw_load_served = 0.35
when 'dhw-invalid-ef-tank'
hpxml, hpxml_bldg = _create_hpxml('base-dhw-tank-gas-ef.xml')
hpxml_bldg.water_heating_systems[0].energy_factor = 1.0
hpxml_bldg.water_heating_systems[0].recovery_efficiency = nil
when 'dhw-invalid-uef-tank-heat-pump'
hpxml, hpxml_bldg = _create_hpxml('base-dhw-tank-heat-pump.xml')
hpxml_bldg.water_heating_systems[0].uniform_energy_factor = 1.0
when 'dishwasher-location'
hpxml, hpxml_bldg = _create_hpxml('base.xml')
hpxml_bldg.dishwashers[0].location = HPXML::LocationGarage
when 'duct-leakage-cfm25'
hpxml, hpxml_bldg = _create_hpxml('base.xml')
hpxml_bldg.hvac_distributions[0].duct_leakage_measurements[0].duct_leakage_value = -2
hpxml_bldg.hvac_distributions[0].duct_leakage_measurements[1].duct_leakage_value = -3
when 'duct-leakage-cfm50'
hpxml, hpxml_bldg = _create_hpxml('base-hvac-ducts-leakage-cfm50.xml')
hpxml_bldg.hvac_distributions[0].duct_leakage_measurements[0].duct_leakage_value = -2
hpxml_bldg.hvac_distributions[0].duct_leakage_measurements[1].duct_leakage_value = -3
when 'duct-leakage-percent'
hpxml, hpxml_bldg = _create_hpxml('base.xml')
hpxml_bldg.hvac_distributions[0].duct_leakage_measurements[0].duct_leakage_units = HPXML::UnitsPercent
hpxml_bldg.hvac_distributions[0].duct_leakage_measurements[1].duct_leakage_units = HPXML::UnitsPercent
when 'duct-location'
hpxml, hpxml_bldg = _create_hpxml('base.xml')
hpxml_bldg.hvac_distributions[0].ducts[0].duct_location = HPXML::LocationGarage
hpxml_bldg.hvac_distributions[0].ducts[1].duct_location = HPXML::LocationGarage
when 'duct-location-unconditioned-space'
hpxml, hpxml_bldg = _create_hpxml('base.xml')
hpxml_bldg.hvac_distributions[0].ducts[0].duct_location = HPXML::LocationUnconditionedSpace
hpxml_bldg.hvac_distributions[0].ducts[1].duct_location = HPXML::LocationUnconditionedSpace
when 'emissions-electricity-schedule'
hpxml, hpxml_bldg = _create_hpxml('base-misc-emissions.xml')
hpxml.header.emissions_scenarios[0].elec_schedule_number_of_header_rows = -1
hpxml.header.emissions_scenarios[0].elec_schedule_column_number = 0
when 'enclosure-attic-missing-roof'
hpxml, hpxml_bldg = _create_hpxml('base.xml')
hpxml_bldg.roofs.reverse_each do |roof|
roof.delete
end
when 'enclosure-basement-missing-exterior-foundation-wall'
hpxml, hpxml_bldg = _create_hpxml('base-foundation-unconditioned-basement.xml')
hpxml_bldg.foundation_walls.reverse_each do |foundation_wall|
foundation_wall.delete
end
when 'enclosure-basement-missing-slab'
hpxml, hpxml_bldg = _create_hpxml('base-foundation-unconditioned-basement.xml')
hpxml_bldg.slabs.reverse_each do |slab|
slab.delete
end
when 'enclosure-floor-area-exceeds-cfa'
hpxml, hpxml_bldg = _create_hpxml('base.xml')
hpxml_bldg.building_construction.conditioned_floor_area = 1348.8
when 'enclosure-floor-area-exceeds-cfa2'
hpxml, hpxml_bldg = _create_hpxml('base-bldgtype-mf-unit.xml')
hpxml_bldg.building_construction.conditioned_floor_area = 898.8
when 'enclosure-garage-missing-exterior-wall'
hpxml, hpxml_bldg = _create_hpxml('base-enclosure-garage.xml')
hpxml_bldg.walls.select { |w|
w.interior_adjacent_to == HPXML::LocationGarage &&
w.exterior_adjacent_to == HPXML::LocationOutside
}.reverse_each do |wall|
wall.delete
end
when 'enclosure-garage-missing-roof-ceiling'
hpxml, hpxml_bldg = _create_hpxml('base-enclosure-garage.xml')
hpxml_bldg.floors.select { |w|
w.interior_adjacent_to == HPXML::LocationGarage &&
w.exterior_adjacent_to == HPXML::LocationAtticUnvented
}.reverse_each do |floor|
floor.delete
end
when 'enclosure-garage-missing-slab'
hpxml, hpxml_bldg = _create_hpxml('base-enclosure-garage.xml')
hpxml_bldg.slabs.select { |w| w.interior_adjacent_to == HPXML::LocationGarage }.reverse_each do |slab|
slab.delete
end
when 'enclosure-conditioned-missing-ceiling-roof'
hpxml, hpxml_bldg = _create_hpxml('base.xml')
hpxml_bldg.floors.reverse_each do |floor|
floor.delete
end
when 'enclosure-conditioned-missing-exterior-wall'
hpxml, hpxml_bldg = _create_hpxml('base.xml')
hpxml_bldg.walls.reverse_each do |wall|
next unless wall.interior_adjacent_to == HPXML::LocationConditionedSpace
wall.delete
end
when 'enclosure-conditioned-missing-floor-slab'
hpxml, hpxml_bldg = _create_hpxml('base-foundation-slab.xml')
hpxml_bldg.slabs[0].delete
when 'frac-sensible-latent-fuel-load-values'
hpxml, hpxml_bldg = _create_hpxml('base-misc-loads-large-uncommon.xml')
hpxml_bldg.fuel_loads[0].frac_sensible = -0.1
hpxml_bldg.fuel_loads[0].frac_latent = -0.1
when 'frac-sensible-latent-fuel-load-presence'
hpxml, hpxml_bldg = _create_hpxml('base-misc-loads-large-uncommon.xml')
hpxml_bldg.fuel_loads[0].frac_sensible = 1.0
hpxml_bldg.fuel_loads[0].frac_latent = nil
when 'frac-sensible-latent-plug-load-values'
hpxml, hpxml_bldg = _create_hpxml('base-misc-loads-large-uncommon.xml')
hpxml_bldg.plug_loads[0].frac_sensible = -0.1
hpxml_bldg.plug_loads[0].frac_latent = -0.1
when 'frac-sensible-latent-plug-load-presence'
hpxml, hpxml_bldg = _create_hpxml('base-misc-loads-large-uncommon.xml')
hpxml_bldg.plug_loads[0].frac_latent = 1.0
hpxml_bldg.plug_loads[0].frac_sensible = nil
when 'frac-total-fuel-load'
hpxml, hpxml_bldg = _create_hpxml('base-misc-loads-large-uncommon.xml')
hpxml_bldg.fuel_loads[0].frac_sensible = 0.8
hpxml_bldg.fuel_loads[0].frac_latent = 0.3
when 'frac-total-plug-load'
hpxml, hpxml_bldg = _create_hpxml('base-misc-loads-large-uncommon.xml')
hpxml_bldg.plug_loads[1].frac_sensible = 0.855
hpxml_bldg.plug_loads[1].frac_latent = 0.245
when 'furnace-invalid-afue'
hpxml, hpxml_bldg = _create_hpxml('base.xml')
hpxml_bldg.heating_systems[0].heating_efficiency_afue *= 100.0
when 'generator-number-of-bedrooms-served'
hpxml, hpxml_bldg = _create_hpxml('base-bldgtype-mf-unit-shared-generator.xml')
hpxml_bldg.generators[0].number_of_bedrooms_served = 3
when 'generator-output-greater-than-consumption'
hpxml, hpxml_bldg = _create_hpxml('base-misc-generators.xml')
hpxml_bldg.generators[0].annual_consumption_kbtu = 1500
when 'heat-pump-backup-sizing'
hpxml, hpxml_bldg = _create_hpxml('base-hvac-air-to-air-heat-pump-1-speed.xml')
hpxml_bldg.header.heat_pump_backup_sizing_methodology = 'foobar'
when 'heat-pump-separate-backup-inputs'
hpxml, hpxml_bldg = _create_hpxml('base-hvac-air-to-air-heat-pump-var-speed-backup-furnace.xml')
hpxml_bldg.heat_pumps[0].backup_heating_capacity = 12345
hpxml_bldg.heat_pumps[0].backup_heating_efficiency_afue = 0.8
hpxml_bldg.heat_pumps[0].backup_heating_autosizing_factor = 1.2
when 'heat-pump-capacity-17f-value'
hpxml, hpxml_bldg = _create_hpxml('base-hvac-air-to-air-heat-pump-1-speed.xml')
hpxml_bldg.heat_pumps[0].heating_capacity_17F = hpxml_bldg.heat_pumps[0].heating_capacity + 1000.0
hpxml_bldg.heat_pumps[0].heating_capacity_fraction_17F = nil
when 'heat-pump-capacity-17f-presence'
hpxml, hpxml_bldg = _create_hpxml('base-hvac-air-to-air-heat-pump-1-speed.xml')
hpxml_bldg.heat_pumps[0].heating_capacity_17F = 0.5 * hpxml_bldg.heat_pumps[0].heating_capacity
hpxml_bldg.heat_pumps[0].heating_capacity = nil
hpxml_bldg.heat_pumps[0].heating_capacity_fraction_17F = nil
when 'heat-pump-lockout-temperatures'
hpxml, hpxml_bldg = _create_hpxml('base-hvac-air-to-air-heat-pump-1-speed-lockout-temperatures.xml')
hpxml_bldg.heat_pumps[0].compressor_lockout_temp = hpxml_bldg.heat_pumps[0].backup_heating_lockout_temp + 1
when 'heat-pump-multiple-backup-systems'
hpxml, hpxml_bldg = _create_hpxml('base-hvac-air-to-air-heat-pump-var-speed-backup-boiler.xml')
hpxml_bldg.heating_systems << hpxml_bldg.heating_systems[0].dup
hpxml_bldg.heating_systems[-1].id = 'HeatingSystem2'
hpxml_bldg.heat_pumps[0].fraction_heat_load_served = 0.5
hpxml_bldg.heat_pumps[0].fraction_cool_load_served = 0.5
hpxml_bldg.heat_pumps << hpxml_bldg.heat_pumps[0].dup
hpxml_bldg.heat_pumps[-1].id = 'HeatPump2'
hpxml_bldg.heat_pumps[-1].primary_heating_system = false
hpxml_bldg.heat_pumps[-1].primary_cooling_system = false
when 'hvac-detailed-performance-bad-odbs'
hpxml, hpxml_bldg = _create_hpxml('base-hvac-air-to-air-heat-pump-var-speed-detailed-performance.xml')
# For heating, test invalid ODB
hpxml_bldg.heat_pumps[0].heating_detailed_performance_data.add(
outdoor_temperature: 7.0,
capacity_description: HPXML::CapacityDescriptionMinimum,
capacity: 1000.0,
efficiency_cop: 0.7
)
hpxml_bldg.heat_pumps[0].heating_detailed_performance_data.add(
outdoor_temperature: 7.0,
capacity_description: HPXML::CapacityDescriptionMaximum,
capacity: 10000.0,
efficiency_cop: 2.1
)
# For cooling, test invalid ODB
hpxml_bldg.heat_pumps[0].cooling_detailed_performance_data.add(
outdoor_temperature: 60.0,
capacity_description: HPXML::CapacityDescriptionMinimum,
capacity: 10000.0,
efficiency_cop: 6.0
)
hpxml_bldg.heat_pumps[0].cooling_detailed_performance_data.add(
outdoor_temperature: 60.0,
capacity_description: HPXML::CapacityDescriptionMaximum,
capacity: 20000.0,
efficiency_cop: 7.0
)
when 'hvac-detailed-performance-inconsistent-capacities'
hpxml, hpxml_bldg = _create_hpxml('base-hvac-air-to-air-heat-pump-var-speed-detailed-performance.xml')
hpxml_bldg.heat_pumps[0].heating_capacity = 10000
hpxml_bldg.heat_pumps[0].cooling_capacity = 10000
hpxml_bldg.heat_pumps[0].heating_capacity_17F = 1000
when 'hvac-detailed-performance-inconsistent-capacity-fractions'
hpxml, hpxml_bldg = _create_hpxml('base-hvac-air-to-air-heat-pump-var-speed-detailed-performance-normalized-capacities.xml')
hpxml_bldg.heat_pumps[0].cooling_detailed_performance_data[1].capacity_fraction_of_nominal = 0.98
hpxml_bldg.heat_pumps[0].heating_detailed_performance_data[1].capacity_fraction_of_nominal = 0.98
when 'hvac-detailed-performance-incomplete-pair'
hpxml, hpxml_bldg = _create_hpxml('base-hvac-air-to-air-heat-pump-var-speed-detailed-performance.xml')
hpxml_bldg.heat_pumps[0].cooling_detailed_performance_data.add(
outdoor_temperature: 105.0,
capacity_description: HPXML::CapacityDescriptionMinimum,
capacity: 15000.0,
efficiency_cop: 7
)
hpxml_bldg.heat_pumps[0].heating_detailed_performance_data.add(
outdoor_temperature: -2.0,
capacity_description: HPXML::CapacityDescriptionMinimum,
capacity: 1500.0,
efficiency_cop: 0.7
)
when 'hvac-detailed-performance-invalid-data'
hpxml, hpxml_bldg = _create_hpxml('base-hvac-air-to-air-heat-pump-var-speed-detailed-performance.xml')
min_dp_82F = hpxml_bldg.heat_pumps[0].cooling_detailed_performance_data.find { |dp| dp.capacity_description == HPXML::CapacityDescriptionMinimum && dp.outdoor_temperature == 82.0 }
max_dp_82F = hpxml_bldg.heat_pumps[0].cooling_detailed_performance_data.find { |dp| dp.capacity_description == HPXML::CapacityDescriptionMaximum && dp.outdoor_temperature == 82.0 }
min_dp_82F.efficiency_cop = 0.1 * max_dp_82F.efficiency_cop
min_dp_95F = hpxml_bldg.heat_pumps[0].cooling_detailed_performance_data.find { |dp| dp.capacity_description == HPXML::CapacityDescriptionMinimum && dp.outdoor_temperature == 95.0 }
max_dp_95F = hpxml_bldg.heat_pumps[0].cooling_detailed_performance_data.find { |dp| dp.capacity_description == HPXML::CapacityDescriptionMaximum && dp.outdoor_temperature == 95.0 }
min_dp_95F.capacity = 1.1 * max_dp_95F.capacity
min_dp_47F = hpxml_bldg.heat_pumps[0].heating_detailed_performance_data.find { |dp| dp.capacity_description == HPXML::CapacityDescriptionMinimum && dp.outdoor_temperature == 47.0 }
max_dp_47F = hpxml_bldg.heat_pumps[0].heating_detailed_performance_data.find { |dp| dp.capacity_description == HPXML::CapacityDescriptionMaximum && dp.outdoor_temperature == 47.0 }
min_dp_47F.efficiency_cop = 0.1 * max_dp_47F.efficiency_cop
min_dp_5F = hpxml_bldg.heat_pumps[0].heating_detailed_performance_data.find { |dp| dp.capacity_description == HPXML::CapacityDescriptionMinimum && dp.outdoor_temperature == 5.0 }
max_dp_5F = hpxml_bldg.heat_pumps[0].heating_detailed_performance_data.find { |dp| dp.capacity_description == HPXML::CapacityDescriptionMaximum && dp.outdoor_temperature == 5.0 }
min_dp_5F.capacity = 1.1 * max_dp_5F.capacity
min_dp_5F.efficiency_cop = 2 * max_dp_5F.efficiency_cop
when 'hvac-distribution-return-duct-leakage-missing'
hpxml, hpxml_bldg = _create_hpxml('base-hvac-evap-cooler-only-ducted.xml')
hpxml_bldg.hvac_distributions[0].duct_leakage_measurements[-1].delete
when 'hvac-frac-load-served'
hpxml, hpxml_bldg = _create_hpxml('base-hvac-multiple.xml')
hpxml_bldg.heating_systems[0].fraction_heat_load_served += 0.1
hpxml_bldg.cooling_systems[0].fraction_cool_load_served += 0.2
hpxml_bldg.heating_systems[0].primary_system = true
hpxml_bldg.cooling_systems[0].primary_system = true
hpxml_bldg.heat_pumps[-1].primary_heating_system = false
hpxml_bldg.heat_pumps[-1].primary_cooling_system = false
when 'hvac-research-features-timestep-ten-mins'
hpxml, _hpxml_bldg = _create_hpxml('base-hvac-air-to-air-heat-pump-1-speed-research-features.xml')
hpxml.header.timestep = 10
when 'hvac-research-features-timestep-missing'
hpxml, _hpxml_bldg = _create_hpxml('base-hvac-air-to-air-heat-pump-1-speed-research-features.xml')
hpxml.header.timestep = nil
when 'hvac-research-features-onoff-thermostat-heat-load-fraction-partial'
hpxml, hpxml_bldg = _create_hpxml('base-hvac-air-to-air-heat-pump-1-speed-research-features.xml')
hpxml_bldg.heat_pumps[0].fraction_heat_load_served = 0.5
when 'hvac-research-features-onoff-thermostat-cool-load-fraction-partial'
hpxml, hpxml_bldg = _create_hpxml('base-hvac-air-to-air-heat-pump-1-speed-research-features.xml')
hpxml_bldg.heat_pumps[0].fraction_cool_load_served = 0.5
when 'hvac-research-features-onoff-thermostat-negative-value'
hpxml, _hpxml_bldg = _create_hpxml('base-hvac-air-to-air-heat-pump-1-speed-research-features.xml')
hpxml.header.hvac_onoff_thermostat_deadband = -1.0
when 'hvac-research-features-onoff-thermostat-two-heat-pumps'
hpxml, hpxml_bldg = _create_hpxml('base-hvac-air-to-air-heat-pump-1-speed-research-features.xml')
hpxml_bldg.heat_pumps[0].fraction_cool_load_served = 0.5
hpxml_bldg.heat_pumps[0].fraction_heat_load_served = 0.5
hpxml_bldg.heat_pumps << hpxml_bldg.heat_pumps[0].dup
hpxml_bldg.heat_pumps[-1].id = 'HeatPump2'
hpxml_bldg.heat_pumps[-1].primary_heating_system = false
hpxml_bldg.heat_pumps[-1].primary_cooling_system = false
when 'hvac-gshp-invalid-bore-config'
hpxml, hpxml_bldg = _create_hpxml('base-hvac-ground-to-air-heat-pump-detailed-geothermal-loop.xml')
hpxml_bldg.geothermal_loops[0].bore_config = 'Invalid'
when 'hvac-gshp-invalid-bore-depth-low'
hpxml, hpxml_bldg = _create_hpxml('base-hvac-ground-to-air-heat-pump-detailed-geothermal-loop.xml')
hpxml_bldg.geothermal_loops[0].bore_length = 78
when 'hvac-gshp-invalid-bore-depth-high'
hpxml, hpxml_bldg = _create_hpxml('base-hvac-ground-to-air-heat-pump-detailed-geothermal-loop.xml')
hpxml_bldg.geothermal_loops[0].bore_length = 501
when 'hvac-gshp-autosized-count-not-rectangle'
hpxml, hpxml_bldg = _create_hpxml('base-hvac-ground-to-air-heat-pump-detailed-geothermal-loop.xml')
hpxml_bldg.geothermal_loops[0].num_bore_holes = nil
when 'hvac-invalid-fan-model-type'
hpxml, hpxml_bldg = _create_hpxml('base-hvac-air-to-air-heat-pump-1-speed.xml')
hpxml_bldg.heat_pumps[0].fan_motor_type = 'foo'
when 'hvac-invalid-eer'
hpxml, hpxml_bldg = _create_hpxml('base-hvac-air-to-air-heat-pump-1-speed-seer-hspf.xml')
hpxml_bldg.heat_pumps[0].cooling_efficiency_eer = hpxml_bldg.heat_pumps[0].cooling_efficiency_seer + 1
when 'hvac-invalid-eer2'
hpxml, hpxml_bldg = _create_hpxml('base-hvac-air-to-air-heat-pump-1-speed.xml')
hpxml_bldg.heat_pumps[0].cooling_efficiency_eer2 = hpxml_bldg.heat_pumps[0].cooling_efficiency_seer2 + 1
when 'hvac-location-heating-system'
hpxml, hpxml_bldg = _create_hpxml('base-hvac-boiler-oil-only.xml')
hpxml_bldg.heating_systems[0].location = HPXML::LocationBasementUnconditioned
when 'hvac-location-cooling-system'
hpxml, hpxml_bldg = _create_hpxml('base-hvac-central-ac-only-1-speed.xml')
hpxml_bldg.cooling_systems[0].location = HPXML::LocationBasementUnconditioned
when 'hvac-location-heat-pump'
hpxml, hpxml_bldg = _create_hpxml('base-hvac-air-to-air-heat-pump-1-speed.xml')
hpxml_bldg.heat_pumps[0].location = HPXML::LocationBasementUnconditioned
when 'hvac-msac-not-var-speed'
hpxml, hpxml_bldg = _create_hpxml('base-hvac-mini-split-air-conditioner-only-ductless.xml')
hpxml_bldg.cooling_systems[0].compressor_type = HPXML::HVACCompressorTypeTwoStage
when 'hvac-mshp-not-var-speed'
hpxml, hpxml_bldg = _create_hpxml('base-hvac-mini-split-heat-pump-ductless.xml')
hpxml_bldg.heat_pumps[0].compressor_type = HPXML::HVACCompressorTypeSingleStage
when 'hvac-sizing-humidity-setpoint'
hpxml, hpxml_bldg = _create_hpxml('base.xml')
hpxml_bldg.header.manualj_humidity_setpoint = 50
when 'hvac-sizing-daily-temp-range'
hpxml, hpxml_bldg = _create_hpxml('base.xml')
hpxml_bldg.header.manualj_daily_temp_range = 'foobar'
when 'hvac-negative-crankcase-heater-watts'
hpxml, hpxml_bldg = _create_hpxml('base.xml')
hpxml_bldg.cooling_systems[0].crankcase_heater_watts = -10
when 'incomplete-integrated-heating'
hpxml, hpxml_bldg = _create_hpxml('base-hvac-ptac-with-heating-electricity.xml')
hpxml_bldg.cooling_systems[0].integrated_heating_system_fraction_heat_load_served = nil
when 'invalid-airflow-defect-ratio'
hpxml, hpxml_bldg = _create_hpxml('base-hvac-mini-split-heat-pump-ductless.xml')
hpxml_bldg.heat_pumps[0].airflow_defect_ratio = -0.25
when 'invalid-airflow-rates'
hpxml, hpxml_bldg = _create_hpxml('base.xml')
hpxml_bldg.heating_systems[0].heating_design_airflow_cfm = -1
hpxml_bldg.cooling_systems[0].cooling_design_airflow_cfm = -1
when 'invalid-assembly-effective-rvalue'
hpxml, hpxml_bldg = _create_hpxml('base.xml')
hpxml_bldg.walls[0].insulation_assembly_r_value = 0.0
when 'invalid-battery-capacities-ah'
hpxml, hpxml_bldg = _create_hpxml('base-pv-battery-ah.xml')
hpxml_bldg.batteries[0].usable_capacity_ah = hpxml_bldg.batteries[0].nominal_capacity_ah
when 'invalid-battery-capacities-kwh'
hpxml, hpxml_bldg = _create_hpxml('base-pv-battery.xml')
hpxml_bldg.batteries[0].usable_capacity_kwh = hpxml_bldg.batteries[0].nominal_capacity_kwh
when 'invalid-calendar-year-low'
hpxml, hpxml_bldg = _create_hpxml('base.xml')
hpxml.header.sim_calendar_year = 1575
when 'invalid-calendar-year-high'
hpxml, hpxml_bldg = _create_hpxml('base.xml')
hpxml.header.sim_calendar_year = 20000
when 'invalid-clothes-dryer-cef'
hpxml, hpxml_bldg = _create_hpxml('base.xml')
hpxml_bldg.clothes_dryers[0].combined_energy_factor = 0
when 'invalid-clothes-washer-imef'
hpxml, hpxml_bldg = _create_hpxml('base.xml')
hpxml_bldg.clothes_washers[0].integrated_modified_energy_factor = 0
when 'invalid-cfis-addtl-runtime-mode'
hpxml, hpxml_bldg = _create_hpxml('base-mechvent-cfis-control-type-timer.xml')
hpxml_bldg.ventilation_fans[0].cfis_addtl_runtime_operating_mode = HPXML::CFISModeNone
hpxml_bldg.ventilation_fans[0].fan_power = nil
when 'invalid-dishwasher-ler'
hpxml, hpxml_bldg = _create_hpxml('base.xml')
hpxml_bldg.dishwashers[0].label_electric_rate = 0
when 'invalid-duct-area-fractions'
hpxml, hpxml_bldg = _create_hpxml('base-enclosure-2stories.xml')
hpxml_bldg.hvac_distributions[0].ducts[0].duct_fraction_area = 0.65
hpxml_bldg.hvac_distributions[0].ducts[1].duct_fraction_area = 0.65
hpxml_bldg.hvac_distributions[0].ducts[2].duct_fraction_area = 0.15
hpxml_bldg.hvac_distributions[0].ducts[3].duct_fraction_area = 0.15
when 'invalid-facility-type'
hpxml, hpxml_bldg = _create_hpxml('base-bldgtype-mf-unit-shared-laundry-room.xml')
hpxml_bldg.building_construction.residential_facility_type = HPXML::ResidentialTypeSFD
when 'invalid-foundation-wall-properties'
hpxml, hpxml_bldg = _create_hpxml('base-foundation-unconditioned-basement-wall-insulation.xml')
hpxml_bldg.foundation_walls[0].depth_below_grade = 9.0
hpxml_bldg.foundation_walls[0].insulation_interior_distance_to_top = 12.0
hpxml_bldg.foundation_walls[0].insulation_interior_distance_to_bottom = 10.0
when 'invalid-ground-conductivity'
hpxml, hpxml_bldg = _create_hpxml('base.xml')
hpxml_bldg.site.ground_conductivity = 0.0
when 'invalid-ground-diffusivity'
hpxml, hpxml_bldg = _create_hpxml('base.xml')
hpxml_bldg.site.ground_diffusivity = 0.0
when 'invalid-heat-pump-capacity-fraction-17F'
hpxml, hpxml_bldg = _create_hpxml('base-hvac-air-to-air-heat-pump-1-speed.xml')
hpxml_bldg.heat_pumps[0].heating_capacity_17F = nil
hpxml_bldg.heat_pumps[0].heating_capacity_fraction_17F = 1.5
when 'invalid-heat-pump-capacity-fraction-17F-2'
hpxml, hpxml_bldg = _create_hpxml('base-hvac-air-to-air-heat-pump-1-speed.xml')
hpxml_bldg.heat_pumps[0].heating_capacity_17F = nil
hpxml_bldg.heat_pumps[0].heating_capacity_fraction_17F = -1
when 'invalid-hvac-installation-quality'
hpxml, hpxml_bldg = _create_hpxml('base-hvac-air-to-air-heat-pump-1-speed.xml')
hpxml_bldg.heat_pumps[0].airflow_defect_ratio = -99
hpxml_bldg.heat_pumps[0].charge_defect_ratio = -99
when 'invalid-hvac-installation-quality2'
hpxml, hpxml_bldg = _create_hpxml('base-hvac-air-to-air-heat-pump-1-speed.xml')
hpxml_bldg.heat_pumps[0].airflow_defect_ratio = 99
hpxml_bldg.heat_pumps[0].charge_defect_ratio = 99
when 'invalid-id2'
hpxml, hpxml_bldg = _create_hpxml('base-enclosure-skylights.xml')
when 'invalid-input-parameters'
hpxml, hpxml_bldg = _create_hpxml('base.xml')
hpxml.header.transaction = 'modify'
hpxml_bldg.site.site_type = 'mountain'
hpxml_bldg.climate_and_risk_zones.climate_zone_ieccs[0].year = 2020
hpxml_bldg.roofs.each do |roof|
roof.radiant_barrier_grade = 4
end
hpxml_bldg.roofs[0].azimuth = 365
hpxml_bldg.dishwashers[0].rated_annual_kwh = nil
hpxml_bldg.dishwashers[0].energy_factor = 5.1
when 'invalid-insulation-top'
hpxml, hpxml_bldg = _create_hpxml('base.xml')
hpxml_bldg.foundation_walls[0].insulation_interior_distance_to_top = -0.5
when 'invalid-integrated-heating'
hpxml, hpxml_bldg = _create_hpxml('base-hvac-central-ac-only-1-speed.xml')
hpxml_bldg.cooling_systems[0].integrated_heating_system_fuel = HPXML::FuelTypeElectricity
hpxml_bldg.cooling_systems[0].integrated_heating_system_efficiency_percent = 0.98
hpxml_bldg.cooling_systems[0].integrated_heating_system_fraction_heat_load_served = 1.0
when 'invalid-lighting-groups'
hpxml, hpxml_bldg = _create_hpxml('base-enclosure-garage.xml')
[HPXML::LocationInterior, HPXML::LocationExterior, HPXML::LocationGarage].each do |ltg_loc|
hpxml_bldg.lighting_groups.each do |lg|
next unless lg.location == ltg_loc
lg.delete
break
end
end
when 'invalid-lighting-groups2'
hpxml, hpxml_bldg = _create_hpxml('base-enclosure-garage.xml')
[HPXML::LocationInterior, HPXML::LocationExterior, HPXML::LocationGarage].each do |ltg_loc|
hpxml_bldg.lighting_groups.each do |lg|
next unless lg.location == ltg_loc
hpxml_bldg.lighting_groups << lg.dup
hpxml_bldg.lighting_groups[-1].id = "LightingGroup#{hpxml_bldg.lighting_groups.size}"
hpxml_bldg.lighting_groups[-1].fraction_of_units_in_location = 0.0
break
end
end
when 'invalid-natvent-availability'
hpxml, hpxml_bldg = _create_hpxml('base.xml')
hpxml_bldg.header.natvent_days_per_week = 8
when 'invalid-natvent-availability2'
hpxml, hpxml_bldg = _create_hpxml('base.xml')
hpxml_bldg.header.natvent_days_per_week = -1
when 'invalid-number-of-bedrooms-served-pv'
hpxml, hpxml_bldg = _create_hpxml('base-bldgtype-mf-unit-shared-pv.xml')
hpxml_bldg.pv_systems[0].number_of_bedrooms_served = 3
when 'invalid-number-of-bedrooms-served-recirc'
hpxml, hpxml_bldg = _create_hpxml('base-bldgtype-mf-unit-shared-water-heater-recirc.xml')
hpxml_bldg.hot_water_distributions[0].shared_recirculation_number_of_bedrooms_served = 3
when 'invalid-number-of-bedrooms-served-water-heater'
hpxml, hpxml_bldg = _create_hpxml('base-bldgtype-mf-unit-shared-water-heater.xml')
hpxml_bldg.water_heating_systems[0].number_of_bedrooms_served = 3
when 'invalid-number-of-conditioned-floors'
hpxml, hpxml_bldg = _create_hpxml('base.xml')
hpxml_bldg.building_construction.number_of_conditioned_floors_above_grade = 3
when 'invalid-number-of-conditioned-floors-above-grade'
hpxml, hpxml_bldg = _create_hpxml('base.xml')
hpxml_bldg.building_construction.number_of_conditioned_floors_above_grade = 0
when 'invalid-pilot-light-heating-system'
hpxml, hpxml_bldg = _create_hpxml('base-hvac-floor-furnace-propane-only.xml')
hpxml_bldg.heating_systems[0].heating_system_fuel = HPXML::FuelTypeElectricity
when 'invalid-shared-vent-in-unit-flowrate'
hpxml, hpxml_bldg = _create_hpxml('base-bldgtype-mf-unit-shared-mechvent.xml')
hpxml_bldg.ventilation_fans[0].rated_flow_rate = 80
when 'invalid-timestep'
hpxml, hpxml_bldg = _create_hpxml('base.xml')
hpxml.header.timestep = 45
when 'invalid-timezone-utcoffset-low'
hpxml, hpxml_bldg = _create_hpxml('base.xml')
hpxml_bldg.time_zone_utc_offset = -13
when 'invalid-timezone-utcoffset-high'
hpxml, hpxml_bldg = _create_hpxml('base.xml')
hpxml_bldg.time_zone_utc_offset = 15
when 'invalid-ventilation-fan'
hpxml, hpxml_bldg = _create_hpxml('base-mechvent-exhaust.xml')
hpxml_bldg.ventilation_fans[0].used_for_garage_ventilation = true
when 'invalid-ventilation-recovery'
hpxml, hpxml_bldg = _create_hpxml('base-mechvent-exhaust.xml')
hpxml_bldg.ventilation_fans[0].sensible_recovery_efficiency = 0.72
hpxml_bldg.ventilation_fans[0].total_recovery_efficiency = 0.48
when 'invalid-water-heater-heating-capacity'
hpxml, hpxml_bldg = _create_hpxml('base-dhw-tank-gas.xml')
hpxml_bldg.water_heating_systems[0].heating_capacity = 0
when 'invalid-water-heater-heating-capacity2'
hpxml, hpxml_bldg = _create_hpxml('base-dhw-tank-heat-pump.xml')
hpxml_bldg.water_heating_systems[0].heating_capacity = 0
when 'invalid-water-heater-stratified-tank-model'
hpxml, hpxml_bldg = _create_hpxml('base-dhw-tank-gas.xml')
hpxml_bldg.water_heating_systems[0].tank_model_type = HPXML::WaterHeaterTankModelTypeStratified
when 'invalid-whole-sfa-or-mf-building-sim'
hpxml, hpxml_bldg = _create_hpxml('base.xml')
hpxml.header.whole_sfa_or_mf_building_sim = true
when 'invalid-window-height'
hpxml, hpxml_bldg = _create_hpxml('base-enclosure-overhangs.xml')
hpxml_bldg.windows[1].overhangs_distance_to_bottom_of_window = 1.0
when 'leakiness-description-missing-year-built'
hpxml, hpxml_bldg = _create_hpxml('base-enclosure-infil-leakiness-description.xml')
hpxml_bldg.building_construction.year_built = nil
when 'lighting-fractions'
hpxml, hpxml_bldg = _create_hpxml('base.xml')
int_cfl = hpxml_bldg.lighting_groups.find { |lg| lg.location == HPXML::LocationInterior && lg.lighting_type == HPXML::LightingTypeCFL }
int_cfl.fraction_of_units_in_location = 0.8
when 'manufactured-home-reference-duct'
hpxml, hpxml_bldg = _create_hpxml('base.xml')
hpxml_bldg.hvac_distributions[0].ducts[1].duct_location = HPXML::LocationManufacturedHomeBelly
when 'manufactured-home-reference-water-heater'
hpxml, hpxml_bldg = _create_hpxml('base.xml')
hpxml_bldg.water_heating_systems[0].location = HPXML::LocationManufacturedHomeBelly
when 'manufactured-home-reference-floor'
hpxml, hpxml_bldg = _create_hpxml('base-foundation-vented-crawlspace.xml')
hpxml_bldg.floors.each do |floor|
if floor.exterior_adjacent_to == HPXML::LocationCrawlspaceVented
floor.exterior_adjacent_to = HPXML::LocationManufacturedHomeUnderBelly
break
end
end
when 'missing-attached-to-space-wall'
hpxml, hpxml_bldg = _create_hpxml('base-zones-spaces.xml')
hpxml_bldg.walls.find { |s| s.interior_adjacent_to == HPXML::LocationConditionedSpace }.attached_to_space_idref = nil
when 'missing-attached-to-space-slab'
hpxml, hpxml_bldg = _create_hpxml('base-zones-spaces.xml')
hpxml_bldg.slabs.find { |s| s.interior_adjacent_to == HPXML::LocationBasementConditioned }.attached_to_space_idref = nil
when 'missing-attached-to-zone'
hpxml, hpxml_bldg = _create_hpxml('base-zones-spaces.xml')
hpxml_bldg.hvac_systems[0].attached_to_zone_idref = nil
when 'missing-cfis-supplemental-fan'
hpxml, hpxml_bldg = _create_hpxml('base-mechvent-cfis-supplemental-fan-exhaust.xml')
hpxml_bldg.ventilation_fans[1].delete
when 'missing-distribution-cfa-served'
hpxml, hpxml_bldg = _create_hpxml('base.xml')
hpxml_bldg.hvac_distributions[0].conditioned_floor_area_served = nil
when 'missing-duct-area'
hpxml, hpxml_bldg = _create_hpxml('base.xml')
hpxml_bldg.hvac_distributions[0].conditioned_floor_area_served = hpxml_bldg.building_construction.conditioned_floor_area
hpxml_bldg.hvac_distributions[0].ducts[1].duct_fraction_area = nil
hpxml_bldg.hvac_distributions[0].ducts[3].duct_fraction_area = 1.0
when 'missing-duct-location'
hpxml, hpxml_bldg = _create_hpxml('base.xml')
hpxml_bldg.hvac_distributions[0].ducts[1].duct_location = nil
when 'missing-elements'
hpxml, hpxml_bldg = _create_hpxml('base.xml')
hpxml_bldg.building_construction.number_of_conditioned_floors = nil
hpxml_bldg.building_construction.conditioned_floor_area = nil
when 'missing-epw-filepath-and-zipcode'
hpxml, hpxml_bldg = _create_hpxml('base.xml')
hpxml_bldg.climate_and_risk_zones.weather_station_epw_filepath = nil
when 'missing-hpwh-containment-volume'
hpxml, hpxml_bldg = _create_hpxml('base-dhw-tank-heat-pump-confined-space.xml')
hpxml_bldg.water_heating_systems[0].hpwh_containment_volume = nil
when 'missing-inverter-idref'
hpxml, hpxml_bldg = _create_hpxml('base-pv.xml')
hpxml_bldg.inverters.add(id: 'Inverter1')
hpxml_bldg.inverters.add(id: 'Inverter2')
when 'missing-skylight-floor'
hpxml, hpxml_bldg = _create_hpxml('base-enclosure-skylights.xml')
hpxml_bldg.skylights[0].attached_to_floor_idref = nil
when 'multifamily-common-space-extra-inputs'
hpxml, hpxml_bldg = _create_hpxml('base-bldgtype-mf-whole-building-common-spaces.xml')
hpxml.buildings[1].foundation_walls[1].height = 8
hpxml.buildings[1].floors[0].area = 20
hpxml.buildings[1].rim_joists[1].area = 10
hpxml.buildings[2].walls[1].area = 20
when 'multifamily-common-space-whole-sfa-or-mf-building-sim-false'
hpxml, hpxml_bldg = _create_hpxml('base-bldgtype-mf-whole-building-common-spaces.xml')
hpxml.header.whole_sfa_or_mf_building_sim = false
when 'multifamily-reference-appliance'
hpxml, hpxml_bldg = _create_hpxml('base.xml')
hpxml_bldg.clothes_washers[0].location = HPXML::LocationOtherHousingUnit
when 'multifamily-reference-duct'
hpxml, hpxml_bldg = _create_hpxml('base.xml')
hpxml_bldg.hvac_distributions[0].ducts[0].duct_location = HPXML::LocationOtherMultifamilyBufferSpace
when 'multifamily-reference-surface'
hpxml, hpxml_bldg = _create_hpxml('base.xml')
hpxml_bldg.floors << hpxml_bldg.floors[0].dup
hpxml_bldg.floors[1].id = "Floor#{hpxml_bldg.floors.size}"
hpxml_bldg.floors[1].insulation_id = "FloorInsulation#{hpxml_bldg.floors.size}"
hpxml_bldg.floors[1].exterior_adjacent_to = HPXML::LocationOtherHeatedSpace
hpxml_bldg.floors[1].floor_or_ceiling = HPXML::FloorOrCeilingCeiling
when 'multifamily-reference-water-heater'
hpxml, hpxml_bldg = _create_hpxml('base.xml')
hpxml_bldg.water_heating_systems[0].location = HPXML::LocationOtherNonFreezingSpace
when 'negative-autosizing-factors'
hpxml, hpxml_bldg = _create_hpxml('base-hvac-air-to-air-heat-pump-1-speed-autosize-factor.xml')
hpxml_bldg.heat_pumps[0].heating_autosizing_factor = -0.5
hpxml_bldg.heat_pumps[0].cooling_autosizing_factor = -1.2
hpxml_bldg.heat_pumps[0].backup_heating_autosizing_factor = -0.1
when 'negative-hpwh-containment-volume'
hpxml, hpxml_bldg = _create_hpxml('base-dhw-tank-heat-pump-confined-space.xml')
hpxml_bldg.water_heating_systems[0].hpwh_containment_volume = -10.0
when 'panel-zero-total-breaker-spaces'
hpxml, hpxml_bldg = _create_hpxml('base.xml')
hpxml_bldg.electric_panels.add(id: 'ElectricPanel1',
rated_total_spaces: 0)
when 'panel-without-required-system'
hpxml, hpxml_bldg = _create_hpxml('base.xml')
hpxml_bldg.electric_panels.add(id: 'ElectricPanel1')
hpxml_bldg.electric_panels[0].service_feeders.add(id: 'ServiceFeeder1',
type: HPXML::ElectricPanelLoadTypeHeating)
when 'panel-with-unrequired-system'
hpxml, hpxml_bldg = _create_hpxml('base.xml')
hpxml_bldg.electric_panels.add(id: 'ElectricPanel1')
hpxml_bldg.electric_panels[0].service_feeders.add(id: 'ServiceFeeder1',
type: HPXML::ElectricPanelLoadTypeLighting,
component_idrefs: [hpxml_bldg.lighting_groups[0].id])
when 'panel-without-load-type'
hpxml, hpxml_bldg = _create_hpxml('base.xml')
hpxml_bldg.electric_panels.add(id: 'ElectricPanel1')
hpxml_bldg.electric_panels[0].service_feeders.add(id: 'ServiceFeeder1')
when 'panel-insufficient-voltage'
hpxml, hpxml_bldg = _create_hpxml('base.xml')
hpxml_bldg.electric_panels.add(id: 'ElectricPanel1',
voltage: HPXML::ElectricPanelVoltage120)
hpxml_bldg.electric_panels[0].branch_circuits.add(id: 'BranchCircuit1',
voltage: HPXML::ElectricPanelVoltage240)
when 'panel-zero-meter-based'
hpxml, hpxml_bldg = _create_hpxml('base.xml')
hpxml_bldg.electric_panels.add(id: 'ElectricPanel1')
hpxml.header.service_feeders_load_calculation_types = [HPXML::ElectricPanelLoadCalculationType2023ExistingDwellingMeterBased]
hpxml_bldg.header.electric_panel_baseline_peak_power = 0
when 'refrigerator-location'
hpxml, hpxml_bldg = _create_hpxml('base.xml')
hpxml_bldg.refrigerators[0].location = HPXML::LocationGarage
when 'refrigerator-schedule'
hpxml, hpxml_bldg = _create_hpxml('base.xml')
hpxml_bldg.refrigerators[0].weekday_fractions = '0.040, 0.039, 0.038, 0.037, 0.036, 0.036, 0.038, 0.040, 0.041, 0.041, 0.040, 0.040, 0.042, 0.042, 0.042, 0.041, 0.044, 0.048, 0.050, 0.048, 0.047, 0.046, 0.044, 0.041'
hpxml_bldg.refrigerators[0].constant_coefficients = '-0.487, -0.340, -0.370, -0.361, -0.515, -0.684, -0.471, -0.159, -0.079, -0.417, -0.411, -0.386, -0.240, -0.314, -0.160, -0.121, -0.469, -0.412, -0.091, 0.077, -0.118, -0.247, -0.445, -0.544'
when 'solar-fraction-one'
hpxml, hpxml_bldg = _create_hpxml('base-dhw-solar-fraction.xml')
hpxml_bldg.solar_thermal_systems[0].solar_fraction = 1.0
when 'sum-space-floor-area'
hpxml, hpxml_bldg = _create_hpxml('base-zones-spaces.xml')
hpxml_bldg.conditioned_spaces.each do |space|
space.floor_area /= 2.0
end
when 'sum-space-floor-area2'
hpxml, hpxml_bldg = _create_hpxml('base-zones-spaces.xml')
hpxml_bldg.conditioned_spaces.each do |space|
space.floor_area *= 2.0
end
when 'vehicle-ev-multiple-BEV'
hpxml, hpxml_bldg = _create_hpxml('base-vehicle-ev-charger-scheduled.xml')
hpxml_bldg.vehicles.add(id: 'ElectricVehicle2',
vehicle_type: HPXML::VehicleTypeBEV)
when 'vehicle-ev-invalid-fuel-economy-units'
hpxml, hpxml_bldg = _create_hpxml('base-vehicle-ev-charger-scheduled.xml')
hpxml_bldg.vehicles[0].fuel_economy_units = 'mpg'
when 'water-heater-location'
hpxml, hpxml_bldg = _create_hpxml('base.xml')
hpxml_bldg.water_heating_systems[0].location = HPXML::LocationCrawlspaceVented
when 'water-heater-location-other'
hpxml, hpxml_bldg = _create_hpxml('base.xml')
hpxml_bldg.water_heating_systems[0].location = HPXML::LocationUnconditionedSpace
when 'water-heater-recovery-efficiency'
hpxml, hpxml_bldg = _create_hpxml('base-dhw-tank-gas-ef.xml')
hpxml_bldg.water_heating_systems[0].recovery_efficiency = hpxml_bldg.water_heating_systems[0].energy_factor
when 'wrong-infiltration-method-blower-door'
hpxml, hpxml_bldg = _create_hpxml('base-enclosure-infil-leakiness-description.xml')
hpxml_bldg.header.manualj_infiltration_method = HPXML::ManualJInfiltrationMethodBlowerDoor
when 'wrong-infiltration-method-default-table'
hpxml, hpxml_bldg = _create_hpxml('base.xml')
hpxml_bldg.header.manualj_infiltration_method = HPXML::ManualJInfiltrationMethodDefaultTable
else
fail "Unhandled case: #{error_case}."
end
hpxml_doc = hpxml.to_doc()
# Perform additional raw XML manipulation
if error_case == 'invalid-id2'
element = XMLHelper.get_element(hpxml_doc, '/HPXML/Building/BuildingDetails/Enclosure/Skylights/Skylight/SystemIdentifier')
XMLHelper.delete_attribute(element, 'id')
end
# Test against schematron
XMLHelper.write_file(hpxml_doc, @tmp_hpxml_path)
_test_schema_and_schematron_validation(@tmp_hpxml_path, hpxml_doc, expected_errors: expected_errors, test_name: error_case)
end
end
# Test warnings are correctly triggered during the XSD schema or Schematron validation
def test_schema_schematron_warning_messages
# Test case => Warning message(s)
all_expected_warnings = { 'battery-pv-output-power-low' => ['Max power output should typically be greater than or equal to 500 W.',
'Max power output should typically be greater than or equal to 500 W.',
'Rated power output should typically be greater than or equal to 1000 W.'],
'dhw-capacities-low' => ['Heating capacity should typically be greater than or equal to 1000 Btu/hr.',
'Heating capacity should typically be greater than or equal to 1000 Btu/hr.',
'No space cooling specified, the model will not include space cooling energy use.'],
'dhw-efficiencies-low' => ['EnergyFactor should typically be greater than or equal to 0.45.',
'EnergyFactor should typically be greater than or equal to 0.45.',
'EnergyFactor should typically be greater than or equal to 0.45.',
'EnergyFactor should typically be greater than or equal to 0.45.',
'No space cooling specified, the model will not include space cooling energy use.'],
'dhw-setpoint-low' => ['Hot water setpoint should typically be greater than or equal to 110 deg-F.'],
'erv-atre-low' => ['Adjusted total recovery efficiency should typically be at least half of the adjusted sensible recovery efficiency.'],
'erv-tre-low' => ['Total recovery efficiency should typically be at least half of the sensible recovery efficiency.'],
'ev-charging-methods' => ['Electric vehicle charging was specified as both a PlugLoad and a Vehicle, the latter will be ignored.'],
'fuel-load-type-other' => ["Fuel load type 'other' is not currently handled, the fuel load will not be modeled."],
'garage-ventilation' => ['Ventilation fans for the garage are not currently modeled.'],
'heat-pump-defrost-backup' => ['BackupHeatingActiveDuringDefrost does not apply when system has separate backup heating'],