-
Recent Posts
Recent Comments
- R.P. Churchill on TWSL Series 07: Discovery and Data Collection
- R.P. Churchill on A Simulationist’s Framework for Business Analysis: Round Two
- LN on A Simulationist’s Framework for Business Analysis: Round Two
- R.P. Churchill on Starting to Learn About the Java Memory Model
- R.P. Churchill on Multidimensional Arrays in Javascript
Categories
Meta
Monthly Archives: September 2016
A Simple Discrete-Event Simulation: Part 17
Today I added an animation to the simulation. There are a lot of things that could be said about this, and I’ll go into just a few of them today. At this point I wanted to get some kind of … Continue reading
A Simple Discrete-Event Simulation: Part 16
So far I’ve been discussing ways of generating arrivals according to a specific schedule. There’s another way to do it, based on the Poisson distribution. From Wikipedia: The Poisson distribution is an appropriate model if the following assumptions are true. … Continue reading
Posted in Simulation
Tagged discrete-event sim project, JavaScript, math, Poisson distribution
Leave a comment
A Simple Discrete-Event Simulation: Part 15
Today I wanted to describe a few additional methods for generating arrivals over a given time span. Last week we divided the arrivals evenly over the span without placing any at the beginning or end. The next possibility is generating … Continue reading
A Simple Discrete-Event Simulation: Part 14
Today I modified the entry component so it creates new entities according to a supplied schedule. This can be made as complex as we’d like but let’s keep it simple for now: the input parameters are the duration of each … Continue reading
A Simple Discrete-Event Simulation: Part 13
Today I wanted to streamline the code in the activate method for the entities that apply the advance command. I started by breaking the code in the series of if statements out into separate methods, which at least makes things … Continue reading
A Simple Discrete-Event Simulation: Part 12
Today I wanted to start constructing an Entry component. I created a very simple on that generates modeled entities are regular, defined intervals over the duration of the simulation run. Here’s the relevant code.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
//time to end the entire simulation var endSimTime = 1440.0; //time increments in minutes, run for 24 hours //collection of all entities in the system var setOfEntities = new Array(); //Entry component function entryComponent(arrivalsPerHour) { //initially assume it just generates entity1s that disappear after a single cycle this.entityID = getNewID(); this.initialTime = 0.0; this.incrementTime = 60.0 / arrivalsPerHour; this.endTime = endSimTime; this.nextState = "increment"; feq.newItem(globalSimClock,this); //assume all components created at time zero this.generateNewEntity = function() { var newEntity = new entity1(globalSimClock,2.0,globalSimClock+1.0); setOfEntities.push(newEntity); } this.activate = function() { if (this.nextState == "increment") { this.generateNewEntity(); //<<<< this one line does all the meaningful work <<<< displayProgressText("Entry component "+this.entityID+" generates new entity at time "+globalSimClock+"<br />"); if (globalSimClock + this.incrementTime >= this.endTime) { this.nextState = "destroy"; } advance(this.incrementTime); } else if (this.nextState == "destroy") { displayProgressText("Entry component "+this.entityID+" terminated at time "+globalSimClock+"<br />"); } else { alert("Entry component "+this.entityID+" went into undefined state"); displayProgressText("entity "+this.entityID+" in undefined state at time "+globalSimClock+"<br />"); } } }; //entryComponent var entry1 = new entryComponent(2.0); |
This generates the following output. … Continue reading
A Simple Discrete-Event Simulation: Part 11
Now that we have a couple of basic mechanisms in place for building discrete-event simulations let’s apply them to some actual components we can use to represent something real. A very simple system might consist of the following four components … Continue reading
Art, Waste, and a Rumination on Economics
I’m going to table the work on the discrete-event simulation today in order to discuss a public art critique I attended last night. The gallery featured a few pieces of the works of two artists, Jessica Burnam and Eric Celarier, … Continue reading
A Simple Discrete-Event Simulation: Part 10
Today I defined some new entities that better illustrate the operation of the wait mechanism and the current events queue, which I have modified so it scans the list of current items repeatedly until no conditions are met. Here’s the … Continue reading
A Simple Discrete-Event Simulation: Part 9
It’s one thing when you place an entity back in the future events queue at a specific absolute or relative time, but it’s quite another if you want an entity to become active when a certain condition–or set of conditions–becomes … Continue reading