def create_sap_dwelling(inputs):
    dwelling = ParamTrackerDwelling()  # sap_worksheet.Dwelling()
    input_conversion_rules.process_inputs(dwelling, inputs)

    # if not sap_dwelling_validator.validate(d):
        #logging.error("Bad inputs")
        # exit(0)

    log_dwelling(dwelling.__dict__)

    dwelling.next_stage()
    return dwelling
예제 #2
0
def create_sap_dwelling(inputs):
    """
    Create a SAP dwelling object from parsed SAP input file
    :param inputs:
    :return:
    """
    dwelling = Dwelling()
    input_conversion_rules.process_inputs(dwelling, inputs)

    # TODO validate inputs
    # if not sap_dwelling_validator.validate(dwelling):
    # logging.error("Bad inputs")

    return dwelling
예제 #3
0
def create_sap_dwelling(inputs):
    """
    Create a SAP dwelling object from parsed SAP input file
    :param inputs:
    :return:
    """
    dwelling = Dwelling()
    input_conversion_rules.process_inputs(dwelling, inputs)

    # TODO validate inputs
    # if not sap_dwelling_validator.validate(dwelling):
    # logging.error("Bad inputs")

    return dwelling
예제 #4
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
예제 #5
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
예제 #6
0
def create_sap_dwelling(inputs):
    """
    Create a SAP dwelling object from parsed SAP input file
    :param inputs:
    :return:
    """
    # dwelling = ParamTrackerDwelling()

    dwelling = Dwelling()
    input_conversion_rules.process_inputs(dwelling, inputs)

    # if not sap_dwelling_validator.validate(dwelling):
    # logging.error("Bad inputs")
    # exit(0)
    log_dwelling(dwelling)

    # dwelling.next_stage()
    return dwelling