Category Archives: Simulation

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

Posted in Simulation | Tagged , | Leave a comment

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

Posted in Simulation | Tagged , | Leave a comment

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.

This generates the following output. … Continue reading

Posted in Simulation | Tagged , | Leave a comment

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

Posted in Simulation | Tagged , | Leave a comment

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

Posted in Simulation | Tagged , | Leave a comment

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

Posted in Simulation | Tagged , | Leave a comment

A Simple Discrete-Event Simulation: Part 8

Today I automated the generation of entity IDs. First we create a basic counter.

Then we change the entity declarations to remove the explicit assignment of IDs as we have been doing.

That was pretty mindless, so let’s … Continue reading

Posted in Simulation | Tagged , | Leave a comment

A Simple Discrete-Event Simulation: Part 7

Today we’ll do some more streamlining. We’ll start by adding a new function to the futureEventsQueue object.

Then, instead of having to specify the “absolute” (vs. “advance”) flag in the initialization of a new entity object, we know we’ll … Continue reading

Posted in Simulation | Tagged , | Leave a comment

A Simple Discrete-Event Simulation: Part 6

Now that I’m sure the basics are working the way I’d like I want to see if I can streamline things some more. The first thing to do is recognize that the next item being pulled off the future events … Continue reading

Posted in Simulation | Tagged , | Leave a comment

A Simple Discrete-Event Simulation: Part 5

Adding a second entity works correctly.

104 minutes entity 1 created at time 0 entity 2 created at time 0 entity 1 updated at time 11 entity 2 updated at time 13 entity 1 updated at time 21 entity … Continue reading

Posted in Simulation | Tagged , | Leave a comment