Beispiel #1
0
t = time + int(round(pr.exponential(clients_arrival_interval)))
ev = Event(t, 2, (0, 0))
EVENTS = fill_events(EVENTS, ev)

while EVENTS:

    ev = EVENTS.pop(0)
    time = ev.tm

    if ev.tp in [1, 8]:
        print(ev)

    if ev.tp == 2:
        ncl = pr.discrete(prob_incoming_clients)
        ev.data = (ncl, N + ncl)
        print(ev)
        for _ in range(ncl):
            N = N + 1
            if WORKERS:
                servtype = pr.discrete(prob_service_type)
                duration = round(
                    pr.normal(avg_service_duration[servtype - 1],
                              stdev_service_duration[servtype - 1]))
                worker = WORKERS.pop(0)
                worker.servicetime = worker.servicetime + duration
                worker.numclients = worker.numclients + 1
                ev = Event(time + duration, 5, (N, worker))
                EVENTS = fill_events(EVENTS, ev)
                info = (N, worker, servtype, duration, hourmin(t + duration),
                        worker.servicetime)