Subject: | |
From: | |
Reply To: | |
Date: | Mon, 10 Jan 2011 12:37:54 -0800 |
Content-Type: | text/plain |
Parts/Attachments: |
|
|
I've just discovered the MASON framework and have started writing my
first simulation. I have constructed a grid of nodes (held in a
SparseGrid2D) and connected them in a Network. Now what I'd like to do
is allow nodes to send packages to each other along the edges in the
network, and I'm thinking about how best to accomplish this.
I want the time it takes for a package to traverse an edge to be
proportional to the edge's weight (held as the Edge's info Object). So
far what I've come up with is a class to represent the package and a
Steppable that counts down time for the package. When the package
figures it has arrived, it stops the corresponding Stoppable and then
delivers itself to the receiving node. This requires that the sending
node have access to the SimState (so it can schedule the Steppable and
hand the Stoppable to the package). All this entangled knowledge of
the sim feels inelegant, though. Is there a cleaner way to do this?
I'd kind of like to be able to have the originating node construct the
package and hand it off to the edge, which would deal with keeping
track of packages en route and delivering the packages to the node at
the other end.
|
|
|