class ModelToOsm(Function):
    """Translate a Model JSON file into an OpenStudio Model and corresponding IDF."""

    model = Inputs.file(
        description='Honeybee model in JSON format.', path='model.json',
        extensions=['hbjson', 'json']
    )

    sim_par = Inputs.file(
        description='SimulationParameter JSON that describes the settings for the '
        'simulation.', path='sim-par.json', extensions=['json']
    )

    @command
    def model_to_osm(self):
        return 'honeybee-energy translate model-to-osm model.json ' \
            '--sim-par-json sim-par.json --folder output ' \
            '--log-file output/output_paths.json'

    osm = Outputs.file(
        description='The OpenStudio model file.', path='output/run/in.osm'
    )

    idf = Outputs.file(
        description='The IDF file.', path='output/run/in.idf'
    )
Пример #2
0
class CreateSunMatrix(Function):
    """Generate a Radiance sun matrix (AKA sun-path)."""

    north = Inputs.int(
        description='An angle for north direction. Default is 0.',
        default=0,
        spec={
            'type': 'integer',
            'maximum': 360,
            'minimum': 0
        })

    wea = Inputs.file(description='Path to a wea file.',
                      extensions=['wea'],
                      path='sky.wea')

    output_type = Inputs.int(
        description='Output type. 0 is for visible and 1 is for solar.',
        default=0,
        spec={
            'type': 'integer',
            'maximum': 1,
            'minimum': 0
        })

    @command
    def generate_sun_matrix(self):
        return 'gendaymtx -n -D sunpath.mtx -M suns.mod -O{{self.output_type}} ' \
            '-r {{self.north}} -v sky.wea'

    sunpath = Outputs.file(description='Output sunpath matrix.',
                           path='sunpath.mtx')

    sun_modifiers = Outputs.file(
        description='List of sun modifiers in sunpath.', path='suns.mod')
Пример #3
0
class SimulateIdf(Function):
    """Simulate an IDF file in EnergyPlus."""

    idf = Inputs.file(description='Path to a simulate-able IDF file.',
                      path='model.idf',
                      extensions=['idf'])

    epw = Inputs.file(description='Weather file.',
                      path='weather.epw',
                      extensions=['epw'])

    @command
    def simulate_model(self):
        return 'honeybee-energy simulate idf model.idf weather.epw --folder output'

    sql = Outputs.file(
        description='The result SQL file output by the simulation.',
        path='output/eplusout.sql')

    zsz = Outputs.file(
        description=
        'The result CSV with the zone loads over the design day output '
        'by the simulation.',
        path='output/epluszsz.csv',
        optional=True)

    html = Outputs.file(
        description='The result HTML page with summary reports output by the '
        'simulation.',
        path='output/eplustbl.htm')

    err = Outputs.file(
        description='The error report output by the simulation.',
        path='output/eplusout.err')
Пример #4
0
class MapResultInfo(Function):
    """Get a JSON that specifies the data type and units for comfort map outputs."""

    comfort_model = Inputs.str(
        description='Text for the comfort model of the thermal mapping '
        'simulation. Choose from: pmv, adaptive, utci.',
        spec={
            'type': 'string',
            'enum': ['pmv', 'adaptive', 'utci']
        })

    run_period = Inputs.str(
        description=
        'The AnalysisPeriod string that dictates the start and end of '
        'the analysis (eg. "6/21 to 9/21 between 8 and 16 @1"). If unspecified, it '
        'will be assumed results are for a full year.',
        default='')

    qualifier = Inputs.str(
        description=
        'Text for any options used on the comfort map simulation that '
        'change the output data type of results. For example, the write-set-map text '
        'of the pmv map can be passed here to ensure the output of this command is '
        'for SET instead of operative temperature.',
        default='')

    @command
    def map_results_information(self):
        return 'ladybug-comfort map map-result-info {{self.comfort_model}} ' \
            '--run-period "{{self.run_period}}" --qualifier "{{self.qualifier}}" ' \
            '--folder output --log-file results_info.json'

    results_info_file = Outputs.file(
        description=
        'A JSON that specifies the data type and units for all comfort map '
        'outputs.',
        path='results_info.json')

    viz_config_file = Outputs.file(
        description=
        'A JSON that specifies configurations for VTK visualizations.',
        path='output/config.json')

    temperature_info = Outputs.file(
        description=
        'A JSON that specifies the data type and units for temperature map '
        'results.',
        path='output/temperature.json')

    condition_info = Outputs.file(
        description='A JSON that specifies the data type and units for thermal '
        'condition map results.',
        path='output/condition.json')

    condition_intensity_info = Outputs.file(
        description='A JSON that specifies the data type and units for '
        'condition intensity map results.',
        path='output/condition_intensity.json')
Пример #5
0
class Tcp(Function):
    """Compute Thermal Comfort Petcent (TCP) from thermal condition CSV map."""

    condition_csv = Inputs.file(
        description=
        'A CSV file of thermal conditions output by a thermal mapping '
        'function.',
        path='condition.csv',
        extensions=['csv', 'cond'])

    enclosure_info = Inputs.file(
        description='A JSON file containing information about the radiant '
        'enclosure that sensor points belong to.',
        path='enclosure_info.json',
        extensions=['json'])

    occ_schedule_json = Inputs.file(
        description='An occupancy schedule JSON output by the honeybee-energy '
        'model-occ-schedules function.',
        path='occ_schedule.json',
        extensions=['json'])

    schedule = Inputs.file(
        description=
        'An optional path to a CSV file to specify the relevant times '
        'during which comfort should be evaluated. If specified, this will override '
        'the occ-schedule-json for both indoor and outdoor conditions. Values '
        'should be 0-1 separated by new line.',
        path='schedule.txt',
        optional=True)

    @command
    def compute_tcp(self):
        return 'ladybug-comfort map tcp condition.csv enclosure_info.json ' \
            '--schedule schedule.txt --occ-schedule-json occ_schedule.json ' \
            '--folder output'

    tcp = Outputs.file(
        description='A CSV that contains the Thermal Comfort Percent (TCP) for '
        'each sensor.',
        path='output/tcp.csv')

    hsp = Outputs.file(
        description='A CSV that contains the Heat Sensation Percent (HSP) for '
        'each sensor.',
        path='output/hsp.csv')

    csp = Outputs.file(
        description='A CSV that contains the Cold Sensation Percent (CSP) for '
        'each sensor.',
        path='output/csp.csv')
class ModelOccSchedules(Function):
    """Translate a Model's occupancy schedules into a JSON of 0/1 values.

    This JSON is useful in workflows that compute thermal comfort percent,
    daylight autonomy, etc.
    """

    model = Inputs.file(
        description='Honeybee model in JSON format.', path='model.json',
        extensions=['hbjson', 'json']
    )

    period = Inputs.str(
        description='An AnalysisPeriod string to dictate the start and end of the '
        'exported occupancy values (eg. "6/21 to 9/21 between 0 and 23 @1"). Note '
        'that the timestep of the period will determine the timestep of output '
        'values. If unspecified, the values will be annual.', default=''
    )

    threshold = Inputs.float(
        description='A number between 0 and 1 for the threshold at and above which '
        'a schedule value is considered occupied.', default=0.1,
        spec={'type': 'number', 'maximum': 1, 'minimum': 0}
    )

    @command
    def export_model_occ_schedules(self):
        return 'honeybee-energy translate model-occ-schedules model.json ' \
            '--threshold {{self.threshold}} --period "{{self.period}}" ' \
            '--output-file occ_schedules.json'

    occ_schedule_json = Outputs.file(
        description='An occupancy schedule JSON that is useful in workflows like '
        'thermal comfort percent, daylight autonomy, etc.', path='occ_schedules.json'
    )
Пример #7
0
class CreateRadianceFolderView(Function):
    """Create a Radiance folder from a HBJSON input file."""

    input_model = Inputs.file(description='Path to input HBJSON file.',
                              path='model.hbjson')

    view_filter = Inputs.str(
        description='Text for a view identifer or a pattern to filter the views '
        'of the model that are simulated. For instance, first_floor_* will simulate '
        'only the views that have an identifier that starts with first_floor_. By '
        'default, all views in the model will be simulated.',
        default='*')

    @command
    def hbjson_to_rad_folder(self):
        return 'honeybee-radiance translate model-to-rad-folder model.hbjson ' \
            '--view "{{self.view_filter}}" --view-check'

    model_folder = Outputs.folder(description='Radiance folder.', path='model')

    views = Outputs.list(description='Views information.',
                         path='model/view/_info.json')

    views_file = Outputs.file(description='Views information JSON file.',
                              path='model/view/_info.json')
class WindowsByRatio(Function):
    """Add windows to all outdoor walls of a model given a ratio."""

    model = Inputs.file(description='Dragonfly model in JSON format.',
                        path='model.dfjson',
                        extensions=['dfjson', 'json'])

    ratio = Inputs.str(
        description=
        'A number between 0 and 1 (but not perfectly equal to 1) for the '
        'desired ratio between window area and wall area. If multiple values are '
        'input here (each separated by a space), different WindowParameters will be '
        'assigned based on cardinal direction, starting with north and moving '
        'clockwise.',
        default='0.4')

    @command
    def windows_by_ratio(self):
        return 'dragonfly edit windows-by-ratio model.dfjson {{self.ratio}} ' \
            '--output-file new_model.dfjson'

    new_model = Outputs.file(
        description='Dragonfly Model JSON with window parameters set based on '
        'the input ratio.',
        path='new_model.dfjson')
Пример #9
0
class SumRow(Function):
    """Postprocess a Radiance matrix and add all the numbers in each row.

    This function is useful for translating Radiance results to outputs like radiation
    to total radiation. Input matrix must be in ASCII format. The header in the input
    file will be ignored.
    """

    # inputs
    input_mtx = Inputs.file(
        description='Input Radiance matrix in ASCII format', path='input.mtx')

    divisor = Inputs.float(
        description=
        'An optional number, that the summed row will be divided by. '
        'For example, this can be a timestep, which can be used to ensure that a '
        'summed row of irradiance yields cumulative radiation over the entire '
        'time period of the matrix.',
        default=1)

    @command
    def sum_mtx_row(self):
        return 'honeybee-radiance post-process sum-row input.mtx ' \
            '--divisor {{self.divisor}} --output sum.mtx'

    # outputs
    output_mtx = Outputs.file(description='Newly created sum matrix.',
                              path='sum.mtx')
Пример #10
0
class CreateOctree(Function):
    """Generate an octree from a Radiance folder."""

    # inputs
    include_aperture = Inputs.str(
        default='include',
        description=
        'A value to indicate if the static aperture should be included in '
        'octree. Valid values are include and exclude. Default is include.',
        spec={
            'type': 'string',
            'enum': ['include', 'exclude']
        })

    black_out = Inputs.str(
        default='default',
        description=
        'A value to indicate if the black material should be used. Valid '
        'values are default and black. Default value is default.',
        spec={
            'type': 'string',
            'enum': ['black', 'default']
        })

    model = Inputs.folder(description='Path to Radiance model folder.',
                          path='model')

    @command
    def create_octree(self):
        return 'honeybee-radiance octree from-folder model --output scene.oct ' \
            '--{{self.include_aperture}}-aperture --{{self.black_out}}'

    # outputs
    scene_file = Outputs.file(description='Output octree file.',
                              path='scene.oct')
Пример #11
0
class MergeFiles(Function):
    """Merge several files with similar starting name into one."""

    name = Inputs.str(
        description='Base name for files to be merged.',
        default='grid'
    )

    extension = Inputs.str(
        description='File extension including the . before the extension (e.g. .res, '
        '.ill)'
    )

    folder = Inputs.folder(
        description='Target folder with the input files.',
        path='input_folder'
    )

    @command
    def merge_files(self):
        return 'honeybee-radiance grid merge input_folder grid ' \
            ' {{self.extension}} --name {{self.name}}'

    result_file = Outputs.file(
        description='Output result file.', path='{{self.name}}{{self.extension}}'
    )
Пример #12
0
class WeaToConstant(Function):
    """Convert a Wea file to have a constant value for each datetime.

    This is useful in workflows where hourly irradiance values are inconsequential
    to the analysis and one is only using the Wea as a format to pass location
    and datetime information (eg. for direct sun hours).
    """

    wea = Inputs.file(
        description='Wea file with irradiance values to be set to constant.',
        path='weather.wea',
        extensions=['wea'])

    value = Inputs.int(
        description=
        'The direct and diffuse irradiance value that will be written '
        'in for all datetimes of the Wea.',
        default=1000)

    @command
    def wea_to_constant(self):
        return 'ladybug translate wea-to-constant weather.wea ' \
            '--value {{self.value}} --output-file constant.wea'

    constant_wea = Outputs.file(
        description=
        'A wea file with constant irradiance values for each datetime.',
        path='constant.wea')
Пример #13
0
class EpwToWea(Function):
    """Translate an .epw file to a .wea file."""

    epw = Inputs.file(description='Weather file.',
                      path='weather.epw',
                      extensions=['epw'])

    period = Inputs.str(
        description=
        'An AnalysisPeriod string to filter the datetimes in the resulting '
        'Wea (eg. "6/21 to 9/21 between 8 and 16 @1"). Note that the timestep '
        'of the analysis period should match the input timestep and a * must be at '
        'the end of the string if the input epw is for a leap year. If None, '
        'the Wea will be annual.',
        default='')

    timestep = Inputs.int(
        description=
        'An integer to set the number of time steps per hour. Default is 1 '
        'for one value per hour. Note that this input will only do a linear '
        'interpolation over the data in the epw file.',
        default=1)

    @command
    def epw_to_wea(self):
        return 'ladybug translate epw-to-wea weather.epw ' \
            '--analysis-period "{{self.period}}" --timestep {{self.timestep}} ' \
            '--output-file weather.wea'

    wea = Outputs.file(description='A wea file generated from the input epw.',
                       path='weather.wea')
Пример #14
0
class RayTracingPicture(Function):
    """Run ray-tracing with rpict command for an input octree and a view file.."""

    view = Inputs.file(description='Input view file.', path='view.vf')

    scene_file = Inputs.file(
        description='Path to an octree file to describe the scene.',
        path='scene.oct')

    radiance_parameters = Inputs.str(
        description='Radiance parameters to be exposed within recipes. -h is '
        'usually already included in the fixed_radiance_parameters and -I will '
        'be overwritten based on the input metric.',
        default='-ab 2')

    metric = Inputs.str(
        description=
        'Text for the type of metric to be output from the calculation. '
        'Choose from: illuminance, irradiance, luminance, radiance.',
        default='luminance',
        spec={
            'type': 'string',
            'enum': ['illuminance', 'irradiance', 'luminance', 'radiance']
        })

    resolution = Inputs.int(
        description=
        'An integer for the maximum dimension of the image in pixels '
        '(either width or height depending on the input view angle and type).',
        spec={
            'type': 'integer',
            'minimum': 1
        },
        default=512)

    scale_factor = Inputs.float(
        description=
        'A number that will be multiplied by the input resolution to '
        'scale the dimensions of the output image. This is useful in workflows if '
        'one plans to re-scale the image after the ray tracing calculation to '
        'improve anti-aliasing.',
        default=1)

    ambient_cache = Inputs.file(
        description='Path to the ambient cache if an overture calculation was '
        'specified. If unspecified, no ambient cache will be used.',
        path='view.amb',
        optional=True)

    @command
    def ray_tracing(self):
        return 'honeybee-radiance rpict rpict scene.oct view.vf ' \
            '--rad-params "{{self.radiance_parameters}}" --metric {{self.metric}} ' \
            '--resolution {{self.resolution}} --scale-factor {{self.scale_factor}} ' \
            '--output view.HDR'

    result_image = Outputs.file(
        description='Path to the High Dynamic Range (HDR) image file of the '
        'input view.',
        path='view.HDR')
Пример #15
0
class CreateRadiantEnclosureInfo(Function):
    """Create JSONs with radiant enclosure information from a HBJSON input file.

    This enclosure info is intended to be consumed by thermal mapping functions.
    """

    model = Inputs.file(description='Path to input HBJSON file.',
                        path='model.hbjson')

    @command
    def hbjson_to_radiant_enclosure_info(self):
        return 'honeybee-radiance translate model-radiant-enclosure-info model.hbjson ' \
            '--folder output --log-file enclosure_list.json'

    enclosure_list = Outputs.dict(
        description=
        'A list of dictionaries that include information about generated '
        'radiant enclosure files.',
        path='enclosure_list.json')

    enclosure_list_file = Outputs.file(
        description=
        'A JSON file that includes information about generated radiant '
        'enclosure files.',
        path='enclosure_list.json')

    output_folder = Outputs.folder(
        description=
        'Output folder with the enclosure info JSONs for each grid.',
        path='output')
Пример #16
0
class AdjustSkyForMetric(Function):
    """Adjust a sky file to ensure it is suitable for a given metric.

    Specifcally, this ensures that skies being created with gendaylit have a -O
    option that aligns with visible vs. solar energy.
    """

    sky = Inputs.file(
        description='Path to a .sky file to be adjusted based on the metric.',
        path='input.sky')

    metric = Inputs.str(
        description=
        'Text for the type of metric to be output from the calculation. '
        'Choose from: illuminance, irradiance, luminance, radiance.',
        default='illuminance',
        spec={
            'type': 'string',
            'enum': ['illuminance', 'irradiance', 'luminance', 'radiance']
        })

    @command
    def adjust_sky_for_metric(self):
        return 'honeybee-radiance sky adjust-for-metric {{self.sky}} ' \
            '--metric {{self.metric}}'

    adjusted_sky = Outputs.file(description='Adjusted sky file.',
                                path='{{self.metric}}.sky')
Пример #17
0
class CreateSkyMatrix(Function):
    """Generate a sun-up sky matrix."""

    north = Inputs.int(
        description='An angle for north direction. Default is 0.',
        default=0,
        spec={
            'type': 'integer',
            'maximum': 360,
            'minimum': 0
        })

    sky_component = Inputs.str(
        description='A switch for generating sun-only using -d or exclude sun '
        'contribution using -s. The default is an empty string for including both.',
        default=' ',
        spec={
            'type': 'string',
            'enum': ['-s', '-d', ' ']
        })

    wea = Inputs.file(description='Path to a wea file.',
                      extensions=['wea'],
                      path='sky.wea')

    @command
    def generate_sky_matrix(self):
        return 'gendaymtx -u -O0 -r {{self.north}} -v {{self.sky_component}} sky.wea > sky.mtx'

    sky_matrix = Outputs.file(description='Output Sky matrix', path='sky.mtx')
Пример #18
0
class MergeImages(Function):
    """Merge several .HDR image files with similar starting name into one."""

    folder = Inputs.folder(
        description='Target folder with the input .HDR image files.',
        path='input_folder')

    name = Inputs.str(description='Base name for files to be merged.',
                      default='view')

    extension = Inputs.str(
        description='File extension including the . before the extension '
        '(e.g. .HDR, .pic, .unf)',
        default='.unf')

    scale_factor = Inputs.float(
        description='A number that will be used to scale the dimensions of the '
        'output image as it is filtered for anti-aliasing.',
        default=1)

    @command
    def merge_files(self):
        return 'honeybee-radiance view merge input_folder view ' \
            '{{self.extension}} --scale-factor {{self.scale_factor}} ' \
            '--name {{self.name}}'

    result_image = Outputs.file(description='Output combined image file.',
                                path='{{self.name}}.HDR')
class EnergyUseIntensity(Function):
    """Get information about energy use intensity from energy simulation SQLite files."""

    result_folder = Inputs.folder(
        description='Path to folder containing SQLite files that were generated '
        'by EnergyPlus. This can be a single EnergyPlus simulation folder or '
        'it can be a folder with multiple sql files, in which case EUI will '
        'be computed across all results.',
        path='result_folder')

    units = Inputs.str(
        description=
        'A switch to indicate whether the data in the resulting JSON '
        'should be in SI or IP units. Valid values are "si" and "ip".',
        default='si',
        spec={
            'type': 'string',
            'enum': ['si', 'ip']
        })

    @command
    def energy_use_intensity(self):
        return 'honeybee-energy result energy-use-intensity result_folder ' \
            '--{{inputs.units}} --output-file output.json'

    eui_json = Outputs.file(
        description=
        'A JSON object with the following keys - eui, total_floor_area, '
        'total_energy, end_uses. The eui value is the energy use intensity across '
        'the total floor area. The end_uses value is a dictionary containing a '
        'breakdown of the eui by end use.',
        path='output.json')
class CreateRadianceFolderGrid(Function):
    """Create a Radiance folder from a HBJSON input file."""

    input_model = Inputs.file(
        description='Path to input HBJSON file.',
        path='model.hbjson'
    )

    grid_filter = Inputs.str(
        description='Text for a grid identifer or a pattern to filter the sensor grids '
        'of the model that are simulated. For instance, first_floor_* will simulate '
        'only the sensor grids that have an identifier that starts with '
        'first_floor_. By default, all grids in the model will be simulated.',
        default='*'
    )

    @command
    def hbjson_to_rad_folder(self):
        return 'honeybee-radiance translate model-to-rad-folder model.hbjson ' \
            '--grid "{{self.grid_filter}}" --grid-check'

    model_folder = Outputs.folder(description='Radiance folder.', path='model')

    bsdf_folder = Outputs.folder(
        description='Folder containing any BSDF files needed for the simulation.',
        path='model/bsdf', optional=True
    )

    sensor_grids = Outputs.list(
        description='Information for exported sensor grids in grids subfolder.',
        path='model/grid/_info.json'
    )

    sensor_grids_file = Outputs.file(
        description='Information JSON file for exported sensor grids in grids '
        'subfolder.', path='model/grid/_info.json'
    )

    model_sensor_grids = Outputs.list(
        description='Sensor grids information from the HB model.',
        path='model/grid/_model_grids_info.json'
    )

    model_sensor_grids_file = Outputs.file(
        description='Sensor grids information from the HB model JSON file.',
        path='model/grid/_model_grids_info.json'
    )
Пример #21
0
class CreateSkyDome(Function):
    """Create a skydome for daylight coefficient studies."""
    @command
    def gen_sky_dome(self):
        return 'honeybee-radiance sky skydome --name rflux_sky.sky'

    sky_dome = Outputs.file(description='A sky hemisphere with ground.',
                            path='rflux_sky.sky')
class ResultCsvQueryable(Function):
    """Get a CSV of energy simulation results as an easily query-able SQLite table."""

    result_sql = Inputs.file(
        description='A SQLite file that was generated by EnergyPlus.',
        path='result.sql',
        extensions=['sql', 'db', 'sqlite'])

    model = Inputs.file(
        description=
        'Honeybee model in JSON format that will be matched to results '
        'in the result sql and used to account for triangulated sub-faces, room '
        'multipliers, and any area normalization of results.',
        path='model.json',
        extensions=['hbjson', 'json'])

    output_name = Inputs.str(
        description=
        'An EnergyPlus output name to be retrieved from the result-sql. '
        '(eg. Zone Operative Temperature). This can also be a JSON array of names '
        'formatted with [] brackets.')

    run_period = Inputs.str(
        description='The name of the run period from which the CSV data will be '
        'selected. (eg. BOSTON LOGAN INTL ARPT ANN CLG .4% CONDNS DB=>MWB).')

    units = Inputs.str(
        description='A switch to indicate whether the data in the resulting CSV '
        'should be in SI or IP units. Valid values are "si" and "ip".',
        default='si',
        spec={
            'type': 'string',
            'enum': ['si', 'ip']
        })

    normalization = Inputs.str(
        description=
        'A switch to indicate whether the data in the resulting CSV should '
        'be normalized by floor area (in the case of Zone/System data) or surface '
        'area (in the case of Surface data). This has no effect if the requested '
        'data is not normalizable. Valid values are "normalize" and "no-normalize".',
        default='normalize',
        spec={
            'type': 'string',
            'enum': ['normalize', 'no-normalize']
        })

    @command
    def result_csv_queryable(self):
        return 'honeybee-energy result output-csv-queryable result.sql model.json ' \
            '"{{inputs.run-period}}" "{{inputs.output_name}}" --{{inputs.units}} ' \
            '--{{inputs.normalization}} --folder output --log-file output/col_names.json'

    column_names = Outputs.file(
        description='A list of DataCollection JSONs that match the requested '
        'output name.',
        path='output.json')
class DaylightContribution(Function):
    """
    Calculate daylight contribution for a grid of sensors from a series of modifiers
    using rcontrib command.
    """

    radiance_parameters = Inputs.str(
        description='Radiance parameters. -I and -aa 0 are already included in '
        'the command.',
        default='')

    fixed_radiance_parameters = Inputs.str(
        description='Radiance parameters. -I and -aa 0 are already included in '
        'the command.',
        default='-aa 0')

    calculate_values = Inputs.str(
        description='A switch to indicate if the values should be multiplied. '
        'Otherwise the contribution is calculated as a coefficient. Default is set to '
        'value. Use coeff for contribution',
        default='value',
        spec={
            'type': 'string',
            'enum': ['value', 'coeff']
        })

    sensor_count = Inputs.int(
        description='Number of maximum sensors in each generated grid.',
        spec={
            'type': 'integer',
            'minimum': 1
        })

    modifiers = Inputs.file(
        description=
        'Path to modifiers file. In most cases modifiers are sun modifiers.',
        path='suns.mod')

    sensor_grid = Inputs.file(description='Path to sensor grid files.',
                              path='grid.pts',
                              extensions=['pts'])

    scene_file = Inputs.file(
        description='Path to an octree file to describe the scene.',
        path='scene.oct',
        extensions=['oct'])

    @command
    def run_daylight_coeff(self):
        return 'honeybee-radiance dc scontrib scene.oct grid.pts suns.mod ' \
            '--{{self.calculate_values}} --sensor-count {{self.sensor_count}} ' \
            '--rad-params "{{self.radiance_parameters}}" --rad-params-locked ' \
            '"{{self.fixed_radiance_parameters}}" --output results.ill'

    result_file = Outputs.file(description='Output result file.',
                               path='results.ill')
Пример #24
0
class ConvertToBinary(Function):
    """Convert a Radiance matrix to a new matrix with 0-1 values."""

    # inputs
    input_mtx = Inputs.file(
        description='Input Radiance matrix in ASCII format', path='input.mtx')

    minimum = Inputs.float(
        description='Minimum range for the values that will be converted to 1.',
        default=-1 * 10**100)

    maximum = Inputs.float(
        description='Maximum range for the values that will be converted to 1.',
        default=10**100)

    include_min = Inputs.str(
        description=
        'A flag to include the minimum threshold itself. By default the '
        'threshold value will be included.',
        default='include',
        spec={
            'type': 'string',
            'enum': ['include', 'exclude']
        })

    include_max = Inputs.str(
        description=
        'A flag to include the maximum threshold itself. By default the '
        'threshold value will be included.',
        default='include',
        spec={
            'type': 'string',
            'enum': ['include', 'exclude']
        })

    reverse = Inputs.str(
        description=
        'A flag to reverse the selection logic. This is useful for cases '
        'that you want to all the values outside a certain range to be converted to 1. '
        'By default the input logic will be used as is.',
        default='comply',
        spec={
            'type': 'string',
            'enum': ['comply', 'reverse']
        })

    @command
    def convert_to_zero_one(self):
        return 'honeybee-radiance post-process convert-to-binary input.mtx ' \
            '--output binary.mtx --maximum {{self.maximum}} ' \
            '--minimum {{self.minimum}} --{{self.reverse}} ' \
            '--{{self.include_min}}-min --{{self.include_max}}-max'

    # outputs
    output_mtx = Outputs.file(description='Newly created binary matrix.',
                              path='binary.mtx')
Пример #25
0
class Count(Function):
    """Count values in a row that meet a certain criteria."""

    # inputs
    input_mtx = Inputs.file(
        description='Input Radiance matrix in ASCII format', path='input.mtx')

    minimum = Inputs.float(
        description='Minimum range for the values that should be counted.',
        default=-1 * 10**100)

    maximum = Inputs.float(
        description='Maximum range for the values that should be counted.',
        default=10**100)

    include_min = Inputs.str(
        description=
        'A flag to include the minimum threshold itself. By default the '
        'threshold value will be included.',
        default='include',
        spec={
            'type': 'string',
            'enum': ['include', 'exclude']
        })

    include_max = Inputs.str(
        description=
        'A flag to include the maximum threshold itself. By default the '
        'threshold value will be included.',
        default='include',
        spec={
            'type': 'string',
            'enum': ['include', 'exclude']
        })

    reverse = Inputs.str(
        description=
        'A flag to reverse the selection logic. This is useful for cases '
        'that you want to all the values outside a certain range. By default the input '
        'logic will be used as is.',
        default='comply',
        spec={
            'type': 'string',
            'enum': ['comply', 'reverse']
        })

    @command
    def count_values(self):
        return 'honeybee-radiance post-process count input.mtx ' \
            '--output counter.mtx --maximum {{self.maximum}} ' \
            '--minimum {{self.minimum}} --{{self.reverse}} ' \
            '--{{self.include_min}}-min --{{self.include_max}}-max'

    # outputs
    output_mtx = Outputs.file(description='Newly created binary matrix.',
                              path='counter.mtx')
Пример #26
0
class WriteInt(Function):
    """Write an integer to a text file."""

    src = Inputs.int(description='Integer to write into a text file.')

    @command
    def write_integer(self):
        return 'echo {{self.src}} > input_int.txt'

    dst = Outputs.file(description='The integer in a text file.',
                       path='input_int.txt')
Пример #27
0
class GenSkyWithCertainIllum(Function):
    """Generates a sky with certain illuminance level."""

    illuminance = Inputs.float(default=100000,
                               description='Sky illuminance level.')

    @command
    def gen_overcast_sky(self):
        return 'honeybee-radiance sky illuminance {{self.illuminance}} --name overcast.sky'

    sky = Outputs.file(description='Generated sky file.', path='overcast.sky')
class AirSpeedJson(Function):
    """Get a JSON of air speeds that can be used as input for the mtx functions."""

    epw = Inputs.file(
        description='Weather file used to obtain prevailing temperatures.',
        path='weather.epw', extensions=['epw']
    )

    enclosure_info = Inputs.file(
        description='A JSON file containing information about the radiant '
        'enclosure that sensor points belong to.', path='enclosure_info.json',
        extensions=['json']
    )

    multiply_by = Inputs.float(
        description='A number to denote a factor that EPW wind speeds should be '
        'multipled by in order to represent air speeds at ground level.', default=0.5
    )

    indoor_air_speed = Inputs.file(
        description='The path to a CSV file containing a single number for air speed '
        'in m/s or multiple numbers (with one value per row) that align with the '
        'length of the run-period. This will be used for all '
        'indoor comfort evaluation.', path='in_speed.txt', optional=True
    )

    outdoor_air_speed = Inputs.file(
        description='The path to a CSV file containing a single number for air speed '
        'in m/s or multiple numbers (with one value per row) that align with the '
        'length of the run-period. If None, the resulting air speed JSON will use '
        'the EPW wind speed times the multiply-by value.',
        path='out_speed.txt', optional=True
    )

    run_period = Inputs.str(
        description='An AnalysisPeriod string to set the start and end dates of the '
        'analysis (eg. "6/21 to 9/21 between 8 and 16 @1"). If unspecified, results '
        'will be annual.', default=''
    )

    @command
    def get_air_speed_json(self):
        return 'ladybug-comfort epw air-speed-json weather.epw enclosure_info.json ' \
            '--multiply-by {{self.multiply_by}} --indoor-air-speed in_speed.txt ' \
            '--outdoor-air-speed out_speed.txt --run-period "{{self.run_period}}" ' \
            '--output-file air_speed.json'

    air_speeds = Outputs.file(
        description='A JSON of air speeds that can be used as input for the mtx '
        'functions.', path='air_speed.json'
    )
Пример #29
0
class LongwaveMrtMap(Function):
    """Get CSV files with maps of longwave MRT from Radiance and EnergyPlus results."""

    result_sql = Inputs.file(
        description=
        'A SQLite file that was generated by EnergyPlus and contains '
        'hourly or sub-hourly thermal comfort results.',
        path='result.sql',
        extensions=['sql', 'db', 'sqlite'],
        optional=True)

    view_factors = Inputs.file(
        description=
        'A CSV of spherical view factors to the surfaces in the result-sql.',
        path='view_factors.csv',
        extensions=['csv'])

    modifiers = Inputs.file(
        description=
        'Path to a modifiers file that aligns with the view-factors.',
        path='view_factors.mod',
        extensions=['mod', 'txt'])

    enclosure_info = Inputs.file(
        description='A JSON file containing information about the radiant '
        'enclosure that sensor points belong to.',
        path='enclosure_info.json',
        extensions=['json'])

    epw = Inputs.file(
        description='Weather file used to estimate conditions for any outdoor '
        'sensors.',
        path='weather.epw',
        extensions=['epw'])

    run_period = Inputs.str(
        description=
        'An AnalysisPeriod string to set the start and end dates of the '
        'analysis (eg. "6/21 to 9/21 between 8 and 16 @1"). If unspecified, results '
        'will be annual.',
        default='')

    @command
    def run_longwave_map(self):
        return 'ladybug-comfort map longwave-mrt result.sql view_factors.csv ' \
            'view_factors.mod enclosure_info.json weather.epw ' \
            '--run-period "{{self.run_period}}" --output-file longwave.csv'

    longwave_mrt_map = Outputs.file(
        description='CSV file containing a map of longwave MRT.',
        path='longwave.csv')
Пример #30
0
class AirMap(Function):
    """Get CSV files with maps of air temperatures or humidity from EnergyPlus results.
    """

    result_sql = Inputs.file(
        description=
        'A SQLite file that was generated by EnergyPlus and contains '
        'hourly or sub-hourly thermal comfort results.',
        path='result.sql',
        extensions=['sql', 'db', 'sqlite'],
        optional=True)

    enclosure_info = Inputs.file(
        description='A JSON file containing information about the radiant '
        'enclosure that sensor points belong to.',
        path='enclosure_info.json',
        extensions=['json'])

    epw = Inputs.file(
        description='Weather file used to estimate conditions for any outdoor '
        'sensors.',
        path='weather.epw',
        extensions=['epw'])

    run_period = Inputs.str(
        description=
        'An AnalysisPeriod string to set the start and end dates of the '
        'analysis (eg. "6/21 to 9/21 between 8 and 16 @1"). If unspecified, results '
        'will be annual.',
        default='')

    metric = Inputs.str(
        description=
        'A switch to note whether the the output matrix should be with '
        'relative humidity or air temperature values.',
        default='air-temperature',
        spec={
            'type': 'string',
            'enum': ['air-temperature', 'relative-humidity']
        })

    @command
    def run_air_map(self):
        return 'ladybug-comfort map air result.sql enclosure_info.json weather.epw ' \
            '--run-period "{{self.run_period}}" --{{self.metric}} ' \
            '--output-file air.csv'

    air_map = Outputs.file(
        description=
        'CSV file containing a map of air temperatures or humidity.',
        path='air.csv')