Skip to content

Commit

Permalink
feat(altweather): Add components for the UWG
Browse files Browse the repository at this point in the history
  • Loading branch information
chriswmackey authored and Chris Mackey committed Jan 20, 2021
1 parent 21e77d3 commit a1ef0d6
Show file tree
Hide file tree
Showing 65 changed files with 1,211 additions and 41 deletions.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified dragonfly_grasshopper/icon/DF Construct Design Day.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified dragonfly_grasshopper/icon/DF ContextShade.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified dragonfly_grasshopper/icon/DF Create EPW.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified dragonfly_grasshopper/icon/DF Horizontal Infrared.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified dragonfly_grasshopper/icon/DF Import NOAA File.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified dragonfly_grasshopper/icon/DF Luminous Efficacy.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added dragonfly_grasshopper/icon/DF Terrain.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added dragonfly_grasshopper/icon/DF Traffic Parameters.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified dragonfly_grasshopper/icon/DF Write DDY.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified dragonfly_grasshopper/icon/DF Write EPW.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
78 changes: 78 additions & 0 deletions dragonfly_grasshopper/json/DF_Assign_Building_UWG_Properties.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
{
"version": "1.1.0",
"nickname": "BuildingUWG",
"outputs": [
[
{
"access": "None",
"name": "building",
"description": "The input Dragonfly Building with its UWG properties re-assigned based\non the input.",
"type": null,
"default": null
}
]
],
"inputs": [
{
"access": "item",
"name": "_building",
"description": "A Dragonfly Building which is to have its Urban Weather Generator (UWG)\nproperties assigned.",
"type": "System.Object",
"default": null
},
{
"access": "item",
"name": "program_",
"description": "Text for the name of the building program. Must be one of the\noptions below. (Default: LargeOffice).\n* LargeOffice\n* MediumOffice\n* SmallOffice\n* MidriseApartment\n* Retail\n* StripMall\n* PrimarySchool\n* SecondarySchool\n* SmallHotel\n* LargeHotel\n* Hospital\n* Outpatient\n* Warehouse\n* SuperMarket\n* FullServiceRestaurant\n* QuickServiceRestaurant",
"type": "string",
"default": null
},
{
"access": "item",
"name": "vintage_",
"description": "Text for the vintage of the building. This will be used to set\ndefault constructions. Must be one of the options below or one of\nthe options from the \"HB Building Vintages\" component, which will\nbe mapped to one of the options below. (Default: New).\n* New\n* 1980_Present\n* Pre1980",
"type": "string",
"default": null
},
{
"access": "item",
"name": "fr_canyon_",
"description": "A number from 0 to 1 that represents the fraction of the building's\nwaste heat from air conditioning that gets rejected into the urban\ncanyon. (Default: 0.5).",
"type": "System.Object",
"default": null
},
{
"access": "item",
"name": "shgc_",
"description": "A number from 0 to 1 that represents the SHGC of the building's windows.\nThis is used to evaluate the amount of solar heat reflected into the\nstreet canyon. By default, it will be set by the building vintage\nand the Model climate zone.",
"type": "double",
"default": null
},
{
"access": "item",
"name": "wall_alb_",
"description": "A number from 0 to 1 that represents the exterior wall albedo\nof the building. By default, it will be set by the building program\nand the DoE commercial reference buildings.",
"type": "double",
"default": null
},
{
"access": "item",
"name": "roof_alb_",
"description": "A number from 0 to 1 that represents the exterior roof albedo of\nthe building. By default, it will be set by the vintage, meaning 0.7\nfor New and 0.2 for 1980_Present and Pre1980.",
"type": "double",
"default": null
},
{
"access": "item",
"name": "roof_veg_",
"description": "A number from 0 to 1 that represents the fraction of the building's\nroofs covered in vegetation. (Default: 0).",
"type": "double",
"default": null
}
],
"subcategory": "4 :: AlternativeWeather",
"code": "\ntry: # import the dragonfly dependencies\n from dragonfly.building import Building\nexcept ImportError as e:\n raise ImportError('\\nFailed to import dragonfly:\\n\\t{}'.format(e))\n\ntry:\n from ladybug_{{cad}}.{{plugin}} import all_required_inputs\nexcept ImportError as e:\n raise ImportError('\\nFailed to import ladybug_{{cad}}:\\n\\t{}'.format(e))\n\n# dictionary to map vintages to acceptable UWG ones\nVINTAGE_MAP = {\n 'New': 'New',\n '1980_Present': '1980_Present',\n 'Pre1980': 'Pre1980',\n '2013': '1980_Present',\n '2010': '1980_Present',\n '2007': '1980_Present',\n '2004': '1980_Present',\n '1980_2004': '1980_Present',\n 'pre_1980': 'Pre1980'\n}\n\n\nif all_required_inputs(ghenv.Component):\n # check and duplicate the input\n assert isinstance(_building, Building), \\\n 'Expected Dragonfly Building. Got {}.'.format(type(_building))\n building = _building.duplicate()\n\n # assign all of the properties to the building\n if program_ is not None:\n building.properties.uwg.program = program_\n if vintage_ is not None:\n building.properties.uwg.vintage = VINTAGE_MAP[vintage_]\n if fr_canyon_ is not None:\n building.properties.uwg.fract_heat_to_canyon = fr_canyon_\n if shgc_ is not None:\n building.properties.uwg.shgc = shgc_\n if wall_alb_ is not None:\n building.properties.uwg.wall_albedo = wall_alb_\n if roof_alb_ is not None:\n building.properties.uwg.roof_albedo = roof_alb_\n if roof_veg_ is not None:\n building.properties.uwg.roof_veg_fraction = roof_veg_\n",
"category": "Dragonfly",
"name": "DF Assign Building UWG Properties",
"description": "Edit the properties of a Dragonfly Building that affect simulation with to the Urban\nWeather Generator (UWG).\n-"
}
57 changes: 57 additions & 0 deletions dragonfly_grasshopper/json/DF_Assign_Model_UWG_Properties.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
{
"version": "1.1.0",
"nickname": "ModelUWG",
"outputs": [
[
{
"access": "None",
"name": "model",
"description": "The input Dragonfly Model with its UWG properties re-assigned based\non the input.",
"type": null,
"default": null
}
]
],
"inputs": [
{
"access": "item",
"name": "_model",
"description": "A Dragonfly Model which is to have its Urban Weather Generator (UWG)\nproperties assigned.",
"type": "System.Object",
"default": null
},
{
"access": "item",
"name": "_terrain_",
"description": "A Terrain object that dictates the properties of the street and\nground beneath the buildings. If None, a default terrain object will be\ngenerated by analysing all of the buildings in the Model and drawing\na bounding rectangle in the XY plane around them.",
"type": "System.Object",
"default": null
},
{
"access": "item",
"name": "_traffic_",
"description": "A TrafficPararameter object that defines the activity and intensity\nof traffic within the urban street canyons. If None, traffic\nintensity will be approximated using the average building\nstory count along with a generic traffic schedule.",
"type": "System.Object",
"default": null
},
{
"access": "item",
"name": "tree_cover_",
"description": "A number from 0 to 1 that defines the fraction of the exposed\nterrain covered by trees. If None, it will be determined by\nevaluating the horizontal area of all ContextShade geometry\nthat has a true is_vegetation property.",
"type": "double",
"default": null
},
{
"access": "item",
"name": "grass_cover_",
"description": "A number from 0 to 1 that defines the fraction of the exposed\nterrain that is covered by grass or shrubs. If None, no grass will\nbe assumed for the urban area.",
"type": "double",
"default": null
}
],
"subcategory": "4 :: AlternativeWeather",
"code": "\ntry: # import the dragonfly dependencies\n from dragonfly.model import Model\nexcept ImportError as e:\n raise ImportError('\\nFailed to import dragonfly:\\n\\t{}'.format(e))\n\ntry:\n from ladybug_{{cad}}.{{plugin}} import all_required_inputs\nexcept ImportError as e:\n raise ImportError('\\nFailed to import ladybug_{{cad}}:\\n\\t{}'.format(e))\n\n\nif all_required_inputs(ghenv.Component):\n # check and duplicate the input\n assert isinstance(_model, Model), \\\n 'Expected Dragonfly Model. Got {}.'.format(type(_model))\n model = _model.duplicate()\n\n # assign any of the input properties\n if _terrain_ is not None:\n model.properties.uwg.terrain = _terrain_\n if _traffic_ is not None:\n model.properties.uwg.traffic = _traffic_\n if tree_cover_ is not None:\n model.properties.uwg.tree_coverage_fraction = tree_cover_\n if grass_cover_ is not None:\n model.properties.uwg.grass_coverage_fraction = grass_cover_\n\n # print some useful information about the model\n print('{} m - average height'.format(\n round(model.average_height_above_ground, 1)))\n print('{} - footprint density'.format(\n round(model.properties.uwg.footprint_density, 2)))\n print('{} - facade to site'.format(\n round(model.properties.uwg.facade_to_site, 2)))\n print('{} - tree cover'.format(\n round(model.properties.uwg.tree_coverage_fraction, 2)))\n print('{} - grass cover'.format(\n round(model.properties.uwg.grass_coverage_fraction, 2)))\n",
"category": "Dragonfly",
"name": "DF Assign Model UWG Properties",
"description": "Edit the properties of a Dragonfly Model that affect simulation with to the Urban\nWeather Generator (UWG).\n-"
}
57 changes: 57 additions & 0 deletions dragonfly_grasshopper/json/DF_Boundary_Layer_Parameters.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
{
"version": "1.1.0",
"nickname": "BoundaryLayer",
"outputs": [
[
{
"access": "None",
"name": "bnd_layer",
"description": "Boundary layer parameters that can be plugged into the \"DF Run\nUrban Weather Generator\" component to specify the properties of\nthe urban boundary layer.",
"type": null,
"default": null
}
]
],
"inputs": [
{
"access": "item",
"name": "_day_hght_",
"description": "A number that represents the height in meters of the urban boundary\nlayer during the daytime. This is the height to which the urban\nmeteorological conditions are stable and representative of the\noverall urban area. Typically, this boundary layer height increases\nwith the height of the buildings. (Default: 1000 meters).",
"type": "double",
"default": null
},
{
"access": "item",
"name": "_night_hght_",
"description": "A number that represents the height in meters of the urban\nboundary layer during the nighttime. This is the height to which the\nurban meteorological conditions are stable and representative of\nthe overall urban area. Typically, this boundary layer height\nincreases with the height of the buildings. (Default: 80 meters).",
"type": "double",
"default": null
},
{
"access": "item",
"name": "_inversion_hght_",
"description": "A number that represents the height in meters at which\nthe vertical profile of potential temperature becomes stable.\nCan be determined by flying helium balloons equipped\nwith temperature sensors and recording the air temperatures\nat different heights. (Default: 150 meters).",
"type": "double",
"default": null
},
{
"access": "item",
"name": "_circ_coeff_",
"description": "A number representing the circulation coefficient. (Default: 1.2,\nper Bueno (2012)).",
"type": "double",
"default": null
},
{
"access": "item",
"name": "_exch_coeff_",
"description": "A number representing the exchange coefficient. (Default: 1.0,\nper Bueno (2014)).",
"type": "double",
"default": null
}
],
"subcategory": "4 :: AlternativeWeather",
"code": "\ntry: # import the dragonfly_uwg dependencies\n from dragonfly_uwg.simulation.boundary import BoundaryLayerParameter\nexcept ImportError as e:\n raise ImportError('\\nFailed to import dragonfly_uwg:\\n\\t{}'.format(e))\n\n\n# process default values\n_day_hght_ = _day_hght_ if _day_hght_ is not None else 1000\n_night_hght_ = _night_hght_ if _night_hght_ is not None else 80\n_inversion_hght_ = _inversion_hght_ if _inversion_hght_ is not None else 150\n_circ_coeff_ = _circ_coeff_ if _circ_coeff_ is not None else 1.2\n_exch_coeff_ = _exch_coeff_ if _exch_coeff_ is not None else 1.0\n\n# create the traffic parameters\nbnd_layer = BoundaryLayerParameter(\n _day_hght_, _night_hght_, _inversion_hght_, _circ_coeff_, _exch_coeff_)\n",
"category": "Dragonfly",
"name": "DF Boundary Layer Parameters",
"description": "Create BoundaryLayerParameters representing the properties of the urban boundary\nlayer in an Urban Weather Genrator (UWG) simulation.\n-"
}
2 changes: 1 addition & 1 deletion dragonfly_grasshopper/json/DF_Construct_Design_Day.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"version": "1.1.0",
"version": "1.1.1",
"nickname": "ConstrDesignDay",
"outputs": [
[
Expand Down
11 changes: 9 additions & 2 deletions dragonfly_grasshopper/json/DF_ContextShade.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"version": "1.1.0",
"version": "1.1.1",
"nickname": "Context",
"outputs": [
[
Expand Down Expand Up @@ -40,10 +40,17 @@
"description": "Optional text for the ContextShade's energy transmittance\nschedule to be looked up in the schedule library. This can also be a\ncustom schedule object. If no energy schedule is input here, the default\nwill be always opaque.",
"type": "System.Object",
"default": null
},
{
"access": "item",
"name": "uwg_is_veg_",
"description": "Boolean to note whether the shade represents a tree canopy within\nsimulations with the Urban Weather Generator (UWG), in which case,\nit will be incorporated into the simulation as tree cover. (Default: False).",
"type": "bool",
"default": null
}
],
"subcategory": "0 :: Create",
"code": "\nimport uuid\n\ntry: # import the core honeybee dependencies\n from honeybee.typing import clean_and_id_string\nexcept ImportError as e:\n raise ImportError('\\nFailed to import honeybee:\\n\\t{}'.format(e))\n\ntry: # import the core dragonfly dependencies\n from dragonfly.context import ContextShade\nexcept ImportError as e:\n raise ImportError('\\nFailed to import dragonfly:\\n\\t{}'.format(e))\n\ntry: # import the ladybug_{{cad}} dependencies\n from ladybug_{{cad}}.togeometry import to_face3d\n from ladybug_{{cad}}.{{plugin}} import all_required_inputs, longest_list\nexcept ImportError as e:\n raise ImportError('\\nFailed to import ladybug_{{cad}}:\\n\\t{}'.format(e))\n\ntry: # import the honeybee-energy extension\n from honeybee_energy.lib.constructions import shade_construction_by_identifier\n from honeybee_energy.lib.schedules import schedule_by_identifier\nexcept ImportError as e:\n if len(ep_constr_) != 0:\n raise ValueError('ep_constr_ has been specified but honeybee-energy '\n 'has failed to import.\\n{}'.format(e))\n elif len(ep_trans_sch_) != 0:\n raise ValueError('ep_trans_sch_ has been specified but honeybee-energy '\n 'has failed to import.\\n{}'.format(e))\n\n\nif all_required_inputs(ghenv.Component):\n context = [] # list of context shades that will be returned\n base_name = str(uuid.uuid4())\n for i, geo in enumerate(_geo):\n lb_faces = to_face3d(geo)\n name = longest_list(_name_, i) if len(_name_) != 0 else base_name\n df_shd = ContextShade(clean_and_id_string('{}_{}'.format(name, i)), lb_faces)\n df_shd.display_name = '{}_{}'.format(name, i)\n\n # try to assign the energyplus construction\n if len(ep_constr_) != 0:\n ep_constr = longest_list(ep_constr_, i)\n if isinstance(ep_constr, str):\n ep_constr = shade_construction_by_identifier(ep_constr)\n df_shd.properties.energy.construction = ep_constr\n\n # try to assign the energyplus transmittance schedule\n if len(ep_trans_sch_) != 0:\n ep_trans_sch = longest_list(ep_trans_sch_, i)\n if isinstance(ep_trans_sch, str):\n ep_trans_sch = schedule_by_identifier(ep_trans_sch)\n df_shd.properties.energy.transmittance_schedule = ep_trans_sch\n\n context.append(df_shd) # collect the final ContextShades",
"code": "\ntry: # import the core honeybee dependencies\n from honeybee.typing import clean_and_id_string\nexcept ImportError as e:\n raise ImportError('\\nFailed to import honeybee:\\n\\t{}'.format(e))\n\ntry: # import the core dragonfly dependencies\n from dragonfly.context import ContextShade\nexcept ImportError as e:\n raise ImportError('\\nFailed to import dragonfly:\\n\\t{}'.format(e))\n\ntry: # import the ladybug_{{cad}} dependencies\n from ladybug_{{cad}}.togeometry import to_face3d\n from ladybug_{{cad}}.{{plugin}} import all_required_inputs, longest_list\nexcept ImportError as e:\n raise ImportError('\\nFailed to import ladybug_{{cad}}:\\n\\t{}'.format(e))\n\ntry: # import the honeybee-energy extension\n from honeybee_energy.lib.constructions import shade_construction_by_identifier\n from honeybee_energy.lib.schedules import schedule_by_identifier\nexcept ImportError as e:\n if len(ep_constr_) != 0:\n raise ValueError('ep_constr_ has been specified but honeybee-energy '\n 'has failed to import.\\n{}'.format(e))\n elif len(ep_trans_sch_) != 0:\n raise ValueError('ep_trans_sch_ has been specified but honeybee-energy '\n 'has failed to import.\\n{}'.format(e))\n\n\nif all_required_inputs(ghenv.Component):\n context = [] # list of context shades that will be returned\n for i, geo in enumerate(_geo):\n # get the name for the ContextShade\n if len(_name_) == 0: # make a default name\n display_name = 'Context_{}'.format(document_counter('context_count'))\n else:\n display_name = '{}_{}'.format(longest_list(_name_, i), i + 1) \\\n if len(_name_) != len(_geo) else longest_list(_name_, i)\n name = clean_and_id_string(display_name)\n\n # create the ContextShade object\n df_shd = ContextShade(name, to_face3d(geo))\n df_shd.display_name = display_name\n\n # try to assign the energyplus construction\n if len(ep_constr_) != 0:\n ep_constr = longest_list(ep_constr_, i)\n if isinstance(ep_constr, str):\n ep_constr = shade_construction_by_identifier(ep_constr)\n df_shd.properties.energy.construction = ep_constr\n\n # try to assign the energyplus transmittance schedule\n if len(ep_trans_sch_) != 0:\n ep_trans_sch = longest_list(ep_trans_sch_, i)\n if isinstance(ep_trans_sch, str):\n ep_trans_sch = schedule_by_identifier(ep_trans_sch)\n df_shd.properties.energy.transmittance_schedule = ep_trans_sch\n\n # try to assign the uwg us_vegetation property\n try:\n df_shd.properties.uwg.is_vegetation = uwg_is_veg_\n except AttributeError:\n pass # no dragonfly_uwg extension installed\n\n context.append(df_shd) # collect the final ContextShades",
"category": "Dragonfly",
"name": "DF ContextShade",
"description": "Create Dragonfly ContextShade.\n-"
Expand Down
2 changes: 1 addition & 1 deletion dragonfly_grasshopper/json/DF_Create_EPW.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"version": "1.1.0",
"version": "1.1.1",
"nickname": "CreateEPW",
"outputs": [
[
Expand Down
2 changes: 1 addition & 1 deletion dragonfly_grasshopper/json/DF_Horizontal_Infrared.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"version": "1.1.0",
"version": "1.1.1",
"nickname": "HorizInfr",
"outputs": [
[
Expand Down
2 changes: 1 addition & 1 deletion dragonfly_grasshopper/json/DF_Import_NOAA_File.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"version": "1.1.0",
"version": "1.1.1",
"nickname": "ImportNOAA",
"outputs": [
[
Expand Down
2 changes: 1 addition & 1 deletion dragonfly_grasshopper/json/DF_Luminous_Efficacy.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"version": "1.1.0",
"version": "1.1.1",
"nickname": "LumEff",
"outputs": [
[
Expand Down
Loading

0 comments on commit a1ef0d6

Please sign in to comment.