[Python] Can you make a recursive simulation with simpy

Discussão em 'Python' iniciado por Stack, Setembro 29, 2024.

  1. Stack

    Stack Membro Participativo

    I was trying to make a recursive realtime simulation to see it it was possible within the simpy framework. the function was made to track into a log dictionary... The jupyter kernel stopped working and shutdown when I ran this code, why?

    def simStudy(env,AVERAGE_PROGRAMME_LENGTH):
    i = 0
    while i < int(3000/TYPING_RATE):
    ans = input("Target achieved?")
    log[env.now] = int(bool(ans))
    print(log)
    AVERAGE_PROGRAMME_LENGTH -= TYPING_RATE
    yield env.timeout(1)

    env = sim.rt.RealtimeEnvironment(factor = 10,strict = True)

    def startSim():
    try:
    env.process(simStudy(env,AVERAGE_PROGRAMME_LENGTH))
    env.run()
    except RuntimeError as e:
    startSim()
    print(str(e)[-8:-3])


    startSim()

    Continue reading...

Compartilhe esta Página