swarm-support
[Top][All Lists]
Advanced

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

Re: setRepeatInterval [os:all swarm:all lib:activity]


From: Steve Emsley
Subject: Re: setRepeatInterval [os:all swarm:all lib:activity]
Date: Fri, 24 Jul 1998 17:30:42 +0100

>>>>> "SE" == Steve Emsley <address@hidden> writes:

SE>> I need some way of knowing what the repeatInterval counter state
SE>> is and resetting it to, in this instance, twice that value. The
SE>> manual entry for repeatInterval doesn't mention such a method. 

>>>>> "MD" == Marcus Daniels <address@hidden> writes:

MD>How about [schedule setRepeatInterval: [schedule getRepeatInterval] * 2]?

Yes, I guess I didn't explain my problem properly. I can change the
repeat interval fine. However, I can'tt work out ... using Mousetrap as
my primer ... how I reset, or even access, the schedules timer.

This output is an example:

      : day 0 at 00:00  step 7.50    96 --> 192      0
      : day 0 at 00:00  step 3.75   192 --> 384      0    #1
OUTPUT: day 0 at 00:03  step 3.75                    0
      : day 0 at 23:59  step 7.50   384 --> 192    384    #2
OUTPUT: day 1 at 00:07  step 7.50                  384
      : day 1 at 02:44  step 3.75   192 --> 384    406
OUTPUT: day 1 at 13:26  step 3.75                  576    #3
      : day 2 at 02:45  step 7.50   384 --> 192    790
      : day 2 at 04:52  step 3.75   192 --> 384    807
OUTPUT: day 2 at 14:29  step 3.75                  960    #4
      : day 3 at 04:52  step 7.50   384 --> 192   1191
      : day 3 at 06:44  step 3.75   192 --> 384   1206
OUTPUT: day 3 at 15:26  step 3.75                 1344    #5
      : day 4 at 06:44  step 7.50   384 --> 192   1590
      : day 4 at 08:29  step 3.75   192 --> 384   1604


A schedule (modelSchedule) has a repeat interval = 1 and this is used
to advance the model in step intervals (in simulated minutes). This is
used to update a day counter. However, deep in the model is a
Runge-Kutta routine that signals changes in the step size if
required. AFter a simulated day the step size is doubled again since
too small a step size slows performance which, if not required, is to
be avoided. Thus, in above 96 --> 192 shows the change in the repeat
interval of the outputSchedule.

That all works e.g. #1 to #2 in 1 day (=384 clock ticks). The final
column is the clock tick of the running activity i.e. the
modelSchedule. 

Another schedule, outputSchedule signals output supposedly at a
constant simulated timepoint. I have schedules for day, week,
month. However, looking at the time of the OUTPUT entries, which should
be at midnight each day, they drift. A typical example is the period
between #3 and #4 which is 384 ticks (i.e. step 3.75) but during that
period the repeatInterval changes to 192 ticks (i.e. step 7.50). The
end result is the output #4 is one simulated hour later than it should
be.

I need to be able to set the clock time of outputSchedule to reflect
the time left until the next output event depending on the changing
step size when repeatInterval is changed.

There seems to be some examples of playing with schedules in the
gridturtle examples. I would appreciate a few pointers since I'm just
blundering about at the moment.

To sumarize: I setup the schedule
  outputSchedule = [Schedule createBegin: self];
  [outputSchedule setRepeatInterval: 96];
  outputSchedule = [outputSchedule createEnd];
  [outputSchedule at: 0 createAction: outputActions];

and update it with:
-repeatIntervalDouble {
  printf("  %3d --> ", [outputSchedule getRepeatInterval]);
  [outputSchedule setRepeatInterval: [outputSchedule getRepeatInterval] * 2];
  printf("%3d ", [outputSchedule getRepeatInterval]);
  printf("  %4d\n", getCurrentTime());
  return self;
}

I need to be able to getCurrentTime for outputSchedule and reset it
depending on the repeatInterval (i.e. the step size in minutes).

Thanks for any help,
Steve.
-- 
-- 
---------------------------------------------------------------------
 Steve Emsley                 Ecosystems Analysis & Management Group
 address@hidden              University of Warwick, England
 http://www.oikos.warwick.ac.uk/~sme/           (+44) (0)1598 753648
---------------------------------------------------------------------

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