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
0 answers

Capture 1 resource from a request of many resources: easier approach?

I am relatively new to Python and very new to Simpy. I am trying to build a model of a hospital system that: Has roughly 20 resources (units) where each resource has a capacity of 5 to 50 (beds) Not all units can serve the same patients. They…
DapperDanh
  • 555
  • 2
  • 5
  • 17
1
vote
1 answer

Python SimPy - Request resource for certain time, if not given then quit

So basically, to request a resource and while it's waiting, if there is no resource given to the request for X seconds, we basically don't do anything.. "customer did not get help" etc. From their example code: print('%s arrives at the carwash at…
PPP
  • 11
  • 1
  • 2
1
vote
1 answer

What could be casuing the simpy exception 'No scheduled events left but "until" event was not triggered'?

I am working on a larger simulator (Mocasin) that uses the simpy discrete event simulation framework. The simulator mostly works correctly, but for some larger problems I get an error like this: Traceback (most recent call last): File…
1
vote
0 answers

SimPy: Is it possible to create an Exclusive OR (OneOf) alternative to AnyOf which allows only one process to be triggered?

I would like to be able to trigger exactly one process in a list, and interrupt the other processes in the list. In the example below I want to trigger either A or B, but never both. The example below works, fine except when waitingtimeA =…
Nick P
  • 11
  • 1
1
vote
1 answer

How to know which resource is being used when using SimPy's AnyOf method?

In my program, agents need to use some specific resources. I want to call all of the resources that are assigned for an agent at the same time and use the first available one. Think about 3 servers and 4 agents. agent1 can use server1, agent2 can…
RookieScientist
  • 314
  • 2
  • 12
1
vote
1 answer

Can I get 'until' parameter value at runtime?

I have been wondering whether it is possible to extract value of 'until' parameter passed to simpy.run() method at runtime. It is probably possible to around this issue by storing this value elsewhere, but it may be I am just curious if simpy…
Fly_37
  • 312
  • 1
  • 12
1
vote
1 answer

Python did not run function with infinite loop

I am still quite new to python. Lately, playing with simpy module I encountered some strange behaviour by python interpreter. I implemented .flood() function and it is supposed to be a part of simulation. To my surprise, the debug inside of it was…
Fly_37
  • 312
  • 1
  • 12
1
vote
1 answer

Can you make a recursive simulation with simpy

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…
AbhiCoder
  • 13
  • 4
1
vote
2 answers

Creating as many events as needed in Simpy simulation

I am working on a python simulation using Simpy but I am having somewhat of a brick wall. The simulation has an arrival process and a shipping process. The goal is to ship as many orders as they arrive and not leave orders waiting. This code gives…
nesquess
  • 39
  • 4
1
vote
0 answers

SimPy - infinite run time bug

I have observed some "odd" behaviour with SimPy event scheduling. When a nan value, is used as the delay in the env.timeout method, it sometimes, overwrites the until = XXX parameter inside the env.run method. I have outlined a minimal example, to…
Hector Haffenden
  • 1,360
  • 10
  • 25
1
vote
0 answers

Can I create and store a snapshot of a simpy simulation?

I am building a simulation of a production process using simpy and an agent (Heuristic or Reinforcement Learning via tensorforce) that allocates orders to stations in the production system. Every simulation starts with an empty production system…
OPFx
  • 11
  • 1
1
vote
0 answers

Does Python With provide concurrent synchronization monitor?

Background Reading SimPy Shared Resources where with statement is used to acquire resources shared among multiple running SimPy processes. The car will now drive to a battery charging station (BCS) and request one of its two charging spots. If both…
mon
  • 18,789
  • 22
  • 112
  • 205
1
vote
1 answer

How do I make Simpy simulation to depict a markovian M/M/1 process?

output printing the len of arrival and service timesI am trying to implement an M/M/1 markovian process with exponential inter arrival and exponential service times using simpy. The code runs fine but I dont quite get the expected results. Also the…
1
vote
0 answers

Python, Simpy: pause function for a period for the time when another function is being executed

Using simpy I want to implement a simple queueing simulator, in which packets are processed in batches of a given size. In order words: I want to have a simulator in which packets are sent (the packets are send at some random intervals). When the…
Ziva
  • 3,181
  • 15
  • 48
  • 80
1
vote
0 answers

Python Simpy: Using two ressources in parallel

Greetings StackOverflow Community! I have a question regarding the SimPy framework in Python: Here is a very simple code example for cars continously arriving at a charging station and get charged at one of the two available charging spots and then…
Soda
  • 89
  • 1
  • 8