Synchronization in Cougaar
Todd Wright
twright at bbn.com
Thu Dec 21 16:41:46 EST 2006
Zach.Lewkovicz at lip6.fr wrote:
> Bonjour,
>
> I am a PhD student and I intend to use cougaar for a multi-agent
> simulation. I would like to know if it is possible to use cougaar in a
> synchronized mode. If not, how can I use the message passing between
> agents in a synchronized way ?
Since you mentioned simulation, I'll assume you mean time
synchronization, as opposed to coordination synchronization (e.g.
transactions or group communications).
I'll also assume you're running a single Cougaar node (JVM). This isn't
required, but it greatly simplifies things.
Cougaar includes support for Alarms, which plugins can use to schedule
themselves to wake up at a future time. Alarms can specify either a
"real" time, which matches "System.currentTimeMillis()", or a "demo"
time, which is also called "simulation" time or "execution" time. By
default, the demo time matches the real time:
start at System.currentTimeMillis()
rate is 1 second per second
There's a "DemoControlService.setNodeTime(long time, double rate)"
method to change the demo time and speed.
For example, a plugin can add an alarm set to demo time of "12/31/2009".
When that time arrives, or a plugin calls "setNodeTime" past
12/31/2009, the alarm will expire. The expire calls the plugin
"execute()" method and tells the plugin to act.
See the developers' guide for more information about how to use Alarm
and the DemoControlService.
If you need finer control, you can implement a custom, node-level
service to support a timestamped event queue. As with alarms, your
plugin could add Event objects to the queue, and the queue can sort the
events and invoke callback methods to tell the plugins when an event is
due. It'd be a very standard "global clock" simulator.
Todd
>
> Thank you in advance,
>
> Lewkovicz Zach, Doctorant
> UPMC, LIP6
> 104 avenue du président Kennedy,
> 75016 Paris
>
>
> _______________________________________________
> Cougaar-developers mailing list
> Cougaar-developers at cougaar.org
> http://cougaar.org/mailman/listinfo/cougaar-developers
>
More information about the Cougaar-developers
mailing list