comp.lang.ada
 help / color / mirror / Atom feed
From: Ted Dennison <dennison@telepath.com>
Subject: Re: Using "delay until" in real-time
Date: Tue, 12 Dec 2000 22:31:14 GMT
Date: 2000-12-12T22:31:14+00:00	[thread overview]
Message-ID: <9168vi$7mp$1@nnrp1.deja.com> (raw)
In-Reply-To: iA1duAAkYpN6Iw1g@diphi.demon.co.uk

In article <iA1duAAkYpN6Iw1g@diphi.demon.co.uk>,
  JP Thornley <jpt@diphi.demon.co.uk> wrote:
> In article <915jl7$jt5$1@nnrp1.deja.com>, Ted Dennison
> <dennison@telepath.com> writes
> >1/60 works out to about 0.016(6-repeating). That can't be accurately
> >represented in an IEEE floating-point register. So what we get is
> >something like 0.016667 (forgive me if I'm rounding the wrong digit).
>
> Why not use 3 'minor' cycles in a 'major' cycle.
>
> The major cycle then has an exact delay of 0.05, and the minor cycles
> are offset by 0.016667 and 0.033333 within the major cycle.

Ahhh, someone who speaks our language. :-)

It looks like you are essentially suggesting that the scheduler do
something like:
      Minor_Iteration_Rate : constant := 1.0/60.0;
      Major_Iteration_Rate : consant  := 0.05;
begin

   loop
      -- do work
      for Minor_Cycle in 1..2 loop
         delay until Next_Time + Iteration_Rate * Minor_Cycle;
         -- do work
      end loop;
      Next_Time := Next_Time + Major_Iteration_Rate;
      delay until Next_Time;
   end loop;

I think this is essentially the same as my iteration-counting scheme,
except that the "Major_Iteration_Rate" is set to 0.05 instead of 1.0,
and the number of minor cycles is hard-coded.

I did simplify things a bit for my question. We are actually using 4
minor cycles in our 60Hz major cycle. Under the scheme we use here
things can only run once a major cycle, so the fastest with the current
settings would be 60Hz. However, we can adjust the minor cycle used in
order to prevent jitter in those tasks that are expecially sensitive to
it (eg: Controls and the Visual system). So our executive is *actually*
running at 240Hz (but of course this doesn't affect the math problem.
1/240th still a repeating decimal).

--
T.E.D.

http://www.telepath.com/~dennison/Ted/TED.html


Sent via Deja.com
http://www.deja.com/



  reply	other threads:[~2000-12-12 22:31 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2000-12-12 16:27 Using "delay until" in real-time Ted Dennison
2000-12-12 18:01 ` Mike Silva
2000-12-12 19:57   ` Ted Dennison
2000-12-12 23:02     ` Mike Silva
2000-12-12 23:49       ` Ted Dennison
2000-12-18  6:26     ` Ray Blaak
2000-12-12 20:00 ` Ken Garlington
2000-12-12 20:40   ` Ted Dennison
2000-12-13  4:02     ` Ken Garlington
2000-12-13 14:29       ` Ted Dennison
2000-12-13 16:53     ` Larry Hazel
2000-12-13 17:41       ` Ted Dennison
2000-12-12 20:22 ` Keith Thompson
2000-12-12 20:54   ` Ted Dennison
2000-12-13  5:35   ` tmoran
2000-12-12 20:23 ` David C. Hoos, Sr.
2000-12-12 21:58   ` Ted Dennison
2000-12-12 23:18   ` Jeff Carter
2000-12-12 21:18 ` JP Thornley
2000-12-12 22:31   ` Ted Dennison [this message]
2000-12-13  8:02     ` Brian Orpin
2000-12-13 17:32     ` JP Thornley
2000-12-12 23:09 ` Ted Dennison
2000-12-13  7:43 ` Brian Orpin
2000-12-15  0:27 ` Frank
2000-12-19  7:50 ` Martin Gangkofer
2000-12-20  3:32   ` Ted Dennison
2000-12-20  5:29     ` tmoran
2000-12-20  7:59     ` Martin Gangkofer
2000-12-20  9:15       ` java servlets JF Harrison
2000-12-20 12:50     ` Using "delay until" in real-time Marin David Condic
2000-12-21  0:08     ` Alejandro R. Mosteo
2000-12-20  3:17 ` Ted Dennison
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox