Summary
Determining the best way to manage the capacity and flow of goods through a system is a complicated issue and can be exceedingly expensive to get wrong. Rather than experimenting with the physical objects to determine the optimal algorithm for managing the logistics of everything from global shipping lanes to your local bank, it is better to do that analysis in a simulation. Ruud van der Ham has been working in this area for the majority of his professional life at the Dutch port of Rotterdam. Using his acquired domain knowledge he wrote Salabim as a library to assist others in writing detailed simulations of their own and make logistical analysis of real world systems accessible to anyone with a Python interpreter.
Preface
- Hello and welcome to Podcast.__init__, the podcast about Python and the people who make it great.
- I would like to thank everyone who supports us on Patreon. Your contributions help to make the show sustainable.
- When you’re ready to launch your next project you’ll need somewhere to deploy it. Check out Linode at podastinit.com/linode and get a $20 credit to try out their fast and reliable Linux virtual servers for running your awesome app. And now you can deliver your work to your users even faster with the newly upgraded 200 GBit network in all of their datacenters.
- If you’re tired of cobbling together your deployment pipeline then it’s time to try out GoCD, the open source continuous delivery platform built by the people at ThoughtWorks who wrote the book about it. With GoCD you get complete visibility into the life-cycle of your software from one location. To download it now go to podcatinit.com/gocd. Professional support and enterprise plugins are available for added piece of mind.
- Visit the site to subscribe to the show, sign up for the newsletter, and read the show notes. And if you have any questions, comments, or suggestions I would love to hear them. You can reach me on Twitter at @Podcast__init__ or email hosts@podcastinit.com)
- To help other people find the show please leave a review on iTunes, or Google Play Music, tell your friends and co-workers, and share it on social media.
- Your host as usual is Tobias Macey and today I’m interviewing Ruud van der Ham about Salabim, a Python library for conducting discrete event simulations
Interview
- Introductions
- How did you get introduced to Python?
- Can you start by explaining what Discrete Event Simulation is and how Salabim helps with that?
- Can you explain how you chose the name?
- What was your motivation for creating Salabim and how does it compare to other tools for discrete event simulation?
- How does discrete event simulation compare with state machines?
- How is Salabim implemented and how has the design evolved over the time that you have been working on it?
- I understand that you have done a majority of Salabim was written on an iPad. Can you speak about why you have chosen that as your development environment and your experience working in that manner?
- What are some examples of the types of models that you can model with Salabim?
- What would an implementation of one of these models look like for someone using Salabim?
- What options does a user have to verify the accuracy of a simulation created with Salabim?
- One of the nice aspects of Salabim is the fact that it provides a visual output as a simulation runs. Can you describe the workflow for someone who wants to use Salabim for modeling and visualizing a system?
- At what point does a system become too complex to encapsulate in a simulation and what techniques can you use to modularize it to make a simulation useful?
- When is Salabim not the right tool to use and what would you suggest for people who find themselves in that situation?
- What have been some of the most complicated or difficult aspects of building and maintaining Salabim?
- What are some of the new features or improvements that you have planned for the future of Salabim?
Keep In Touch
Picks
- Tobias
- Ruud
Links
- Salabim
- Dining Philosophers Animation
- Elevator Animation
- Rotterdam
- Discrete Event Simulation
- Container Terminal Automation
- Basic
- Algol
- Pascal
- Operations Research
- Continuous Simulation
- Simula
- Coroutines
- SymPy
- Another DES in Python: SimPy
- DES in Julia: SimJulia
- DES in R: Simmer
- DES in Delphi/Pascal: Tomas
- Pillow
- PyPy
- Delphi
- PyGame
- PyQT
- TkInter
- Inspect Module
- OpenCV
- Blender
The intro and outro music is from Requiem for a Fish The Freak Fandango Orchestra / CC BY-SA
Hello, and welcome to podcast dot in it, the podcast about Python and the people who make it great. When you're ready to launch your next project, you'll need somewhere to deploy it, so you should check out linode@podcastinit.com/linode and get a $20 credit to try out their fast and reliable Linux virtual servers for running your app. And now you can deliver your work to your users even faster with the newly upgraded 200 gigabit network in all of their data centers. If you're tired of cobbling together your deployment pipeline, then it's time to try out GoCD, the open source continuous delivery platform built by the people at Thoughtworks who wrote the book about it. With Go CD, you get complete visibility into the life cycle of your software from 1 location. To download it now, go to podcastinit.com/gocd.
Professional support and enterprise plug ins ins are available for added peace of mind. You can visit the site at podcastinit.com to subscribe to the show, sign up for the newsletter, and read the show notes. And if you have any questions, comments, or suggestions, I would love to hear them. Your host as usual is Tobias Macy. And today, I'm interviewing Grood Van Der Ham about Salabim, a Python library for conducting discrete event simulations. So, Ruud, could you start by introducing yourself?
[00:01:17] Unknown:
Yes. Thank you very much for inviting me in the show. Well, I started my working life, as a, an operations research engineer in the, particularly in the, port port industry in Rotterdam. I'm from Holland. And, I'd had a long, long working experience in that field. And I particularly did a lot of work in the, the field of simulations. It's also 1 of this this is actually the subject of this podcast, I think. And, I retired a couple of years ago, and, I live now in the south of France. And, I'm still active as a consultant in the field of of container terminal automation and all that.
And besides that, I'm, a quite active, Python developer, particularly in this in this, package we're going to to to, to discuss today. And do you remember how you first got introduced to Python? Yes. Yes. Actually, that all happened, well, something 2 years ago, I think. I I have a good friend of mine who works for the, for the Dutch Railways, and he pointed me out and pointed me in the direction of Bison. And, I have a very long experience with all kind of other languages. I've started actually with, well, like like everyone in my generation more than just basic. It was all Gol on, big mainframes, and it had all the languages you can imagine. Example, there are a lot of example, Pascal, p01, and all that.
But, my friend actually said, well, the Spanish language. And so I had a look at it. And at first I found it a rather strange, strange language, which actually did this, this indentation, business of, pointing out the structure of the program. But after a while, I I got to understand it, and I found it really a great language and, never regretted in going to, into this, direction. And now Python is really my my language. Although still I use from time to time for specific tasks, some, some basic, particularly for, extending Excel.
[00:03:32] Unknown:
And so the Salaban package that you've been working on is for doing modeling of discrete event simulations. So So I'm wondering if you can explain a bit about what that term means and how the Salaban package helps with, performing that modeling.
[00:03:50] Unknown:
Yes. Well, this great event simulation is actually a technique from the fields of of operations research. And, it tries to, to simulate, to model processes. And that whole is particularly, industrial processes and logistic process and all that. Actually, if you just look at the the term discrete event simulation, you see the the, the term discrete. And why is that discrete? There's also other simulation type, which are continuous simulations, And that's another field actually. That's if you have to it involves differential equations and all that. And that's not the field I'm, I'm working at. Although there are some some, some ideas on that. I extended it. Maybe you'll come to that later.
Event simulation. Well, events actually means that you skip from time to time. So what what they're what the f g is, there's also always the concept of time. So, we have processes and those processes have a certain timeline, and they interact with each other. And that's where the event comes in, into, into the picture. So we simulate actually from from a certain time time moments to the next moments. And what's differentiates that from, for instance, real time programming is that that's time step is done in in real time time 0. So you have to skip from 1 event to the other 1. And if there is a, let's say in simulation time, an hour between those events, you don't have to wait for that hour. You just skip in well, just in the processing time or just 1 1 step with the program.
You step from 1 hour to the other 1. And then maybe a minute later, something something else happens, and then you you you've just stepped for that 1 minute. So you see a kind of stepping, on the timeline, which is not uniform at all. So sometimes there's there's an hour, sometimes a couple of seconds, sometimes there are even maybe hundreds of events at 1 moment. And, that's the, where those events come in to. And now, what can Salabim do with that? Well, this technique actually started more or less in the late seventies. So there was a simulation language called, Simula then. It was actually, that was the first object oriented language, ever. And that, that language had already elements, in it to, to perform those discrete event simulations. And what does that mean? Actually, what we call we now call that coroutine usually.
And that means that you can have a, a, a process running separately from another process. And you just have a, a mechanism to synchronize those things. Well, that's that's, similar language was developed, and the basis of that is still the basis of a number of other packages. And similar and, Sanabim is 1 of them. And, so Sanabim actually supports terms like hold and activate and pacificates. So you can pacificate a, a process. And that means that the the process just waits for for for an outside signal, kind of the kind of trigger mechanism. And that's the basis of the, the silo bin package, actually.
And so by, making a a model, a describe actually the, the system you want to, you want to simulate. You can translate that into, into Python Python codes, and then you can just just run it and then you get your results. So that is how Salabim can help, running, simulations.
[00:07:53] Unknown:
And can you explain a bit about how you chose the name for the package?
[00:07:57] Unknown:
Yeah. That's, yes. Of course. Well, salabim is actually, maybe the listeners know is, 1 of the magic words, the the, magic words, sim salabim. So sim salavim. Sim is actually short for for simulation. So that's actually the connection, and it's just nice, a a nice word that didn't exist in any other package. So I thought that's a good thing there. So what EACN and, actually, what what I do usually in, in my, in my simulation models and all the, the sample programs I, I've made, I always start with import Salabim as sim. So there you can actually see the connection as well.
[00:08:37] Unknown:
It's always great when there's a bit of humor connected with these different packages that people put out. It's 1 of the great things about the Python community as a whole is that sense of whimsy that's just sort of built into the community.
[00:08:49] Unknown:
Yes. That's true.
[00:08:50] Unknown:
And so I'm wondering if you can talk a bit about what your motivation was for creating Salabim in the first place and how it compares with other tools that are available for performing discrete event simulation, whether that's within Python or within other languages.
[00:09:07] Unknown:
Yes. Yes. I can do that. Well, as I explained earlier, I'm a consultant in the field of, of simulations. And in the past, I did a lot of programming as well. And nowadays, I still do a lot of, consultancy and that sales actually just just guiding simulation studies. And those simulation studies are mainly always done in rather big propriety simulation packages. And those are we does fully contains this. They're based on the kind of languages, but it's a lot of click click and, point and click systems. And they are highly advanced. They are extremely nice, visualizations from time to time. But there's a there are a couple of disadvantages of those packages.
First of all, they're extremely expensive. You have to think about, prices like 10 to, 10 to a 100 k, and that even doesn't include, hundreds of users. So they are very expensive. And the second thing is that they're good for a certain, certain type of applications in certain fields. For instance, if you want to do warehouses or something like that, they might be extremely good for at that. But if you want to do a little bit more different than the usual algorithms that are, integrated in the package, you're more or less stuck. There are all kind of decisions made in the package already. And if you want to do something else, those packages usually have a kind of escape routes. They support c plus plus, subroutines or Java subroutines or something like that. But then all of a sudden, this very nice nice framework that they they they offer isn't that isn't that nice anymore at all, because then you have to to, to interface with this this, with those those visual elements and all that. It is not clear at all. So I, I work a lot with those with people who who who are using those, those those packages. But I also wanted to wanted to do maybe go a little bit back to my, to my roots to, to, to do a little bit of modeling myself. And then I started looking, and I had already implemented once a similar package in, in in Pascal. And I was looking, well, how can I can I do that? And, well, there was a time that I, my friends came along with who, points me into direction of Python. And I started looking and I found a discrete event simulation package, in Python. It's a package called SIMPI.
And this is s I m p I, because there's also the symbolic package SIMPI was a reason why, but this is different package here. And that's actually And all of a sudden, they had other implementations. They didn't use the words I was used to, like hold and, pacify and activate. They had terms like events, triggers, and all that. So quite different, and I didn't find really at ease with that. So I started actually building a kind of layer around it, and I could do more or less what I wanted to do, but it wasn't very elegant. And, I I I I did want to, to build an another feature, and that was not available. And I had to extend it. And then I thought, well, if I really look at it, I can also do it myself. And that opens the possibility for me to do more to structure it more the way I wanted it and to add many more features because this SIMP package, the first version was very nice, and they have a lot of features in it. But at a certain time, the developers, decided to take a lot of functionality out of the package because they said, well, that's also available at another services. But in in practice, at least in not in my, my opinion, that doesn't really work that way. So I really wanted to have something more.
So I started developing my own package. And in the beginning, it was a rather simple simple thing that could just perform the, the, the event simulation and all that. But, I got more and more involved in, what's what's, simulation what, Python could do. And as a side project, I had also done already quite a lot of animation, creative animation in Python, and, trying to figure, that can, can just move and all that. And then I found that then I, then, yeah, then I just just found actually that those 2 techniques could be brought together. So then I start building a an animation on top of it, and that was not available in that other package at at all.
And that really is a, is an enormous advantage because now I can just visualize my, my models. You can see objects moving and machines working and vehicles running and all that. And that's actually the, what it made quite different from this, this, SIMP, SIMP package. And, while looking at other systems, there are other packages like this in other languages. There's a Julia implementation of SIMP as well, and there's an r implementation of this kind of similar thing. So there are some other pegs, but I'm very familiar with with Python, and I love the infrastructure and all that. And, well, maybe we come to that later. The the only disadvantage is the is the, the execution speed maybe, which is definitely not the same as you get to reach in, for for instance, in in Julia or in or in Go. But, so far, for my project, it it's it's okay. But that might be a, problem in the future.
[00:15:07] Unknown:
And while I was reading through some of the documentation for Salabim and a bit about the concept of discrete event simulation, I was struck by the fact that it seems fairly similar, at least in some elements, to the idea of state machines. So I'm wondering if there's any overlap in the sort of use cases for a package such as salabim and a state machine library.
[00:15:32] Unknown:
Yeah. Well, I'm not extremely familiar with state machines. I know a little bit about the, the background of it. What's important in in, in simulation is event simulation at the time the time aspect is extremely important. And as far as I know, state machines doesn't really support that, that that mechanism. Of course, the state of of what we call components are stored all the time, and we we we skip from state to state and all that. But I don't really have, any experience with state machines, but I've I've I've I've just looked at it. And what's definitely possible is to simulate state machines with, with with Salabim, because that's just just just going from 1 state to another, and that's also definitely possible.
But I think the the type of, of applications are quite different. But then as I said, I don't have that much experience with state machines myself, actually.
[00:16:34] Unknown:
And how is Salabim implemented under the covers? And I'm wondering how the overall design of the package has evolved over the time that you've been working on it. Yes. Well, Sanabim is,
[00:16:46] Unknown:
is implemented as, as as as 1 package actually. It's, at at this moment, still 1 single file, and, it runs under, all versions of well, they, they could be the the normal versions of of Fison, including 2.7. Well, I first started simple, and then I added the animation and the animation features. And then I added quite a lot of other functionalities. 1 of the most important thing is what I call monitors. Monitors is actually following the state of, well, we have something called the state in in Salaban, but also in a very important aspect of, this, simulation packages in Salaban as well is cues.
Components, that's 1 of the main elements. Maybe you Python people might might use the word object, but I want to differentiate that from Python object can be in queues and can be in many queues at the same time. And those queues are usually very important to collect, statistics about. And with Sanobin, there's an automatic monitoring system. So every time there's state change, for instance, a component that says queues or leave a queue or something like that or state changes, that's all monitored. And then you can just at any time point of time, you can, request, the statistical information about it. That's extremely powerful.
I I I added also a lot of statistical distributions in, in simulation, statistical sampling is extremely important. You usually just define properties as a statistical, distribution. So for instance, you say a, time between arrivals of clients in the system is, well, is it the term, exponential distributed? And you can just say that the sample from an exponential distribution. But I've included many more other, distributions. And over time, as I say, I started the the developments, something late, 2, 016, And, then it was still well, it worked, but that was all and made it much more, Pythonic, over the of the updated, the last year. And now I think it's rather it's more of nicely structured.
And I use a lot of the, facilities of, of Python. Now for instance, I have my own queuing system. You of course, you have in in, Python, you have lists and tuples and, index and all that. But for, sublimation purse purposes, it's much nicer to have some more facilities, particularly for the data collection and all that. And, quite often also, components just enter in a queue just somewhere relative to another component and all that. That's all supported. But in the beginning, I had to say things like queue dot length and, as an attribute.
But, of course, Python also supports those those structures like like Len. So now you can just say Len of a of a structure, and you can just go through the queue by saying for for component in, in queue and all that. And it's it it it really looks very nice and also very compact code, of course, by by implementing it implementing it that way.
[00:20:15] Unknown:
And I understand that the majority of the development that you've done on the package has actually been written on an iPad. So I'm wondering if you can speak to why you chose that as your development environment and what your experience has been working in that environment.
[00:20:32] Unknown:
It's a little bit weird maybe, but, and I really just just, switch between the 2 systems, between a Windows environment and and an iPad all the time. And the reason I started this actually that's I started actually my animations on the Ipads. So I did a lot of of, work in there. And so the the animation engine actually just just worked in the beginning when we worked on an iPad actually, because it's quite different structure and they have good facilities for that and all that. And, then, and then I started the, the, the windows implemented or the CPython implementation.
But then still I found it really very easy to, to develop on a, an iPad because it's so simple. You have it always on you. You can't just take it into train or in a plane or whatever. And, it's, it's, it's, it's, it's, it's, it's so extremely simple. And the environment, the development environment of this implementation on the iPad is really fantastic. You have all facilities, including debugging and good to good IDE and all that. So I feel very at ease with that environment, actually. But, well, the development is actually more or less split. So from time to time, I do, do some work on my iPad and then then switch back to, to an ordinary IDE on a desktop system. And, and particularly if I do a lot to do some bulk editing, like replacing and all that, it's quite usually much easier on a, on a proper ID actually with a keyboard and all that. But, still I do, well, quite a lot of quite a lot of work on the on the iPad, actually, just because it's so so convenient, to me. And it also makes the coach maybe better because I have to maintain 2 environments.
And that makes me think more more about what's the best structure and all that. And, so the, the way it's built actually is we have 2, I have 2, different animation engines which come together. And in beginning they were quite different. So I had a lot of, lot of codes specific for the iPad and a lot of codes specific for, ordinary CPython, implementations. But I found that actually in the in the iPad, I had some things that I couldn't do. And I tried also some things on the, the CPython platform, which I couldn't do. And then I escaped to do a to to a more common base in doing all the animation. Actually, all the animation pictures are actually now made in a pill in pillow and the Python image library. And the Python image library is now just the basis of all my my animations.
The engine on which I run on the c Python platform is TKinter. So I used to canvas of, TKinter for my my animations. But TKinter doesn't support, for instance, rotating of strings, text text strings. And that's that's quite a hindrance because sometimes you want to have a, a, to put a string under a on an angle for certain, certain purposes. So that was it was something what you couldn't do. And on an iOS system, on the, the iPad, I couldn't actually do a field polygon. But under on the pillow, that's all available. So I do all the, the preparation time in pillow and then just just present it. And that's definitely something and possibly I would never thought of when I just did did my work on the on the on the on the desktop.
[00:24:25] Unknown:
And for somebody who wants to use Salabim to create a simulation, I'm wondering what the workflow looks like for being able to actually model the different components of the system and then actually create a visualization from that, and then what the output from the simulation would look like and how they might use that for validating the system that they're trying to perform a simulation on?
[00:24:54] Unknown:
Well, what's extremely important in simulation modeling is, first of all, to to have an idea of the the system you want to simulate, you have to model, because the real life system is usually far too complicated to put every aspect in. So you have to make a to make to make some, some ideas to have an idea on what's what you put in a model, how far you want to go and all that. For for instance, in my, in my field of of of container terminals, what's I've done a lot of work in. If you want to work to simulate a, a container terminal, you can can go into every detail in the movement of wheels and and effort of of the equipment and, ships with the mooring and all that. But it all depends on the question you want to, you want to answer. If you're only interested in the capacity of cranes, for instance, well, maybe you can just omit the, the arrival of trucks and maybe even of the ships and all that. So you have to make a a model in your, in your mind. And usually you can just just go further in a later stage, but usually the best is to go to start a little bit on a high level. And then you go and, describe the different processes.
Well, as I said before, we have, the, the word components. And components is actually the main structure, of the, the main elements of a simulation. So maybe I can just describe a little bit about a, on how I would model, for instance, a post office, post office where clients arrive. So we have a, we have the post office. There's a, there's a clerk, I suppose. Maybe there are even more clerks, behind the counter. And we have the clients, coming in. And let's say that's that's all we want to, to to model. We don't have to to go and model every detail of the doors when the door open and all that, but they just enter the system. Well, obviously, in this case, we have the, the clients, as as components. There's quite likely, and that depends a little bit on your modeling, but we might also have the clerks as the as a component And the clients have to be generated. So usually, you you model it then with a client generator.
And the client generator is actually the driving force behind the whole simulation. That's built as a class in in Python's terms. So there's a class client generator, which is subclass from a, an, Saba BIM, class called components. So it's, class components and the client generator. Well, what does he do have to do? He has to to to generate the clients over time. So and has to do it all the time. So we just say, well, true. And all the time, generate it, generate a, a client. Client is a new 1. So we we make a new, new component there. If you say something like clients, client is clients or something like that. And then we have to wait for a certain time and then and here comes in the, the real, discrete different simulation terminology.
Then we actually in the process of the client generator, it has a, special procedure, special message, it's actually a generator. We say the yields, hold. And the yield yield holds, that just says that give control back to the, to the event mechanism, and then something else can happen. So we say yield holds, and then we sample from a certain distribution. Let's say we sample from uniform distribution between, let's say, 2 and 10 minutes. So every 2 and 10 between 2 10 minutes a client arrives. So we just say yields, from sample between this 2 and 10. And that's the end of this this processing. That's all. Because then there's the while loop. So then after this, let's say we sample 5:5 minutes.
After 5 minutes, the client generated comes active again, and then it's a it starts up. What I said, I've made a a client and the client automatically starts a pro its own process. And the client has has a process and the client, will have a process like it looks for, is there any clerk available? And if so, activates that clerk. And if not, just go and pacivate. And that's actual. And then after that, that's the main structure of this, of the, the client. And the clerk is actually also quite quite easy 1 because the clerks actually do it all the time because the clerk has to work, of course, all the time. The clerk has has a wild wild around it, so it's a wild through.
And they always says, is is there a client waiting from is there a client waiting? Is there a client in the queue? And so if there's client in the, the waiting line, it says, it picks up the client. Does it work? So it holds for a certain amount. This is, again, that's saying that's a yield. It holds for a certain time, let's say between 3 5 minutes or something like that. It's the the the real processing. And then after that time, it just had to activate the client. And then after and the client was actually just just specified it. And then by activating that client, the client knows, okay. I'm I'm done. And that's the end of the client and the client just, automatically disappears then.
And what you can do with this type of modeling already, as I said, there's a queue waiting line. You can just ask for the, the statistic on the queuing line. How long? What what was the average, curing time? What was the maximum and all that? You can see it in time and all those, those things. We we usually do, presented as a, as a histogram. Or you can just feed it into, to more sophisticated, packages like or something like that and visualize it properly. And so, then you can get all the information. You can see the, occupancy of the clerks, and and all that. And so I've described now those 3 components, the the client clerk and the client generator. And all you have to do is you have to start it because there's this there's a mechanism. The mechanism starts. So just at the the main program is just say run for a certain time. You say, for instance, run for a day, for 24 hours. And then, and then the whole mechanism just starts, with fire those those the yields, those those co routines actually.
And then you get the, the the the system running. And then after that, that 1 day, you can just collect your information. But this is rather static. You can trace those things. So if you put a trace on, you get a kind of dump where you can actually see, okay, this is the client generates generates something, and the clerk does something, and it goes into queue and sends and leaves the queue and all that. And you see that on a timeline, and that's ex that's excellent for debugging and and all that. But, of course, you can't really see it in in time. And that's where animation comes in in in the field. And in this case, that's really extremely easy because there's just a facility to animate cues. So if you say, say, any way to this queue, this waiting line, you can see immediately the the waiting line getting longer and shorter and all that.
You can even see which clients there are and all that. And you don't have to you hardly have to program anything to to see that. That's a simple type of animation, actually. If you just want to have a block, rectangle, for for clients, of course, that's not always enough. Sometimes you need vehicles running or, cranes moving and all that, and then you have to do more. And then you have to go into make your own animation objects. And the basics actually rather simple. The Sala BIM supports a couple of of basic structures and and not there's not a lot actually. We can do, rectangles, lines, polygons, text circles, images.
And those objects can be moved over time to what you can actually say, okay, we are now let's say it's it's now time 10. And I want to have that that rectangle, which is a actually, it's a red rectangle. And I want to move that, to another coordinates and to arrive at their edge time t is t is 20. And those times are usually of course connect to the simulation time. And then all this movement is done automatically by the system. The user doesn't have to do anything like that. And you can change all the attributes of the components over time. So for instance, you can change the color. You can say, okay, at time 10 is red, and at time 20, it's blue. And it just automatically goes from red to blue as the angle, rotation, the the size, all those things, line width and all that can be all changed over time. It's a little bit overkill for for for most, animation for most simulations, but it's all available in the, in the package. And so the for for complicated, animations, you have to do quite a lot of coding, but it's, you can make very, very nice, nice animations with that.
[00:34:32] Unknown:
For people who are interested in doing these different event simulations, I'm wondering if there's a point at which the capabilities of salibim are not sufficient and whether you have any suggestions of the types of tooling that people might be able to use in those situations?
[00:34:52] Unknown:
Yes. Yes. Well, for for first of all, let me state that Salabim is is is only an an option, I think, for, for for for for people who have, abilities to to program. It's not for the for the end users. And a lot of the, nowadays, the the the simulation developers are not really programmers anymore. So if on the team, there are no people who can do or want to do that, that that type of program, it's not the right the right package. And then the next step where it might not be, not perform is, is really if the program, if the problem becomes too big, and particularly in processing power, I mean, and that has to do with with the fact, of course, that Python is the definitely not the fastest language in the world.
And then you might get into into trouble. So far in my, experience, it still worked okay. If that doesn't work well, Python, you can still use, Salabim actually, with, with PyPy, which is really excellent. I've done a lot of ex and I've done a number of experiments and I found that under pypi, my models run something like 7 times faster than than under normal interpreter in the normal interpretations. So it's a very nice, performance. And actually I had a there's another package, which is quite popular that runs on the Delphi. And, I've done some benchmarks again, Salabeam with Pypi, compared to this, well, considered quite performing, package, and I find it's only twice as as slower than the, than the other package. So that's not too bad. Well, if Sullivan doesn't work anymore, you'll you'll have to escape to more sophisticated packages that can run on multiprocessors and all that. And that's something I don't support. And I don't think I'm going in the direction in going to, those really high end, simulations. So then you have to really escape to other, to other packages and maybe to go as well, those those very expensive packages that are on the market.
[00:37:16] Unknown:
And what have you found to be the most complicated or difficult aspects of building and maintaining salobem?
[00:37:24] Unknown:
Yes. It has to do with the integration of, of of animation and simulation. And simulation has its own time timeline, and the animation has has has its own time frame. And to synchronize those things is not really is not really easy. And, that was quite complicated to realize. And I also spent quite a lot of time and thinking of what kind of engine graphic, graphic engine I would like to use under, to, to animate, the the processes. And, I had already some experiences Pygame, and that is not too bad actually. But, well, the misses to some of the features I wanted actually. And then I looked at PyQT, but PyQT has the disadvantage of, well, it's quite big package. And, I didn't want to have my, my users install that.
So I then I, I I went to t tkinter, which is is okay. It's I don't consider it as a great package, but it it it works for me. And, so that's the the design was really something, quite complicated. I as I said before, I use PIL, the the Python image library, and the, that's that's a nice package, I must say, but also has some some peculiar things. There are even some bugs in it, which I have to to program around, which was not not always that that obvious. Well, just in general, the API design, what what kind of calls, how would you like to how how would I like to interface with it was not obvious to me in the beginning, and I've changed actually that quite a few times. It's now rather stable, actually, I must say. So that was, was something.
I really wanted to have compatibility with, the Python 2.7, and that gave me some some some trouble. But now we have the same code base for for all the Python versions. And recently, that was quite interesting, and quite, technical challenge, actually. In my tracing, I wanted actually also to trace the line numbers of the of the code where I was in. So, now you can see in the in the trace, you can see exactly at what line process is and where it's activated from and all that. And I had the idea to to do that. I had to, to look into the code for that. And there's a very nice module, the inspect modules, part of the standard library, I think. And, that's, that gave me the option to, to program, this this this functionality.
That's just not always that that obvious. And another thing I but more or less a design consideration, actually, I wanted to keep the the the the dependencies as slow as possible. So in the beginning, I had, for instance, NumPy, in my, in my imports. But now I, I've just just phased that out. So there are hardly any any dependencies. Only TKs are and, but TKs are standard and pillow, the PIL. That's actually the main, the main dependencies I have. And we haven't touched yet that item yet, but maybe nice to, to talk about that as well. This the animation can be also I put it to, to videos. So you can make an MP 4 video, and that's done straight into, into Sullivan. So you can just say video is, and you get the the file name. And then you get a nice MP 4, if you do out of it. And in the beginning, I just made a, a bunch of, of of JPEG, pictures.
And then with FFmpeg, I just just combined them. But now, there's also open CV, also called CV 2. And I just include that, in my, in my dependencies. And then you can just record a video, which is excellent for, for communication with, with people, somewhere else, of course. There's a very nice feature in this open open CV. And if you don't do any video productions, you don't have to include that open CV at all. So it's it's, it's nice and, and clean. You hardly need any any other libraries for that. And then talking about the difficulties, and the challenges is is particularly the the documentation.
As you know, the developers or the developer, they don't really like the, the documentation. Of course, it's important if you want to have some use, some other users. But I found the the docstrings rather good. So I rely on the docstrings, very much, but there's more you need, of course. So I've done I've developed now a pretty expensive set of documentation sphinx. But to get all that up and running, it's it's it's it's not all obvious, and it's also not my my favorite my favorite work. So, still hope to have some other people, going to work on that to help me with that.
[00:42:33] Unknown:
And are there any new features or particular improvements that you are planning to include in future releases of Celebi?
[00:42:42] Unknown:
Yes. Well, first of all, I want to make the animation a bit easier to interface with. There are still some rather complicated calls you have to do, but I think there are some other possibilities. And 1 other thing, it's 1 of my users actually, in the in the community who suggested that and have done some experience with that already. He is apparently trying to or has has implemented. I'm not really sure of the state of that. Integrating this with Blender, this 3 d animation engine. And that might be really great if you if you could do the, the outputs in 3 d, full 3 d and all that.
So I'm definitely going to look into that whether that could be a, an addition, maybe another, an extension in in some way. But that's really on my, on my radar for the next, for the next month. Further, I still consider making some continuous simulations. I'm doing differential equations as well. I'm working together, or in contact with a Belgian chap who was who had made something similar in Julia. And, so I'm looking at whether I could maybe use some of that technology as well in, in Python, well, and other improvements. I am still looking at at other, user interfaces.
Maybe, wx Python is is a possibility and to offer some more facilities for that. And definitely in the in the future, I have to want to improve my manual and have some more tutorial material available for, well, for for new and current users.
[00:44:31] Unknown:
And are there any other topics that you think we should talk about before we start to close out the show?
[00:44:37] Unknown:
Well, we didn't really actually talk about, what type of applications, this type of modeling can be used for. Very typical applications are, well, I've mentioned already ports from where I'm very, very familiar with, but also warehouses, distribution networks. You see a lot of implementation on airports, both for the passenger flows and for luggage handling systems, gate control, and all those those type of things. I've seen a lot of applications in hospital logistics, for distributing, medical material. But even for, the operation, see your turn on that, how to operate that.
So, really a lot of applications, mainly always the, the generic term, that's combined the most logistics, together. And then what's necessary to realize that, simulation such as is is never real production engine, with wells of that exist, but it's it's quite rare. So it's really a research tool. And what what and when do we need as a research tool? Particularly for dimension program, problems. What how big would the, the fleet side be, the fleet size be, what's the optimal speed of vehicles? How do you the outer warehouse? What type of cranes would you install and all that? So that all has to go always with the resources, and and how many and how fast and all that. And then also the control, of those things. What kind of algorithms can you use to to, to control, the, the the resources?
So decision logic in other words. And well, 1 example in my field is for instance, if container comes in into the port, where do you store it? You can store it nearby, but then it's in the way, for other containers. So you can store it far away, but then you need the equipment and all that. So quite complicated algorithms you have to, to design. It has to be implanted later in the production system. And for that type of of, problems, simulation is also extremely useful. And so in other words, just, just most of the time before you implement a new system, reinvest in the new system, or just to redesign, systems in, by implementing new, new algorithms and all that.
[00:47:10] Unknown:
Yeah. It definitely seems like a very useful package for being able to perform the simulations for the sort of logistics problem domain or capacity planning, so I can see a lot of value that people can gain from that. So for anybody who wants to get in touch with you or follow the work that you're doing, I'll have you add your preferred contact information to the show notes. And so with that, I'm going to move us into the picks. And this week, I'm going to choose a coffee grinder that I got recently, it's a burr mill grinder, so it gives a nice consistency of the grounds. And, it's proven quite pleasant to be able to just walk into my kitchen in the morning, hit the button on how much coffee grounds I want and just walk away to get the water started. So, for anybody who's in the market for a new grinder, I'll add the 1 that I got. It's, Cuisinart.
It's relatively inexpensive compared to some of the other options on the market, which can go up to the 100 of dollars if you're so inclined. This 1 was in the sub $100 range, so, pretty happy with the quality for the price. And so with that, I'll pass it to you, Rooj. Do you have any pics for us this week?
[00:48:23] Unknown:
Yes. I have some, well, first of all, I want to mention, Parsonista. Parsonista is the, the well, 1 of them, but in my view, the only good implementation of Pison on, on iOS. And it's really an excellent, an excellent package. It includes an IDE and, it's, it's compatible with Python 2 point 7 and 3.6, support things like NumPy. Unfortunately, .tkinter. But it's, it's an excellent package. It's a, very likely community around it. And I can really recommend, that's, for me, it would be just a reason to buy an iPad actually. Because on, on Android systems, there isn't anything comparable available at all. So I really recommend it. And then I have just just 2 books on my, on my, on my list. And there's 1 I think it's only available as an ebook, Spies and notes for professionals. It's a it's a free book. It's, over, 700 pages of very nice, nicely presented material on, pison covers more or less the whole language.
It seems to be composed of, Stack Overflow articles, but nicely presented and all that, and it's free. So just have a look at it. And this is not really new, but I just looked at my bookshelf and, I can only recommend the book of Fluid Bison by Luciano. And, it's it's a super book, and it covers, quite advanced Python, everything you you will need. And even if you've read it already once or twice, then if you pick it up next time, like I do from time to time, I always find some new and new things, and, it's really, recommended.
[00:50:31] Unknown:
Alright. Well, I appreciate you taking the time out of your day to join me and discuss the work that you've been doing with Salabim. Definitely looks like an interesting package that's solving a useful problem for a lot of people. So I appreciate the time that you've put into that, and I hope you enjoy the rest of your day.
[00:50:49] Unknown:
Thank you very much. And, well, I hope the the readers, the listeners have enjoyed it.
Introduction and Guest Introduction
Interview with Ruud Van Der Ham
Ruud's Journey to Python
Introduction to Salabim
Discrete Event Simulation Explained
Salabim's Features and History
Motivation Behind Salabim
Salabim vs State Machines
Implementation and Evolution of Salabim
Workflow for Creating Simulations
Limitations and Alternatives
Challenges in Developing Salabim
Future Features and Improvements
Applications of Discrete Event Simulation
Closing Remarks and Picks