Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pulls OSut v0.5.0 #114

Merged
merged 8 commits into from
Apr 17, 2024
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
source "https://rubygems.org"

gem "osut", git: "https://github.com/rd2/osut", branch: "geo"

gemspec
10 changes: 5 additions & 5 deletions lib/measures/tbd/measure.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
<schema_version>3.1</schema_version>
<name>tbd_measure</name>
<uid>8890787b-8c25-4dc8-8641-b6be1b6c2357</uid>
<version_id>bd35a453-60b3-4329-9699-3c7e8e49b5bf</version_id>
<version_modified>2024-01-01T12:58:55Z</version_modified>
<version_id>247ec62b-4661-4ed1-b2b6-64113bcacf11</version_id>
<version_modified>2024-04-13T20:03:13Z</version_modified>
<xml_checksum>99772807</xml_checksum>
<class_name>TBDMeasure</class_name>
<display_name>Thermal Bridging and Derating - TBD</display_name>
Expand Down Expand Up @@ -499,7 +499,7 @@
<filename>geo.rb</filename>
<filetype>rb</filetype>
<usage_type>resource</usage_type>
<checksum>1D9996A0</checksum>
<checksum>6C7ACC99</checksum>
</file>
<file>
<filename>geometry.rb</filename>
Expand All @@ -523,7 +523,7 @@
<filename>psi.rb</filename>
<filetype>rb</filetype>
<usage_type>resource</usage_type>
<checksum>9B29CA06</checksum>
<checksum>5ABDEC60</checksum>
</file>
<file>
<filename>tbd.rb</filename>
Expand All @@ -547,7 +547,7 @@
<filename>utils.rb</filename>
<filetype>rb</filetype>
<usage_type>resource</usage_type>
<checksum>7385DFE0</checksum>
<checksum>83EACDDB</checksum>
</file>
<file>
<filename>version.rb</filename>
Expand Down
10 changes: 5 additions & 5 deletions lib/measures/tbd/resources/geo.rb
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,7 @@ def faces(s = {}, e = {})
#
# @return [Topolys::Vector3D] true normal vector of s
# @return [nil] if invalid input (see logs)
def trueNormal(s = nil, r = 0)
def truNormal(s = nil, r = 0)
mth = "TBD::#{__callee__}"
cl = OpenStudio::Model::PlanarSurface
return mismatch("surface", s, cl, mth) unless s.is_a?(cl)
Expand Down Expand Up @@ -285,18 +285,18 @@ def properties(surface = nil, argh = {})
surf = {}
subs = {}
fd = false
return invalid("#{nom}", mth, 1, FTL) if poly(surface).empty?
return invalid("#{nom}", mth, 1, ERR) if poly(surface).empty?
return empty("#{nom} space", mth, ERR) if surface.space.empty?

space = surface.space.get
stype = space.spaceType
story = space.buildingStory
tr = transforms(space)
return invalid("#{nom} transform", mth, 0, FTL) unless tr[:t] && tr[:r]
return invalid("#{nom} transform", mth, 0, ERR) unless tr[:t] && tr[:r]

t = tr[:t]
n = trueNormal(surface, tr[:r])
return invalid("#{nom} normal", mth, 0, FTL) unless n
n = truNormal(surface, tr[:r])
return invalid("#{nom} normal", mth, 0, ERR) unless n

type = surface.surfaceType.downcase
facing = surface.outsideBoundaryCondition
Expand Down
24 changes: 9 additions & 15 deletions lib/measures/tbd/resources/psi.rb
Original file line number Diff line number Diff line change
Expand Up @@ -1598,14 +1598,14 @@ def process(model = nil, argh = {})
tr = transforms(group)
t = tr[:t] if tr[:t] && tr[:r]

log(FTL, "Can't process '#{id}' transformation (#{mth})") unless t
return tbd unless t
log(ERR, "Can't process '#{id}' transformation (#{mth})") unless t
next unless t

space = group.space
tr[:r] += space.get.directionofRelativeNorth unless space.empty?
n = trueNormal(s, tr[:r])
log(FTL, "Can't process '#{id}' true normal (#{mth})") unless n
return tbd unless n
n = truNormal(s, tr[:r])
log(ERR, "Can't process '#{id}' true normal (#{mth})") unless n
next unless n

points = (t * s.vertices).map { |v| Topolys::Point3D.new(v.x, v.y, v.z) }

Expand Down Expand Up @@ -1695,14 +1695,10 @@ def process(model = nil, argh = {})
dx = (origin.x - terminal.x).abs
dy = (origin.y - terminal.y).abs
dz = (origin.z - terminal.z).abs
horizontal = dz.abs < TOL
horizontal = dz < TOL
vertical = dx < TOL && dy < TOL
edge_V = terminal - origin

if edge_V.magnitude < TOL
invalid("1x edge length < TOL", mth, 0, ERROR)
next
end
next if edge_V.magnitude < TOL

edge_plane = Topolys::Plane3D.new(origin, edge_V)

Expand Down Expand Up @@ -1766,10 +1762,8 @@ def process(model = nil, argh = {})
farthest_V = origin_point_V if farther
end

angle = reference_V.angle(farthest_V)
invalid("#{id} polar angle", mth, 0, ERROR, 0) if angle.nil?
angle = 0 if angle.nil?

angle = reference_V.angle(farthest_V)
angle = 0 if angle.nil?
adjust = false # adjust angle [180°, 360°] if necessary

if vertical
Expand Down
Loading
Loading