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
3
votes
2 answers

How do I interrupt or cancel a SimPy Timeout event?

I want to create a timer with a callback that can be interrupted or reset using SimPy. If interrupted, I do not want the callback to be executed, and if reset, I want the timer to restart with the same delay from env.now. This seemed like an easy…
bbengfort
  • 5,254
  • 4
  • 44
  • 57
3
votes
4 answers

simpy resource availability schedule

I'm using SimPy in Python to create a Discrete Event Simulation that requires resources to be available based on a schedule input by the user in my case in a csv file. The aim is to represent different numbers of the same resource (e.g. staff)…
Pete
  • 767
  • 3
  • 9
  • 16
3
votes
1 answer

How can I have a process wait for multiple resources?

I am currently using SimPy to model and simulate a server process and I would like this process to execute a different action depending on where it receives this message from. The SimPy documentation shows how to wait for multiple events: Ex: yield…
user2059807
  • 671
  • 1
  • 5
  • 16
3
votes
1 answer

SimPy Resource of 3 where each has different characteristics

I am trying to simulate a situation where we have 5 machines that occur in a 1 -> 3 -> 1 situation. i.e the 3 in the middle operate in parallel to reduce the effective time they take. I can easily simulate this by create a SimPy resource with a…
Alarr
  • 121
  • 2
  • 11
3
votes
3 answers

Simpy 3: Resources.Resource.request()/.release() WITHOUT 'with...as:'

I'm trying to add SimPy simulation to a project I'm working on and I have some confusion about version 3's release/request. I was able to implement resources using a 'with'-block without trouble but in my situation I want to request/release a…
Cactusman
  • 335
  • 3
  • 12
2
votes
1 answer

Why is the mean reward per episode of my PPO and DQN decreasing over time?

I am training an RL agent to optimise dispatching in a job shop manufacturing system. My approach is based on this code: https://github.com/AndreasKuhnle/SimRLFab. It migrates the environment to a gymnasium environment and updates the Python version…
2
votes
1 answer

Simulate battery charging in real time with python simpy

I'm trying to do a simulation with simpy for a battery charging. The parameters needed are the battery capacity (W), the state of charge of the battery (in percentage) and the charging power of the charger (W/h) My code looks like this: import…
Geo30
  • 99
  • 1
  • 6
2
votes
2 answers

How to terminate simulation in SimPy 4

Is there a way to terminate the simpy simulation by using a command like env.exit()? I don't understand how to place an event into env.run(until=event). I want to terminate the simulation when there are no objects left in my certain Simpy Stores.…
RookieScientist
  • 314
  • 2
  • 12
2
votes
0 answers

Simpy process - can not use the generator send method?

Background SimPy process is said to be a generator in the document, which I expected to have the send method as in PEP 342. Docs » SimPy in 10 Minutes » Basic Concepts Processes are described by simple Python generators. You can call them process…
mon
  • 18,789
  • 22
  • 112
  • 205
2
votes
1 answer

Simpy - setting resource requests at specific times

I am trying to model a system where after a process is defined, there are two sets of resource requests. Following an initial intake of the original process, a set of new resource requests are immediately requested. This is straightforward and is…
ramzeek
  • 2,226
  • 12
  • 23
2
votes
0 answers

How to find a solution for a non-linear equation in python using ifelse defined function

I am encountering a problem solving a nonlinea equation using nsolve from the python simpy package, this problem was easily solved in R, below the code I use in R and what I am trying in python: R : library(dplyr) library(plyr) sol = adply(df,1,…
2
votes
2 answers

simpy traffic light simulation

I am trying to simulate a circular road with a series of traffic lights in sequence. Vehicles enter the system via a Poisson process. Once in the system, they queue at each light. It takes one time unit for them to go through each queue. They exit…
lewis500
  • 89
  • 6
2
votes
1 answer

How do i make a priority get request from resource store

In simpy, I'm using the store as my resource due to the nature of the problem. I have a few get request for a store item. However, some get request have higher priority and I wish for it to be processed first. I do not wish to follow the FIFO rules…
Nic
  • 44
  • 3
2
votes
2 answers

Discrete Event Modelling - Simpy - how to model complex dependencies?

I am new to Simpy and I am having troubles figuring out how to model a process scheduler that has complex dependencies. High-level summary of my problem: I have a warehouse that receives boxes containing items through an entrance. The boxes are put…
Radu
  • 1,098
  • 1
  • 11
  • 22
2
votes
2 answers

How can I iterate a SimPy simulation in parallel?

I have a SimPy model that returns a random result which I would like to replicate many times. Each replication is independent so to make it faster I'd like to run them in parallel. I've tried Python's multiprocessing, Pathos multiprocessing, and…
hoffee
  • 470
  • 3
  • 16
1
2
3
22 23