-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(des): Refactor DES and add component for visualizing GHEs
- Loading branch information
1 parent
2a3314d
commit 6af5ba6
Showing
21 changed files
with
467 additions
and
163 deletions.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
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.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
{ | ||
"version": "1.8.0", | ||
"nickname": "ColorNetAttr", | ||
"outputs": [ | ||
[ | ||
{ | ||
"access": "None", | ||
"name": "boreholes", | ||
"description": "A list of points for the borehole locations within the _site.", | ||
"type": null, | ||
"default": null | ||
}, | ||
{ | ||
"access": "None", | ||
"name": "bore_geo", | ||
"description": "Script variable ColorNetAttr", | ||
"type": null, | ||
"default": null | ||
}, | ||
{ | ||
"access": "None", | ||
"name": "g_function", | ||
"description": "A data tree of G-function coefficients that describe the response\nof the ground to the input loads. Each pair of factors represents\na point on the G-function. Flattening this data tree enables you\nto plug it directly into the \"Ironbug Ground Heat Exchanger Vertical\"\ncomponent to simulate the ground heat exchanger in EnergyPlus.", | ||
"type": null, | ||
"default": null | ||
}, | ||
{ | ||
"access": "None", | ||
"name": "properties", | ||
"description": "A list of properties for the GHE that can be used to describe it\nin EnergyPlus simulations. The properties that can be plugged directly\ninto the parameters of the \"Ironbug Ground Heat Exchanger Vertical\"\ncomponent. The properties are in the following order:\n_\n* Borehole Length\n* Borehole Radius\n* Design Flow Rate\n* Ground Temperature\n* Ground Conductivity\n* Ground Heat Capacity\n* Grout Conductivity\n* Number of Boreholes\n* Pipe Outer Diameter\n* Pipe Conductivity\n* Pipe Thickness\n* U Tube Distance", | ||
"type": null, | ||
"default": null | ||
}, | ||
{ | ||
"access": "None", | ||
"name": "month_temps", | ||
"description": "A list of ground temperatures in Celsius with one value for each month\nof the period over which the GHEDesigner simulation was run (typically\n20 years). This can be connected to a nativ Grasshopper \"Quick Graph\"\ncomponent and used to check the drift in the ground temperature\nover long periods of time.", | ||
"type": null, | ||
"default": null | ||
} | ||
] | ||
], | ||
"inputs": [ | ||
{ | ||
"access": "item", | ||
"name": "_sys_param", | ||
"description": "The system parameters JSON file output by the \"DF Write Modelica DES\"\ncomponent. This includes the detailed Building load profiles,\nequipment specifications, and borehole field characteristics.", | ||
"type": "string", | ||
"default": null | ||
}, | ||
{ | ||
"access": "item", | ||
"name": "_des_loop", | ||
"description": "The GHE Thermal Loop object output by the \"DF GHE Thermal Loop\",\nwhich contains the geometry of the district energy system.", | ||
"type": "System.Object", | ||
"default": null | ||
} | ||
], | ||
"subcategory": "1 :: Visualize", | ||
"code": "\nimport os\n\ntry: # import the ladybug_geometry dependencies\n from ladybug_geometry.geometry3d import Vector3D, Point3D, LineSegment3D, Face3D\nexcept ImportError as e:\n raise ImportError('\\nFailed to import ladybug_geometry:\\n\\t{}'.format(e))\n\ntry: # import the ladybug_{{cad}} dependencies\n from ladybug_{{cad}}.config import units_system\n from ladybug_{{cad}}.fromgeometry import from_point2d, from_linesegment3d\n from ladybug_{{cad}}.{{plugin}} import all_required_inputs, list_to_data_tree\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 # get the folder where all of the sizing results live\n proj_folder = os.path.dirname(_sys_param)\n ghe_dir = os.path.join(proj_folder, 'run', 'honeybee_scenario', 'ghe_dir')\n assert os.path.isdir(ghe_dir), \\\n 'No {{PLGN}}E sizing results were found at\" {}.'.format(ghe_dir)\n\n # parse the borehole geometry\n units = units_system()\n boreholes, bore_geo, g_function, properties, month_temps = [], [], [], [], []\n for ghe_id in os.listdir(ghe_dir):\n # find the matching {{PLGN}}E in the loop\n for ghe in _des_loop.ground_heat_exchangers:\n if ghe_id == ghe.identifier:\n matched_ghe = ghe\n break\n else:\n msg = 'No {{PLGN}}E in the connected _des_loop matches with the {{PLGN}}E ' \\\n '\"{}\" in the _sys_param.'.format(ghe_id)\n raise ValueError(msg)\n \n # get the files with all of the information\n bore_file = os.path.join(ghe_dir, ghe_id, 'BoreFieldData.csv')\n summary_file = os.path.join(ghe_dir, ghe_id, 'SimulationSummary.json')\n g_func_file = os.path.join(ghe_dir, ghe_id, 'Gfunction.csv')\n\n # load the borehole positions\n ghe_bores = matched_ghe.load_boreholes(bore_file, units, ortho_rotation=True)\n ghe_boreholes = [from_point2d(pt) for pt in ghe_bores]\n boreholes.append(ghe_boreholes)\n\n # load the summary data\n props = matched_ghe.load_energyplus_properties(summary_file)\n properties.append(props)\n zp = zip(matched_ghe.PROPERTY_NAMES, props)\n print(ghe_id + '\\n' + '\\n'.join(' {}: {}'.format(name, val) for name, val in zp))\n\n # create a line segment for each borehole\n z_val = matched_ghe.geometry.min.z if isinstance(matched_ghe.geometry, Face3D) else 0\n bore_dir = Vector3D(0, 0, -props[0])\n ghe_geos = [LineSegment3D(Point3D(pt.x, pt.y, z_val), bore_dir) for pt in ghe_bores]\n ghe_geos = [from_linesegment3d(pt) for pt in ghe_geos]\n bore_geo.append(ghe_geos)\n\n # load the g-function and the monthly temperatures\n g_function.append(matched_ghe.load_g_function(g_func_file))\n month_temps.append(matched_ghe.load_monthly_temperatures(summary_file))\n\n # convert the boreholes to a data tree\n boreholes = list_to_data_tree(boreholes)\n bore_geo = list_to_data_tree(bore_geo)\n g_function = list_to_data_tree(g_function)\n properties = list_to_data_tree(properties)\n month_temps = list_to_data_tree(month_temps)\n", | ||
"category": "Dragonfly", | ||
"name": "DF Read GHE Sizing", | ||
"description": "Load properties of the Ground Heat Exchangers (GHEs) from the \"DF Write Modelica DES\"\ncomponent. This includes the positions of boreholes in each GHE, the G-function\nof each GHE that describes the response of the ground to load, an a range of other\nproperties output from the sizing simulation performed by GHEDesigner.\n-" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
{ | ||
"version": "1.8.0", | ||
"nickname": "RunModelica", | ||
"outputs": [ | ||
[ | ||
{ | ||
"access": "None", | ||
"name": "results", | ||
"description": "A folder containing the results of the Modelica simulation.", | ||
"type": null, | ||
"default": null | ||
} | ||
] | ||
], | ||
"inputs": [ | ||
{ | ||
"access": "item", | ||
"name": "_modelica", | ||
"description": "A folder where all of the Modelica files of the District Energy\nSystem (DES) are written. These Modelica files can be created using\nthe \"DF Write Modelica DES\" component.", | ||
"type": "System.Object", | ||
"default": null | ||
}, | ||
{ | ||
"access": "item", | ||
"name": "_run", | ||
"description": "Script variable Python", | ||
"type": "System.Object", | ||
"default": null | ||
} | ||
], | ||
"subcategory": "5 :: District Thermal", | ||
"code": "\nimport os\nimport subprocess\n\ntry:\n from ladybug.futil import nukedir\n from ladybug.config import folders as lb_folders\nexcept ImportError as e:\n raise ImportError('\\nFailed to import honeybee:\\n\\t{}'.format(e))\n\ntry:\n from honeybee.config import folders\nexcept ImportError as e:\n raise ImportError('\\nFailed to import honeybee:\\n\\t{}'.format(e))\n\ntry: # import the dragonfly_energy dependencies\n from dragonfly_energy.config import folders as df_folders\n from dragonfly_energy.run import run_modelica_docker\nexcept ImportError as e:\n raise ImportError('\\nFailed to import dragonfly_energy:\\n\\t{}'.format(e))\n\ntry:\n from ladybug_{{cad}}.download import download_file_by_name\n from ladybug_{{cad}}.{{plugin}} import all_required_inputs, give_warning\nexcept ImportError as e:\n raise ImportError('\\nFailed to import ladybug_{{cad}}:\\n\\t{}'.format(e))\n\nUO_GMT_VERSION = '0.8.0'\n\n\nif all_required_inputs(ghenv.Component) and _run:\n # set up the custom python environment\n custom_env = os.environ.copy()\n custom_env['PYTHONHOME'] = ''\n\n # set global values\n ext = '.exe' if os.name == 'nt' else ''\n executor_path = os.path.join(\n lb_folders.ladybug_tools_folder, '{{plugin}}',\n 'ladybug_{{plugin}}_dotnet', 'Ladybug.Executor.exe')\n\n # check to see if the geojson-modelica-translator is installed\n uo_gmt = '{}/uo_des{}'.format(folders.python_scripts_path, ext)\n uo_gmt_pack = '{}/geojson_modelica_translator-{}.dist-info'.format(\n folders.python_package_path, UO_GMT_VERSION)\n if not os.path.isfile(uo_gmt) or not os.path.isdir(uo_gmt_pack):\n install_cmd = 'pip install geojson-modelica-translator=={}'.format(UO_GMT_VERSION)\n if os.name == 'nt' and os.path.isfile(executor_path) and \\\n 'Program Files' in executor_path:\n pip_cmd = [\n executor_path, folders.python_exe_path, '-m {}'.format(install_cmd)\n ]\n else:\n pip_cmd = '\"{py_exe}\" -m {uo_cmd}'.format(\n py_exe=folders.python_exe_path, uo_cmd=install_cmd)\n shell = True if os.name == 'nt' else False\n process = subprocess.Popen(\n pip_cmd, stderr=subprocess.PIPE, shell=shell, env=custom_env)\n stderr = process.communicate()\n\n # execute the modelica files in URBANopt\n if df_folders.docker_version_str is not None:\n results = run_modelica_docker(_modelica)\n else:\n docker_url = 'https://www.docker.com/products/docker-desktop/'\n msg = 'No Docker installation was found on this machine.\\n' \\\n 'This is needed to execute Modelica simulations.\\n' \\\n 'Download Docker Desktop from: {}'.format(docker_url)\n print(msg)\n give_warning(ghenv.Component, msg)\n", | ||
"category": "Dragonfly", | ||
"name": "DF Run Modelica", | ||
"description": "Run a Modelica District Energy System (DES) through an annual simulation using\nOpenModelica inside a Docker image (via Docker Desktop).\n_\nDocker Dekstop can be downloaded at the following link:\nhttps://www.docker.com/products/docker-desktop/\n-" | ||
} |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.