[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Swarm: specifying initial discrete2d values
From: |
Manor Askenazi |
Subject: |
Re: Swarm: specifying initial discrete2d values |
Date: |
Mon, 16 Sep 96 01:54:24 MDT |
Hi Christian!
In my Swarm simulation I have 3 discrete2d objects which all get their
values from flat files right after being created. I get these values
after I createEnd them, and I have no problems. But this doesn't work
for my diffuse2d for some reason.
That's weird... After all if you load the space just after createEnd there
should be no problem. Either that or you could subclass initializeLattice.
The only way I can get the initial values for the diffuse2d is by reading
the values every time step in the schedule.
Sounds worrying...
I want to get these values only once (at the first time step of the
simulation) but I can't figure out how to do this.
One way to do this is to create more than one schedule in the buildActions
part of the ModelSwarm:
-buildActions {
[super buildActions];
...
modelSchedule1 = [Schedule createBegin: [self getZone]];
[modelSchedule1 setRepeatInterval: 1];
modelSchedule1 = [modelSchedule1 createEnd];
[modelSchedule1 at: 0 createAction: modelActions];
// ***** Note: this one has no repetition!!! *****
modelSchedule2 = [Schedule createBegin: [self getZone]];
modelSchedule2 = [modelSchedule2 createEnd];
[modelSchedule2 at: 0 createActionTo: theSpace message: M(loadValues)];
return self;
}
-activateIn: (id) swarmContext {
[super activateIn: swarmContext];
[modelSchedule1 activateIn: self];
[modelSchedule2 activateIn: self];
return [self getSwarmActivity];
}
Hope this helps,
Manor.
PS> Loading spaces from a file in a portable/standard/general way is a
reasonably important thing to do right. If you don't mind posting
the code we could debug it as a group on swarm-support...
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- Re: Swarm: specifying initial discrete2d values,
Manor Askenazi <=