modulo reset [message #41703] |
Tue, 23 November 2004 04:19  |
Ralf Schaa
Messages: 37 Registered: June 2001
|
Member |
|
|
Hi there,
I'm reading out some binary data and the description says this about a data field :
in the case of a modulo reset add 2^32
What is this about? googling for "modulo reset" didn't get me far;
I only imagine that I need some kind of overflow to get things fixed,
but it is very unclear to me what is happening and why ...
and how to do it with IDL, i tried
long(datafield + 2d^32d) = data
which doesn't seem right ...
thanks,
-Ralf
|
|
|
Re: modulo reset [message #41844 is a reply to message #41703] |
Tue, 23 November 2004 11:36  |
Ralf Schaa
Messages: 37 Registered: June 2001
|
Member |
|
|
James Kuyper wrote:
> Ralf Schaa wrote:
> ...
>
>> I am reading binary data (not longer than 32 bit, and I store it in
>> ULL as suggested)
>> and the 'modulo reset' I talked about may appear at one datafield:
>> that is in an accumulated
>> "Doppler" cycle count.
>> By differentiating with respect to time, one can get the true doppler
>> count.
>
>
> "Differencing", not "Differentiating". You differentiate a continuous
> function of time. For a discontinuously sampled function, you can't
> differentiate, you can only calculate finite differences.
yep, of course
>> Than the documentation says, when a modula reset occurs , add 2^32.
>> I think, this means when the counter is full and is starting with zero
>> again. than add the 2^32.
>> But I don't see what adding 2^32 exactly would do ...
>
>
> Let's assume that the current cycle count is t0=2^32-5. 20 cyles later
> the true count would be 2^32+15. However, because it reset at 2^32, the
> actual number in the cycle count would be t1=15. If you calculate the
> time difference as dt = t1-t2 while storing the value in, for instance,
> a 64 byte integer or floating point type, then the dt will be
> 15-(2^32-5) = 20-2^32. To get the correct number of cycles, you have to
> add in 2^32, leaving you with dt = 20.
sounds good, i'll try that.
thanks
|
|
|
Re: modulo reset [message #41847 is a reply to message #41703] |
Tue, 23 November 2004 09:45  |
MKatz843
Messages: 98 Registered: March 2002
|
Member |
|
|
Ralf Schaa wrote in message news:<cnv951$kfc$1@newsreader2.netcologne.de>...
> Hi there,
>
> I'm reading out some binary data and the description says this about a data field :
>
> in the case of a modulo reset add 2^32
This seems like an "unwrapping" problem.
If your data is (relatively) slowly varying, you could interpret any
discrete jump of more than 2^31 as having come from a "modulo reset"
to use their terminology, which I'm guessing I understand.
For example, if the data were modulo 16 (2^4) then a series that looks
like this
1, 3, 5, 7, 9, 11, 13, 15, 1, 3, 5 might actually be
1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21
Here, where a jump of larger than 8 was detected, add (or subtract as
the case may be) 16 to restore "continuity."
M.
|
|
|