Class: BTAP::EQuest::DOERoof

Inherits:
DOECommand show all
Defined in:
lib/openstudio-standards/btap/equest.rb

Overview

The interface for the roof command.. same as parent.

Instance Attribute Summary

Attributes inherited from DOECommand

#building, #children, #commandName, #commandType, #comments, #exempt, #keywordPairs, #non_utype_commands, #one_line_commands, #parents, #utype, #uvalue

Instance Method Summary collapse

Methods inherited from DOECommand

#basic_output, #check_keyword?, #depth, #doe_scope, #get_children, #get_children_of_command, #get_command_from_string, #get_keyword_value, #get_name, #get_parent, #get_parents, #name, #output, #remove, #remove_keyword_pair, #set_keyword_value, #set_parent

Constructor Details

#initializeDOERoof

Returns a new instance of DOERoof.



1305
1306
1307
# File 'lib/openstudio-standards/btap/equest.rb', line 1305

def initialize
  super()
end

Instance Method Details

#get_absolute_azimuthObject

OUTPUT: Azimuth between ROOF and TRUE NORTH



1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
# File 'lib/openstudio-standards/btap/equest.rb', line 1445

def get_absolute_azimuth
  space = get_parent("SPACE")
  if check_keyword?("AZIMUTH")
    azimuth = get_keyword_value("AZIMUTH").to_f
    space_azimuth = space.get_absolute_azimuth
    return azimuth + space_azimuth
  else
    if check_keyword?("LOCATION")
      location = get_keyword_value("LOCATION")
      case location
      when "TOP"
        raise "Exception: Azimuth does not exist"
      when "BOTTOM"
        raise "Exception: Azimuth does not exist"
      when "FRONT"
        return 0.0 + space.get_absolute_azimuth
      when "RIGHT"
        return 90.0 + space.get_absolute_azimuth
      when "BACK"
        return 180.0 + space.get_absolute_azimuth
      when "LEFT"
        return 270.0 + space.get_absolute_azimuth
      end
    end
    if space.get_keyword_value("SHAPE") == "POLYGON"
      space_vertex = get_keyword_value("LOCATION")
      space_vertex.match(/SPACE-(.*)/)
      vertex = $1.strip
      return space.polygon.get_azimuth(vertex) + space.get_absolute_azimuth
    end
  end
end

#get_areaObject

This method finds the area of the roof



1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
# File 'lib/openstudio-standards/btap/equest.rb', line 1310

def get_area

  # Finds the floor and space parents and assigns them to @floor and @space
  # variables to be used later
  parent = get_parents
  parent.each do |findcommand|
    if ( findcommand.commandName == "FLOOR" )
      @floor = findcommand
    end
    if ( findcommand.commandName == "SPACE")
      @space = findcommand
    end
  end

  # Get the keyword value for location
  begin
    location = get_keyword_value("LOCATION")
  rescue
  end

  # Get the keyword value for polygon
  begin
    polygon_id = get_keyword_value("POLYGON")
  rescue
  end

  # if the polygon_id keyword value was nil and the location value was nil, then
  # the height and width are directly defined within the "roof" command


  if  ( location == "BOTTOM" || location == "TOP") && (@space.get_shape != "BOX")
    return @space.polygon.get_area

  elsif ( location == nil  && polygon_id == nil )
    height = get_keyword_value("HEIGHT")
    width = get_keyword_value("WIDTH")
    height = height.to_f
    width = width.to_f
    return height * width
  elsif ( location == nil && polygon_id != nil)
    return @space.polygon.get_area


    # if the location was defined as "SPACE...", it is immediately followed by a
    # vertex, upon which lies the width of the roof
  elsif location.match(/SPACE.*/)
    location = location.sub( /^(.{6})/, "")
    width = @space.polygon.get_length(location)
    height = @floor.get_space_height
    return width * height
    # if the shape was a box, the width and height would be taken from the
    # "SPACE" object
  elsif ( @space.get_shape == "BOX" )
    width = @space.get_width
    height = @space.get_height
    return width * height
  else
    raise "The area could not be evaluated"
  end
end

#get_azimuthObject

OUTPUT: Azimuth between the parent SPACE and the ROOF



1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
# File 'lib/openstudio-standards/btap/equest.rb', line 1402

def get_azimuth()
  space = get_parent("SPACE")
  if check_keyword?("AZIMUTH") then return get_keyword_value("AZIMUTH").to_f
  else
    if check_keyword?("LOCATION")
      location = get_keyword_value("LOCATION")

      case location
      when "TOP"
        raise "Exception: Azimuth does not exist"
      when "BOTTOM"
        raise "Exception: Azimuth does not exist"
      when "FRONT"
        return 0.0 + space.get_azimuth
      when "RIGHT"
        return 90.0 + space.get_azimuth
      when "BACK"
        return 180.0 + space.get_azimuth
      when "LEFT"
        return 270.0 + space.get_azimuth
      end
    end
    if space.get_keyword_value("SHAPE") == "POLYGON"
      space_vertex = get_keyword_value("LOCATION")
      space_vertex.match(/SPACE-(.*)/)
      vertex = $1.strip
      return space.polygon.get_azimuth(vertex)
    end

  end
end

#get_tiltObject

returns tilt of roof surface.



1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
# File 'lib/openstudio-standards/btap/equest.rb', line 1372

def get_tilt()
  if check_keyword?("TILT") then return get_keyword_value("TILT").to_f
  else
    if check_keyword?("LOCATION")
      location = get_keyword_value("LOCATION")
      case location
      when "TOP"
        return 0.0
      when "BOTTOM"
        return 180.0
      when "LEFT", "RIGHT", "BACK", "FRONT"
        return 90.0
      end
    end
    # If it is a polygon or not defined, set to DOE default = 0.0
    return 0
  end
end