Пример #1
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')
Пример #2
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')
Пример #3
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')
Пример #4
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')
Пример #5
0
class CreateLeedSkies(Function):
    """Generate two climate-based lear skies for LEED v4.1 Daylight Option 2."""

    wea = Inputs.file(
        description=
        'Path to a Typical Meteorological Year (TMY) .wea file. The file '
        'must be annual with a timestep of 1 for a non-leap year.',
        extensions=['wea'],
        path='sky.wea')

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

    @command
    def create_leed_skies(self):
        return 'honeybee-radiance sky leed-illuminance sky.wea ' \
            '--north {{self.north}} --folder output --log-file output/sky_info.json'

    sky_list = Outputs.list(
        description='A JSON array containing the information about the two '
        'generated sky files.',
        path='output/sky_info.json')

    output_folder = Outputs.folder(
        description='Output folder with the generated sky files.',
        path='output')
Пример #6
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')
Пример #7
0
class SplitGrid(Function):
    """Split a single sensor grid file into multiple smaller grids."""

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

    input_grid = Inputs.file(description='Input grid file.', path='grid.pts')

    @command
    def split_grid(self):
        return 'honeybee-radiance grid split grid.pts ' \
            '{{self.sensor_count}} --folder output --log-file output/grids_info.json'

    grids_list = Outputs.list(
        description=
        'A JSON array that includes information about generated sensor '
        'grids.',
        path='output/grids_info.json')

    output_folder = Outputs.folder(
        description='Output folder with new sensor grids.', path='output')
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')
Пример #9
0
class BaselineOrientationSimPars(Function):
    """Get SimulationParameters with different north angles for a baseline building sim.
    """

    ddy = Inputs.file(
        description='A DDY file with design days to be included in the '
        'SimulationParameter',
        path='input.ddy',
        extensions=['ddy'])

    run_period = Inputs.str(
        description=
        'An AnalysisPeriod string or an IDF RunPeriod string to set the '
        'start and end dates of the simulation (eg. "6/21 to 9/21 between 0 and 23 @1").'
        ' If None, the simulation will be annual.',
        default='')

    north = Inputs.int(
        description=
        'A number from -360 to 360 for the counterclockwise difference '
        'between North and the positive Y-axis in degrees. 90 is west; 270 is east',
        default=0,
        spec={
            'type': 'integer',
            'maximum': 360,
            'minimum': -360
        })

    filter_des_days = Inputs.str(
        description=
        'A switch for whether the ddy-file should be filtered to only '
        'include 99.6 and 0.4 design days',
        default='filter-des-days',
        spec={
            'type': 'string',
            'enum': ['filter-des-days', 'all-des-days']
        })

    @command
    def baseline_orientation_sim_pars(self):
        return 'honeybee-energy settings orientation-sim-pars input.ddy ' \
            '0 90 180 270 --run-period "{{self.run_period}}" --start-north ' \
            '{{self.north}} --{{self.filter_des_days}} --folder output ' \
            '--log-file output/sim_par_info.json'

    sim_par_list = Outputs.dict(
        description=
        'A JSON array that includes information about generated simulation '
        'parameters.',
        path='output/sim_par_info.json')

    output_folder = Outputs.folder(
        description='Output folder with the simulation parameters.',
        path='output')
Пример #10
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')
Пример #11
0
class SimParSizing(Function):
    """Get a SimulationParameter JSON with outputs for peak loads and HVAC sizing."""

    ddy = Inputs.file(
        description='A DDY file with design days to be included in the '
        'SimulationParameter',
        path='input.ddy',
        extensions=['ddy'])

    load_type = Inputs.str(
        description=
        'Text to indicate the type of load. Choose from (Total, Sensible, '
        'Latent, All)',
        default='Total',
        spec={
            'type': 'string',
            'enum': ['Total', 'Sensible', 'Latent', 'All']
        })

    north = Inputs.int(
        description=
        'A number from -360 to 360 for the counterclockwise difference '
        'between North and the positive Y-axis in degrees. 90 is west; 270 is east',
        default=0,
        spec={
            'type': 'integer',
            'maximum': 360,
            'minimum': -360
        })

    filter_des_days = Inputs.str(
        description=
        'A switch for whether the ddy-file should be filtered to only '
        'include 99.6 and 0.4 design days',
        default='filter-des-days',
        spec={
            'type': 'string',
            'enum': ['filter-des-days', 'all-des-days']
        })

    @command
    def create_sim_param(self):
        return 'honeybee-energy settings sizing-sim-par input.ddy ' \
            '--load-type {{self.load_type}} --north {{self.north}} ' \
            '--{{self.filter_des_days}} --output-file sim_par.json'

    sim_par_json = Outputs.file(
        description='SimulationParameter JSON with outputs for peak loads and '
        'HVAC sizing.',
        path='sim_par.json')
Пример #12
0
class SimParDefault(Function):
    """Get a SimulationParameter JSON with default outputs for energy use only."""

    ddy = Inputs.file(
        description='A DDY file with design days to be included in the '
        'SimulationParameter',
        path='input.ddy',
        extensions=['ddy'])

    run_period = Inputs.str(
        description=
        'An AnalysisPeriod string or an IDF RunPeriod string to set the '
        'start and end dates of the simulation (eg. "6/21 to 9/21 between 0 and 23 @1").'
        ' If None, the simulation will be annual.',
        default='')

    north = Inputs.int(
        description=
        'A number from -360 to 360 for the counterclockwise difference '
        'between North and the positive Y-axis in degrees. 90 is west; 270 is east',
        default=0,
        spec={
            'type': 'integer',
            'maximum': 360,
            'minimum': -360
        })

    filter_des_days = Inputs.str(
        description=
        'A switch for whether the ddy-file should be filtered to only '
        'include 99.6 and 0.4 design days',
        default='filter-des-days',
        spec={
            'type': 'string',
            'enum': ['filter-des-days', 'all-des-days']
        })

    @command
    def create_sim_param(self):
        return 'honeybee-energy settings default-sim-par input.ddy ' \
            '--run-period "{{self.run_period}}" --north {{self.north}} ' \
            '--{{self.filter_des_days}} --output-file sim_par.json'

    sim_par_json = Outputs.file(
        description=
        'SimulationParameter JSON with default outputs for energy use',
        path='sim_par.json')
Пример #13
0
class AnnualIrradianceMetrics(Function):
    """Calculate annual irradiance metrics for annual irradiance simulation."""

    folder = Inputs.folder(
        description='A folder output from and annual irradiance recipe.',
        path='raw_results')

    wea = Inputs.file(
        description=
        'The .wea file that was used in the annual irradiance simulation. '
        'This will be used to determine the duration of the analysis for computing '
        'average irradiance.',
        path='weather.wea')

    timestep = Inputs.int(
        description='The timestep of the Wea file, which is used to ensure the '
        'summed row of irradiance yields cumulative radiation over the time '
        'period of the Wea.',
        default=1)

    @command
    def calculate_irradiance_metrics(self):
        return 'honeybee-radiance post-process annual-irradiance raw_results ' \
            'weather.wea --timestep {{self.timestep}} --sub-folder ../metrics'

    # outputs
    metrics = Outputs.folder(
        description='Annual irradiance metrics folder. This folder includes all '
        'the other subfolders which are exposed as separate outputs.',
        path='metrics')

    average_irradiance = Outputs.folder(
        description=
        'Average irradiance in W/m2 for each sensor over the wea period.',
        path='metrics/average_irradiance')

    peak_irradiance = Outputs.folder(
        description=
        'The highest irradiance value in W/m2 for each sensor during '
        'the wea period.',
        path='metrics/average_irradiance')

    cumulative_radiation = Outputs.folder(
        description='The cumulative radiation in kWh/m2 for each sensor over '
        'the wea period.',
        path='metrics/cumulative_radiation')
Пример #14
0
class DaylightCoefficient(Function):
    """Calculate daylight coefficient for a grid of sensors from a sky matrix."""

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

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

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

    sky_matrix = Inputs.file(description='Path to a sky matrix.',
                             path='sky.mtx',
                             extensions=['mtx', 'smx'])

    sky_dome = Inputs.file(description='Path to a sky dome.', path='sky.dome')

    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 scoeff scene.oct grid.pts sky.dome sky.mtx ' \
            '--sensor-count {{self.sensor_count}} --output results.ill --rad-params ' \
            '"{{self.radiance_parameters}}" --rad-params-locked '\
            '"{{self.fixed_radiance_parameters}}"'

    result_file = Outputs.file(description='Output result file.',
                               path='results.ill')
class RayTracingDaylightFactor(Function):
    """Run ray-tracing and post-process the results for a daylight factor simulation."""

    radiance_parameters = Inputs.str(
        description=
        'Radiance parameters to be exposed within recipes. -I and -h are '
        'usually already included in the fixed_radiance_parameters.',
        default='-ab 2')

    sky_illum = Inputs.int(
        description='Sky illuminance level for the sky included in octree.',
        default=100000)

    fixed_radiance_parameters = Inputs.str(
        description=
        'Parameters that are meant to be fixed for a given recipe and '
        'should not be overwritten by radiance_parameters input.',
        default='-I -h')

    grid = Inputs.file(description='Input sensor grid.', path='grid.pts')

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

    bsdf_folder = Inputs.folder(
        description='Folder containing any BSDF files needed for ray tracing.',
        path='model/bsdf',
        optional=True)

    @command
    def ray_tracing(self):
        return 'honeybee-radiance raytrace daylight-factor scene.oct grid.pts ' \
            '--rad-params "{{self.radiance_parameters}}" --rad-params-locked ' \
            '"{{self.fixed_radiance_parameters}}" --sky-illum {{self.sky_illum}} ' \
            '--output grid.res'

    result = Outputs.file(
        description=
        'Daylight factor results file. The results for each sensor is in a '
        'new line.',
        path='grid.res')
Пример #16
0
class ParseSunUpHours(Function):
    """Parse sun up hours from sun modifiers file."""

    sun_modifiers = Inputs.file(description='Path to sun-modifiers file.',
                                path='suns.mod')

    timestep = Inputs.int(
        description=
        'An integer value to set the timestep of the input hours. If '
        'timestep is set to 1 the time will be offset by -0.5 to align with the start '
        'of the hour. For other timesteps the hour will not be adjusted.',
        default=1,
        spec={
            'type': 'integer',
            'minimum': 1
        })

    leap_year = Inputs.str(
        description=
        'A flag to switch between a normal year and a leap year. The '
        'default is a normal year. Use leap-year if the input hours are for a full '
        'year',
        default='full-year',
        spec={
            'type': 'string',
            'enum': ['full-year', 'leap-year']
        })

    @command
    def parse_hours(self):
        return 'honeybee-radiance sunpath parse-hours suns.mod ' \
            '--name sun-up-hours.txt --timestep {{self.timestep}} --{{self.leap_year}}'

    sun_up_hours = Outputs.file(
        description=
        'A text file that includes all the sun up hours. Each hour is '
        'separated by a new line.',
        path='sun-up-hours.txt')
Пример #17
0
class CreateSkyDome(Function):
    """Create a skydome for daylight coefficient studies."""

    sky_density = Inputs.int(
        description=
        'The density of generated sky. This input corresponds to gendaymtx '
        '-m option. -m 1 generates 146 patch starting with 0 for the ground and '
        'continuing to 145 for the zenith. Increasing the -m parameter yields a higher '
        'resolution sky using the Reinhart patch subdivision. For example, setting -m 4 '
        'yields a sky with 2305 patches plus one patch for the ground.',
        default=1,
        spec={
            'type': 'integer',
            'minimum': 1
        })

    @command
    def gen_sky_dome(self):
        return 'honeybee-radiance sky skydome --name rflux_sky.sky ' \
            '--sky-density {{self.sky_density}}'

    sky_dome = Outputs.file(description='A sky hemisphere with ground.',
                            path='rflux_sky.sky')
Пример #18
0
class RayTracingDaylightFactor(Function):
    """Run ray-tracing and post-process the results for a daylight factor simulation."""

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

    sky_illum = Inputs.int(
        description='Sky illuminance level for the sky included in octree.',
        default=100000)

    fixed_radiance_parameters = Inputs.str(
        description=
        'Parameters that should not be overwritten by radiance_parameters '
        'input.',
        default='-I -h')

    grid = Inputs.file(description='Input sensor grid.', path='grid.pts')

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

    @command
    def ray_tracing(self):
        return 'honeybee-radiance raytrace daylight-factor scene.oct grid.pts ' \
            '--rad-params "{{self.radiance_parameters}}" --rad-params-locked ' \
            '"{{self.fixed_radiance_parameters}}" --sky-illum {{self.sky_illum}} ' \
            '--output grid.res'

    result = Outputs.file(
        description=
        'Daylight factor results file. The results for each sensor is in a '
        'new line.',
        path='grid.res')
class Hvac2004(Function):
    """Convert a Model's HVAC to conform to ASHRAE 90.1-2004 appendix G.

    This includes the selection of the correct Appendix G template HVAC based on
    the inputs and the application of this HVAC to all conditioned spaces in
    the model.
    """

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

    climate_zone = Inputs.str(
        description='Text indicating the ASHRAE climate zone. This can be a single '
        'integer (in which case it is interpreted as A) or it can include the '
        'A, B, or C qualifier (eg. 3C).',
        spec={
            'type': 'string',
            'enum': [
                '1', '2', '3', '4', '5', '6', '7', '8',
                '1A', '2A', '3A', '4A', '5A', '6A', '7A', '8A',
                '1B', '2B', '3B', '4B', '5B', '6B', '7B', '8B',
                '3C', '4C', '5C'
            ]
        }
    )

    is_residential = Inputs.str(
        description='A switch to note whether the model represents a residential '
        'or nonresidential building.', default='nonresidential',
        spec={'type': 'string', 'enum': ['nonresidential', 'residential']}
    )

    energy_source = Inputs.str(
        description='A switch to note whether the available energy source is '
        'fossil fuel based or all-electric.', default='fuel',
        spec={'type': 'string', 'enum': ['fuel', 'electric']}
    )

    floor_area = Inputs.float(
        description='A number for the floor area of the building that the model '
        'is a part of in m2. If 0, the model floor area will be used.', default=0
    )

    story_count = Inputs.int(
        description='An integer for the number of stories of the building that the '
        'model is a part of. If None, the model stories will be used.', default=0,
        spec={'type': 'integer', 'minimum': 0}
    )

    @command
    def hvac_2004(self):
        return 'honeybee-energy baseline hvac-2004 model.hbjson {{self.climate_zone}} ' \
            '--{{self.is_residential}} --{{self.energy_source}} ' \
            '--story-count {{self.story_count}} --floor-area {{self.floor_area}} ' \
            '--output-file new_model.hbjson'

    new_model = Outputs.file(
        description='Model JSON with its properties edited to conform to ASHRAE '
        '90.1 appendix G.', path='new_model.hbjson'
    )
Пример #20
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_type = Inputs.str(
        description='A switch for generating sun-only sky or exclude sun '
        'contribution. The default is total sky which includes both.',
        default='total',
        spec={
            'type': 'string',
            'enum': ['total', 'sun-only', 'no-sun']
        })

    sky_density = Inputs.int(
        description=
        'The density of generated sky. This input corresponds to gendaymtx '
        '-m option. -m 1 generates 146 patch starting with 0 for the ground and '
        'continuing to 145 for the zenith. Increasing the -m parameter yields a higher '
        'resolution sky using the Reinhart patch subdivision. For example, setting -m 4 '
        'yields a sky with 2305 patches plus one patch for the ground.',
        default=1,
        spec={
            'type': 'integer',
            'minimum': 1
        })

    cumulative = Inputs.str(
        description=
        'An option to generate a cumulative sky instead of an hourly sky',
        default='hourly',
        spec={
            'type': 'string',
            'enum': ['hourly', 'cumulative']
        })

    output_type = Inputs.str(
        description='Output type which can be visible and or solar.',
        default='visible',
        spec={
            'type': 'string',
            'enum': ['visible', 'solar']
        })

    output_format = Inputs.str(
        description='Output file format. Options are float, double and ASCII.',
        default='ASCII',
        spec={
            'type': 'string',
            'enum': ['float', 'double', 'ASCII']
        })

    sun_up_hours = Inputs.str(
        description=
        'An option to generate the sky for sun-up hours only. Default is '
        'for all the hours of the year.',
        default='all-hours',
        spec={
            'type': 'string',
            'enum': ['all-hours', 'sun-up-hours']
        })

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

    @command
    def generate_sky_matrix(self):
        return 'honeybee-radiance sky mtx sky.wea --name sky --north {{self.north}} ' \
            '--sky-type {{self.sky_type}} --{{self.cumulative}} ' \
            '--{{self.sun_up_hours}} --{{self.output_type}} ' \
            '--output-format {{self.output_format}} --sky-density {{self.sky_density}}'

    sky_matrix = Outputs.file(description='Output Sky matrix', path='sky.mtx')
class DaylightCoefficient(Function):
    """Calculate daylight coefficient for a grid of sensors from a sky matrix."""

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

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

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

    sky_matrix = Inputs.file(description='Path to a sky matrix.',
                             path='sky.mtx',
                             extensions=['mtx', 'smx'])

    sky_dome = Inputs.file(description='Path to a sky dome.', path='sky.dome')

    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'])

    conversion = Inputs.str(
        description=
        'Conversion values as a string which will be passed to rmtxop -c.'
        'This option is useful to post-process the results from 3 RGB components into '
        'one as part of this command.',
        default='')

    order_by = Inputs.str(
        description=
        'An option to change how results are ordered in each row. By '
        'default each row are the results for each sensor during all the datetime. '
        'Valid options are sensor and datetime.',
        default='sensor',
        spec={
            'type': 'string',
            'enum': ['sensor', 'datetime']
        })

    output_format = Inputs.str(
        description=
        'Output format for converted results. Valid inputs are a, f and '
        'd for ASCII, float or double.',
        default='f',
        spec={
            'type': 'string',
            'enum': ['a', 'd', 'f']
        })

    bsdf_folder = Inputs.folder(
        description='Folder containing any BSDF files needed for ray tracing.',
        path='model/bsdf',
        optional=True)

    @command
    def run_daylight_coeff(self):
        return 'honeybee-radiance dc scoeff scene.oct grid.pts sky.dome sky.mtx ' \
            '--sensor-count {{self.sensor_count}} --output results.ill --rad-params ' \
            '"{{self.radiance_parameters}}" --rad-params-locked '\
            '"{{self.fixed_radiance_parameters}}" --conversion "{{self.conversion}}" ' \
            '--output-format {{self.output_format}} --order-by-{{self.order_by}}'

    result_file = Outputs.file(description='Output result file.',
                               path='results.ill')
Пример #22
0
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']
        })

    conversion = Inputs.str(
        description=
        'Conversion values as a string which will be passed to rmtxop -c.',
        default='')

    order_by = Inputs.str(
        description=
        'An option to change how results are grouped in each row. By '
        'default each row are the results for each sensor during all the datetimes. '
        'Valid options are sensor and datetime.',
        default='sensor',
        spec={
            'type': 'string',
            'enum': ['sensor', 'datetime']
        })

    output_format = Inputs.str(
        description=
        'Output format for converted results. Valid inputs are a, f and '
        'd for ASCII, float or double. If conversion is not provided you can change the '
        'output format using rad-params options.',
        default='a',
        spec={
            'type': 'string',
            'enum': ['a', 'd', 'f']
        })

    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}}" --conversion "{{self.conversion}}" ' \
            '--output-format {{self.output_format}} --output results.ill ' \
            '--order-by-{{self.order_by}}'

    result_file = Outputs.file(description='Output result file.',
                               path='results.ill')
Пример #23
0
class SplitView(Function):
    """Split a single view file (.vf) into multiple smaller views."""

    view_count = Inputs.int(
        description=
        'Number of views into which the input view will be subdivided.',
        spec={
            'type': 'integer',
            'minimum': 1
        })

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

    overture = Inputs.str(
        description='A switch to note whether an ambient file (.amb) should be '
        'generated for an overture calculation before the view is split into smaller '
        'views. With an overture calculation, the ambient file (aka ambient cache) is '
        'first populated with values. Thereby ensuring that - when reused to create '
        'an image - Radiance uses interpolation between already calculated values '
        'rather than less reliable extrapolation. The overture calculation has '
        'comparatively small computation time to full rendering but is single-core '
        'can become time consuming in situations with very high numbers of '
        'rendering multiprocessors.',
        default='overture',
        spec={
            'type': 'string',
            'enum': ['overture', 'skip-overture']
        })

    scene_file = Inputs.file(
        description=
        'Path to an octree file for the overture calculation. This must be '
        'specified when the overture is not skipped.',
        path='scene.oct',
        optional=True)

    radiance_parameters = Inputs.str(
        description='Radiance parameters for the overture calculation. '
        'If unspecified, default rpict paramters will be used.',
        default='-ab 2')

    bsdf_folder = Inputs.folder(
        description='Folder containing any BSDF files needed for ray tracing.',
        path='model/bsdf',
        optional=True)

    @command
    def split_view(self):
        return 'honeybee-radiance view split view.vf ' \
            '{{self.view_count}} --{{self.overture}} ' \
            '--octree {{self.scene_file}} --rad-params "{{self.radiance_parameters}}" ' \
            '--folder output --log-file output/views_info.json'

    views_list = Outputs.list(
        description='A JSON array that includes information about generated '
        'views.',
        path='output/views_info.json')

    output_folder = Outputs.folder(
        description='Output folder with new view files.', path='output')

    ambient_cache = Outputs.file(
        description='Path to the ambient cache if an overture calculation was '
        'specified.',
        path='output/view.amb',
        optional=True)