コード例 #1
0
def add_zone_infiltration(idf, zone_idf_obj_name, infiltration_rate,
                          infiltration_profile, ureg):
    infiltration_idf_obj = idf.newidfobject(
        idf_strings.IDFObjects.zone_infiltration_design_flow_rate)
    infiltration_idf_obj.Name = idf_strings.CustomObjNames.zone_infiltration.format(
        zone_idf_obj_name)
    infiltration_idf_obj.Zone_or_ZoneList_Name = zone_idf_obj_name
    infiltration_schedule_name = idf_writing_helpers.add_schedule(
        idf,
        infiltration_profile,
        required_type=cesarp.common.ScheduleTypeLimits.FRACTION())
    infiltration_idf_obj.Schedule_Name = infiltration_schedule_name
    try:
        infiltration_idf_obj.Design_Flow_Rate_Calculation_Method = idf_strings.FlowRateCalculationMethod.air_changes_per_hour
        infiltration_idf_obj.Air_Changes_per_Hour = infiltration_rate.to(
            ureg.ACH).m
    except DimensionalityError:
        try:
            infiltration_idf_obj.Design_Flow_Rate_Calculation_Method = idf_strings.FlowRateCalculationMethod.flow_per_zone_area
            infiltration_idf_obj.Flow_per_Zone_Floor_Area = infiltration_rate.to(
                ureg.m**3 / ureg.s / ureg.m**2).m
        except DimensionalityError:
            raise Exception(
                f"infiltration rate should be in ACH or m3/s/m2 but was {str(infiltration_rate)}"
            )
コード例 #2
0
def add_night_ventilation_for_zone(idf: IDF, idf_zone_name: str,
                                   night_vent_model: NightVent):
    """
    For description of model used for night ventilation please refer to docs/features/passive-cooling.rst.

    :param idf: eppy IDF object for which to add shading. Zones must already be defined in passed IDF object!
    :param idf_zone_name: zone name in idf for which to add night ventilation
    :param night_vent_model: parameters for the night ventilation
    :return: nothing, idf is extended in place
    """

    max_temp_profile_idf_name = add_schedule(
        idf,
        night_vent_model.maximum_indoor_temp_profile,
        required_type=cesarp.common.ScheduleTypeLimits.TEMPERATURE())
    night_vent_schedule_name = _adding_the_schedule(
        idf, night_vent_model.start_hour, night_vent_model.end_hour)

    night_vent_obj = idf.newidfobject("ZoneVentilation:DesignFlowRate")
    night_vent_obj.Name = idf_zone_name + "_night_vent"
    night_vent_obj.Zone_or_ZoneList_Name = idf_zone_name
    night_vent_obj.Schedule_Name = night_vent_schedule_name
    night_vent_obj.Design_Flow_Rate_Calculation_Method = idf_strings.FlowRateCalculationMethod.air_changes_per_hour
    night_vent_obj.Air_Changes_per_Hour = night_vent_model.flow_rate.to(
        "ACH").m
    night_vent_obj.Ventilation_Type = "Natural"
    night_vent_obj.Minimum_Indoor_Temperature = night_vent_model.min_indoor_temperature.to(
        "degreeC").m
    night_vent_obj.Maximum_Indoor_Temperature_Schedule_Name = max_temp_profile_idf_name
    night_vent_obj.Delta_Temperature = night_vent_model.maximum_in_out_deltaT.to(
        "degreeC").m
    night_vent_obj.Maximum_Wind_Speed = night_vent_model.max_wind_speed.to(
        "m/s").m
コード例 #3
0
def add_people(idf, zone_idf_name, occupancy: Occupancy,
               fraction_radiant_from_activity: pint.Quantity, ureg):
    occupancy_sched_idf_name = idf_writing_helpers.add_schedule(
        idf,
        occupancy.occupancy_fraction_schedule,
        required_type=cesarp.common.ScheduleTypeLimits.FRACTION())
    activity_sched_idf_name = idf_writing_helpers.add_schedule(
        idf, occupancy.activity_schedule, required_unit=ureg.W / ureg.person)
    people_idf_obj = idf.newidfobject(idf_strings.IDFObjects.people)
    people_idf_obj.Name = idf_strings.CustomObjNames.people.format(
        zone_idf_name)
    people_idf_obj.Zone_or_ZoneList_Name = zone_idf_name
    people_idf_obj.Number_of_People_Schedule_Name = occupancy_sched_idf_name
    people_idf_obj.Number_of_People_Calculation_Method = idf_strings.NumOfPeopleCalc.area_per_person
    people_idf_obj.Zone_Floor_Area_per_Person = occupancy.floor_area_per_person.to(
        ureg.m**2 / ureg.person).m
    people_idf_obj.Fraction_Radiant = fraction_radiant_from_activity.to(
        ureg.dimensionless).m
    people_idf_obj.Activity_Level_Schedule_Name = activity_sched_idf_name
コード例 #4
0
def add_thermostat_template(idf, heating_setpoint_schedule,
                            cooling_setpoint_schedule, name_prefix: str):
    # calling add_schedule before checking if the thremostat template already exists only to have the schedule name to create thermostat template idf name,
    # which must be different in case different schedules for different zones shall be used...
    heating_sched_idf_name = idf_writing_helpers.add_schedule(
        idf,
        heating_setpoint_schedule,
        required_type=cesarp.common.ScheduleTypeLimits.TEMPERATURE())
    cooling_sched_idf_name = idf_writing_helpers.add_schedule(
        idf,
        cooling_setpoint_schedule,
        required_type=cesarp.common.ScheduleTypeLimits.TEMPERATURE())
    name = name_prefix + "_" + idf_strings.CustomObjNames.thermostat_template
    idf_obj_type = idf_strings.IDFObjects.hvac_template_thermostat
    if not idf_writing_helpers.exists_in_idf(idf, idf_obj_type, name):
        templ_thermostat_idf_obj = idf.newidfobject(idf_obj_type)
        templ_thermostat_idf_obj.Name = name
        templ_thermostat_idf_obj.Heating_Setpoint_Schedule_Name = heating_sched_idf_name
        templ_thermostat_idf_obj.Cooling_Setpoint_Schedule_Name = cooling_sched_idf_name
        templ_thermostat_idf_obj.Constant_Cooling_Setpoint = ""

    return name
コード例 #5
0
def add_hot_water_equipment(idf, zone_idf_name, dhw_op: InstallationOperation,
                            dhw_fraction_lost: pint.Quantity, ureg):
    dhw_schedule_idf_name = idf_writing_helpers.add_schedule(
        idf,
        dhw_op.fraction_schedule,
        required_type=cesarp.common.ScheduleTypeLimits.FRACTION())
    hot_water_equ_idf_obj = idf.newidfobject(
        idf_strings.IDFObjects.hot_water_equipment)
    hot_water_equ_idf_obj.Name = idf_strings.CustomObjNames.hot_water_equipment.format(
        zone_idf_name)
    hot_water_equ_idf_obj.Zone_or_ZoneList_Name = zone_idf_name
    hot_water_equ_idf_obj.Schedule_Name = dhw_schedule_idf_name
    hot_water_equ_idf_obj.Design_Level_Calculation_Method = idf_strings.DesignLevelCalc.watts_per_area
    hot_water_equ_idf_obj.Power_per_Zone_Floor_Area = dhw_op.power_demand_per_area.to(
        ureg.W / ureg.m**2).m
    hot_water_equ_idf_obj.Fraction_Lost = dhw_fraction_lost.to(
        ureg.dimensionless).m
コード例 #6
0
def add_electric_equipment(idf, zone_idf_name,
                           el_app_op: InstallationOperation,
                           el_app_fraction_radiant: pint.Quantity, ureg):
    applicance_sched_idf_name = idf_writing_helpers.add_schedule(
        idf,
        el_app_op.fraction_schedule,
        required_type=cesarp.common.ScheduleTypeLimits.FRACTION())
    el_equ_idf_obj = idf.newidfobject(
        idf_strings.IDFObjects.electric_equipment)
    el_equ_idf_obj.Name = idf_strings.CustomObjNames.electric_equipment.format(
        zone_idf_name)
    el_equ_idf_obj.Zone_or_ZoneList_Name = zone_idf_name
    el_equ_idf_obj.Schedule_Name = applicance_sched_idf_name
    el_equ_idf_obj.Design_Level_Calculation_Method = idf_strings.DesignLevelCalc.watts_per_area
    el_equ_idf_obj.Watts_per_Zone_Floor_Area = el_app_op.power_demand_per_area.to(
        ureg.W / ureg.m**2).m
    el_equ_idf_obj.Fraction_Radiant = el_app_fraction_radiant.to(
        ureg.dimensionless).m
コード例 #7
0
def add_lights(idf, zone_idf_name, lighting_op: InstallationOperation,
               lighting_characteristics: LightingCharacteristics, ureg):
    lighting_sched_idf_name = idf_writing_helpers.add_schedule(
        idf,
        lighting_op.fraction_schedule,
        required_type=cesarp.common.ScheduleTypeLimits.FRACTION())
    lights_idf_obj = idf.newidfobject(idf_strings.IDFObjects.ligths)
    lights_idf_obj.Name = idf_strings.CustomObjNames.lights.format(
        zone_idf_name)
    lights_idf_obj.Zone_or_ZoneList_Name = zone_idf_name
    lights_idf_obj.Schedule_Name = lighting_sched_idf_name
    lights_idf_obj.Design_Level_Calculation_Method = idf_strings.DesignLevelCalc.watts_per_area
    lights_idf_obj.Watts_per_Zone_Floor_Area = lighting_op.power_demand_per_area.to(
        ureg.W / ureg.m**2).m
    lights_idf_obj.Return_Air_Fraction = lighting_characteristics.return_air_fraction.to(
        ureg.dimensionless).m
    lights_idf_obj.Fraction_Radiant = lighting_characteristics.fraction_radiant.to(
        ureg.dimensionless).m
    lights_idf_obj.Fraction_Visible = lighting_characteristics.fraction_visible.to(
        ureg.dimensionless).m
コード例 #8
0
def add_outdoor_air_sepc(idf, ventilation_schedule,
                         outdoor_air_flow_per_floor_area: pint.Quantity,
                         name_prefix: str, ureg):
    ventilation_sched_idf_name = idf_writing_helpers.add_schedule(
        idf,
        ventilation_schedule,
        required_type=cesarp.common.ScheduleTypeLimits.FRACTION())
    idf_obj_type = idf_strings.IDFObjects.design_specifictaion_outdoor_air
    name = name_prefix + "_" + idf_strings.CustomObjNames.outdoor_air_spec
    if not idf_writing_helpers.exists_in_idf(idf, idf_obj_type, name):
        outdoor_air_spec_idf_obj = idf.newidfobject(idf_obj_type)
        outdoor_air_spec_idf_obj.Name = name
        outdoor_air_spec_idf_obj.Outdoor_Air_Method = idf_strings.OutdoorAirCalcMethod.flow_per_area
        outdoor_air_spec_idf_obj.Outdoor_Air_Flow_per_Zone_Floor_Area = outdoor_air_flow_per_floor_area.to(
            ureg.m**3 / ureg.s / ureg.m**2).m
        # clean up default values: set to zero because calc method changed to flow/area
        outdoor_air_spec_idf_obj.Outdoor_Air_Flow_per_Person = 0
        if idf.idd_version[0] < 9 and idf.idd_version[1] < 6:
            outdoor_air_spec_idf_obj.Outdoor_Air_Flow_Rate_Fraction_Schedule_Name = ventilation_sched_idf_name
        else:
            outdoor_air_spec_idf_obj.Outdoor_Air_Schedule_Name = ventilation_sched_idf_name

    return name