swarm-support
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Q: re dynamic scheduling


From: Benedikt Stefansson
Subject: Re: Q: re dynamic scheduling
Date: Wed, 04 Feb 1998 13:50:03 -0800

Hi Geoffrey,

A schedule has to be activated in order to be executed. In this case the
schedule instance lives in a limbo - the SwarmProcess, which is running the
"virtual computer" never calls the schedule since it doesn't know about it.

Try adding a [schedule activateIn: swarmContext] line to the program, where
swarmContext is either "self" if this is in modelSwarm or a pointer to an
instance of the Swarm that this object was created in. Activate the schedule
at the beginning of time and then the -myDynamicScheduleTrigger method should
work as advertised.

Check out swarmapps/mousetrap/MousetrapModelSwarm.m for examples.

Regards,
-Benedikt

Geoffrey Schultz wrote:

> Hi,
>
> I'm trying to set up a dynamic schedule in which an action will be added
> to a schedule in response to a user-defined button press of a probe.
> However the action does not seem to be added to the schedule, even though
> the button press message probe appears to be working...
>
> eg.
>
> -buildActions{
>
> // code for other non-dynamic schedules before this
>
>  myDynamicSchedule=[Schedule createBegin: [self getZone]];
>  [myDynamicSchedule setAutoDrop: 1];
>  myDynamicSchedule=[myDynamicSchedule createEnd];
>
>  return self;
> }
>
> -myDynamicScheduleTrigger{
>  timeval_t now;
>  now=getCurrentTime();
>  printf("now is %u\n",now);
>
>  [myDynamicSchedule at: now+10 createActionTo: anObj message:M(aMessage)];
>
>  return self;
> }
>
> Now,
> creating a message probe on "myDynamicScheduleTrigger" sets up ok and
> during the simulation pressing the button prints out the current time to
> stdout however the action does not get added to the schedule (or at least
> I'm assuming that it does not because sending "aMessage" to "anObj" in
> this simulation has visible effects on a ZoomRaster).
>
> Also, if I schedule an action to myDynamicSchedule (non-dynamically from
> within the "buildActions" method) it executes fine...
>
> any Suggestions?
>
> (I'm using 1.0.5,)
>
> Thanks,
>
> Geoff Schultz
>
>                   ==================================
>    Swarm-Support is for discussion of the technical details of the day
>    to day usage of Swarm.  For list administration needs (esp.
>    [un]subscribing), please send a message to <address@hidden>
>    with "help" in the body of the message.
>                   ==================================



--
----------------
Benedikt Stefansson                 address@hidden
Department of Economics, UCLA       Fax. (310) 825-9528
Los Angeles, CA 90095-1477          Tel. (310) 825-4126



                  ==================================
   Swarm-Support is for discussion of the technical details of the day
   to day usage of Swarm.  For list administration needs (esp.
   [un]subscribing), please send a message to <address@hidden>
   with "help" in the body of the message.
                  ==================================


reply via email to

[Prev in Thread] Current Thread [Next in Thread]