|
367 | 367 |
|
368 | 368 | it "checks construction thickness" do |
369 | 369 | translator = OpenStudio::OSVersion::VersionTranslator.new |
| 370 | + version = OpenStudio.openStudioVersion.split(".").join.to_i |
370 | 371 | expect(cls1.clean!).to eq(DBG) |
371 | 372 |
|
| 373 | + # The v1.11.5 (2016) seb.osm, shipped with OpenStudio, holds (what would now |
| 374 | + # be considered as deprecated) a definition of plenum floors (i.e. ceiling |
| 375 | + # tiles) generating several warnings with more recent OpenStudio versions. |
372 | 376 | file = File.join(__dir__, "files/osms/in/seb.osm") |
373 | 377 | path = OpenStudio::Path.new(file) |
374 | 378 | model = translator.loadModel(path) |
375 | 379 | expect(model).to_not be_empty |
376 | 380 | model = model.get |
377 | 381 |
|
378 | | - # -- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- cleanup # |
379 | | - # This is the first test relying on the 'seb.osm' file, which ships with |
380 | | - # OpenStudio. The v1.11.5 model (2016) holds a number of artefacts that |
381 | | - # would be frowned upon today (e.g. plenum floors tagged as roofs/ceilings). |
| 382 | + # "Shading Surface 4" is overlapping with a plenum exterior wall. |
| 383 | + sh4 = model.getShadingSurfaceByName("Shading Surface 4") |
| 384 | + expect(sh4).to_not be_empty |
| 385 | + sh4 = sh4.get |
| 386 | + sh4.remove |
| 387 | + |
382 | 388 | plenum = model.getSpaceByName("Level 0 Ceiling Plenum") |
383 | 389 | expect(plenum).to_not be_empty |
384 | 390 | plenum = plenum.get |
385 | 391 |
|
| 392 | + thzone = plenum.thermalZone |
| 393 | + expect(thzone).to_not be_empty |
| 394 | + thzone = thzone.get |
| 395 | + |
| 396 | + # Before the fix. |
| 397 | + unless version < 350 |
| 398 | + expect(plenum.isEnclosedVolume).to be true |
| 399 | + expect(plenum.isVolumeDefaulted).to be true |
| 400 | + expect(plenum.isVolumeAutocalculated).to be true |
| 401 | + end |
| 402 | + |
| 403 | + if version > 350 && version < 370 |
| 404 | + expect(plenum.volume.round(0)).to eq(234) |
| 405 | + else |
| 406 | + expect(plenum.volume.round(0)).to eq(0) |
| 407 | + end |
| 408 | + |
| 409 | + expect(thzone.isVolumeDefaulted).to be true |
| 410 | + expect(thzone.isVolumeAutocalculated).to be true |
| 411 | + expect(thzone.volume).to be_empty |
| 412 | + |
386 | 413 | plenum.surfaces.each do |s| |
387 | 414 | next if s.outsideBoundaryCondition.downcase == "outdoors" |
388 | 415 |
|
| 416 | + # If a SEB plenum surface isn't facing outdoors, it's 1 of 4 "floor" |
| 417 | + # surfaces (each facing a ceiling surface below). |
| 418 | + adj = s.adjacentSurface |
| 419 | + expect(adj).to_not be_empty |
| 420 | + adj = adj.get |
| 421 | + expect(adj.vertices.size).to eq(s.vertices.size) |
| 422 | + |
| 423 | + # Same vertex sequence? Should be in reverse order. |
| 424 | + adj.vertices.each_with_index do |vertex, i| |
| 425 | + expect(mod1.same?(vertex, s.vertices.at(i))).to be true |
| 426 | + end |
| 427 | + |
| 428 | + expect(adj.surfaceType).to eq("RoofCeiling") |
| 429 | + expect(s.surfaceType).to eq("RoofCeiling") |
389 | 430 | expect(s.setSurfaceType("Floor")).to be true |
390 | 431 | expect(s.setVertices(s.vertices.reverse)).to be true |
| 432 | + |
| 433 | + # Vertices now in reverse order. |
| 434 | + adj.vertices.reverse.each_with_index do |vertex, i| |
| 435 | + expect(mod1.same?(vertex, s.vertices.at(i))).to be true |
| 436 | + end |
391 | 437 | end |
392 | 438 |
|
| 439 | + # After the fix. |
| 440 | + unless version < 350 |
| 441 | + expect(plenum.isEnclosedVolume).to be true |
| 442 | + expect(plenum.isVolumeDefaulted).to be true |
| 443 | + expect(plenum.isVolumeAutocalculated).to be true |
| 444 | + end |
| 445 | + |
| 446 | + expect(plenum.volume.round(0)).to eq(50) # right answer |
| 447 | + expect(thzone.isVolumeDefaulted).to be true |
| 448 | + expect(thzone.isVolumeAutocalculated).to be true |
| 449 | + expect(thzone.volume).to be_empty |
| 450 | + |
393 | 451 | file = File.join(__dir__, "files/osms/out/seb2.osm") |
394 | 452 | model.save(file, true) |
395 | 453 | # --- --- --- --- --- --- --- --- --- --- --- --- --- --- end of cleanup # |
|
0 commit comments