예제 #1
0
def process_hw(xlbook, d: Dwelling):
    xlbook.set_input("water_heating_type_code", d.water_heating_type_code)
    if hasattr(d, "use_immersion_heater_summer"):
        xlbook.set_input("use_immersion_heater_summer", d.use_immersion_heater_summer)
    else:
        xlbook.set_input("use_immersion_heater_summer", False)

    if hasattr(d, "immersion_type"):
        xlbook.set_input("immersion_type", IMMERSION_TYPES[d.immersion_type])
    else:
        xlbook.set_input("immersion_type", "")

    if hasattr(d, "water_sys_fuel") and not d.water_sys_fuel is None:
        if d.water_sys_fuel.is_electric:
            xlbook.set_input("water_sys_fuel", "Electric")
        else:
            xlbook.set_input("water_sys_fuel", d.water_sys_fuel.name)
    else:
        xlbook.set_input("water_sys_fuel", "")

    xlbook.set_input("has_hw_time_control", d.get("has_hw_time_control", False))
    xlbook.set_input("has_cylinderstat", d.get("has_cylinderstat", False))
    xlbook.set_input("primary_pipework_insulated", d.get("primary_pipework_insulated", False))

    if not hasattr(d, "hw_cylinder_volume") or d.hw_cylinder_volume == 0:
        xlbook.set_input("cylinder_in_heated_space", "")
        xlbook.set_input("use_measured_cylinder_loss", True)
        xlbook.set_input("measured_cylinder_loss", "")
        xlbook.set_input("hw_cylinder_volume", "")
        xlbook.set_input("hw_cylinder_insulation", "")
        xlbook.set_input("hw_cylinder_insulation_type", "")
    else:
        if hasattr(d, 'cylinder_in_heated_space'):
            xlbook.set_input("cylinder_in_heated_space", d.cylinder_in_heated_space)
        else:
            xlbook.set_input("cylinder_in_heated_space", True)

        if hasattr(d, 'measured_cylinder_loss'):
            xlbook.set_input("use_measured_cylinder_loss", True)
            xlbook.set_input("measured_cylinder_loss", d.measured_cylinder_loss)
            xlbook.set_input("hw_cylinder_volume", d.hw_cylinder_volume)
            xlbook.set_input("hw_cylinder_insulation", "")
            xlbook.set_input("hw_cylinder_insulation_type", "")
        else:
            xlbook.set_input("use_measured_cylinder_loss", False)
            xlbook.set_input("measured_cylinder_loss", "")
            xlbook.set_input("hw_cylinder_volume", d.hw_cylinder_volume)
            xlbook.set_input("hw_cylinder_insulation", d.hw_cylinder_insulation)
            xlbook.set_input("hw_cylinder_insulation_type",
                             "Factory Fitted" if d.hw_cylinder_insulation_type == CylinderInsulationTypes.FOAM else "Loose Jacket")

    if hasattr(d, "solar_collector_aperture") and d.solar_collector_aperture > 0:
        write_solar_hw(xlbook, d)
    else:
        clear_solar_hw(xlbook, d)
예제 #2
0
def run_case(xlbook, fname):
    if fname in [
            "EW-2k-semi - electric CPSU_10-hour 180 litres.rtf",
    ]:
        return False

    res = load_or_parse_file(fname, reference_case_parser.whole_file, False)
    dwelling = Dwelling()
    input_conversion_rules.process_inputs(dwelling, res.inputs)

    can_run_der = True
    can_run_ter = True
    can_run_fee = True

    if hasattr(dwelling, 'main_sys_2_fuel'):
        can_run_der = False
        can_run_ter = False
    if not hasattr(dwelling, 'main_sys_fuel'):
        # These are the community heating tests cases
        #can_run_der=False
        return
    if dwelling.get('wwhr_systems'):
        can_run_der = False
    if hasattr(dwelling, 'main_heating_pcdf_id'):
        can_run_der = False
    if hasattr(
            dwelling,
            'photovoltaic_systems') and len(dwelling.photovoltaic_systems) > 1:
        can_run_der = False
    if not dwelling['ventilation_type'] in [
            VentilationTypes.NATURAL, VentilationTypes.MVHR,
            VentilationTypes.MEV_CENTRALISED, VentilationTypes.MV
    ]:
        #sap_VentilationTypes.MEV_DECENTRALISED]:
        #sap_VentilationTypes.PIV_FROM_OUTSIDE]:
        can_run_der = False
    if hasattr(dwelling, 'appendix_q_systems'):
        can_run_der = False
        can_run_fee = False

    print(fname)
    try:
        run_dwelling(xlbook, dwelling, can_run_fee, can_run_der, can_run_ter)
        return True
    except CannotDoInSpreadsheetError as e:
        print(("Skipping because: " + e.message))
        return False
예제 #3
0
def run_case(xlbook, fname):
    if fname in [
        "EW-2k-semi - electric CPSU_10-hour 180 litres.rtf",
    ]:
        return False

    res = load_or_parse_file(fname, reference_case_parser.whole_file, False)
    dwelling = Dwelling()
    input_conversion_rules.process_inputs(dwelling, res.inputs)

    can_run_der = True
    can_run_ter = True
    can_run_fee = True

    if hasattr(dwelling, 'main_sys_2_fuel'):
        can_run_der = False
        can_run_ter = False
    if not hasattr(dwelling, 'main_sys_fuel'):
        # These are the community heating tests cases
        #can_run_der=False
        return
    if dwelling.get('wwhr_systems'):
        can_run_der = False
    if hasattr(dwelling, 'main_heating_pcdf_id'):
        can_run_der = False
    if hasattr(dwelling, 'photovoltaic_systems') and len(dwelling.photovoltaic_systems) > 1:
        can_run_der = False
    if not dwelling['ventilation_type'] in [
        VentilationTypes.NATURAL,
        VentilationTypes.MVHR,
        VentilationTypes.MEV_CENTRALISED,
        VentilationTypes.MV]:
        #sap_VentilationTypes.MEV_DECENTRALISED]:
        #sap_VentilationTypes.PIV_FROM_OUTSIDE]:
        can_run_der = False
    if hasattr(dwelling, 'appendix_q_systems'):
        can_run_der = False
        can_run_fee = False

    print(fname)
    try:
        run_dwelling(xlbook, dwelling, can_run_fee, can_run_der, can_run_ter)
        return True
    except CannotDoInSpreadsheetError as e:
        print(("Skipping because: " + e.message))
        return False
예제 #4
0
def process_hw(xlbook, d: Dwelling):
    xlbook.set_input("water_heating_type_code", d.water_heating_type_code)
    if hasattr(d, "use_immersion_heater_summer"):
        xlbook.set_input("use_immersion_heater_summer",
                         d.use_immersion_heater_summer)
    else:
        xlbook.set_input("use_immersion_heater_summer", False)

    if hasattr(d, "immersion_type"):
        xlbook.set_input("immersion_type", IMMERSION_TYPES[d.immersion_type])
    else:
        xlbook.set_input("immersion_type", "")

    if hasattr(d, "water_sys_fuel") and not d.water_sys_fuel is None:
        if d.water_sys_fuel.is_electric:
            xlbook.set_input("water_sys_fuel", "Electric")
        else:
            xlbook.set_input("water_sys_fuel", d.water_sys_fuel.name)
    else:
        xlbook.set_input("water_sys_fuel", "")

    xlbook.set_input("has_hw_time_control", d.get("has_hw_time_control",
                                                  False))
    xlbook.set_input("has_cylinderstat", d.get("has_cylinderstat", False))
    xlbook.set_input("primary_pipework_insulated",
                     d.get("primary_pipework_insulated", False))

    if not hasattr(d, "hw_cylinder_volume") or d.hw_cylinder_volume == 0:
        xlbook.set_input("cylinder_in_heated_space", "")
        xlbook.set_input("use_measured_cylinder_loss", True)
        xlbook.set_input("measured_cylinder_loss", "")
        xlbook.set_input("hw_cylinder_volume", "")
        xlbook.set_input("hw_cylinder_insulation", "")
        xlbook.set_input("hw_cylinder_insulation_type", "")
    else:
        if hasattr(d, 'cylinder_in_heated_space'):
            xlbook.set_input("cylinder_in_heated_space",
                             d.cylinder_in_heated_space)
        else:
            xlbook.set_input("cylinder_in_heated_space", True)

        if hasattr(d, 'measured_cylinder_loss'):
            xlbook.set_input("use_measured_cylinder_loss", True)
            xlbook.set_input("measured_cylinder_loss",
                             d.measured_cylinder_loss)
            xlbook.set_input("hw_cylinder_volume", d.hw_cylinder_volume)
            xlbook.set_input("hw_cylinder_insulation", "")
            xlbook.set_input("hw_cylinder_insulation_type", "")
        else:
            xlbook.set_input("use_measured_cylinder_loss", False)
            xlbook.set_input("measured_cylinder_loss", "")
            xlbook.set_input("hw_cylinder_volume", d.hw_cylinder_volume)
            xlbook.set_input("hw_cylinder_insulation",
                             d.hw_cylinder_insulation)
            xlbook.set_input(
                "hw_cylinder_insulation_type",
                "Factory Fitted" if d.hw_cylinder_insulation_type
                == CylinderInsulationTypes.FOAM else "Loose Jacket")

    if hasattr(d,
               "solar_collector_aperture") and d.solar_collector_aperture > 0:
        write_solar_hw(xlbook, d)
    else:
        clear_solar_hw(xlbook, d)