Esempio n. 1
0
def test_wrong_reference_system(test_net, diag_params, diag_errors,
                                report_methods):
    net = copy.deepcopy(test_net)
    check_function = 'wrong_reference_system'
    diag_params = copy.deepcopy(diag_params)
    report_methods = copy.deepcopy(report_methods)
    net.load.p_mw.at[0] = -1
    net.gen.p_mw.at[0] = -1
    net.sgen.p_mw.at[0] = -1
    check_result = pp.wrong_reference_system(net)
    if check_result:
        diag_results = {check_function: check_result}
    else:
        diag_results = {}
    assert diag_results[check_function] == {
        'gens': [0],
        'loads': [0],
        'sgens': [0]
    }

    for bool_value in [True, False]:
        diag_report = DiagnosticReports(net,
                                        diag_results,
                                        diag_errors,
                                        diag_params,
                                        compact_report=bool_value)
        report_check = None
        try:
            eval(report_methods[check_function])
            report_check = True
        except:
            report_check = False
        assert report_check
Esempio n. 2
0
def test_wrong_reference_system(test_net):
    net = copy.deepcopy(test_net)
    net.load.p_kw.at[0] = -1
    net.gen.p_kw.at[0] = 1
    net.sgen.p_kw.at[0] = 1

    assert pp.wrong_reference_system(net) == {
        'gens': [0],
        'loads': [0],
        'sgens': [0]
    }