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: Dwight Wilson
Subject: Re: questions regarding activity and getCurrentTime()...
Date: Sat, 21 Feb 1998 14:52:41 -0500 (EST)

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


reply via email to

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