Video thumbnail (Frame 0) Video thumbnail (Frame 1771) Video thumbnail (Frame 2933) Video thumbnail (Frame 3680) Video thumbnail (Frame 5797) Video thumbnail (Frame 7324) Video thumbnail (Frame 8054) Video thumbnail (Frame 11043) Video thumbnail (Frame 12515) Video thumbnail (Frame 14608) Video thumbnail (Frame 16378) Video thumbnail (Frame 18186) Video thumbnail (Frame 19409) Video thumbnail (Frame 21202) Video thumbnail (Frame 28109) Video thumbnail (Frame 37749)
Video in TIB AV-Portal: SimPy

Formal Metadata

Discrete-event simulation with SimPy
Alternative Title
Event discrete simulation with SimPy
Title of Series
Part Number
Number of Parts
CC Attribution 3.0 Unported:
You are free to use, adapt and copy, distribute and transmit the work or content in adapted or unchanged form for any legal purpose as long as the work is attributed to the author in the manner specified by the author or licensor.
Release Date
Production Place

Content Metadata

Subject Area
ssc - Event discrete simulation with SimPy Often, experiments with real world systems are high-risk, accompanied by high costs or not even possible at all. That’s when simulations come into play. This talk will give a brief introduction into the topic of simulation. By means of simple examples, it will demonstrate how you can use SimPy to implement event-discrete simulations and which features SimPy offers to help you doing that. ----- Simulation is important for the analysis of complex systems or the analysis of the impact of certain actions on that systems. They are especially useful if the actions are potentially harmful or expensive. Simulation is used in various natural scientific and economic areas, e.g., for the modeling and study of biological or physical systems, for resource scheduling and optimization or at the research for the integration of renewable energies into the power grid (my personal background). The simulated time can thereby be seen as continuous or discrete (discrete time or discrete event). In this talk, I want to show why Python is a good choice for implementing simulation models and how SimPy can help here. Structure of the talk (20min talking + 5min discussion + 5min buffer): - Why simulation? (5min) - History of SimPy (3min) - How does SimPy work? (9min) - Conclusion (3min) In the introduction, I’ll briefly explain what simulation is and motivate, why it is a useful tool. The main part will consist of an introduction and demonstration of SimPy. Since SimPy is now more then ten years old, I’ll first give a quick overview about its history and development. Afterwards, I’ll explain SimPy’s concepts and features by means of simple examples. In the conclusion, I’ll give a short outlook on the future development of SimPy. The main goal of this talk is to create awareness that simulation is a powerful tool in a lot of domains and to give the audience enough information to ease their first steps.
Keywords EuroPython Conference EP 2014 EuroPython 2014
Process (computing) Roundness (object) Event horizon Discrete group Computer simulation Self-organization Planning Software testing Bit rate Computer simulation Task (computing)
Discrete group Computer virus Point (geometry) Multiplication sign Discrete group Projective plane Computer simulation Planning Food energy Computer simulation Software maintenance Event horizon Product (business) Connected space Data mining Process (computing) Event horizon Computer animation Strategy game Software framework Social class Library (computing) Physical system
Ocean current State diagram Multiplication sign Similarity (geometry) Semaphore line Computer simulation Protein Generating function Event horizon Formal language Inference Object (grammar) Core dump Cuboid Integrated development environment Software framework Process (computing) Contrast (vision) Loop (music) Task (computing) Area Electric generator Computer simulation Coroutine Semaphore line Frame problem Symbol table Type theory Process (computing) Event horizon Computer animation Software Integrated development environment Function (mathematics) Telecommunication Object (grammar) Task (computing)
Dialect Computer animation Integrated development environment Lecture/Conference Multiplication sign Interactive television Computer simulation Integrated development environment Real-time operating system Mathematical optimization
Point (geometry) Ocean current Execution unit Mountain pass Multiplication sign Computer simulation Variance Event horizon Type theory Process (computing) Event horizon Computer animation Internet forum Hierarchy Operator (mathematics) Interrupt <Informatik> Normal (geometry) Condition number Process (computing) Interrupt <Informatik> Condition number
Slide rule Multiplication sign Source code Similarity (geometry) Event horizon Element (mathematics) Internet forum Shared memory Interrupt <Informatik> Process (computing) Condition number Shared memory Data storage device Range (statistics) Letterpress printing Receiver operating characteristic Category of being Causality Process (computing) Event horizon Computer animation Condition number Summierbarkeit Queue (abstract data type) Object (grammar) Resultant
Dataflow Building Functional (mathematics) Observational study Multiplication sign Virtual machine Control flow Water vapor Arm Variance Value-added network CAN bus Programmschleife Object (grammar) Shared memory Process (computing) Conditional-access module Cone penetration test Block (periodic table) Fitness function Computer simulation Bit Line (geometry) Control flow Type theory Message passing Process (computing) Computer animation Integrated development environment Personal digital assistant Configuration space Right angle Queue (abstract data type) Object (grammar)
Master-Gleichung Context awareness Regulärer Ausdruck <Textverarbeitung> Multiplication sign Simultaneous localization and mapping Control flow Mereology Special unitary group Coprocessor Event horizon Different (Kate Ryan album) Physical law Condition number Metropolitan area network Execution unit Venn diagram Block (periodic table) Electronic mailing list Computer simulation Menu (computing) Variable (mathematics) Orbit Electronic signature Data management Message passing Process (computing) Computer animation Uniform resource name Computer cluster Statement (computer science) Speech synthesis Configuration space Resultant Wide area network
Discrete group Presentation of a group Manufacturing execution system State of matter Weight Decision theory Multiplication sign Function (mathematics) Computer simulation Special unitary group Tracing (software) Variance Formal language Mathematics Estimator Bit rate Computer configuration Cuboid Physical system Exception handling Area Metropolitan area network Theory of relativity Arm Channel capacity View (database) Building Sampling (statistics) Shared memory Computer simulation Menu (computing) Port scanner Band matrix Data mining Type theory Message passing Process (computing) Vector space Uniform resource name Telecommunication Order (biology) Self-organization Software testing Summierbarkeit Right angle Simulation Wide area network Probability distribution Functional (mathematics) Statistics Service (economics) Computer file Electronic program guide 3 (number) Control flow Electronic mailing list Web browser Event horizon Field (computer science) Number Product (business) Multi-agent system Internet forum Telecommunication Lecture/Conference Natural number Software testing Differential equation Summierbarkeit Mathematical optimization Condition number Form (programming) Socket-Schnittstelle Addition Execution unit Multiplication Distribution (mathematics) Focus (optics) Standard deviation Projective plane Independence (probability theory) Cartesian coordinate system CAN bus Loop (music) Computer animation Visualization (computer graphics) Personal digital assistant Function (mathematics) Network socket Interpreter (computing) Video game Table (information) Family Library (computing)
next up is Sachdev launcher forget he works at the year of his Institute in Oldenburg and as a researcher there and he works on simulating the smart grid is also 1 of the authors of simple which is going to talk about now so please give a warm round of applause for stuff few look at and things were being you so planning big events like if you replace this is no easy task and requires lots of planning and the organizer genes that he has done an amazing job so far and to test the assumptions that we have to make beforehand to test and you can build a model of the Conference of all the attendees and speakers and then run a simulation of that and see how your plans and work out and if you want to that price and you can use some kind this is a
discrete event simulation library and civic and of course not only be used for planning conferences but also for all other kinds of planning problems of for example production planning for what hospital process planning it has been used to assimilate with process of rich systems have been using it you submitted electric vehicles and surcharging strategies and last year I've heard of a guy who used to simulate the spreading of smart viruses via so you can do really interesting things person Pi simply is by now relatively on it was created in 2012 by class melatonin even you and it was designed as a process-based discrete event simulation framework that means that you model the the actors that do something that change the state of
a times processes and this process is scheduled events at the discrete point in time to indicate a state-change or connections that they want to perform and in 2000 based on the use of a friend and colleague of mine and I started to contribute to some power and in 2011 became the project maintainers because Tony and just wanted to retreat from the project on the currently is at the 1st system has 3 which were released in 2013 together is a
shiny new logo and it's only been in the recent years that I realize that so if I has lots of similarities between us is intruders frameworks like as know from the 2 watches that automated what we call an environment in simple i is usually called and even to the other frames our processes are very similar to the task of proteins and other events in some high I really like future promise and finally we have a resources and Amanda resources very much like a semaphore but in contrast to the other frameworks we have with the types of environments events and all resources and since the simplest similar to other as inference on his sword why not put as introduced networking on top of it so we created a simple all was that you can Usenet communication in a simulation and you can simulate network communication I would not possible with the other export more on that later seen core idea awesome pastry use generate functions to model processes and what he does not know how generations were nobody knows OK so I just skip over it I were note to that using these people say working on other frameworks that the the concept of using generators for us and for musical genes is a new concept but simple use from the
beginning so it's not really isn't new but electoral his old so here's a simple example Howison simulation can look like this that porting sometime after the start symbol of course on then we define a symbol clock process which gets in reference to the environment the event because somehow re-use explicit events and no global object because global objects of all races that I'm not that good and may introduce a hard-to-find box then area named entity and a lot clock repeated printing the current simulation time and then waiting for some time to start assimilation we create a lamentable and environment then research process is slope and the task of the 1st couple intrinsic time every half simulation time step and local printed every simulation step and then we can run our simulation to reach simulation and there can the a language apart from the Norman environments that
performs assimilationist tosses possible we also have a real time environment and that can be synchronized with what took time out to to realize regions simulations and that can be useful if you have confidence in if you have human interaction with simulation or if you just want
to analyze the real-time behavior often optimization algorithm for example on and of course you can create a more what environments if you have specialized requirements so I said before the
variance of relevant types in most important event of the simulation is a time event because it time passed the so here's an example for conference speaker of the true hated him beholden talk at a certain point in time and it starts by giving it time to return to the start of the talk and then year another time would even after certain minutes to indicate the end of itself at all so as this the really basic event implies and processes amp II events to that is very useful if you want to model process hierarchies but something curious again a simplified speaker that just you determine what was the end of the talk and then return handheld and we now have a moderator process that would form speak of processes and grateful the speaker process to finish the talk and after that Our start another speaker process until the session finishes so in some sense you can use processes like like normal and starts and red for them to finish and then but they can also return values that you can print for example now not all speakers may just what exactly so the minutes that some speakers may talks lot faster so they need to be some to for the moderator to interrupt slow speaker and also provides a concept for that you're always speaker talks for randomly between 25 and 35 minutes and can be interrupted and all moderator now starts again speaker process but then use its all time of prosody minutes and it has become a tall longer than 30 minutes like in that example the moderator just interrupts the speaker and stop current topic but the think problem is the problem is out of speaker in less than 30 minutes the interrupt would fail so we should fix that we can do that by by condition events that also new and some there was a condition event you can say I'd like to
wait for the event was the event or for that event and that event and that event so you can concatenate events was logical operators but now we have
again the same speaker process as in the last example but our moderator now user condition events that says that OK like to wait until speak process has finished or a time out all of sodium minutes have occurred and then you get results back to results of the dictionary that contains all elements that have been trigger and of our speaker process is not in the results it has not finished yet so we interrupted and instead of the pipe a logical or you can also use the and the character of I want to wait for 2 events to occur both of In the event morphisms timeline can so another way for processes to interact with each other and share resources a simple a has
3 categories of resources the first one is called resources and the main character also suppose we called resource and as I said before it's very much like a sum of 1 of the main results to with the slides from our so solar here slots and we have a Q and red reprocesses queue up and it is the 1st 2 processes can then just go and acquire the resources and this process history and it's what becomes available again and then you said a lot there are special aspects of resources 1 of the priority resources where processes in the are sorted by priority and another specialization is the preemptive results process support processes can kick existing users all of the results but he said 2nd category of resources called strong source similar resource but instead of storing process tokens it can store arbitrary python objects and it has to choose 1 process that want to put something in and 1 for processes that want to get something out so in that example the process put an object into also and another process can then granted object and get all of the strong but we also have the the the process rail processes
can define a fitness function to only get certain types of objects from the so for example if you all like machines in the story only 1 to you use machines that currently the function eating and not broken for example and finally there's a container or a container that stores a Concre a discrete or continuous amount of some homogeneous in strict metazoan it can be used to store like apples school water for example and that case process made put 2 liters of water into all container another process that wants to gets really just also out but history wanted another process puts 2 monitors and so that it can get the amount the requested amount of sea container so these are the 3 types of resources that we have and employ a can of course extend that was there other types of resources you need some and now that we know the building blocks of which you can compose a simulation I'd like to show you why there's a little bit more complex example of a conference attendees you can models that sometimes study caused by importing stuff and then there 3
some configuration now wrote we have a continuous flow of the talk sessions and each session consists of 3 talks and each of us has 30 minutes long and after 3 talks you have a break also 15 minutes and how be there also receive an environment again they would have the name and they start with an initial knowledge of 0 and say I'm not hungry at the beginning and during the talks thinking more knowledge but also get more hungry and so hungry as they are the less knowledge thinking because you know if you you just cannot keep your attention of so we start with the wife of the loops over all sessions and that was in that line exist a phone-loop for each topic 1 iteration and read it random and all model of the knowledge and we get more hungry and then read you the time out for the end of our talk and after this research is to just and how much knowledge 58 and Hungary on now find that regardless of the graphs and run the model food and we use a lot longer and weighed against the right over to go to the next session and reprinted evidence of this message again Starting assimilation is easy we just create an environment .
attending processors and runs the simulation for a few hours and the orbitals of that may look like that on hands you that you for attendees gain different amount of knowledge and they get hungry and after the break and they think something they are not the hungry anymore and can gain more knowledge as you can see in the 2nd block so that was already relatively interesting but we didn't gain any new insights about organizing our conference so we should maybe models fee in more detail to to see where the speaking of what people have to queue up and stuff to death so that appropriate want so that's etc. future simulations and we have 2 new configuration variables run for the duration of eating that says 3 minutes and over the would have 1 slot only 1
person can get food at a time and the others have to queue up and the signature of all at any process known also as a reference to the defeat the part of the Wizard in talks with the same as in the last example but you know this part for getting to the gets more interesting recreated requests for all of the here in the context manager that was that was a statement and using the restatement we don't have to reduce our before when we had done so you that you should always use was issued on this list requested resource you have to explicitly call results released when you're done and to have was the use of statement and the then we had a condition event 2 wake of these answers get to the briefly want 12 minutes of the break have passed because the rate law some 12 minutes we won't have enough time to read all of food and it makes no sense to read any longer and when we get results check all along we've waited and then check whether related to to the the the the if yes really some food and again and you then event for the duration of all accounting process at denies message again and we done and if we had
bad luck and didn't get to the field we get a penalty off 100 because you could just get food but don't eat anything and so on their so status message and wait until the break is over and when we set of a simulation it looks like the last example but we also created that the fear associated to capacity of 1 s and the output now looks against similar last example but you can see that it can be number 4 didn't make it to the that could produce hunger and thus gain the knowledge and this and the following session uh compared to all other attendees so it's yeah and it's really hungry after the conference so very unhappy and we know that we should at most once all of the in order to make every every attendee happy and I think the organizers industry has made a gradual in the before food delicious and enough slots so you have OK and that's the example I now I'd like to get back to some bio balanced by a was an inventor of networking library on top of simple and process you can for example model which agent systems and these multi-agent system can be distributed over multiple systems or processes and use natural communication TCP sockets to communicate with each other but you can also just communication between your agents and for example and look how they behave as there's a big at that and see that the messages on messages dropped so as necessary very true for evaluating your your distributed and dozens and bio also implements wraps up so you can add that visualization for use in relation to to make some nice graphics and the browser for example on so violence so in the very early stages already broken about but doesn't have a lot of documentation and CPA EPA Mesa change but roughly that using simple like that it just you instead of the time what sent event or message received event in order to say something about vector it until I got a new message or I get my messages sense so it's not like that that occurred and I of registered in a production system and it's really cool and relatively fast on yes options for the future of course keeping the community it had been helping everyone was stressed and implementing all the features that that people want to make sense of course but we also have some an optimization of the patent for some speed improvements and we are continuously working at our documentation of and currently we discussing adding some helper functions for for helping you monitoring assimilation especially if you want to monitor the usage of the resources but does nothing and decide against so some final notes I hope that I could show you that simple it's really easy to use and flexible somebody has lots of documentation really probably aware documentation because we have a tutorial we have lots of examples here topic guides and an API reference we have also made and of course if the floor where you can also ask questions and we have quite an extensive tests read that make sure everything works as expected and that can also be used as a reference of all things should work by yeah pythoness there someplace to remain pure Python and it supports 5 7 and 3 2 and above and it also has no external dependencies inciting it's really very very easy and fast since it's pure price and we support all kinds of other interpreters like tries all played for example price can give you huge performance improvements if you have a longer running simulations and there's also a lot of to size and so you can get an additional performance improvements by compiling some to see and since a few months there's also a project called some shop which has supported simply to see shots which is all also kind of cool people voted to another language so area and this and I always that you can use for planning so that communication to simulation so this all go to the target was implied that reads the box don't walk to work and it seems to me but at the end so if you have any questions you may also raise your arms
thank people in the field of computational chemistry In researchers use packages like the gains grown and others to support who always molecular dynamics simulations of Monte-Carlo simulations so the family kind of value in the processes the you know about the applications for users of seen by by computational chemistry morning if there are people that use these packaged computational chemistry but no not directly air critique of mine users want to come assimilation and he doesn't use pay for that because if you have just seen processes that don't really interact with other processes so don't use resources that you don't really needs some high so in that case you may be that better off with just using a winery proposes updates its state after each time step would be to find so I think you may use see if you could you could use some for that but maybe there it's just too much and you can just use plain Python standard library to to do that but and if you want to use continues simulations differential equations impulsive does not really offer anything to help you with that so the main focus of the various discrete-event simulation or discrete time simulations rare processes interact somehow with each other all use share resources that stress and I really helps you 5 of them 1st central documents toward in this package like an arm and a question about the independent events so where the where the best way to to reschedule them if it is freezes service sending a file in already limited bandwidth and there's a sense of out of 5 and of course these delays data arrival times modified also with the best way to do it so you want to nullify already scheduled an event and right for that event now I'd like to wait for another day and this is something happens that's probably cancers that new old developed just 2 days ago or whatever and there are several with that 1 way to do with this interrupting a process that waits for an event and then tell him OK please wait for another event but or that this is a process that waits for the event itself cannot do that base of so it has to be ready for the interrupt and if the process itself wants to become active it should do something like getting a condition event traces a right for that event and if it takes too long then I'd like to for something else and for that you can use easy condition events so you use a condition events or interrupted by another process or maybe biologists assimilation and just implement the process called metric table just a and so these delays with that because it has a reference all the events and in their sale preconceiving just created new events are there in the future you could you could do that by implementing a new type of event but once the process using event that really rates enters the event occurs and then it gets resumed and the only exception to that is if it gets interrupted by by the event loop but if you create a special event where's the conditions under which the event triggers can be changed depending on whether 1 single that happens or another thing happens then you can also achieve should should be possible other same yeah had obligation to questions the 1st 1 do you have some tools to use our model to statistical discrete distributions life forms on something or am I supposed to use something my psyche all the 2nd 1 I do have some you these aeration so the tools or she's not going to produce speaking the louder earlier so once more do you have some built in the tools for modeling discrete distribution statistical distributions are a mess for society because side is like will be packaged and if you try to invite the Conference where it can install that quite a huge thing and it has a lot of the unary dependencies and stuff it could be quite useful if I had like some basic basic bunch of our statistical distributions to model to model time there's simple doesn't have good in any distributions but you can use the the random distributions provided by the sum of every by side so sometimes really just a a small package interest a focus on zz modeling of processes and event loop and everything that goes beyond that as left to to library set up better in that and then we also why should be rebuilt distribution rent distributions of say already very well done inside on a pile of presents anniversary events and so the answer is no it again and I think that the samples of lenses ations you got the same policy forum dieselization have to have writer who so you know how your system develops with sentences get simpler used to have some kind of visualization Newton but it really look not that good estimate for the what these 3 jails in the browser so we just set a be excluded from the by and don't maintain it anymore and collecting data from assimilation is relatively easy you just passed for example a sum of a dictionary is not reason to your processes and then append data and after assimilationist then you just pass this or a studio visualization like much public but and then that it the visualization so that that's a better user centered In any more questions and thank you again that