Questions tagged [simpy]

A discrete-event simulation framework for Python

SimPy is a process-based discrete-event simulation framework based on standard Python. Its event dispatcher is based on Python’s generators and can also be used for asynchronous networking or to implement multi-agent systems (with both, simulated and real communication).

341 questions
1
vote
1 answer

Pandas: dynamically append dataframe column into a running total dataframe within a loop

I am writing a simulation and I am trying to append the result of EACH ITERATION INTO a dataframe that keep track of all the iterations. While everything works fine with collecting the results, I cannot find a way to append the results into a new…
Murcielago
  • 905
  • 1
  • 8
  • 30
1
vote
0 answers

Multi echelon Inventory simulation using simpy

I am building a Inventory simulation model using Simpy in a multi-echelon environment. However there seems to be some blocking function which is not letting my program proceed beyond time unit 0. A simplified version of my code is: class repl(): …
Ankit Goel
  • 360
  • 1
  • 5
  • 18
1
vote
0 answers

Simpy Resource with no waiting queue

I want a resource to be able to handle 100 processes at a time (parallely). As far as i know i can do this by setting capacity to 100. But I also want this resource not to have any waiting queue. For example lets say resource is in full capacity and…
jdoe
  • 59
  • 10
1
vote
2 answers

How to yield multiple requests but only accept one request in Simpy

Within Simpy, I have multiple resources that can do the same job, but they are different so I can't just increase the capacity. Picture a single queue in a shopping centre that leads to all tellers. Some are manned and some are self serve. I put a…
Dan Bouche
  • 11
  • 1
1
vote
4 answers

Python selecting variables based on condition

I'm wondering whether it is possible to select a variable based on a certain condition/input. For example: day_1 = 5 day_2 = 10 day_3 = 15 i =2 selected_variable = day_i The code would give an error that of course day_i is not defined. I know I…
Aimee Vis
  • 51
  • 2
  • 3
1
vote
3 answers

"ValueError: None is not a generator." in SimPy generator function

I am trying to run a simulation with SimPy. Unlike open systems, since my system is closed, I need to generate a constant amount of entities immediately (10 in my case). So, no interarrival times. The problem is that when I try to generate entities…
Can Evin
  • 21
  • 1
  • 4
1
vote
1 answer

Process yields a Process in Python using Simpy

I'm having a problem with my code. I am using the Simpy for Python and I'm trying to make a P2P simulator utilizing Simpy. Bellow is the code of my generator of peers, I don't know why but I never enter in the function generate(). The console don't…
xGlover
  • 59
  • 7
1
vote
2 answers

What is the easiest way to copy a class instance that contains SimPy processes?

I'm trying to create a copy of a class instance that I can simulate without affecting the original instance of the class. I've tried using copy.copy, but I run into this problem: system.simulate(until=100) print(system.env.now) # prints…
hoffee
  • 470
  • 3
  • 16
1
vote
1 answer

How to change the label color color continuously in python pyqt5

I am new to python and I am trying to learn simpy and pyqt5. I am making some program in which I want to change the label color at every iteration but I dont know why It shows only 1 color. To change the color first i mention green color then black…
1
vote
1 answer

How to forget a customer, if all resources are being used at the time

I have a Server that can serve at-most 3 customers at a time. I have modeled it as a SimPy Resource with capacity=3 as follows. How can I update my code such that whenever a new customer arrives, if all of the server's capacity is being utilized,…
1
vote
1 answer

Requesting a Simpy resource never succeeds

I'm currently trying to model a service counter with SimPy but I'm running into difficulties with using yield to hold the resources. Under the Counter.arrive() function, if the line "yield req" exists, the entire function skips execution (at least I…
Joshua
  • 197
  • 12
1
vote
1 answer

Atom and Jupyter can't find SimPy module installed with pip/pip3

I want to install the SimPy module but when I import it into Atom and/or Jupyter Notebook/Lab it says its not found. When I dod pip list it says that it has been installed. I tried installing via conda install command but it won't install. Error…
Tom Curran
  • 11
  • 1
1
vote
1 answer

Simpy get elements that are waiting for a Resource to be free

I'm working with a simple simulation with Simpy and Python. My goal is to have a resource that can be 1 at the time, and count all the other processes that are waiting for that resource to be free. Example : Person 1 comes, takes the resource.…
Nico Gallegos
  • 321
  • 8
  • 20
1
vote
0 answers

why does this simple interrupt example not work

I recently downloaded and installed Anaconda/Spyder with Python 3.6-64 bit on a Win10 computer and installed simpy to try to learn more about discrete event simulations. I am new to both simpy, python, and object oriented program so my question may…
user19633
  • 11
  • 1
1
vote
1 answer

Simpy: simultaneously release resource on allocation of new resource

I have simplified a version of a problem I am attempting to model where I am using Simpy to describe the movement of travellers along a path. The path is represented by a collection of Node() objects where each node contains a Simpy.Resource. Each…