Загрузка...

SimPy Tutorial 1: Introduction to SimPy

In this video, I discuss some of the reasons SimPy is a good option for discrete event simulation. Then, I demonstrate the difference between a generator (one of the fundamental elements of SimPy) and a function. Finally, I wrap up the video by writing a simple SimPy program to illustrate how timeout events work. Use 1080p for best viewing! SimPy documentation: https://simpy.readthedocs.org/en/latest/index.html Python download/installation instructions: https://www.python.org/downloads/ pip installation instructions: http://pip.readthedocs.org/en/stable/installing/ Discrete event simulation: https://en.wikipedia.org/wiki/Discrete_event_simulation Averill Law's take on it: http://www.amazon.com/Simulation-McGraw-Hill-Industrial-Engineering-Management/dp/0073401323 Today's code: ============================== import simpy def main(): env = simpy.Environment() env.process(traffic_light(env)) env.run(until=300) print("Simulation complete") def traffic_light(env): while True: print("Light turned GRN at t= "+str(env.now)) yield env.timeout(30) print("Light turned YEL at t= "+str(env.now)) yield env.timeout(5) print("Light turned RED at t= "+str(env.now)) yield env.timeout(20) if __name__ == '__main__': main() ==============================

Видео SimPy Tutorial 1: Introduction to SimPy автора Python: Кодовое возрождение
Яндекс.Метрика
Все заметки Новая заметка Страницу в заметки
Страницу в закладки Мои закладки
На информационно-развлекательном портале SALDA.WS применяются cookie-файлы. Нажимая кнопку Принять, вы подтверждаете свое согласие на их использование.
О CookiesНапомнить позжеПринять