dragonfly-doe2 0.11.2__py2.py3-none-any.whl → 0.12.1__py2.py3-none-any.whl

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.
@@ -1,120 +0,0 @@
1
- from dataclasses import dataclass
2
- from typing import List
3
- from dragonfly.model import Model
4
- from dragonfly.context import ContextShade
5
- from dragonfly import shadingparameter as shade_params
6
- from ladybug_geometry.geometry3d.face import Face3D
7
- from ladybug_geometry.geometry3d.pointvector import Vector3D
8
- from ladybug_geometry.geometry3d.line import LineSegment3D
9
- from .utils import short_name
10
- from . import blocks as fb
11
- from math import degrees, isclose
12
- import math
13
-
14
-
15
- @dataclass
16
- class Doe2Shade:
17
- # TODO: will need to change things up to support rm2d.shade_params
18
- """ DOE2 shade object. Can be either:
19
- - 'FIXED-SHADE': azimuth is independent from the building, i.e context shade such as
20
- buildings and terrain. Objects that are independent from the orientation of the
21
- building during ASHRAE 90.1 baseline orientation averages.
22
- - 'BUILDING-SHADE': azimuth is connected to the buildign azimuth,
23
- will rotate withh the building on change of azimuth, i.e fin shades, awnings, and
24
- other types of "on building" shading devices.
25
-
26
- """
27
- name: str
28
- shade_type: str
29
- height: float
30
- width: float
31
- x_ref: float
32
- y_ref: float
33
- z_ref: float
34
- azimuth: float
35
- tilt: float
36
- transmittance: float = 0.0
37
-
38
- @classmethod
39
- def from_face3d(cls, face: Face3D, indx_identifier, shade_type=None):
40
- """Create DOE2 shade object from Face3D object"""
41
- face_len_one = LineSegment3D.from_end_points(
42
- face.vertices[0], face.vertices[2]).length
43
- face_len_two = LineSegment3D.from_end_points(
44
- face.vertices[1], face.vertices[3]).length
45
-
46
- face = face if isclose(face_len_one, face_len_two) else \
47
- Face3D.from_regular_polygon(face.boundary_polygon2d)
48
-
49
- face = face if face.normal.z <= 0 else face.flip()
50
- shade_type = "FIXED-SHADE" if shade_type == None else shade_type
51
- orig_point = face.lower_left_corner
52
- x_ref, y_ref, z_ref = orig_point[0], orig_point[1], orig_point[2]
53
-
54
- height = abs(round(LineSegment3D.from_end_points(
55
- face.upper_right_corner, face.lower_right_corner).length, 4))
56
- # ? I don't like the lack of uniformity between the height and width methods; but it DOES work..
57
- width = face.plane.xyz_to_xy(face.max) - face.plane.xyz_to_xy(face.min)
58
- width = abs(round(width[0], 4))
59
-
60
- tilt = round(degrees(face.normal.angle(Vector3D(0, 0, 1))), 0)
61
- y_axis = Vector3D(0, 1, 0)
62
- projected_normal = Vector3D(face.normal[0], face.normal[1], 0)
63
- try:
64
- azimuth = math.degrees(projected_normal.angle(y_axis))
65
- cross = face.normal.cross(y_axis)
66
- if cross.z < 0:
67
- azimuth = 360 - azimuth
68
- except ZeroDivisionError:
69
- # horizontal
70
- azimuth = 180 if face.normal.z > 0 else -180
71
-
72
- return cls(
73
- name=indx_identifier, shade_type=shade_type, height=height, width=width,
74
- x_ref=x_ref, y_ref=y_ref, z_ref=z_ref, azimuth=azimuth, tilt=tilt)
75
-
76
- def to_inp(self):
77
- """Returns *.inp shade object string"""
78
- return f'{self.name} = {self.shade_type}\n ' \
79
- f'HEIGHT = {self.height}\n ' \
80
- f'WIDTH = {self.width}\n ' \
81
- f'TRANSMITTANCE = {self.transmittance}\n ' \
82
- f'X-REF = {self.x_ref}\n ' \
83
- f'Y-REF = {self.y_ref}\n ' \
84
- f'Z-REF = {self.z_ref}\n ' \
85
- f'AZIMUTH = {self.azimuth}\n ' \
86
- f'TILT = {self.tilt}\n ..'
87
-
88
- def __repr__(self):
89
- return self.to_inp()
90
-
91
-
92
- @dataclass
93
- class Doe2ShadeCollection:
94
-
95
- doe_shades: List[Doe2Shade]
96
-
97
- @classmethod
98
- def from_df_context_shades(cls, df_shades: [ContextShade]):
99
- """Generate doe2 fixed shades from dragonfly context shades"""
100
- shade_faces = []
101
-
102
- for shade_i, shade in enumerate(df_shades):
103
- for i, geom in enumerate(shade.geometry):
104
- shade_geom_name = f"shade_{shade_i}_geom{i}"
105
- shade_faces.append((geom, shade_geom_name))
106
- doe_shades = [Doe2Shade.from_face3d(obj[0], obj[1]) for obj in shade_faces]
107
-
108
- return cls(doe_shades=doe_shades)
109
-
110
- def to_inp(self):
111
-
112
- block = [fb.fix_bldg_shade]
113
- shades = [shade.to_inp() for shade in self.doe_shades]
114
-
115
- block.append('\n\n'.join(shades))
116
-
117
- return '\n'.join(block)
118
-
119
- def __repr__(self):
120
- return self.to_inp()
@@ -1,21 +0,0 @@
1
- class SiteBldgData(object):
2
- def __init__(self):
3
- super(SiteBldgData, self).__init__()
4
-
5
- def to_inp(self):
6
- """Return Site and Building Data as an inp string"""
7
- return '$' + ('-'*57) + '\n' \
8
- '$ Site and Building Data\n' \
9
- '$' + ('-'*57) + '\n\n' \
10
- '"Site Data" = SITE-PARAMETERS\n ' \
11
- 'ALTITUDE = 150\n ' \
12
- 'C-STATE = 21\n ' \
13
- 'C-WEATHER-FILE = *TMY2\\HARTFOCT.bin* \n ' \
14
- 'C-COUNTRY = 1\n ' \
15
- 'C-901-LOCATION = 1092\n ..\n' \
16
- '"Building Data" = BUILD-PARAMETERS\n ' \
17
- 'HOLIDAYS = "Standard US Holidays"\n ..\n\n\n' \
18
- 'PROJECT-DATA\n ..\n\n'
19
-
20
- def __repr__(self):
21
- return self.to_inp()
@@ -1,17 +0,0 @@
1
- from dataclasses import dataclass
2
-
3
-
4
- @dataclass
5
- class Title:
6
-
7
- title: str
8
-
9
- def to_inp(self) -> str:
10
- """Return run period as an inp string."""
11
- # standard holidays should be exposed.
12
- return 'TITLE\n' \
13
- f' LINE-1 = *{self.title}*\n' \
14
- ' ..'
15
-
16
- def __repr__(self) -> str:
17
- return self.to_inp()
@@ -1,66 +0,0 @@
1
- import re
2
- from ladybug.datatype import UNITS as lbt_units, TYPESDICT as lbt_td
3
-
4
-
5
- def short_name(name, max_length=32):
6
- if len(name) <= max_length:
7
- return name
8
-
9
- shortened_name = ''.join(re.split("[aeiouy\\-\\_/]", name))
10
-
11
- if len(shortened_name) <= max_length:
12
- return shortened_name
13
-
14
- shortened_name = ''.join(shortened_name.split())
15
- if len(shortened_name) > max_length:
16
- shortened_name = ''.join(shortened_name.split())
17
- if len(shortened_name) > max_length:
18
- raise ValueError(
19
- f'{name} cannot be shorten to fit the eQuest limitation of 32 characters. ',
20
- f'Shortens to {shortened_name}\n '
21
- 'You need to change the name manually to be shorter than 32 characters.')
22
- return shortened_name
23
-
24
-
25
- def lower_left_properties(room_2d):
26
- """Get the vertices, boundary conditions and windows starting from lower left.
27
- v2 WIP
28
- """
29
- room_2d.remove_duplicate_vertices()
30
- simple_w_con = room_2d.properties.energy.construction_set.aperture_set.window_construction.to_simple_construction()
31
- w_const_name = short_name(simple_w_con.identifier, 32)
32
- floor_geo = room_2d.floor_geometry
33
- start_pt = floor_geo.boundary[0]
34
- min_y, min_x, pt_i = start_pt.y, start_pt.x, 0
35
- for i, pt in enumerate(floor_geo.boundary):
36
- if pt.y < min_y:
37
- min_y, min_x = pt.y, pt.x
38
- pt_i = i
39
- elif pt.y == min_y:
40
- if pt.x < min_x:
41
- min_y, min_x = pt.y, pt.x
42
- pt_i = i
43
- verts = floor_geo.boundary[pt_i:] + floor_geo.boundary[:pt_i]
44
- if floor_geo.has_holes:
45
- bcs = room_2d.boundary_conditions[:len(floor_geo.boundary)]
46
- w_par = room_2d.window_parameters[:len(floor_geo.boundary)]
47
- else:
48
- bcs = room_2d.boundary_conditions
49
- w_par = room_2d.window_parameters
50
- bcs = bcs[pt_i:] + bcs[:pt_i]
51
- w_par = w_par[pt_i:] + w_par[:pt_i]
52
-
53
- return (verts, bcs, w_par, w_const_name)
54
-
55
-
56
- def unit_convertor(value, to_, from_):
57
- """Helper function to convert values from one unit to another."""
58
- for key in lbt_units:
59
- if from_ in lbt_units[key]:
60
- base_type = lbt_td[key]()
61
- break
62
- else:
63
- raise ValueError(f'Invalid type: {from_}')
64
-
65
- value = base_type.to_unit(value, to_, from_)
66
- return round(value[0], 3)
@@ -1,26 +0,0 @@
1
- dragonfly_doe2/__init__.py,sha256=7mMolkMWPH3K7XdhywykgzYu_gw7fSViYkbHPxWlrvM,30
2
- dragonfly_doe2/__main__.py,sha256=zzD2bW7VrgXF7o5cymT6AeHxBbXFrUKOjz6ZscuCT_M,76
3
- dragonfly_doe2/writer.py,sha256=ekgNrUZereJeDGH4GzMz-bNPC_s18oPOP3UJ4mKJLW4,1025
4
- dragonfly_doe2/cli/__init__.py,sha256=nltElKII6KfrGtbZJTmVqXUd3UqfzjGgoPsRz50s19c,395
5
- dragonfly_doe2/cli/translate.py,sha256=nnixZMz0op5jeryqZzRqTr61MyZlZwLlKK37BjQW7ZU,2223
6
- dragonfly_doe2/doe/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
7
- dragonfly_doe2/doe/blocks.py,sha256=IX9aueE35FYG0y7mTCKd-wrQWNI90QryfALlBANgkMQ,6982
8
- dragonfly_doe2/doe/compliance.py,sha256=DtVjZ87dABvppn2ZV0zCnUnQD-JnJ_ff6PR2RHQSK7c,1247
9
- dragonfly_doe2/doe/construction.py,sha256=hjpH0CuTtcrWFFkOaz-NyvNBBW6DcJA4DAxMotIOLQM,3842
10
- dragonfly_doe2/doe/floor_space.py,sha256=b7INuIoO2lhInHDvv7QQIWSntpc8-P7_Tx4n9iMi0oA,13859
11
- dragonfly_doe2/doe/glass_types.py,sha256=WSYcjFLdsquFOTUTBYn4rU6wirIxE4CwNkUh9_bsdss,1401
12
- dragonfly_doe2/doe/hvac.py,sha256=vpPHwohWw4OCoiPVv6G6lAwm9NDo_Y7rrpJ7igjuimk,3388
13
- dragonfly_doe2/doe/material.py,sha256=BZ1EqAKl_tWHi0z1zSQAS2lBEqwFpvpKXN3FlBxgNfM,2625
14
- dragonfly_doe2/doe/model.py,sha256=CLUqOlH07BDaXG7yGKuzb4Wxyp3JVRtIsw9RJgdhCaQ,9099
15
- dragonfly_doe2/doe/polygon.py,sha256=QGr3_ljkwvXTqdl4tuDtDB5G3Oo87msrbEr7kux6QEg,2235
16
- dragonfly_doe2/doe/run_period.py,sha256=VhJZ4zAFsIoi1tKFspoZx4YZP-JAtA-FDuscuK5KU9o,1267
17
- dragonfly_doe2/doe/shades.py,sha256=LYQyt7hSWAFdhPKP-rKNzLGAozFVDXlOQO0mJBb1ZzE,4536
18
- dragonfly_doe2/doe/sitebldg.py,sha256=PfOB4OD0zGsIi7uMKRlGOW5Wj3vj5zx-b5Pj39RxZEo,852
19
- dragonfly_doe2/doe/title.py,sha256=42uomcNipWOM4G3SvpGL48KBCpwjnj89-ik3Ucacnh4,369
20
- dragonfly_doe2/doe/utils.py,sha256=lsglL9fqZo8yEeNJ7CJLRNqGUOBQWOBnF5CU1gihu2w,2351
21
- dragonfly_doe2-0.11.2.dist-info/LICENSE,sha256=hIahDEOTzuHCU5J2nd07LWwkLW7Hko4UFO__ffsvB-8,34523
22
- dragonfly_doe2-0.11.2.dist-info/METADATA,sha256=h9uBhuK3XpOmf_QdiaGo_v9Zhf6x6YrLZqY-oJWjLT0,2116
23
- dragonfly_doe2-0.11.2.dist-info/WHEEL,sha256=Z-nyYpwrcSqxfdux5Mbn_DQ525iP7J2DG3JgGvOYyTQ,110
24
- dragonfly_doe2-0.11.2.dist-info/entry_points.txt,sha256=7jeZmW071M_uDLKN1RTzr_KB2r54LcBpjLkyVE0Hh1U,60
25
- dragonfly_doe2-0.11.2.dist-info/top_level.txt,sha256=6CLCvUyl1H2vrbXmeA0ND_znFz4a2oOclc7NMBZxR6c,15
26
- dragonfly_doe2-0.11.2.dist-info/RECORD,,