def epw_to_ddy(epw_file, percentile, output_file): """Get a DDY file with a heating + cooling design day from this EPW. This method will first check if there is a heating or cooling design day that meets the input percentile within the EPW itself. If None is found, the heating and cooling design days will be derived from analysis of the annual data within the EPW, which is usually less accurate. \b Args: epw_file: Path to an .epw file. """ try: epw_obj = EPW(epw_file) ddy_obj = DDY(epw_obj.location, epw_obj.best_available_design_days(percentile)) output_file.write(ddy_obj.to_file_string()) except Exception as e: _logger.exception('DDY translation failed.\n{}'.format(e)) sys.exit(1) else: sys.exit(0)
# create simulation parameters for a design-day-optimized E+ sim _sim_par_ = SimulationParameter() _sim_par_.timestep = _timestep_ if _timestep_ is not None else 6 _sim_par_.output.reporting_frequency = 'Timestep' _sim_par_.simulation_control.run_for_sizing_periods = True _sim_par_.simulation_control.run_for_run_periods = False if run_bal_: _sim_par_.output.add_zone_energy_use('Sensible') _sim_par_.output.add_gains_and_losses('Sensible') _sim_par_.output.add_surface_energy_flow() # load design days to the simulation parameters if _ddy_file.lower().endswith('.epw'): # load design days from EPW epw_obj = EPW(_ddy_file) des_days = epw_obj.best_available_design_days() _sim_par_.sizing_parameter.design_days = des_days location = epw_obj.location else: # load design days from DDY ddy_obj = DDY.from_ddy_file(_ddy_file) w_days = [ day for day in ddy_obj.design_days if day.day_type == 'WinterDesignDay' ] s_days = [ day for day in ddy_obj.design_days if day.day_type == 'SummerDesignDay' ] check_and_filter_des_days(_sim_par_, w_days, 'WinterDesignDay') check_and_filter_des_days(_sim_par_, s_days, 'SummerDesignDay') location = ddy_obj.location