swarm-support
[Top][All Lists]
Advanced

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

Re: questions regarding activity and getCurrentTime()...


From: Rick Riolo
Subject: Re: questions regarding activity and getCurrentTime()...
Date: Sun, 22 Feb 1998 07:55:41 -0500 (EST)

Dwight,
Thanks for looking for those message usages.

I don't know if its a bug or a feature...depends on what
the writers of Diffuse2d intended, I guess.
That is, do they intend that one must do a
  -stepRule
  -updateLattice
combination explicitly, or just do a -stepRule,
to get diffusion to happen.

Note that the -updateLattice in the model schedule is not
redundant in the heatbugs model, because it is needed 
to copy the heat  values added by the bugs from the 
H(t+1) to the H(t) of the DblBuffer2d pair.

I think the documentation for Diffuse2d should make it
clear what they intend, and also if it is really necessary
for initializeLattice to call updateLattice, the doc
should probably say so.  (Though its not clear to me why
it should need to do that.)

- r

Rick Riolo                           address@hidden
Program for Study of Complex Systems (PSCS)
4068 Randall Lab                
University of Michigan         Ann Arbor MI 48109-1120
Phone: 313 763 3323                  Fax: 313 763 9267
http://www.pscs.umich.edu/PEOPLE/rlr-home.html

On Sat, 21 Feb 1998, Dwight Wilson wrote:

> Date: Sat, 21 Feb 1998 14:52:41 -0500 (EST)
> From: Dwight Wilson <address@hidden>
> To: address@hidden
> Subject: Re: questions regarding activity and getCurrentTime()...
> 
> >I have a couple of questions, based on some behavior in the
> >heatbugs demo.  What I did was write this method in HeatSpace.m:
> >
> >-updateLattice {
> >     [super updateLattice];
> >
> >     printf("--> at %lu heat at 20,20 is now %d.\n",
> >                getCurrentTime(), [self getValueAtX: 20 Y: 20] );
> >
> >     return self;
> >}
> >
> >The addition of the above is the only change from the heatbugs
> >as it comes out of swarmapps-1.0.2 (all this with swarm-1.0.5).
> >That is, I am trying to override updateLattice and 
> >have it do what it does usually, then have it print
> >a little message.  But when I then Start heatbugs, I get a
> >crash with this old familiar message:
> >
> >badger-rlr)./heatbugs
> >*** event raised for error: InvalidOperation
> >*** function: _activity_context_error(), file: XActivity.m, line: 622
> >> getCurrentTime(): there is no currently running activity from which
> >> to obtain requested activity context information.
> >> The context query macros are available only within a> compiled action 
> >> being executed under a running activity.
> >> They are not available when the activity is stopped
> >> or otherwise inactive.
> >> This includes any external probe request.
> >
> >So...one thing I don't understand is why it says there is no
> >currently running activity.  As far as I know, the only place 
> >updateLattice gets sent to the heatbugs HeatSpace is in the model
> >activity group:
> >
> >  modelActions = [ActionGroup create: [self getZone]];
> >  [modelActions createActionTo:      heat        message: M(stepRule)];
> >  [modelActions createActionForEach: heatbugList message: M(step)];  
> >  [modelActions createActionTo:      heat        message: M(updateLattice)];
> >
> >
> [...]
> 
> >So....I don't understand what's going on here.
> >Am I missing some sending of the updateLattice message to HeatSpace
> >that happens before the schedule starts?
> >I don't find it if I do a grep in the heatbugs directory.
> 
> HeatSpace is derived from Diffuse2d.  The -initializeLattice
> method of Diffuse2d contains a call to updateLattice.
> 
> >Now a related question:
> >
> >If I take that reference to getCurrentTime() out of my overriding
> >updateLattice, I have:
> >
> >-updateLattice {
> >     [super updateLattice];
> >
> >     printf("--> heat at 20,20 is now %d.\n",
> >           [self getValueAtX: 20 Y: 20] );
> >
> >     return self;
> >}
> >
> >When I do this it runs fine, but what puzzles me is why it prints
> >messages like this:
> >
> >--> heat at 20,20 is now 145.
> >--> heat at 20,20 is now 145.
> >--> heat at 20,20 is now 305.
> >--> heat at 20,20 is now 305.
> >--> heat at 20,20 is now 458.
> >--> heat at 20,20 is now 458.
> 
> >That is, it seems to be printing my little message twice each step.
> >(Each of those pairs comes from pressing <STEP> once in this case.)
> >Why does it do that?  Is it really doing updateLattice twice each time step? 
> >  
> 
> Yes, for a similar reason as the above problem.  The -stepRule method
> from Diffuse2D contains a call to -updateLattice.  
> 
> Unless I'm missing something, this would appear to be a bug in 
> heabugs (har har).  The statement 
> 
> [modelActions createActionTo:      heat        message: M(updateLattice)];
> 
> seems to be redundant.  
> 
> -Dwight
> 
>                   ==================================
>    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.
>                   ==================================
> 

                  ==================================
   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]