Esempio n. 1
0
def main_failure(num, no_input, in_stream, out_stream):

    fail_batch = generate_n_unique(failure_scenario_generator(open("rts.net")), num)

    # for information print the unmodified base case
    # and the un-combined failures
    if not no_input:
        out_stream.write("0, base, None, , 1.0" + windstr(1) + "\n")
    output_scenario(fail_batch, out_stream)

    # if we didn't have a input file then we are done
    if no_input:
        return

    # otherwise read the input as a list of scenarios and their count
    # for each base combine it with all the failures
    # we ignore the count for the base (not sure what to do with it)
    # skip the failed base cases (if they are simulated at all)
    for base_count, base_scenario in stream_scenario_generator(in_stream):
        if base_scenario.result is not False:
            out_stream.write(str(base_count) + ", " + str(base_scenario) + "\n")

            for count, fail_scenario in fail_batch:
                new_scenario = combine_scenarios(base_scenario, fail_scenario)
                out_stream.write(str(count) + ", " + str(new_scenario) + "\n")
Esempio n. 2
0
def main_failure(num, no_input, in_stream, out_stream):

    fail_batch = generate_n_unique(failure_scenario_generator(open("rts.net")), num)

    # for information print the unmodified base case
    # and the un-combined failures
    if not no_input:
        out_stream.write("0, base, None, , 1.0" + windstr(1) + "\n")
    output_scenario(fail_batch, out_stream)

    # if we didn't have a input file then we are done
    if no_input:
        return

    # otherwise read the input as a list of scenarios and their count
    # for each base combine it with all the failures
    # we ignore the count for the base (not sure what to do with it)
    # skip the failed base cases (if they are simulated at all)
    for base_count, base_scenario in stream_scenario_generator(in_stream):
        if base_scenario.result is not False:
            out_stream.write(str(base_count) + ", " + str(base_scenario) + "\n")

            for count, fail_scenario in fail_batch:
                new_scenario = combine_scenarios(base_scenario, fail_scenario)
                out_stream.write(str(count) + ", " + str(new_scenario) + "\n")
Esempio n. 3
0
def main_outage(num, out_stream):
    batch = generate_n_unique(outage_scenario_generator(open("rts.net")), num)
    output_scenario(batch, out_stream)
Esempio n. 4
0
def main_outage(num, out_stream):
    batch = generate_n_unique(outage_scenario_generator(open("rts.net")), num)
    output_scenario(batch, out_stream)