adding nodes to a runnig simulation of a network

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

adding nodes to a runnig simulation of a network

Igor Nikolic
Hello all,
It seems that there was a problem with the mailserver on my side while
sending this message to the list, so here it is again. If you did
actually recieve it, my appologies for that.
igor


Hello,

I have the following problem.

The simulation starts with a  several nodes that are unconnected. As the
simulation progresses, at each step an agent is added to the agentList.
When certain conditions are met, one of the new nodes is connected to
the existing nodes.

While the nodes are added, I do not see them appear in the display. At
the moment that the node is connected, an exception  is thrown.

There are a number of toppic in the email archive dealing with this, and
the advice seems to be, make sure that he edges are added correctly. So
according to that advice I use the following edge code :

 Stream stream = new Stream();
       stream.setFrom(from);
       stream.setTo(to);
       stream.setColor(color);
       from.addOutEdge (stream);
       to.addInEdge (stream);

Stream extrends DefaultDrawableEdge and the Agent ( to and from are
instances of Agent) DefaultDrawableNode

So that seems to be OK.

The exception thrown is :
java.lang.NullPointerException
   at
uchicago.src.sim.gui.Network2DDisplay$NormalDrawer.drawDisplay(Unknown
Source)
   at uchicago.src.sim.gui.Network2DDisplay.drawDisplay(Unknown Source)
   at uchicago.src.sim.gui.LocalPainter.paint(Unknown Source)
   at uchicago.src.sim.gui.DisplaySurface$DUpdate.run(Unknown Source)
   at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:171)
   at java.awt.EventQueue.dispatchEvent(EventQueue.java:454)
   at
java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:201)

   at
java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:151)

   at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:145)
   at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:137)
   at java.awt.EventDispatchThread.run(EventDispatchThread.java:100)

The displaying is handled in the following way :

circle = new CircularGraphLayout((List)agentList,  worldXSize, worldYSize);
Network2DDisplay display = new Network2DDisplay (circle);
surface.addDisplayableProbeable (display, "Evolution View");

In the schedule, I do a

circle.updateLayout();
surface.updateDisplay();


Can anybody point me towards a solution ? I am using
java version "1.4.2_08"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.2_08-b03)
Java HotSpot(TM) Client VM (build 1.4.2_08-b03, mixed mode)

on Linux

and Repast 3.1

Thank you
Igor Nikolic







-------------------------------------------------------
SF.Net email is Sponsored by the Better Software Conference & EXPO
September 19-22, 2005 * San Francisco, CA * Development Lifecycle Practices
Agile & Plan-Driven Development * Managing Projects & Teams * Testing & QA
Security * Process Improvement & Measurement * http://www.sqe.com/bsce5sf
_______________________________________________
Repast-interest mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/repast-interest
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

RE: adding nodes to a runnig simulation of a network

rnick
Do you add the new node to the list of nodes that is being drawn by the
display?

Nick

> -----Original Message-----
> From: [hidden email]
> [mailto:[hidden email]]On Behalf Of Igor
> Nikolic
> Sent: Monday, September 05, 2005 2:54 PM
> To: Repast interest
> Subject: [Repast-interest] adding nodes to a runnig simulation of a
> network
>
>
> Hello all,
> It seems that there was a problem with the mailserver on my side while
> sending this message to the list, so here it is again. If you did
> actually recieve it, my appologies for that.
> igor
>
>
> Hello,
>
> I have the following problem.
>
> The simulation starts with a  several nodes that are unconnected. As the
> simulation progresses, at each step an agent is added to the agentList.
> When certain conditions are met, one of the new nodes is connected to
> the existing nodes.
>
> While the nodes are added, I do not see them appear in the display. At
> the moment that the node is connected, an exception  is thrown.
>
> There are a number of toppic in the email archive dealing with this, and
> the advice seems to be, make sure that he edges are added correctly. So
> according to that advice I use the following edge code :
>
>  Stream stream = new Stream();
>        stream.setFrom(from);
>        stream.setTo(to);
>        stream.setColor(color);
>        from.addOutEdge (stream);
>        to.addInEdge (stream);
>
> Stream extrends DefaultDrawableEdge and the Agent ( to and from are
> instances of Agent) DefaultDrawableNode
>
> So that seems to be OK.
>
> The exception thrown is :
> java.lang.NullPointerException
>    at
> uchicago.src.sim.gui.Network2DDisplay$NormalDrawer.drawDisplay(Unknown
> Source)
>    at uchicago.src.sim.gui.Network2DDisplay.drawDisplay(Unknown Source)
>    at uchicago.src.sim.gui.LocalPainter.paint(Unknown Source)
>    at uchicago.src.sim.gui.DisplaySurface$DUpdate.run(Unknown Source)
>    at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:171)
>    at java.awt.EventQueue.dispatchEvent(EventQueue.java:454)
>    at
> java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatc
> hThread.java:201)
>
>    at
> java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchT
> hread.java:151)
>
>    at
> java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:145)
>    at
> java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:137)
>    at java.awt.EventDispatchThread.run(EventDispatchThread.java:100)
>
> The displaying is handled in the following way :
>
> circle = new CircularGraphLayout((List)agentList,  worldXSize,
> worldYSize);
> Network2DDisplay display = new Network2DDisplay (circle);
> surface.addDisplayableProbeable (display, "Evolution View");
>
> In the schedule, I do a
>
> circle.updateLayout();
> surface.updateDisplay();
>
>
> Can anybody point me towards a solution ? I am using
> java version "1.4.2_08"
> Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.2_08-b03)
> Java HotSpot(TM) Client VM (build 1.4.2_08-b03, mixed mode)
>
> on Linux
>
> and Repast 3.1
>
> Thank you
> Igor Nikolic
>
>
>
>
>
>
>
> -------------------------------------------------------
> SF.Net email is Sponsored by the Better Software Conference & EXPO
> September 19-22, 2005 * San Francisco, CA * Development Lifecycle
> Practices
> Agile & Plan-Driven Development * Managing Projects & Teams * Testing & QA
> Security * Process Improvement & Measurement * http://www.sqe.com/bsce5sf
> _______________________________________________
> Repast-interest mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/repast-interest
>




-------------------------------------------------------
SF.Net email is Sponsored by the Better Software Conference & EXPO
September 19-22, 2005 * San Francisco, CA * Development Lifecycle Practices
Agile & Plan-Driven Development * Managing Projects & Teams * Testing & QA
Security * Process Improvement & Measurement * http://www.sqe.com/bsce5sf
_______________________________________________
Repast-interest mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/repast-interest
Loading...