Пример #1
0
def unit_head_workloads(weather_factors, unit_factors, iterations, workload_steps=20):
    all_logged_info = [{'WORKLOAD': i / workload_steps} for i in range(workload_steps)]
    for i in range(iterations):
        for workload_iteration in range(workload_steps):
            env = simpy.Environment()
            weather = Weather(env=env, **weather_factors)
            Logger._reset()
            #Logger.LOG = False

            units = []
            for factors in unit_factors:
                factors['head_workload'] = workload_iteration / float(workload_steps)
                units.append(factories.build_unit(env, weather, factors))
            _ = Madden(env, weather, 2, [unit[0] for unit in units])

            env.run(until=24)

            this = all_logged_info[workload_iteration]
            gruntled = Review.get_disgruntled_employees()
            for head_id, num in gruntled.items():
                this["LATE MESSAGES"] = this.get("LATE MESSAGES", 0) + num
        print i
    return all_logged_info
Пример #2
0
def weather_differences(weather_factors, unit_factors, iterations, start, finish):
    assert start >= 3
    assert finish <= 25
    all_logged_info = [{'TIME': i} for i in range(finish - start)]
    for iteration in range(iterations):
        for i in range(start, finish):
            env = simpy.Environment()
            weather_factors['time'] = i
            weather = Weather(env=env, **weather_factors)
            Logger._reset()
            Logger.LOG = False

            units = []
            for factors in unit_factors:
                units.append(factories.build_unit(env, weather, factors))
            _ = Madden(env, weather, 2, [unit[0] for unit in units])

            env.run(until=24)

            this = all_logged_info[i - start]
            for status, num in Review.get_statuses()['home'].items():
                this[status] = this.get(status, 0) + num

    return all_logged_info