diff --git a/docs/eppy.rst b/docs/eppy.rst index 23b1c715..9df76baa 100644 --- a/docs/eppy.rst +++ b/docs/eppy.rst @@ -5,9 +5,14 @@ Subpackages ----------- .. toctree:: + :maxdepth: 4 - eppy.results - eppy.runner + eppy.EPlusInterfaceFunctions + eppy.constructions + eppy.geometry + eppy.results + eppy.runner + eppy.useful_scripts Submodules ---------- @@ -16,191 +21,190 @@ eppy.bunch\_subclass module --------------------------- .. automodule:: eppy.bunch_subclass - :members: - :undoc-members: - :show-inheritance: + :members: + :undoc-members: + :show-inheritance: eppy.bunchhelpers module ------------------------ .. automodule:: eppy.bunchhelpers - :members: - :undoc-members: - :show-inheritance: + :members: + :undoc-members: + :show-inheritance: eppy.easyopen module -------------------- .. automodule:: eppy.easyopen - :members: - :undoc-members: - :show-inheritance: + :members: + :undoc-members: + :show-inheritance: eppy.eppy module ---------------- .. automodule:: eppy.eppy - :members: - :undoc-members: - :show-inheritance: + :members: + :undoc-members: + :show-inheritance: eppy.fanpower module -------------------- .. automodule:: eppy.fanpower - :members: - :undoc-members: - :show-inheritance: + :members: + :undoc-members: + :show-inheritance: eppy.function\_helpers module ----------------------------- .. automodule:: eppy.function_helpers - :members: - :undoc-members: - :show-inheritance: + :members: + :undoc-members: + :show-inheritance: eppy.hvacbuilder module ----------------------- .. automodule:: eppy.hvacbuilder - :members: - :undoc-members: - :show-inheritance: + :members: + :undoc-members: + :show-inheritance: eppy.idd\_helpers module ------------------------ .. automodule:: eppy.idd_helpers - :members: - :undoc-members: - :show-inheritance: + :members: + :undoc-members: + :show-inheritance: eppy.iddcurrent module ---------------------- .. automodule:: eppy.iddcurrent - :members: - :undoc-members: - :show-inheritance: + :members: + :undoc-members: + :show-inheritance: eppy.iddgaps module ------------------- .. automodule:: eppy.iddgaps - :members: - :undoc-members: - :show-inheritance: + :members: + :undoc-members: + :show-inheritance: eppy.iddv7 module ----------------- .. automodule:: eppy.iddv7 - :members: - :undoc-members: - :show-inheritance: + :members: + :undoc-members: + :show-inheritance: eppy.iddv800 module ------------------- .. automodule:: eppy.iddv800 - :members: - :undoc-members: - :show-inheritance: + :members: + :undoc-members: + :show-inheritance: eppy.idf\_helpers module ------------------------ .. automodule:: eppy.idf_helpers - :members: - :undoc-members: - :show-inheritance: + :members: + :undoc-members: + :show-inheritance: eppy.idf\_msequence module -------------------------- .. automodule:: eppy.idf_msequence - :members: - :undoc-members: - :show-inheritance: + :members: + :undoc-members: + :show-inheritance: eppy.idfreader module --------------------- .. automodule:: eppy.idfreader - :members: - :undoc-members: - :show-inheritance: + :members: + :undoc-members: + :show-inheritance: eppy.json\_functions module --------------------------- .. automodule:: eppy.json_functions - :members: - :undoc-members: - :show-inheritance: + :members: + :undoc-members: + :show-inheritance: eppy.loops module ----------------- .. automodule:: eppy.loops - :members: - :undoc-members: - :show-inheritance: + :members: + :undoc-members: + :show-inheritance: eppy.modeleditor module ----------------------- .. automodule:: eppy.modeleditor - :members: - :undoc-members: - :show-inheritance: + :members: + :undoc-members: + :show-inheritance: eppy.pytest\_helpers module --------------------------- .. automodule:: eppy.pytest_helpers - :members: - :undoc-members: - :show-inheritance: + :members: + :undoc-members: + :show-inheritance: eppy.simpleread module ---------------------- .. automodule:: eppy.simpleread - :members: - :undoc-members: - :show-inheritance: + :members: + :undoc-members: + :show-inheritance: eppy.simplesurface module ------------------------- .. automodule:: eppy.simplesurface - :members: - :undoc-members: - :show-inheritance: + :members: + :undoc-members: + :show-inheritance: eppy.snippet module ------------------- .. automodule:: eppy.snippet - :members: - :undoc-members: - :show-inheritance: + :members: + :undoc-members: + :show-inheritance: eppy.walk\_hvac module ---------------------- .. automodule:: eppy.walk_hvac - :members: - :undoc-members: - :show-inheritance: - + :members: + :undoc-members: + :show-inheritance: Module contents --------------- .. automodule:: eppy - :members: - :undoc-members: - :show-inheritance: + :members: + :undoc-members: + :show-inheritance: diff --git a/docs/runningeplus.ipynb b/docs/runningeplus.ipynb index 76f6a84e..a5389aad 100644 --- a/docs/runningeplus.ipynb +++ b/docs/runningeplus.ipynb @@ -18,7 +18,7 @@ }, { "cell_type": "code", - "execution_count": 4, + "execution_count": 1, "metadata": {}, "outputs": [], "source": [ @@ -38,7 +38,7 @@ }, { "cell_type": "code", - "execution_count": 5, + "execution_count": 2, "metadata": {}, "outputs": [], "source": [ @@ -50,7 +50,7 @@ }, { "cell_type": "code", - "execution_count": 6, + "execution_count": 3, "metadata": {}, "outputs": [ { @@ -58,7 +58,7 @@ "output_type": "stream", "text": [ "\r\n", - "/Applications/EnergyPlus-8-3-0/energyplus --weather /Applications/EnergyPlus-8-3-0/WeatherData/USA_IL_Chicago-OHare.Intl.AP.725300_TMY3.epw --output-directory /Users/santoshphilip/Documents/coolshadow/github/cutter_eppy/r_eppy/docs --idd /Applications/EnergyPlus-8-3-0/Energy+.idd /Users/santoshphilip/Documents/coolshadow/github/cutter_eppy/r_eppy/docs/in.idf\r\n", + "/Applications/EnergyPlus-8-3-0/energyplus --weather /Applications/EnergyPlus-8-3-0/WeatherData/USA_IL_Chicago-OHare.Intl.AP.725300_TMY3.epw --output-directory /Users/santoshphilip/Documents/coolshadow/github/eppy/docs --idd /Applications/EnergyPlus-8-3-0/Energy+.idd /Users/santoshphilip/Documents/coolshadow/github/eppy/docs/in.idf\r\n", "\n" ] } @@ -120,7 +120,7 @@ }, { "cell_type": "code", - "execution_count": 7, + "execution_count": 4, "metadata": {}, "outputs": [ { @@ -222,31 +222,178 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "One of the great things about Eppy is that it allows you to set up a lot of jobs really easily. However, it can be slow running a lot of EnergyPlus simulations, so it’s pretty important that we can make the most of the processing power you have available by running on multiple CPUs.\n", + "If you have acomputer with multiple cores, you may want to use all the cores. EnergyPlus allows you to run simulations on multiple cores. \n", + "\n", + "Here is an example script of how use ``eppy`` to run on multiple cores" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "\"\"\"multiprocessing runs\"\"\"\n", + "\n", + "\n", + "import os \n", + "from eppy.modeleditor import IDF\n", + "from eppy.runner.run_functions import runIDFs\n", + "\n", + "def make_eplaunch_options(idf):\n", + " \"\"\"Make options for run, so that it runs like EPLaunch on Windows\"\"\"\n", + " idfversion = idf.idfobjects['version'][0].Version_Identifier.split('.')\n", + " idfversion.extend([0] * (3 - len(idfversion)))\n", + " idfversionstr = '-'.join([str(item) for item in idfversion])\n", + " fname = idf.idfname\n", + " options = {\n", + " 'ep_version':idfversionstr, # runIDFs needs the version number\n", + " 'output_prefix':os.path.basename(fname).split('.')[0],\n", + " 'output_suffix':'C',\n", + " 'output_directory':os.path.dirname(fname),\n", + " 'readvars':True,\n", + " 'expandobjects':True\n", + " }\n", + " return options\n", + "\n", + "\n", + "\n", + "\n", + "def main():\n", + " iddfile = \"/Applications/EnergyPlus-9-3-0/Energy+.idd\" # change this for your operating system\n", + " IDF.setiddname(iddfile)\n", + " epwfile = \"USA_CA_San.Francisco.Intl.AP.724940_TMY3.epw\"\n", "\n", - "Again this is as simple as you’d hope it would be.\n", "\n", - "You first need to create your jobs as a list of lists in the form::" + " runs = []\n", + "\n", + " # File is from the Examples Folder\n", + " idfname = \"HVACTemplate-5ZoneBaseboardHeat.idf\"\n", + " idf = IDF(idfname, epwfile)\n", + " theoptions = make_eplaunch_options(idf) \n", + " runs.append([idf, theoptions])\n", + "\n", + " # copy of previous file\n", + " idfname = \"HVACTemplate-5ZoneBaseboardHeat1.idf\"\n", + " idf = IDF(idfname, epwfile)\n", + " theoptions = make_eplaunch_options(idf)\n", + " runs.append([idf, theoptions])\n", + "\n", + " num_CPUs = 2\n", + " runIDFs(runs, num_CPUs)\n", + "\n", + "if __name__ == '__main__':\n", + " main()" ] }, { - "cell_type": "raw", + "cell_type": "markdown", "metadata": {}, "source": [ - " \n", - " [[, ], ...]" + "## Running in parallel processes using Generators" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "Maybe you want to run a 100 or a 1000 simulations. The code above will not let you do that, since it will try to load 1000 files into memory. \n", + "\n", + "Now you need to use generators (python's secret sauce. if you don't know this, you need to look into it). \n", + "\n", + "Here is a code using generators. Now you can simulate a 1000 files" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "### gmulti.py" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "\"\"\"multiprocessing runs\n", + "\n", + "using generators instead of a list\n", + "when you are running a 100 files you have to use generators\"\"\"\n", + "\n", + "import os \n", + "from eppy.modeleditor import IDF\n", + "from eppy.runner.run_functions import runIDFs\n", + "\n", + "def make_eplaunch_options(idf):\n", + " \"\"\"Make options for run, so that it runs like EPLaunch on Windows\"\"\"\n", + " idfversion = idf.idfobjects['version'][0].Version_Identifier.split('.')\n", + " idfversion.extend([0] * (3 - len(idfversion)))\n", + " idfversionstr = '-'.join([str(item) for item in idfversion])\n", + " fname = idf.idfname\n", + " options = {\n", + " 'ep_version':idfversionstr, # runIDFs needs the version number\n", + " 'output_prefix':os.path.basename(fname).split('.')[0],\n", + " 'output_suffix':'C',\n", + " 'output_directory':os.path.dirname(fname),\n", + " 'readvars':True,\n", + " 'expandobjects':True\n", + " }\n", + " return options\n", + "\n", + "\n", + "\n", + "\n", + "def main():\n", + " iddfile = \"/Applications/EnergyPlus-9-3-0/Energy+.idd\"\n", + " IDF.setiddname(iddfile)\n", + " epwfile = \"USA_CA_San.Francisco.Intl.AP.724940_TMY3.epw\"\n", + "\n", + "\n", + "\n", + " # File is from the Examples Folder\n", + " idfname1 = \"HVACTemplate-5ZoneBaseboardHeat.idf\"\n", + " # copy of previous file\n", + " idfname2 = \"HVACTemplate-5ZoneBaseboardHeat1.idf\"\n", + "\n", + "\n", + " fnames = [idfname1, idfname1]\n", + " idfs = (IDF(fname, epwfile) for fname in fnames)\n", + " runs = ((idf, make_eplaunch_options(idf) ) for idf in idfs)\n", + "\n", + "\n", + " num_CPUs = 2\n", + " runIDFs(runs, num_CPUs)\n", + "\n", + "if __name__ == '__main__':\n", + " main()" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## True Multi-processing" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ - "The example here just creates 4 identical jobs apart from the output_directory the results are saved in, but you would obviously want to make each job different.\n", + "What if you want to run your simulations on multiple computers. What if those computers are on other networks (some at home and the other in your office and others in your server room) and some on the cloud.\n", "\n", - "Then run the jobs on the required number of CPUs using runIDFs...\n", + "There is an experimental repository where you can do this. Keep an eye on this:\n", "\n", - "... and your results will all be in the output_directory you specified." + "https://github.com/pyenergyplus/zeppy" ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [] } ], "metadata": {