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

feat(project info): add schema for project information #382

Merged
Merged
Show file tree
Hide file tree
Changes from all 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
4 changes: 3 additions & 1 deletion docs.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
from honeybee_schema.energy.simulation import SimulationParameter
from honeybee_schema.validation import ValidationReport
from honeybee_schema.comparison import ComparisonReport, SyncInstructions
from honeybee_schema.project_info import ProjectInfo

import json
import argparse
Expand Down Expand Up @@ -45,7 +46,8 @@
{'module': [SimulationParameter], 'name': 'Simulation Parameter'},
{'module': [ValidationReport], 'name': 'Validation Report'},
{'module': [ComparisonReport], 'name': 'Comparison Report'},
{'module': [SyncInstructions], 'name': 'Sync Instructions'}
{'module': [SyncInstructions], 'name': 'Sync Instructions'},
{'module': [ProjectInfo], 'name': 'Project Information'}
]


Expand Down
26 changes: 25 additions & 1 deletion honeybee_schema/energy/simulation.py
Original file line number Diff line number Diff line change
Expand Up @@ -273,6 +273,30 @@ class ClimateZones(str, Enum):
zone_8 = '8'


class BuildingTypes(str, Enum):
Residential = 'Residential'
NonResidential = 'NonResidential'
MidriseApartment = 'MidriseApartment'
HighriseApartment = 'HighriseApartment'
LargeOffice = 'LargeOffice'
MediumOffice = 'MediumOffice'
SmallOffice = 'SmallOffice'
Retail = 'Retail'
StripMall = 'StripMall'
PrimarySchool = 'PrimarySchool'
SecondarySchool = 'SecondarySchool'
SmallHotel = 'SmallHotel'
LargeHotel = 'LargeHotel'
Hospital = 'Hospital'
Outpatient = 'Outpatient'
Warehouse = 'Warehouse'
SuperMarket = 'SuperMarket'
FullServiceRestaurant = 'FullServiceRestaurant'
QuickServiceRestaurant = 'QuickServiceRestaurant'
Laboratory = 'Laboratory'
Courthouse = 'Courthouse'


class SizingParameter(NoExtraBaseModel):
"""Used to specify heating and cooling sizing criteria and safety factors."""

Expand Down Expand Up @@ -317,7 +341,7 @@ class SizingParameter(NoExtraBaseModel):
'the design days on this sizing parameter object.'
)

building_type: str = Field(
building_type: BuildingTypes = Field(
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah crud. I should have caught this. I'm going to have to revert this line as it will break several workflows. This one needs to be a string.

default=None,
description='Text for the building type to be used in the efficiency_standard. '
'If the type is not recognized or is None, it will be assumed that the building '
Expand Down
91 changes: 91 additions & 0 deletions honeybee_schema/project_info.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
"""Schema for project information."""
from pydantic import BaseModel, Field, constr, AnyUrl
from typing import List

from .energy.simulation import EfficiencyStandards, ClimateZones, BuildingTypes


class Location(BaseModel):
"""A Ladybug Location."""

type: constr(regex='^Location$') = 'Location'

city: str = Field(
'-',
description='Name of the city as a string.'
)

latitude: float = Field(
0,
description='Location latitude between -90 and 90 (Default: 0).'
)

longitude: float = Field(
0,
description='Location longitude between -180 (west) and 180 (east) (Default: 0).'
)

time_zone: float = Field(
None,
mostaphaRoudsari marked this conversation as resolved.
Show resolved Hide resolved
description='Time zone between -12 hours (west) and +14 hours (east). '
'If None, the time zone will be an estimated integer value derived from '
'the longitude in accordance with solar time.'
)

elevation: float = Field(
0,
description='A number for elevation of the location in meters. (Default: 0).'
)

station_id: str = Field(
None,
mostaphaRoudsari marked this conversation as resolved.
Show resolved Hide resolved
description='ID of the location if the location is representing a weather '
'station.'
)

source: str = Field(
None, description='Source of data (e.g. TMY, TMY3).'
mostaphaRoudsari marked this conversation as resolved.
Show resolved Hide resolved
)


class ProjectInfo(BaseModel):
"""Project information."""

type: constr(regex='^ProjectInfo$') = 'ProjectInfo'

north: float = Field(
0,
description='A number between -360 to 360 where positive values rotate the '
'compass counterclockwise (towards the West) and negative values rotate the '
'compass clockwise (towards the East).',
le=360, ge=-360
)

weather_urls: List[AnyUrl] = Field(
None,
description='A list of URLs to zip files that includes EPW, DDY and STAT files. '
'You can find these URLs from the EPWMAP. The first URL will be used as the '
'primary weather file.'
)

location: Location = Field(
None,
description='Project location. This value is usually generated from the '
'information in the weather files.'
)

ashrae_climate_zone: ClimateZones = Field(
None,
description='Project location climate zone.'
)

building_type: List[BuildingTypes] = Field(
None,
description='A list of building types for the project. The first building '
'type is considered the primary type for the project.'
)

vintage: List[EfficiencyStandards] = Field(
None,
description='A list of building vintages (e.g. ASHRAE_2019, ASHRAE_2016).'
)
Loading