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 2 updated at time 26
entity 1 updated at time 31
entity 2 updated at time 39
entity 1 updated at time 41
entity 1 updated at time 51
entity 2 updated at time 52
entity 1 updated at time 61
entity 2 updated at time 65
entity 1 updated at time 71
entity 2 updated at time 78
entity 1 updated at time 81
entity 2 updated at time 91
entity 1 updated at time 91
entity 1 terminated at time 101
entity 2 terminated at time 104

Posted in Simulation | Tagged , | Leave a comment

A Simple Discrete-Event Simulation: Part 4

Here is code that actually runs. It creates a single entity, then updates it in a loop until the ending time is exceeded. The next steps will be to see how it works with multiple entities of the same kind and then with entities of different kinds.

This example is quite trivial so far. It doesn’t do a thing that’s meaningful but we can see the underlying mechanisms building up. It should get interesting quickly enough.

I also had to modify the getFirstItem method in the futureEventsQueue object. It has to test whether the returned array is of zero length, which indicates that the future events queue is empty.

Here’s the browser output, now that I’ve started to build something the user can see via HTML. The first line is a clock that gets updated with each event. The remainder is a block that logs all the events, which in this case involve only a single entity.


101 minutes

entity 1 created at time 0
entity 1 updated at time 11
entity 1 updated at time 21
entity 1 updated at time 31
entity 1 updated at time 41
entity 1 updated at time 51
entity 1 updated at time 61
entity 1 updated at time 71
entity 1 updated at time 81
entity 1 updated at time 91
entity 1 terminated at time 101

Posted in Simulation | Tagged , | Leave a comment

A Simple Discrete-Event Simulation: Part 3

Here is an entity object that knows how to be created and activated from external calls. It updates itself and puts itself back into the future events queue is appropriate. This is in keeping with my original concept of how an entity would work. The key, of course, is to keep rewriting and simplifying this thing until more and more of the mechanics are hidden from the coder. Languages like SLX do this implicitly, but if we’re building a framework from scratch, given the limitations imposed by JavaScript, there’s only so far we’re going to be able to go with that. Still, it’ll be fun to see how far we get.

In the meantime the forms here mean I’ll have to streamline some of the existing code. Since the state information is all kept within the entity itself it no longer has to be kept with the future events queue elements (since those elements contain a reference to the entity), so those data structures and calls will be pruned.

I’ll make this all run tomorrow, but here’s the rough code for now:

Posted in Simulation | Tagged , | Leave a comment

A Simple Discrete-Event Simulation: Part 2

Today I’ve added the ability to retrieve the first item from the future events queue, which is the next item to process and that with the lowest activation time. In this case I just update the item’s time when it’s retrieved, then insert it back into the future events queue wherever it belongs. In the example it goes to the end of the queue with a time of 55.

Note that I’ve updated that state values, though I haven’t defined how they’re going to work yet.

I added an update function to the futureEventItem object. I added the functions getFirstItem and insertExistingItem to the futureEventsQueue object. Finally, I added some calls to exercise the new capabilities down at the bottom.

The console output again indicates that things are working as expected.

Number of events in queue: 0
Array size: 1
reportItemInfo: element: [object Object] index: 0 arr: [object Object]
Time: 40 ID: 333 Prev: prev1 Next: next1
Number of events in queue: 1
Array size: 2
reportItemInfo: element: [object Object] index: 0 arr: [object Object],[object Object]
Time: 30 ID: 444 Prev: prev2 Next: next2
reportItemInfo: element: [object Object] index: 1 arr: [object Object],[object Object]
Time: 40 ID: 333 Prev: prev1 Next: next1
Number of events in queue: 2
Array size: 3
reportItemInfo: element: [object Object] index: 0 arr: [object Object],[object Object],[object Object]
Time: 30 ID: 444 Prev: prev2 Next: next2
reportItemInfo: element: [object Object] index: 1 arr: [object Object],[object Object],[object Object]
Time: 40 ID: 333 Prev: prev1 Next: next1
reportItemInfo: element: [object Object] index: 2 arr: [object Object],[object Object],[object Object]
Time: 50 ID: 555 Prev: prev3 Next: next3
Number of events in queue: 3
reportItemInfo: element: [object Object] index: 0 arr: [object Object],[object Object]
Time: 40 ID: 333 Prev: prev1 Next: next1
reportItemInfo: element: [object Object] index: 1 arr: [object Object],[object Object]
Time: 50 ID: 555 Prev: prev3 Next: next3
Number of events in queue: 2
Array size: 3
reportItemInfo: element: [object Object] index: 0 arr: [object Object],[object Object],[object Object]
Time: 40 ID: 333 Prev: prev1 Next: next1
reportItemInfo: element: [object Object] index: 1 arr: [object Object],[object Object],[object Object]
Time: 50 ID: 555 Prev: prev3 Next: next3
reportItemInfo: element: [object Object] index: 2 arr: [object Object],[object Object],[object Object]
Time: 55 ID: 444 Prev: prev1a Next: next1a
Number of events in queue: 3

Posted in Simulation | Tagged , | Leave a comment

A Simple Discrete-Event Simulation: Part 1

Some months ago I discussed some internal features of a discrete-event simulation. My next series of exercises and ruminations will proceed toward building one in JavaScript, using the simple pseudo-construct I outlined in the linked post.

I’ll start with the creation of a future events queue. Since the point is to get something running in a reasonably brief series of posts I’ll keep it simple. There are many ways to make a future events queue more efficient, but for our purposes we’ll create one with a straightforward insert/pull structure. That is, it’ll be a single list of items, sorted by time (we’ll assume items occurring at the exact same time are processed in the order in which they were added to the queue, in one dimension.

Here’s a rough bit of code I worked out a while ago.

This code generates the following output to the console, which indicates that the basic insertion mechanism is working.

Number of events in queue: 0
Array size: 1
reportItemInfo: element: [object Object] index: 0 arr: [object Object]
Time: 40 ID: 333 Prev: prev1 Next: next1
Number of events in queue: 1
Array size: 2
reportItemInfo: element: [object Object] index: 0 arr: [object Object],[object Object]
Time: 30 ID: 444 Prev: prev2 Next: next2
reportItemInfo: element: [object Object] index: 1 arr: [object Object],[object Object]
Time: 40 ID: 333 Prev: prev1 Next: next1
Number of events in queue: 2
Array size: 3
reportItemInfo: element: [object Object] index: 0 arr: [object Object],[object Object],[object Object]
Time: 30 ID: 444 Prev: prev2 Next: next2
reportItemInfo: element: [object Object] index: 1 arr: [object Object],[object Object],[object Object]
Time: 40 ID: 333 Prev: prev1 Next: next1
reportItemInfo: element: [object Object] index: 2 arr: [object Object],[object Object],[object Object]
Time: 50 ID: 555 Prev: prev3 Next: next3
Number of events in queue: 3

Posted in Software | Tagged , | Leave a comment

My Favorite Player in the NFL Hall of Fame

My first football hero, Larry Brown, Jr., is still my favorite player. He didn’t stay healthy enough to actually be elected to the NFL Hall of Fame, but if they’d had the medical technology they do now he might have been able to come back from having his knee torn up all the time. He wasn’t the biggest guy or the fastest guy, and I didn’t appreciate what he was doing at the time, but video of his playing days shows that he ran with as much heart and disregard for personal safety as anyone ever has. George Allen was a defensive coach so he tended to play it close to the vest on offense. That meant handing the ball to Brown about a million times a game and letting him hurl his body into the opposition. Everybody in the stadium knew it was coming, but on balance it was more effective than it had a right to be.

This was not a smart way to treat such a valuable asset; by his fourth year in the league you can see he’s practically running on one leg.

Even so, he was only the second player in league history to run for 5,000 yards in his first five seasons (a feat O.J. Simpson matched the same year with his 2,000-yard season). He didn’t get much farther than that, and he isn’t remembered as much as he should be (in my opinion), but I was happy to see him included in this picture when I pulled into Canton, OH.

Granted, the picture is of his efforts being largely thwarted as the Dolphins defeated the Redskins in Super Bowl VII to complete their perfect season, but it made this fan happy to see him remembered at all. Brown was the NFL’s Offensive Player of the Year that year, despite missing the final two regular season games to injury. I think about him sometimes when things get tough.

Posted in Life | Tagged , , | Leave a comment

A New Record! For This Trip, Anyway.

Today I didn’t have anything to do but drive, drive, and drive some more. I took it easy, sat back, drove a bit slower, listened to some XM radio and audio books, and let the miles roll by–over 800 of them. I ended the day near Dayton, OH, home of the Wright Brothers and the always impressive Air Force Museum. I’d been there a few times before and was in a hurry to get home, so I didn’t visit, but if you ever get the chance it’s something well worth seeing at least once. Allow plenty of time if you do go–it’s big!

Posted in Life | Tagged | Leave a comment

And Now For Something Completely Less Serious!

Wednesday saw the turn home really pick up steam, but it wasn’t without frivolity. I hit the UFO Museum in Roswell, NM first thing in the morning. The best thing I saw there was patrons wearing tinfoil hats, which you could apparently get at one of the other gift shops in town.

I picked up some spray paint on the way out of town so I could help my mascot let everyone know he’d been to the Cadillac Ranch in Amarillo, TX. This, boys and girls, is as cheesy (and All-American-ly wonderful) as it gets!

Posted in Life | Tagged , | Leave a comment

Biosphere 2 and a Small Bonus!

I had pre-positioned in Tucson where, after a brief deluge that was almost the only rain I’d seen, I finally got to visit Biosphere 2, which I’d wanted to see since it was built. I’d been in the area a few times doing discovery and collecting data for border crossings, but had never taken the time to stop in. Along with the perpetual sunset as I pulled into Yellowknife at midnight, it was probably the highlight of the trip.


The view as you walk in from the parking lot. I’m a sucker for space frames, metal and glass, and futuristic architecture, so it had me at “Hello!”


Here’s how the interior was laid out, with the five biomes, the agricultural section, and the living quarters. (Picture borrowed from this TED talk.)


The agriculture sections have been converted to experimental bays. The movement and behavior of moisture is under investigation in this one.


A river runs through the savanna biome, toward the desert in the background. I’m guessing this was more densely planted during the initial missions.


Here’s the beach end of the ocean biome.


The marsh biome was at the far end of the ocean. I never got a decent picture of it from inside.


You don’t really get a feel for the space in the rather large rainforest biome, though this picture suggests that it goes on for a bit in the background. There’s a waterfall in there somewhere.


The fog desert biome looked rather different in every direction. This was my favorite angle.


This was my favorite interior shot, which gives you a feel for the space, and has lots of that lovely metal and glass and space frame-y stuff.


The desire may have been to create a stable interior environment where the sections interact and maintain themselves naturally, but the extant reality means that some help was needed. The tanks, pipes, valves, pumps, filters, and control hardware reminded me of all the time I spent in paper and steel mills. I was right at home down there!


One of the most interesting features of the complex was the “lung”, a huge diaphragm that allowed the interior volume to vary so the interior pressure could equalize with the exterior pressure. Without this feature the glass window sections would be blown in or out. The diaphragm (or perhaps the entire lung enclosure) is about 180 feet across. The metal disk in the center is heavy at 16 tons and moves up and down by tens of feet. The diaphragm itself is four tons or rubber.


Opening the door allows huge volumes of air to escape the lung interior. You can see the disc lower significantly.


Here’s the back side of the complex and the exterior of one of the lungs. A second lung is available as a backup, but it has apparently never been used.


Another view along the outside. The rainforest is in the foreground and the desert in the distance.


The ocean can been seen from the outside through a window. We were told that the goal is not to run an aquarium but a more natural system, thus the cloudiness of the water. Interestingly, some scuba divers were practicing for certification in the ocean during the tour.


I really enjoyed the faux New Mexican adobe look of the complex of service buildings on the site. They really added to the ambiance of the place.


After imbibing all of Biosphere 2 I headed west to Roswell. This took me through my old stomping grounds in Alamogordo, NM. I stayed with my Army test platoon at Holloman Air Force Base on and off for several months and trained and participated in tests up north. We’d often stop at this Sonic in the evenings and I relived happy memories of chili cheese coneys and root beer floats. (I chose to pass on the onion rings…)

Posted in Life | Tagged , , | Leave a comment

Arcosanti, my old friend…

I’ve come to talk with you again…

From the Grand Canyon I made it down to one of my favorite places ever, Arcosanti, in time to catch the last tour of the day. I’d made previous pilgrimages here in 1991 and 2004 and was happy to stop in again.

entrance

2004

2016

I first learned about the place in a film strip (remember those?) in Mr. Horst’s Sociology class during my junior year in high school. I can’t say I remember exactly how it was described, though I’m sure it had something to do with experimenting with different ways of having people live and work together. What really set me on fire was the visually striking nature of the architecture itself. As I learned later, designer Paolo Soleri‘s concept was called an arcology, a portmanteau of “architecture” and “ecology.”

pathways

green space

visitor center interior

His idea is to create urban spaces with high population density and low environmental footprint. The high population density is achieved by tucking large numbers of smallish living spaces together in a limited footprint. This is made interesting by creating lots of variations in spaces, levels, connections, and textures. The low environmental footprint is achieved in several ways. One is by integrating residential, commercial, and industrial activities into the same space, which reduces the need to commute long distances for work and commerce. Another is integrating passive solar and wind features into the structures themselves by using apses, vaults, thermal flywheel effects, convection guides for air movement, breezeways, and so on.

The complex is built along the top of a south-facing ridge to take advantage of the motion of the sun. This model shows the completed section of the complex in gray and the latest proposed expansion, which could support a population of 5000 (residentially at least, I’m not sure the industry would scale as well in this design), in white. The truth is that no major construction has been undertaken in at least ten years and the State of Arizona has pulled the organizations building permit. In typical fashion the extant building codes are geared towards standard construction techniques anyway, and don’t really allow for the type of work envisioned for the site.

model

aphitheater

The aforementioned industry involves the casting of metal and ceramic wind chimes, which fund a respectable portion of the Cosanti Foundation’s work. The casting is done by hand in the outdoor apses using the fine sand collected from the valley floor. I believe the remainder of the funding comes from workshop fees, rentals of public and performance spaces in the main vault and amphitheater, donations, grants, public tours, and other sales from the gift shop, bakery, and cafe.

ceramic casting in apse

Soleri bells in the gift shop

the vaults

I have no doubt that the workshop participants, often architects, designers, and urban planners in training, get a lot out of their experiences. The ones I’ve talked to during previous visits have always been excited about the concepts and the work they got to do. The current population is in the mid-90s and includes some children. All of the adult residents work for the Foundation in various capacities under the (co-)leadership of Soleri’s successor, Jeff Stein, AIA.

The concepts explored at Arcosanti have informed research into space colonization, establishing colonies at sea, and urban design. They have been incorporated into science fiction, games, and other areas and have had a notable effect on the larger culture, so in that regard Soleri’s work has been a success. This is in contrast to the feeling some people get when visiting the site itself, which feels rather isolated, drab, run down, and kind of past it. One wonders why the founders didn’t seek investors, build the thing out, get it running, and go on and replicate the process elsewhere. If the ideas were so great then the whole program should be a rousing success, right? Well, someone might do that at some point, but the project was also the brainchild of one individual. Who can blame him for doing things the way he envisioned them, more or less on his own? On balance he made it work, and even if I might have wanted more, that’s something I can appreciate and respect.

Posted in Economy and Society | Tagged , , , | Leave a comment