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

Simpy - when to use yield and when to call the function

I am trying to use Simpy to model some behavior of moving cars around a city grid. However, I am having some trouble wrapping my head conceptually around when to use something like yield self.env.timeout(delay) or yield…
noblerare
  • 10,277
  • 23
  • 78
  • 140
1
vote
0 answers

Getting multiple items from a FilterStore [Python][Simpy]

I am using Python and Simpy for a simulation. In the simulation jobs are processed by resources. Some jobs require a single resource, other jobs require multiple resources. I would like to retrieve (get) multiple resources at once therefore…
nkz
  • 165
  • 9
1
vote
1 answer

Converting from SimPy2 to SimPy3

I am trying to simulate customers going to a bank. And I want to print the average length of the queue, and each value pair of time a request begins and the pairs [time of request or release, length of queue] I am aware that there is no monitor…
Matthew Ciaramitaro
  • 1,184
  • 1
  • 13
  • 27
1
vote
1 answer

Running a Simpy simulation until a given value

I'm new to SymPy (3.0.8) and would like to run a demo simulation 'conference attendee' until a give value (250), i.e. run until talk 7 (3 talks, 1 break, 3 talks, 1 break, 1 talk). 3*30 + 15 + 3*30 + 15 + 1*30 = 240 But the simulation ends after 3…
René
  • 4,594
  • 5
  • 23
  • 52
1
vote
1 answer

Use SimPy to simulate Chord distributed system

I am doing some research on several distributed systems such as Chord, and I would like to be able to write algorithms and run simulations of the distributed system with just my desktop. In the simulation, I need to be able to have each node…
flintlock
  • 97
  • 7
1
vote
2 answers

Simpy: simulation with two types of processes

I want to make a simulation of a store with two types of customers: a normal customer and a VIP. I don't want to serve these customers FIFO. Instead - no matter what the queue looks like - I want to serve a VIP with chance p and a normal customer…
Ricardo
  • 335
  • 1
  • 4
  • 13
1
vote
1 answer

Simpy: Add process during runtime

Is there a way to add a SimPy process to a SimPy environment when the latter is already running? The context is as follows: I have successfully implemented a queueing network for a traffic system using SimPy, where cars are propagated across links.…
Unis
  • 614
  • 1
  • 5
  • 17
1
vote
1 answer

How does a computer store, sort and process the events during a simulation implemented with with Simpy?

I'm facing a synchronization problem in Simpy. By that, I mean that events are not processed by the computer in the order I would like to. I have been looking a lot for more information than that already in Simpy documentation about how events are…
1
vote
1 answer

Simpy how to access objects in a resource queue

I am moving code written in Simpy 2 to version 3 and could not find an equivalent to the following operation. In the code below I access job objects (derived from class job_(Process)) in a Simpy resource's activeQ. def select_LPT(self, mc_no): …
1
vote
1 answer

Simpy Store Batch Processing

I'm trying to create a producer/consumer simulation where the consumer processes items in batches. The problem is that the Store.get() function removes items from the Store as soon as it is called, but I need it to wait until I've called…
sheridp
  • 1,386
  • 1
  • 11
  • 24
1
vote
2 answers

How to split up dependent events in SimPy

I want to implement a discrete-event maintenance scheduling simulation in which some maintenance activities must happen whenever another one happens. For example, if walls are repainted every 5 years, and dry-lining is replaced every 14 years, then…
Jamie Bull
  • 12,889
  • 15
  • 77
  • 116
1
vote
1 answer

disambiguating simpy multi event results

I am trying to code a simple multiplexer in simpy as part of a network modelling exercise. What I have is two stores, s1, and s2 and I wish to do a single yield which waits for one or both of s1 and s2 to return a 'packet' via the standard…
djpwilk
  • 13
  • 3
1
vote
1 answer

how can I set priority on simpy process callbacks?

The default order in which processes are triggered in simpy seems to rely on the order they were created? I want to expressly rank processes so they are triggered in a precise order, regardless of when they were created. If you need an example,…
Dave Bodoh
  • 23
  • 5
1
vote
2 answers

How does one identify the time consuming tasks in a SimPy simulation?

I would like to speed up a SimPy simulation (if possible), but I'm not sure the best way to insert timers to even see what is taking long. Is there a way to do this?
josiekre
  • 795
  • 1
  • 7
  • 19
1
vote
1 answer

Multiple Conditional Events

I have a collection of resources. An incoming process would require a set of resources. For example, let's say I have resources A, B, C, and D in the collection and a process comes along asking for resource A, B and D; I would like the process to…
Aseem Awad
  • 173
  • 1
  • 9