def test_glazeddoor(): """py.test for glazeddoor""" fsdtxt = """FenestrationSurface:Detailed, DF-1, GLASSDOOR, Sgl Grey 3mm, FRONT-1, , 0.5, , , 1, 4, 21.3, 0.0, 2.1, 21.3, 0.0, 0.0, 23.8, 0.0, 0.0, 23.8, 0.0, 2.1;""" simpleobjtxt = """GLAZEDDOOR, DF-1, Sgl Grey 3mm, FRONT-1, , , 1, 0, 0, 2.5, 2.1;""" idf = IDF() idf.initreadtxt(fsdtxt) fsd = idf.idfobjects["FenestrationSurface:Detailed".upper()][0] w_ext = simplesurface.glazeddoor(idf, fsd, deletebsd=False, setto000=True) newidttxt = fsdtxt + simpleobjtxt newidf = IDF() newidf.initreadtxt(newidttxt) assert idf.idfstr() == newidf.idfstr() # test for deletebsd = True idf = IDF() idf.initreadtxt(fsdtxt) fsd = idf.idfobjects["FenestrationSurface:Detailed".upper()][0] w_ext = simplesurface.glazeddoor(idf, fsd, deletebsd=True, setto000=True) newidttxt = simpleobjtxt newidf = IDF() newidf.initreadtxt(newidttxt) assert idf.idfstr() == newidf.idfstr()
def test_wallunderground(): """py.test for wallunderground""" bsdtxt = """BuildingSurface:Detailed, WALL-1PF, WALL, WALL-1, PLENUM-1, Ground, , SunExposed, WindExposed, 0.5, 4, 0.0, 0.0, 3.0, 0.0, 0.0, 2.4, 30.5, 0.0, 2.4, 30.5, 0.0, 3.0; """ simpleobjtxt = """WALL:UNDERGROUND, WALL-1PF, WALL-1, PLENUM-1, 180.0, 90.0, 0, 0, 0, 30.5, 0.6;""" idf = IDF() idf.initreadtxt(bsdtxt) bsd = idf.idfobjects["BuildingSurface:Detailed".upper()][0] w_ext = simplesurface.wallunderground(idf, bsd, deletebsd=False, setto000=True) newidttxt = bsdtxt + simpleobjtxt newidf = IDF() newidf.initreadtxt(newidttxt) assert idf.idfstr() == newidf.idfstr() # test for deletebsd = True idf = IDF() idf.initreadtxt(bsdtxt) bsd = idf.idfobjects["BuildingSurface:Detailed".upper()][0] w_ext = simplesurface.wallunderground(idf, bsd, deletebsd=True, setto000=True) newidttxt = simpleobjtxt newidf = IDF() newidf.initreadtxt(newidttxt) assert idf.idfstr() == newidf.idfstr()
def test_window(): """py.test for window""" fsdtxt = """FenestrationSurface:Detailed, WF-1, WINDOW, Dbl Clr 3mm/13mm Air, FRONT-1, , 0.5, , , 1, 4, 3.0, 0.0, 2.1, 3.0, 0.0, 0.9, 16.8, 0.0, 0.9, 16.8, 0.0, 2.1;""" simpleobjtxt = """WINDOW, WF-1, Dbl Clr 3mm/13mm Air, FRONT-1, , , 1, 0, 0, 13.8, 1.2;""" idf = IDF() idf.initreadtxt(fsdtxt) fsd = idf.idfobjects["FenestrationSurface:Detailed".upper()][0] w_ext = simplesurface.window(idf, fsd, deletebsd=False, setto000=True) newidttxt = fsdtxt + simpleobjtxt newidf = IDF() newidf.initreadtxt(newidttxt) assert idf.idfstr() == newidf.idfstr() # test for deletebsd = True idf = IDF() idf.initreadtxt(fsdtxt) fsd = idf.idfobjects["FenestrationSurface:Detailed".upper()][0] w_ext = simplesurface.window(idf, fsd, deletebsd=True, setto000=True) newidttxt = simpleobjtxt newidf = IDF() newidf.initreadtxt(newidttxt) assert idf.idfstr() == newidf.idfstr()
def test_door(): """py.test for window""" fsdtxt = """FenestrationSurface:Detailed, WR-1, door, Dbl Clr 3mm/13mm Air, RIGHT-1, , 0.5, , , 1, 4, 30.5, 3.8, 2.1, 30.5, 3.8, 0.9, 30.5, 11.4, 0.9, 30.5, 11.4, 2.1;""" simpleobjtxt = """DOOR, WR-1, Dbl Clr 3mm/13mm Air, RIGHT-1, 1, 0, 0, 7.6, 1.2;""" idf = IDF() idf.initreadtxt(fsdtxt) fsd = idf.idfobjects["FenestrationSurface:Detailed".upper()][0] w_ext = simplesurface.door(idf, fsd, deletebsd=False, setto000=True) newidttxt = fsdtxt + simpleobjtxt newidf = IDF() newidf.initreadtxt(newidttxt) assert idf.idfstr() == newidf.idfstr() # test for deletebsd = True idf = IDF() idf.initreadtxt(fsdtxt) fsd = idf.idfobjects["FenestrationSurface:Detailed".upper()][0] w_ext = simplesurface.door(idf, fsd, deletebsd=True, setto000=True) newidttxt = simpleobjtxt newidf = IDF() newidf.initreadtxt(newidttxt) assert idf.idfstr() == newidf.idfstr()
def test_floorinterzone(): """py.test for floorinterzone""" bsdtxt = """BuildingSurface:Detailed, WALL-1PF, floor, WALL-1, PLENUM-1, Zone, gumby, SunExposed, WindExposed, 0.5, 4, 0.0, 0.0, 3.0, 0.0, 0.0, 2.4, 30.5, 0.0, 2.4, 30.5, 0.0, 3.0; """ simpleobjtxt = """FLOOR:INTERZONE, WALL-1PF, WALL-1, PLENUM-1, gumby, 180.0, 90.0, 0, 0, 0, 30.5, 0.6;""" idf = IDF() idf.initreadtxt(bsdtxt) bsd = idf.idfobjects["BuildingSurface:Detailed".upper()][0] w_ext = simplesurface.floorinterzone(idf, bsd, deletebsd=False, setto000=True) newidttxt = bsdtxt + simpleobjtxt newidf = IDF() newidf.initreadtxt(newidttxt) assert idf.idfstr() == newidf.idfstr() # test for deletebsd = True idf = IDF() idf.initreadtxt(bsdtxt) bsd = idf.idfobjects["BuildingSurface:Detailed".upper()][0] w_ext = simplesurface.floorinterzone(idf, bsd, deletebsd=True, setto000=True) newidttxt = simpleobjtxt newidf = IDF() newidf.initreadtxt(newidttxt) assert idf.idfstr() == newidf.idfstr()
def test_floorgroundcontact(): """py.test for floorgroundcontact""" bsdtxt = """BuildingSurface:Detailed, WALL-1PF, floor, WALL-1, PLENUM-1, Ground, , SunExposed, WindExposed, 0.5, 4, 0.0, 0.0, 3.0, 0.0, 0.0, 2.4, 30.5, 0.0, 2.4, 30.5, 0.0, 3.0; """ simpleobjtxt = """FLOOR:GROUNDCONTACT, WALL-1PF, WALL-1, PLENUM-1, 180.0, 90.0, 0, 0, 0, 30.5, 0.6;""" idf = IDF() idf.initreadtxt(bsdtxt) bsd = idf.idfobjects["BuildingSurface:Detailed".upper()][0] w_ext = simplesurface.floorgroundcontact(idf, bsd, deletebsd=False, setto000=True) newidttxt = bsdtxt + simpleobjtxt newidf = IDF() newidf.initreadtxt(newidttxt) assert idf.idfstr() == newidf.idfstr() # test for deletebsd = True idf = IDF() idf.initreadtxt(bsdtxt) bsd = idf.idfobjects["BuildingSurface:Detailed".upper()][0] w_ext = simplesurface.floorgroundcontact(idf, bsd, deletebsd=True, setto000=True) newidttxt = simpleobjtxt newidf = IDF() newidf.initreadtxt(newidttxt) assert idf.idfstr() == newidf.idfstr()
def test_ceilingadiabatic(): """py.test for ceilingadiabatic""" bsdtxt = """BuildingSurface:Detailed, WALL-1PF, ceiling, WALL-1, PLENUM-1, Adiabatic, , SunExposed, WindExposed, 0.5, 4, 0.0, 0.0, 3.0, 0.0, 0.0, 2.4, 30.5, 0.0, 2.4, 30.5, 0.0, 3.0; """ simpleobjtxt = """CEILING:ADIABATIC, WALL-1PF, WALL-1, PLENUM-1, 180.0, 90.0, 0, 0, 0, 30.5, 0.6;""" idf = IDF() idf.initreadtxt(bsdtxt) bsd = idf.idfobjects["BuildingSurface:Detailed".upper()][0] w_ext = simplesurface.ceilingadiabatic(idf, bsd, deletebsd=False, setto000=True) newidttxt = bsdtxt + simpleobjtxt newidf = IDF() newidf.initreadtxt(newidttxt) assert idf.idfstr() == newidf.idfstr() # test for deletebsd = True idf = IDF() idf.initreadtxt(bsdtxt) bsd = idf.idfobjects["BuildingSurface:Detailed".upper()][0] w_ext = simplesurface.ceilingadiabatic(idf, bsd, deletebsd=True, setto000=True) newidttxt = simpleobjtxt newidf = IDF() newidf.initreadtxt(newidttxt) assert idf.idfstr() == newidf.idfstr()
def test_wallunderground(): """py.test for wallunderground""" bsdtxt = """BuildingSurface:Detailed, WALL-1PF, WALL, WALL-1, PLENUM-1, Ground, , SunExposed, WindExposed, 0.5, 4, 0.0, 0.0, 3.0, 0.0, 0.0, 2.4, 30.5, 0.0, 2.4, 30.5, 0.0, 3.0; """ simpleobjtxt = """WALL:UNDERGROUND, WALL-1PF, WALL-1, PLENUM-1, 180.0, 90.0, 0, 0, 0, 30.5, 0.6;""" idf = IDF() idf.initreadtxt(bsdtxt) bsd = idf.idfobjects["BuildingSurface:Detailed".upper()][0] w_ext = simplesurface.wallunderground( idf, bsd, deletebsd=False, setto000=True) newidttxt = bsdtxt + simpleobjtxt newidf = IDF() newidf.initreadtxt(newidttxt) assert idf.idfstr() == newidf.idfstr() # test for deletebsd = True idf = IDF() idf.initreadtxt(bsdtxt) bsd = idf.idfobjects["BuildingSurface:Detailed".upper()][0] w_ext = simplesurface.wallunderground( idf, bsd, deletebsd=True, setto000=True) newidttxt = simpleobjtxt newidf = IDF() newidf.initreadtxt(newidttxt) assert idf.idfstr() == newidf.idfstr()
def test_roof(): """py.test for roof""" bsdtxt = """BuildingSurface:Detailed, WALL-1PF, roof, WALL-1, PLENUM-1, , , SunExposed, WindExposed, 0.5, 4, 0.0, 0.0, 3.0, 0.0, 0.0, 2.4, 30.5, 0.0, 2.4, 30.5, 0.0, 3.0; """ simpleobjtxt = """ROOF, WALL-1PF, WALL-1, PLENUM-1, 180.0, 90.0, 0, 0, 0, 30.5, 0.6;""" idf = IDF() idf.initreadtxt(bsdtxt) bsd = idf.idfobjects["BuildingSurface:Detailed".upper()][0] w_ext = simplesurface.roof(idf, bsd, deletebsd=False, setto000=True) newidttxt = bsdtxt + simpleobjtxt newidf = IDF() newidf.initreadtxt(newidttxt) assert idf.idfstr() == newidf.idfstr() # test for deletebsd = True idf = IDF() idf.initreadtxt(bsdtxt) bsd = idf.idfobjects["BuildingSurface:Detailed".upper()][0] w_ext = simplesurface.roof(idf, bsd, deletebsd=True, setto000=True) newidttxt = simpleobjtxt newidf = IDF() newidf.initreadtxt(newidttxt) assert idf.idfstr() == newidf.idfstr()
def test_floorinterzone(): """py.test for floorinterzone""" bsdtxt = """BuildingSurface:Detailed, WALL-1PF, floor, WALL-1, PLENUM-1, Zone, gumby, SunExposed, WindExposed, 0.5, 4, 0.0, 0.0, 3.0, 0.0, 0.0, 2.4, 30.5, 0.0, 2.4, 30.5, 0.0, 3.0; """ simpleobjtxt = """FLOOR:INTERZONE, WALL-1PF, WALL-1, PLENUM-1, gumby, 180.0, 90.0, 0, 0, 0, 30.5, 0.6;""" idf = IDF() idf.initreadtxt(bsdtxt) bsd = idf.idfobjects["BuildingSurface:Detailed".upper()][0] w_ext = simplesurface.floorinterzone( idf, bsd, deletebsd=False, setto000=True) newidttxt = bsdtxt + simpleobjtxt newidf = IDF() newidf.initreadtxt(newidttxt) assert idf.idfstr() == newidf.idfstr() # test for deletebsd = True idf = IDF() idf.initreadtxt(bsdtxt) bsd = idf.idfobjects["BuildingSurface:Detailed".upper()][0] w_ext = simplesurface.floorinterzone( idf, bsd, deletebsd=True, setto000=True) newidttxt = simpleobjtxt newidf = IDF() newidf.initreadtxt(newidttxt) assert idf.idfstr() == newidf.idfstr()
def test_floorgroundcontact(): """py.test for floorgroundcontact""" bsdtxt = """BuildingSurface:Detailed, WALL-1PF, floor, WALL-1, PLENUM-1, Ground, , SunExposed, WindExposed, 0.5, 4, 0.0, 0.0, 3.0, 0.0, 0.0, 2.4, 30.5, 0.0, 2.4, 30.5, 0.0, 3.0; """ simpleobjtxt = """FLOOR:GROUNDCONTACT, WALL-1PF, WALL-1, PLENUM-1, 180.0, 90.0, 0, 0, 0, 30.5, 0.6;""" idf = IDF() idf.initreadtxt(bsdtxt) bsd = idf.idfobjects["BuildingSurface:Detailed".upper()][0] w_ext = simplesurface.floorgroundcontact( idf, bsd, deletebsd=False, setto000=True) newidttxt = bsdtxt + simpleobjtxt newidf = IDF() newidf.initreadtxt(newidttxt) assert idf.idfstr() == newidf.idfstr() # test for deletebsd = True idf = IDF() idf.initreadtxt(bsdtxt) bsd = idf.idfobjects["BuildingSurface:Detailed".upper()][0] w_ext = simplesurface.floorgroundcontact( idf, bsd, deletebsd=True, setto000=True) newidttxt = simpleobjtxt newidf = IDF() newidf.initreadtxt(newidttxt) assert idf.idfstr() == newidf.idfstr()
def test_ceilingadiabatic(): """py.test for ceilingadiabatic""" bsdtxt = """BuildingSurface:Detailed, WALL-1PF, ceiling, WALL-1, PLENUM-1, Adiabatic, , SunExposed, WindExposed, 0.5, 4, 0.0, 0.0, 3.0, 0.0, 0.0, 2.4, 30.5, 0.0, 2.4, 30.5, 0.0, 3.0; """ simpleobjtxt = """CEILING:ADIABATIC, WALL-1PF, WALL-1, PLENUM-1, 180.0, 90.0, 0, 0, 0, 30.5, 0.6;""" idf = IDF() idf.initreadtxt(bsdtxt) bsd = idf.idfobjects["BuildingSurface:Detailed".upper()][0] w_ext = simplesurface.ceilingadiabatic( idf, bsd, deletebsd=False, setto000=True) newidttxt = bsdtxt + simpleobjtxt newidf = IDF() newidf.initreadtxt(newidttxt) assert idf.idfstr() == newidf.idfstr() # test for deletebsd = True idf = IDF() idf.initreadtxt(bsdtxt) bsd = idf.idfobjects["BuildingSurface:Detailed".upper()][0] w_ext = simplesurface.ceilingadiabatic( idf, bsd, deletebsd=True, setto000=True) newidttxt = simpleobjtxt newidf = IDF() newidf.initreadtxt(newidttxt) assert idf.idfstr() == newidf.idfstr()
def run(self, name: str, idf: IDF, sim_id: str = None) -> str: url = self.url + '/run' logger.debug('Running simulation at: {}'.format(url)) data = idf.idfstr() params = {'name': name} if sim_id is not None: params['id'] = sim_id response = requests.post(url=url, params=params, data=data) return response.text
def idfreadtest(iddhandle, idfhandle1, idfhandle2, verbose=False, save=False): """compare the results of eppy reader and simple reader""" # read using eppy: try: IDF.setiddname(iddhandle) except modeleditor.IDDAlreadySetError: # idd has already been set pass idf = IDF(idfhandle1) idfstr = idf.idfstr() idfstr = idf2txt(idfstr) # - # do a simple read simpletxt = idfhandle2.read() try: simpletxt = simpletxt.decode('ISO-8859-2') except AttributeError: pass simpletxt = idf2txt(simpletxt) # - if save: open('simpleread.idf', 'w').write(idfstr) open('eppyread.idf', 'w').write(simpletxt) # do the compare lines1 = idfstr.splitlines() lines2 = simpletxt.splitlines() for i, (line1, line2) in enumerate(zip(lines1, lines2)): if line1 != line2: # test if it is a mismatch in number format try: line1 = float(line1[:-1]) line2 = float(line2[:-1]) if line1 != line2: if verbose: print() print("%s- : %s" % (i, line1)) print("%s- : %s" % (i, line2)) return False except ValueError: if verbose: print() print("%s- : %s" % (i, line1)) print("%s- : %s" % (i, line2)) return False return True
def test_idfstr(): """Test all outputtype options in IDF.idfstr(). """ idf = IDF() idf.initreadtxt(idfsnippet) assert idf.outputtype == 'standard' # start with the default original = idf.idfstr() assert "!-" in original # has comment assert "\n" in original # has line break assert "\n\n" in original # has empty line idf.outputtype = 'standard' s = idf.idfstr() assert "!-" in s # has comment assert "\n" in s # has line break assert "\n\n" in s # has empty line assert s == original # is unchanged idf.outputtype = 'nocomment' s = idf.idfstr() assert "!-" not in s # has no comments assert "\n" in s # has line break assert "\n\n" in s # has empty line assert s != original # is changed idf.outputtype = 'nocomment1' s = idf.idfstr() assert "!-" not in s # has no comments assert "\n" in s # has line break assert "\n\n" in s # has empty lines assert s != original # is changed idf.outputtype = 'nocomment2' s = idf.idfstr() assert "!-" not in s # has no comments assert "\n" in s # has line break assert "\n\n" not in s # has no empty lines assert s != original # is changed idf.outputtype = 'compressed' s = idf.idfstr() assert "!-" not in s # has no comments assert "\n" not in s # has no line breaks assert "\n\n" not in s # has no empty lines assert s != original # is changed
def compute(self): from eppy.modeleditor import IDF, IDDAlreadySetError from StringIO import StringIO idf_as_string = self.getInputFromPort('idf') key = self.getInputFromPort('key') variable = self.getInputFromPort('variable') frequency = self.getInputFromPort('frequency') idd_path = self.getInputFromPort('idd_path') try: IDF.setiddname(idd_path.name) except IDDAlreadySetError: pass idf = IDF(StringIO(idf_as_string)) output_variable = idf.newidfobject('OUTPUT:VARIABLE') output_variable.Key_Value = key output_variable.Variable_Name = variable output_variable.Reporting_Frequency = frequency # output the result self.set_output('idf', idf.idfstr())
def setup(self, name: str, epw: Path = None, weather_data: Path = None, idf: IDF = None, model: Building = None, parameters: MutableMapping[str, Parameter] = None, lca_calculation: LCACalculation = None, cost_calculation: CostCalculation = None, energy_calculation: str = None, update_model_function: Callable[ [MutableMapping[str, Parameter], Building], Building] = None, evaluate_function: Callable[ [pd.DataFrame, pd.DataFrame, pd.DataFrame], pd.Series] = None, init_db: bool = True) -> str: """ Setup the server with the following options. The options can also be set independently. :param name: Name of the calculation setup tp create or update :param epw: Path to epw file for weather data for simulation :param weather_data: Path to csv weather data for steady state energy calculation :param idf: eppy IDF model of the building :param model: converted firepy model of the building :param parameters: dict of firepy Parameters to use for parametric definition :param lca_calculation: :param cost_calculation: :param energy_calculation: 'simulation' or 'steady_state' :param init_db: set True (default) to create results database for the setup :return: success message """ url = self.url + '/setup' logger.info('Setting up calculation: {n} at: {u}'.format(n=name, u=self.url)) success = {} if epw is not None: logger.debug('Setting up EPW on server') with epw.open('r') as epw_file: epw_text = epw_file.read() # change windows type newline characters to unix type epw_text = epw_text.replace('\r\n', '\n') response = requests.post(url=url, params={ 'name': name, 'type': 'epw' }, data=epw_text) logger.debug('Response from server: ' + response.text) if not response.text.startswith('OK'): return response.text else: success['epw'] = response.text if weather_data is not None: logger.debug('Setting up weather data on server') weather = pd.read_csv(str(weather_data), header=[0, 1], index_col=[0, 1]) content = dill.dumps(weather) response = requests.post(url=url, params={ 'name': name, 'type': 'weather_data' }, data=content) logger.debug('Response from server: ' + response.text) if not response.text.startswith('OK'): return response.text else: success['weather'] = response.text if idf is not None: logger.debug('Setting up IDF on server') idf_text = idf.idfstr() response = requests.post(url=url, params={ 'name': name, 'type': 'idf' }, data=idf_text) logger.debug('Response from server: ' + response.text) if not response.text.startswith('OK'): return response.text else: success['idf'] = response.text if model is not None: logger.debug('Setting up model on server') model_dump = dill.dumps(model) response = requests.post(url=url, params={ 'name': name, 'type': 'model' }, data=model_dump) logger.debug('Response from server: ' + response.text) if not response.text.startswith('OK'): return response.text else: success['model'] = response.text if parameters is not None: logger.debug('Setting up parameters on server') param_dump = dill.dumps(parameters) response = requests.post(url=url, params={ 'name': name, 'type': 'parameters' }, data=param_dump) logger.debug('Response from server: ' + response.text) if not response.text.startswith('OK'): return response.text else: success['parameters'] = response.text if lca_calculation is not None: logger.debug('Setting up LCA Calculation on server') lca_dump = dill.dumps(lca_calculation) response = requests.post(url=url, params={ 'name': name, 'type': 'lca_calculation' }, data=lca_dump) logger.debug('Response from server: ' + response.text) if not response.text.startswith('OK'): return response.text else: success['LCA Calculation'] = response.text if cost_calculation is not None: logger.debug('Setting up Cost Calculation on server') cost_dump = dill.dumps(cost_calculation) response = requests.post(url=url, params={ 'name': name, 'type': 'cost_calculation' }, data=cost_dump) logger.debug('Response from server: ' + response.text) if not response.text.startswith('OK'): return response.text else: success['Cost Calculation'] = response.text if init_db: logger.debug('Initiating result database on server') response = requests.post(url=url, params={ 'name': name, 'type': 'database' }) logger.debug('Response from server: ' + response.text) if not response.text.startswith('OK'): return response.text else: success['Database'] = response.text if energy_calculation: if energy_calculation not in ['simulation', 'steady_state']: return 'Energy calculation type can be one of the following: simulation / steady_state' logger.debug('Setting up Energy Calculation type on server') response = requests.post(url=url, params={ 'name': name, 'type': 'energy_calculation', 'mode': energy_calculation }) logger.debug('Response from server: ' + response.text) if not response.text.startswith('OK'): return response.text else: success['Energy Calculation'] = response.text if update_model_function is not None: logger.debug('Setting up update function on server') func_dump = dill.dumps(update_model_function) response = requests.post(url=url, params={ 'name': name, 'type': 'update_func' }, data=func_dump) logger.debug('Response from server: ' + response.text) if not response.text.startswith('OK'): return response.text else: success['Update function'] = response.text if evaluate_function is not None: logger.debug('Setting up evaluate function on server') func_dump = dill.dumps(evaluate_function) response = requests.post(url=url, params={ 'name': name, 'type': 'evaluate_func' }, data=func_dump) logger.debug('Response from server: ' + response.text) if not response.text.startswith('OK'): return response.text else: success['Evaluate function'] = response.text logger.debug('Setting up idf update configuration on server') idf_update_dump = dill.dumps(self.idf_update_options) response = requests.post(url=url, params={ 'name': name, 'type': 'idf_update_options' }, data=idf_update_dump) logger.debug('Response from server: ' + response.text) if not response.text.startswith('OK'): return response.text else: success['Idf update options'] = response.text if energy_calculation == 'simulation': logger.debug('Setting up simulation configuration on server') sim_opt_dump = dill.dumps(self.energy_calculation_options) response = requests.post(url=url, params={ 'name': name, 'type': 'simulation_options' }, data=sim_opt_dump) logger.debug('Response from server: ' + response.text) if not response.text.startswith('OK'): return response.text else: success['Simulation options'] = response.text return '\n' + pformat(success)
t = 1 / (np.dot(np.array(ray.direction), n)) * (np.dot( n, np.array(self.pts[0])) - np.dot(n, np.array(ray.position))) # Intersection point is behind the ray if t < 0.0: return None # Calculate intersection point point = np.array(ray.position) + t * np.array(ray.direction) # Check if intersection point is really in the polygon or only on the # (infinite) plane if self.on_surface(point): return [list(point)] return None if __name__ == '__main__': from eppy.modeleditor import IDF, IDDAlreadySetError try: IDF.setiddname(r"C:\projects\UMEM-JBPS-Paper\models\Energy+.idd") except IDDAlreadySetError: pass idf = IDF(r"C:\projects\UMEM-JBPS-Paper\results\21-cosim-HPI.vt.idf") idf = remove_extra_shading(idf) with open(r"C:\projects\UMEM-JBPS-Paper\results\removed-shading.idf", 'w') as f: f.write(idf.idfstr())