MASON-INTEREST-L Archives

December 2006

MASON-INTEREST-L@LISTSERV.GMU.EDU

Options: Use Monospaced Font
Show Text Part by Default
Show All Mail Headers

Message: [<< First] [< Prev] [Next >] [Last >>]
Topic: [<< First] [< Prev] [Next >] [Last >>]
Author: [<< First] [< Prev] [Next >] [Last >>]

Print Reply
Subject:
From:
Sean Luke <[log in to unmask]>
Reply To:
MASON Multiagent Simulation Toolkit <[log in to unmask]>
Date:
Mon, 11 Dec 2006 13:49:28 -0500
Content-Type:
text/plain
Parts/Attachments:
text/plain (40 lines)
Last week Mark asked about a bug where simstate.kill() would cause  
chart generators to appear to delete their data.

After poking around I think I've found the source of the problem.   
It's not that the data is going away.  It's that the chart generators  
are receiving a spurious request to update some data at time Infinity  
(which in MASON represents "the simulation is over").  The chart  
generator dutifully adds that timestamp, stretching the space to  
Infinity, and subtly breaking JFreeChart's series mechanism.

It's an easy fix: identify where your chart is being updated and  
check to see if the timestamp is valid.  In ChartingPropertyInspector  
I've fixed it by changing

	        if (lastTime < time || !updatedOnceAlready)
to	
	        if (time >= state.schedule.EPOCH && time <  
state.schedule.AFTER_SIMULATION &&
			 (lastTime < time || !updatedOnceAlready))  // bug fix


If you're following the example in the howto.html file about making a  
programmatic chart, you can change the line

                // now add the data
                series.add(x, y, true);
to

                // now add the data
                if (x >= state.schedule.EPOCH && x <  
state.schedule.AFTER_SIMULATION)
                    series.add(x, y, true);

There's a more subtle, minor, bug that I still have to track down:  
MASON is requesting that elements update themselves at Infinity  
(probably because SimState.kill() advanced the time to Infinity), but  
the Console still shows the next time tick.  I'll mull that over.

Sean

ATOM RSS1 RSS2