tbd 3.4.2 → 3.4.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: abfbf89a3f613a331c4bf58b25832bc2d9e8942a4872e73f76d534ee015eae57
4
- data.tar.gz: a7c0be9d974075a0f7f1e2b661c5a2e2afffb3793f81b232d14a914bd79acc71
3
+ metadata.gz: 24c3c1ce27d2513d0f1529795e7016ad07a69e3499d5e79f7164698e1a16dc48
4
+ data.tar.gz: f23f7f85a54bcc551179ba751e826dc2951520e4ad0e17eaafad8fac01cea9fc
5
5
  SHA512:
6
- metadata.gz: 2b685fbad6b1964db44f7afeb782cc2a59b7a4e8322ee3b14ec402cc3fc0cbe4e7a6d177cb4dc07deab1c184dd3afd0fe66b4d49f5b985c4296138b24889aa48
7
- data.tar.gz: 1f153539250dc61b2da7f5b7badb8bcbe5e6fbdaa8ae316a20bf3b743e57bee27b3cd061b9cbf49cc867db7d9fb867f21f6fcb32252ab60fade7e1e17131ab6e
6
+ metadata.gz: 02cb220811ddcc388c7ae20d17ffc2cfc0b64322605d5c571c2fbd1e325018ec44c7801b7aa0b0d7f2481ec0f0ebee25061130ccd7814f5badf7cb3b01fce625
7
+ data.tar.gz: 7cf328dca053b90d53c05f070c36f13a7ac9b9813435276ddaf9c14a4bc24e4d287ed7ffb698a6e3f1e5a71822b0f568bfa48155053620a3297d497a4cac5c21
@@ -134,3 +134,19 @@ jobs:
134
134
  docker exec -t test bundle update
135
135
  docker exec -t test bundle exec rake
136
136
  docker kill test
137
+ test_390x:
138
+ runs-on: ubuntu-22.04
139
+ steps:
140
+ - name: Check out repository
141
+ uses: actions/checkout@v2
142
+ - name: Run Tests
143
+ run: |
144
+ echo $(pwd)
145
+ echo $(ls)
146
+ docker pull nrel/openstudio:3.9.0
147
+ docker run --name test --rm -d -t -v $(pwd):/work -w /work nrel/openstudio:3.9.0
148
+ docker exec -t test pwd
149
+ docker exec -t test ls
150
+ docker exec -t test bundle update
151
+ docker exec -t test bundle exec rake
152
+ docker kill test
data/Rakefile CHANGED
@@ -15,7 +15,7 @@ task :libraries do
15
15
 
16
16
  libs = ["topolys", "osut", "oslg", "tbd"]
17
17
  files = {}
18
-
18
+
19
19
  $:.each do |path|
20
20
  libs.each do |l|
21
21
  next unless path.include?(l)
@@ -3,8 +3,8 @@
3
3
  <schema_version>3.1</schema_version>
4
4
  <name>tbd_measure</name>
5
5
  <uid>8890787b-8c25-4dc8-8641-b6be1b6c2357</uid>
6
- <version_id>3ebf3217-230b-4420-b679-4bdf8cc51519</version_id>
7
- <version_modified>2024-05-22T14:33:33Z</version_modified>
6
+ <version_id>70223737-c3ea-4df0-8506-67083c92fb6e</version_id>
7
+ <version_modified>2024-11-20T20:02:15Z</version_modified>
8
8
  <xml_checksum>99772807</xml_checksum>
9
9
  <class_name>TBDMeasure</class_name>
10
10
  <display_name>Thermal Bridging and Derating - TBD</display_name>
@@ -499,7 +499,7 @@
499
499
  <filename>geo.rb</filename>
500
500
  <filetype>rb</filetype>
501
501
  <usage_type>resource</usage_type>
502
- <checksum>6C7ACC99</checksum>
502
+ <checksum>9FAC0CDC</checksum>
503
503
  </file>
504
504
  <file>
505
505
  <filename>geometry.rb</filename>
@@ -523,13 +523,13 @@
523
523
  <filename>psi.rb</filename>
524
524
  <filetype>rb</filetype>
525
525
  <usage_type>resource</usage_type>
526
- <checksum>5ABDA733</checksum>
526
+ <checksum>4B7F3586</checksum>
527
527
  </file>
528
528
  <file>
529
529
  <filename>tbd.rb</filename>
530
530
  <filetype>rb</filetype>
531
531
  <usage_type>resource</usage_type>
532
- <checksum>E8D38E59</checksum>
532
+ <checksum>FCCCAE84</checksum>
533
533
  </file>
534
534
  <file>
535
535
  <filename>transformation.rb</filename>
@@ -541,13 +541,13 @@
541
541
  <filename>ua.rb</filename>
542
542
  <filetype>rb</filetype>
543
543
  <usage_type>resource</usage_type>
544
- <checksum>4133AC61</checksum>
544
+ <checksum>626D3BE0</checksum>
545
545
  </file>
546
546
  <file>
547
547
  <filename>utils.rb</filename>
548
548
  <filetype>rb</filetype>
549
549
  <usage_type>resource</usage_type>
550
- <checksum>E3B4AF4B</checksum>
550
+ <checksum>CBC3935D</checksum>
551
551
  </file>
552
552
  <file>
553
553
  <filename>version.rb</filename>
@@ -722,15 +722,10 @@ module TBD
722
722
  kva = true unless surface.surfacePropertyExposedFoundationPerimeter.empty?
723
723
  surface.resetAdjacentFoundation
724
724
  surface.resetSurfacePropertyExposedFoundationPerimeter
725
- next unless surface.isGroundSurface
726
725
  next if surface.outsideBoundaryCondition.capitalize == boundary
726
+ next unless surface.outsideBoundaryCondition.capitalize == "Foundation"
727
727
 
728
- lc = surface.construction.empty? ? nil : surface.construction.get
729
728
  surface.setOutsideBoundaryCondition(boundary)
730
- next if boundary == "Ground"
731
- next if lc.nil?
732
-
733
- surface.setConstruction(lc) if surface.construction.empty?
734
729
  end
735
730
 
736
731
  perimeters = model.getSurfacePropertyExposedFoundationPerimeters
@@ -834,11 +829,16 @@ module TBD
834
829
  edges.each do |code1, edge|
835
830
  edge[:surfaces].keys.each do |id|
836
831
  next unless floors.key?(id)
832
+
837
833
  next unless floors[id][:boundary].downcase == "foundation"
838
834
  next if floors[id].key?(:kiva)
839
835
 
840
- floors[id][:kiva ] = :slab # initially slabs-on-grade
841
- floors[id][:exposed] = 0.0 # slab-on-grade or walkout perimeter
836
+ # Initially set as slab-on-grade. Track 'exposed foundation perimeter'.
837
+ # - outdoor wall/slab-on-grade edge lengths
838
+ # - outdoor wall/basement slab walkout edge lengths
839
+ # - basement wall/basement slab edge lengths
840
+ floors[id][:kiva ] = :slab
841
+ floors[id][:exposed] = 0.0
842
842
 
843
843
  # Loop around current edge.
844
844
  edge[:surfaces].keys.each do |i|
@@ -847,8 +847,9 @@ module TBD
847
847
  next unless walls[i][:boundary].downcase == "foundation"
848
848
  next if walls[i].key?(:kiva)
849
849
 
850
- floors[id][:kiva] = :basement
851
- walls[i ][:kiva] = id
850
+ floors[id][:kiva ] = :basement
851
+ floors[id][:exposed] += edge[:length]
852
+ walls[i ][:kiva ] = id
852
853
  end
853
854
 
854
855
  # Loop around current edge.
@@ -862,7 +863,7 @@ module TBD
862
863
 
863
864
  # Loop around other floor edges.
864
865
  edges.each do |code2, e|
865
- next if code1 == code2 # skip - same edge
866
+ next if code1 == code2 # skip - same edge
866
867
 
867
868
  e[:surfaces].keys.each do |i|
868
869
  next unless i == id # good - same floor
@@ -873,8 +874,9 @@ module TBD
873
874
  next unless walls[ii][:boundary].downcase == "foundation"
874
875
  next if walls[ii].key?(:kiva)
875
876
 
876
- floors[id][:kiva] = :basement
877
- walls[ii ][:kiva] = id
877
+ floors[id][:kiva ] = :basement
878
+ walls[ii ][:kiva ] = id
879
+ floors[id][:exposed] += e[:length]
878
880
  end
879
881
 
880
882
  e[:surfaces].keys.each do |ii|
@@ -889,6 +891,7 @@ module TBD
889
891
 
890
892
  foundation = OpenStudio::Model::FoundationKiva.new(model)
891
893
  foundation.setName("KIVA Foundation Floor #{id}")
894
+
892
895
  floor = model.getSurfaceByName(id)
893
896
  kiva = false if floor.empty?
894
897
  next if floor.empty?
@@ -1678,8 +1678,8 @@ module TBD
1678
1678
  # around edge with respect to a reference vector (perpendicular to the
1679
1679
  # edge), +clockwise as one is looking in the opposite position of the edge
1680
1680
  # vector. For instance, a vertical edge has a reference vector pointing
1681
- # North - surfaces eastward of the edge are (0°,180°], while surfaces
1682
- # westward of the edge are (180°,360°].
1681
+ # North - surfaces eastward of the edge are (0deg,180deg], while surfaces
1682
+ # westward of the edge are (180deg,360deg].
1683
1683
  #
1684
1684
  # Much of the following code is of a topological nature, and should ideally
1685
1685
  # (or eventually) become available functionality offered by Topolys. Topolys
@@ -1717,54 +1717,31 @@ module TBD
1717
1717
  t_model.wires.each do |wire|
1718
1718
  next unless surface[:wire] == wire.id # should be a unique match
1719
1719
 
1720
- normal = tbd[:surfaces][id][:n] if tbd[:surfaces].key?(id)
1721
- normal = holes[id].attributes[:n] if holes.key?(id)
1722
- normal = shades[id][:n] if shades.key?(id)
1723
- farthest = Topolys::Point3D.new(origin.x, origin.y, origin.z)
1724
- farthest_V = farthest - origin # zero magnitude, initially
1725
- inverted = false
1726
- i_origin = wire.points.index(origin)
1727
- i_terminal = wire.points.index(terminal)
1728
- i_last = wire.points.size - 1
1729
-
1730
- if i_terminal == 0
1731
- inverted = true unless i_origin == i_last
1732
- elsif i_origin == i_last
1733
- inverted = true unless i_terminal == 0
1734
- else
1735
- inverted = true unless i_terminal - i_origin == 1
1736
- end
1720
+ normal = tbd[:surfaces][id][:n] if tbd[:surfaces].key?(id)
1721
+ normal = holes[id].attributes[:n] if holes.key?(id)
1722
+ normal = shades[id][:n] if shades.key?(id)
1723
+ farthest = Topolys::Point3D.new(origin.x, origin.y, origin.z)
1724
+ farthest_V = farthest - origin # zero magnitude, initially
1725
+ farthest_mag = 0
1737
1726
 
1738
1727
  wire.points.each do |point|
1739
1728
  next if point == origin
1740
1729
  next if point == terminal
1741
1730
 
1742
- point_on_plane = edge_plane.project(point)
1743
- origin_point_V = point_on_plane - origin
1744
- point_V_magnitude = origin_point_V.magnitude
1745
- next unless point_V_magnitude > TOL
1746
-
1747
- # Generate a plane between origin, terminal & point. Only consider
1748
- # planes that share the same normal as wire.
1749
- if inverted
1750
- plane = Topolys::Plane3D.from_points(terminal, origin, point)
1751
- else
1752
- plane = Topolys::Plane3D.from_points(origin, terminal, point)
1753
- end
1754
-
1755
- dnx = (normal.x - plane.normal.x).abs
1756
- dny = (normal.y - plane.normal.y).abs
1757
- dnz = (normal.z - plane.normal.z).abs
1758
- next unless dnx < TOL && dny < TOL && dnz < TOL
1731
+ point_on_plane = edge_plane.project(point)
1732
+ origin_point_V = point_on_plane - origin
1733
+ point_V_mag = origin_point_V.magnitude
1734
+ next unless point_V_mag > TOL
1735
+ next unless point_V_mag > farthest_mag
1759
1736
 
1760
- farther = point_V_magnitude > farthest_V.magnitude
1761
- farthest = point if farther
1762
- farthest_V = origin_point_V if farther
1737
+ farthest = point
1738
+ farthest_V = origin_point_V
1739
+ fathest_mag = point_V_mag
1763
1740
  end
1764
1741
 
1765
1742
  angle = reference_V.angle(farthest_V)
1766
1743
  angle = 0 if angle.nil?
1767
- adjust = false # adjust angle [180°, 360°] if necessary
1744
+ adjust = false # adjust angle [180deg, 360deg] if necessary
1768
1745
 
1769
1746
  if vertical
1770
1747
  adjust = true if east.dot(farthest_V) < -TOL
@@ -2125,7 +2102,7 @@ module TBD
2125
2102
  end
2126
2103
 
2127
2104
  # Label edge as :ceiling if linked to:
2128
- # +1 deratable surfaces
2105
+ # +1 deratable surface(s)
2129
2106
  # 1x underatable CONDITIONED floor linked to an unoccupied space
2130
2107
  # 1x adjacent CONDITIONED ceiling linked to an occupied space
2131
2108
  edge[:surfaces].keys.each do |i|
@@ -2139,9 +2116,9 @@ module TBD
2139
2116
  next if floors[i][:occupied ]
2140
2117
 
2141
2118
  ceiling = floors[i][:boundary]
2142
- next unless ceilings.key?(ceiling)
2143
- next unless ceilings[ceiling][:conditioned]
2144
- next unless ceilings[ceiling][:occupied ]
2119
+ next unless ceilings.key?(ceiling)
2120
+ next unless ceilings[ceiling][:conditioned]
2121
+ next unless ceilings[ceiling][:occupied ]
2145
2122
 
2146
2123
  other = deratables.first unless deratables.first == id
2147
2124
  other = deratables.last unless deratables.last == id
@@ -40,16 +40,16 @@ require_relative "geo"
40
40
  require_relative "ua"
41
41
 
42
42
  module TBD
43
- extend OSut # OpenStudio utilities
44
-
45
- TOL = OSut::TOL
46
- TOL2 = OSut::TOL2
47
- DBG = OSut::DEBUG # mainly to flag invalid arguments for devs (buggy code)
48
- INF = OSut::INFO # informs TBD user of measure success or failure
49
- WRN = OSut::WARN # e.g. WARN users of 'iffy' .osm inputs (yet not critical)
50
- ERR = OSut::ERR # e.g. flag invalid .osm inputs
51
- FTL = OSut::FATAL # e.g. invalid TBD JSON format/entries
52
- NS = "nameString" # OpenStudio IdfObject nameString method
43
+ extend OSut # OpenStudio utilities
44
+
45
+ TOL = OSut::TOL.dup # default distance tolerance (m)
46
+ TOL2 = OSut::TOL2.dup # default area tolerance (m2)
47
+ DBG = OSut::DEBUG.dup # github.com/rd2/oslg
48
+ INF = OSut::INFO.dup # github.com/rd2/oslg
49
+ WRN = OSut::WARN.dup # github.com/rd2/oslg
50
+ ERR = OSut::ERR.dup # github.com/rd2/oslg
51
+ FTL = OSut::FATAL.dup # github.com/rd2/oslg
52
+ NS = OSut::NS.dup # OpenStudio IdfObject nameString method
53
53
 
54
54
  extend TBD
55
55
  end
@@ -422,8 +422,8 @@ module TBD
422
422
  # @param [Hash] s TBD surfaces (keys: Openstudio surface names)
423
423
  # @option s [Bool] :deratable whether surface is deratable, s[][:deratable]
424
424
  # @option s [:wall, :ceiling, :floor] :type TBD surface type
425
- # @option s [#to_f] :heating applicable heating setpoint temperature in °C
426
- # @option s [#to_f] :cooling applicable cooling setpoint temperature in °C
425
+ # @option s [#to_f] :heating applicable heating setpoint temperature in C
426
+ # @option s [#to_f] :cooling applicable cooling setpoint temperature in C
427
427
  # @option s [Hash] :windows TBD surface-specific windows e.g. s[][:windows]
428
428
  # @option s [Hash] :doors TBD surface-specific doors
429
429
  # @option s [Hash] :skylights TBD surface-specific skylights
@@ -466,7 +466,7 @@ module TBD
466
466
  ref = 1 / 5.46
467
467
  ref = 1 / 3.60 if surface[:type] == :wall
468
468
 
469
- # Adjust for lower heating setpoint (assumes -25°C design conditions).
469
+ # Adjust for lower heating setpoint (assumes -25C design conditions).
470
470
  ref *= 43 / (heating + 25) if heating < 18 && cooling > 40
471
471
 
472
472
  surface[:ref] = ref
@@ -628,8 +628,8 @@ module TBD
628
628
  end
629
629
 
630
630
  # Set up 2x heating setpoint (HSTP) "blocks" (or bins):
631
- # bloc1: spaces/zones with HSTP >= 18°C
632
- # bloc2: spaces/zones with HSTP < 18°C
631
+ # bloc1: spaces/zones with HSTP >= 18C
632
+ # bloc2: spaces/zones with HSTP < 18C
633
633
  # (ref: 2021 Quebec energy code 3.3. UA' trade-off methodology)
634
634
  # (... can be extended in the future to cover other standards)
635
635
  #
@@ -799,8 +799,8 @@ module TBD
799
799
  blc.each do |b|
800
800
  bloc = b1
801
801
  bloc = b2 if b == :b2
802
- pro_sum = bloc[:pro].values.reduce(:+)
803
- ref_sum = bloc[:ref].values.reduce(:+)
802
+ pro_sum = bloc[:pro].values.sum
803
+ ref_sum = bloc[:ref].values.sum
804
804
 
805
805
  if pro_sum > TOL || ref_sum > TOL
806
806
  ratio = nil
@@ -1000,7 +1000,7 @@ module TBD
1000
1000
  model = "* modèle : #{ua[:file]}" if ua.key?(:file) && lang == :fr
1001
1001
  model += " (v#{ua[:version]})" if ua.key?(:version)
1002
1002
  report << model unless model.empty?
1003
- report << "* TBD : v3.4.2"
1003
+ report << "* TBD : v3.4.4"
1004
1004
  report << "* date : #{ua[:date]}"
1005
1005
 
1006
1006
  if lang == :en