Skip to content

Commit cd30085

Browse files
committed
Completes genConstruction unit tests
1 parent ab6b34a commit cd30085

File tree

2 files changed

+578
-62
lines changed

2 files changed

+578
-62
lines changed

src/osut/osut.py

Lines changed: 50 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -421,15 +421,15 @@ def genConstruction(model=None, specs=dict()):
421421
d = 0.015
422422
a["compo"]["mat"] = mats()[mt]
423423
a["compo"]["d" ] = d
424-
a["compo"]["id" ] = "OSut." + mt + "%03d" % int(d * 1000)
424+
a["compo"]["id" ] = "OSut." + mt + ".%03d" % int(d * 1000)
425425

426426
elif specs["type"] == "partition":
427-
if not specs["clad"]:
427+
if not specs["clad"] == "none":
428428
mt = "drywall"
429429
d = 0.015
430430
a["clad"]["mat"] = mats()[mt]
431431
a["clad"]["d" ] = d
432-
a["clad"]["id" ] = "OSut." + mt + "%03d" % int(d * 1000)
432+
a["clad"]["id" ] = "OSut." + mt + ".%03d" % int(d * 1000)
433433

434434
mt = "concrete"
435435
d = 0.015
@@ -440,25 +440,25 @@ def genConstruction(model=None, specs=dict()):
440440
if u: d = 0.100
441441
a["compo"]["mat"] = mats()[mt]
442442
a["compo"]["d" ] = d
443-
a["compo"]["id" ] = "OSut." + mt + "%03d" % int(d * 1000)
443+
a["compo"]["id" ] = "OSut." + mt + ".%03d" % int(d * 1000)
444444

445-
if not specs["finish"]:
445+
if not specs["finish"] == "none":
446446
mt = "drywall"
447447
d = 0.015
448448
a["finish"]["mat"] = mats()[mt]
449449
a["finish"]["d" ] = d
450-
a["finish"]["id" ] = "OSut." + mt + "%03d" % int(d * 1000)
450+
a["finish"]["id" ] = "OSut." + mt + ".%03d" % int(d * 1000)
451451

452452
elif specs["type"] == "wall":
453-
if not specs["clad"]:
453+
if not specs["clad"] == "none":
454454
mt = "material"
455455
d = 0.100
456456
if specs["clad"] == "medium": mt = "brick"
457457
if specs["clad"] == "heavy": mt = "concrete"
458458
if specs["clad"] == "light": d = 0.015
459459
a["clad"]["mat"] = mats()[mt]
460460
a["clad"]["d" ] = d
461-
a["clad"]["id" ] = "OSut." + mt + "%03d" % int(d * 1000)
461+
a["clad"]["id" ] = "OSut." + mt + ".%03d" % int(d * 1000)
462462

463463
mt = "drywall"
464464
d = 0.100
@@ -467,7 +467,7 @@ def genConstruction(model=None, specs=dict()):
467467
if specs["frame"] == "light": d = 0.015
468468
a["sheath"]["mat"] = mats()[mt]
469469
a["sheath"]["d" ] = d
470-
a["sheath"]["id" ] = "OSut." + mt + "%03d" % int(d * 1000)
470+
a["sheath"]["id" ] = "OSut." + mt + ".%03d" % int(d * 1000)
471471

472472
mt = "mineral"
473473
d = 0.100
@@ -478,56 +478,56 @@ def genConstruction(model=None, specs=dict()):
478478
if not u: d = 0.015
479479
a["compo"]["mat"] = mats()[mt]
480480
a["compo"]["d" ] = d
481-
a["compo"]["id" ] = "OSut." + mt + "%03d" % int(d * 1000)
481+
a["compo"]["id" ] = "OSut." + mt + ".%03d" % int(d * 1000)
482482

483-
if not specs["finish"]:
483+
if not specs["finish"] == "none":
484484
mt = "concrete"
485485
d = 0.015
486486
if specs["finish"] == "light": mt = "drywall"
487487
if specs["finish"] == "medium": d = 0.100
488488
if specs["finish"] == "heavy": d = 0.200
489489
a["finish"]["mat"] = mats()[mt]
490490
a["finish"]["d" ] = d
491-
a["finish"]["id" ] = "OSut." + mt + "%03d" % int(d * 1000)
491+
a["finish"]["id" ] = "OSut." + mt + ".%03d" % int(d * 1000)
492492

493493
elif specs["type"] == "roof":
494-
if not specs["clad"]:
494+
if not specs["clad"] == "none":
495495
mt = "concrete"
496496
d = 0.015
497497
if specs["clad"] == "light": mt = "material"
498498
if specs["clad"] == "medium": d = 0.100 # e.g. terrace
499499
if specs["clad"] == "heavy": d = 0.200 # e.g. parking garage
500500
a["clad"]["mat"] = mats()[mt]
501501
a["clad"]["d" ] = d
502-
a["clad"]["id" ] = "OSut." + mt + "%03d" % int(d * 1000)
502+
a["clad"]["id" ] = "OSut." + mt + ".%03d" % int(d * 1000)
503503

504504
mt = "mineral"
505505
d = 0.100
506506
if specs["frame"] == "medium": mt = "polyiso"
507507
if specs["frame"] == "heavy": mt = "cellulose"
508508
if not u: mt = "material"
509509
if not u: d = 0.015
510-
a["compo"][:"mat"] = mats()[mt]
511-
a["compo"][:"d" ] = d
512-
a["compo"][:"id" ] = "OSut." + mt + "%03d" % int(d * 1000)
510+
a["compo"]["mat"] = mats()[mt]
511+
a["compo"]["d" ] = d
512+
a["compo"]["id" ] = "OSut." + mt + ".%03d" % int(d * 1000)
513513

514-
if not specs["finish"]:
514+
if not specs["finish"] == "none":
515515
mt = "concrete"
516516
d = 0.015
517517
if specs["finish"] == "light": mt = "drywall"
518518
if specs["finish"] == "medium": d = 0.100 # proxy for steel decking
519519
if specs["finish"] == "heavy": d = 0.200
520520
a["finish"]["mat"] = mats()[mt]
521521
a["finish"]["d" ] = d
522-
a["finish"]["id" ] = "OSut." + mt + "%03d" % int(d * 1000)
522+
a["finish"]["id" ] = "OSut." + mt + ".%03d" % int(d * 1000)
523523

524524
elif specs["type"] == "floor":
525-
if not specs["clad"]:
525+
if not specs["clad"] == "none":
526526
mt = "material"
527527
d = 0.015
528528
a["clad"]["mat"] = mats()[mt]
529529
a["clad"]["d" ] = d
530-
a["clad"]["id" ] = "OSut." + mt + "%03d" % int(d * 1000)
530+
a["clad"]["id" ] = "OSut." + mt + ".%03d" % int(d * 1000)
531531

532532
mt = "mineral"
533533
d = 0.100
@@ -537,109 +537,109 @@ def genConstruction(model=None, specs=dict()):
537537
if not u: d = 0.015
538538
a["compo"]["mat"] = mats()[mt]
539539
a["compo"]["d" ] = d
540-
a["compo"]["id" ] = "OSut." + mt + "%03d" % int(d * 1000)
540+
a["compo"]["id" ] = "OSut." + mt + ".%03d" % int(d * 1000)
541541

542-
if not specs["finish"]:
542+
if not specs["finish"] == "none":
543543
mt = "concrete"
544544
d = 0.015
545545
if specs["finish"] == "light": mt = "material"
546546
if specs["finish"] == "medium": d = 0.100
547547
if specs["finish"] == "heavy": d = 0.200
548-
a["finish"][:"mat"] = mats()[mt]
549-
a["finish"][:"d" ] = d
550-
a["finish"][:"id" ] = "OSut." + mt + "%03d" % int(d * 1000)
548+
a["finish"]["mat"] = mats()[mt]
549+
a["finish"]["d" ] = d
550+
a["finish"]["id" ] = "OSut." + mt + ".%03d" % int(d * 1000)
551551

552552
elif specs["type"] == "slab":
553553
mt = "sand"
554554
d = 0.100
555555
a["clad"]["mat"] = mats()[mt]
556556
a["clad"]["d" ] = d
557-
a["clad"]["id" ] = "OSut." + mt + "%03d" % int(d * 1000)
557+
a["clad"]["id" ] = "OSut." + mt + ".%03d" % int(d * 1000)
558558

559-
if not specs["frame"]:
559+
if not specs["frame"] == "none":
560560
mt = "polyiso"
561561
d = 0.025
562562
a["sheath"]["mat"] = mats()[mt]
563563
a["sheath"]["d" ] = d
564-
a["sheath"]["id" ] = "OSut." + mt + "%03d" % int(d * 1000)
564+
a["sheath"]["id" ] = "OSut." + mt + ".%03d" % int(d * 1000)
565565

566566
mt = "concrete"
567567
d = 0.100
568568
if specs["frame"] == "heavy": d = 0.200
569569
a["compo"]["mat"] = mats()[mt]
570570
a["compo"]["d" ] = d
571-
a["compo"]["id" ] = "OSut." + mt + "%03d" % int(d * 1000)
571+
a["compo"]["id" ] = "OSut." + mt + ".%03d" % int(d * 1000)
572572

573-
if not specs["finish"]:
573+
if not specs["finish"] == "none":
574574
mt = "material"
575575
d = 0.015
576576
a["finish"]["mat"] = mats()[mt]
577577
a["finish"]["d" ] = d
578-
a["finish"]["id" ] = "OSut." + mt + "%03d" % int(d * 1000)
578+
a["finish"]["id" ] = "OSut." + mt + ".%03d" % int(d * 1000)
579579

580580
elif specs["type"] == "basement":
581-
if not specs["clad"]:
581+
if not specs["clad"] == "none":
582582
mt = "concrete"
583583
d = 0.100
584584
if specs["clad"] == "light": mt = "material"
585585
if specs["clad"] == "light": d = 0.015
586-
a["clad"][:"mat"] = mats[mt]
587-
a["clad"][:"d" ] = d
588-
a["clad"][:"id" ] = "OSut." + mt + "%03d" % int(d * 1000)
586+
a["clad"]["mat"] = mats[mt]
587+
a["clad"]["d" ] = d
588+
a["clad"]["id" ] = "OSut." + mt + ".%03d" % int(d * 1000)
589589

590590
mt = "polyiso"
591591
d = 0.025
592592
a["sheath"]["mat"] = mats()[mt]
593593
a["sheath"]["d" ] = d
594-
a["sheath"]["id" ] = "OSut." + mt + "%03d" % int(d * 1000)
594+
a["sheath"]["id" ] = "OSut." + mt + ".%03d" % int(d * 1000)
595595

596596
mt = "concrete"
597597
d = 0.200
598598
a["compo"]["mat"] = mats()[mt]
599599
a["compo"]["d" ] = d
600-
a["compo"]["id" ] = "OSut." + mt + "%03d" % int(d * 1000)
600+
a["compo"]["id" ] = "OSut." + mt + ".%03d" % int(d * 1000)
601601
else:
602602
mt = "concrete"
603603
d = 0.200
604604
a["sheath"]["mat"] = mats()[mt]
605605
a["sheath"]["d" ] = d
606-
a["sheath"]["id" ] = "OSut." + mt + "%03d" % int(d * 1000)
606+
a["sheath"]["id" ] = "OSut." + mt + ".%03d" % int(d * 1000)
607607

608-
if not specs["finish"]:
608+
if not specs["finish"] == "none":
609609
mt = "mineral"
610610
d = 0.075
611611
a["compo"]["mat"] = mats()[mt]
612612
a["compo"]["d" ] = d
613-
a["compo"]["id" ] = "OSut." + mt + "%03d" % int(d * 1000)
613+
a["compo"]["id" ] = "OSut." + mt + ".%03d" % int(d * 1000)
614614

615615
mt = "drywall"
616616
d = 0.015
617617
a["finish"]["mat"] = mats()[mt]
618618
a["finish"]["d" ] = d
619-
a["finish"]["id" ] = "OSut." + mt + "%03d" % int(d * 1000)
619+
a["finish"]["id" ] = "OSut." + mt + ".%03d" % int(d * 1000)
620620

621621
elif specs["type"] == "door":
622622
mt = "door"
623623
d = 0.045
624624
a["compo" ]["mat" ] = mats()[mt]
625625
a["compo" ]["d" ] = d
626-
a["compo" ]["id" ] = "OSut." + mt + "%03d" % int(d * 1000)
626+
a["compo" ]["id" ] = "OSut." + mt + ".%03d" % int(d * 1000)
627627

628628
elif specs["type"] == "window":
629629
a["glazing"]["u" ] = specs["uo"]
630-
a["glazing"]["id" ] = "OSut.window"
631-
a["glazing"]["id" ] += ".U%.1f" % a["glazing"]["u"]
632-
a["glazing"]["id" ] += ".SHGC%d" % a["glazing"]["shgc"]*100
633630
a["glazing"]["shgc"] = 0.450
634631
if "shgc" in specs: a["glazing"]["shgc"] = specs["shgc"]
632+
a["glazing"]["id" ] = "OSut.window"
633+
a["glazing"]["id" ] += ".U%.1f" % a["glazing"]["u"]
634+
a["glazing"]["id" ] += ".SHGC%d" % (a["glazing"]["shgc"]*100)
635635

636636
elif specs["type"] == "skylight":
637637
a["glazing"]["u" ] = specs["uo"]
638-
a["glazing"]["id" ] = "OSut.skylight"
639-
a["glazing"]["id" ] += ".U%.1f" % a["glazing"]["u"]
640-
a["glazing"]["id" ] += ".SHGC%d" % a["glazing"]["shgc"]*100
641638
a["glazing"]["shgc"] = 0.450
642639
if "shgc" in specs: a["glazing"]["shgc"] = specs["shgc"]
640+
a["glazing"]["id" ] = "OSut.skylight"
641+
a["glazing"]["id" ] += ".U%.1f" % a["glazing"]["u"]
642+
a["glazing"]["id" ] += ".SHGC%d" % (a["glazing"]["shgc"]*100)
643643

644644
if a["glazing"]:
645645
layers = openstudio.model.FenestrationMaterialVector()
@@ -716,10 +716,9 @@ def genConstruction(model=None, specs=dict()):
716716
if d < 0.03:
717717
return oslg.invalid(id + " adjusted material thickness", mth, 0)
718718

719-
print(layer.nameString()) # OSut.mineral100
720719
nom = re.sub(r'[^a-zA-Z]', '', layer.nameString())
721720
nom = re.sub(r'OSut', '', nom)
722-
nom = "osut." + nom + "%03d" % int(d * 1000)
721+
nom = "OSut." + nom + ".%03d" % int(d * 1000)
723722

724723
if not model.getStandardOpaqueMaterialByName(nom):
725724
layer.setName(nom)

0 commit comments

Comments
 (0)