// Swarm-support, MGD: July 7, 2000 >>>>> "DA" == David Aliaga writes: DA> I just want to graph the value of a variable every time a trial finish. [..] DA> Should I create another level with diferent schedule If you want to have the trial independent from the mechanics of the trial, I think what you want is at:createAction: (or a similiar activate-in-nil idiom). Below is an example of at:createAction:. Also take a look at simpleExperBug in swarmapps for another an example of a separation of observeration timescale from the actual trial. #import // initSwarm #import // Schedule #import // Swarm @interface Trial: Swarm { unsigned trialNumber; id trialSchedule; } - buildActions; - step; - (id )activateIn: (id )swarmContext; @end @implementation Trial - buildActions { trialSchedule = [Schedule create: self]; [trialSchedule at: 0 createActionTo: self message: M(step)]; [trialSchedule at: 10 createActionTo: self message: M(step)]; return self; } - step { printf ("trial# %u step @ %lu\n", trialNumber, getCurrentTime ()); return self; } - (id )activateIn: swarmContext { trialNumber++; [super activateIn: swarmContext]; [trialSchedule activateIn: self]; return [self getActivity]; } @end @interface Controller: Swarm { id experimentSchedule; } - buildActions; - activateIn: swarmContext; @end @implementation Controller - buildActions { id trialSwarm = [Trial create: self]; [trialSwarm buildActions]; experimentSchedule = [Schedule create: self]; [experimentSchedule at: 0 createAction: trialSwarm]; [experimentSchedule at: 1 createAction: trialSwarm]; return self; } - activateIn: swarmContext { [super activateIn: swarmContext]; [experimentSchedule activateIn: self]; return [self getActivity]; } @end int main (int argc, const char **argv) { initSwarmBatch (argc, argv); [[[[Controller create: globalZone] buildActions] activateIn: nil] run]; return 0; } /* Local Variables: compile-command: "$SWARMHOME/bin/libtool-swarm --mode=link gcc -o createAction -Wall -Werror -g -Wno-import -I$SWARMHOME/include -L$SWARMHOME/lib createAction.m -lswarm -lobjc" End: */