Jump to content
OMRON Forums

Incorrect calculations on 48 bits fixed-point (D:) Variable in high ranges (above 35 bits)


sutty

Recommended Posts

Hi!

I am using V1.945 on a DSP56311

I set m1->d:$0010FF

I set m1=(2^35)-1  (34359738367)

I increment/decrement m1 by 1: m1=m1+1 resp m1=m1-1 - but the result is not always +1 higher / less:

image.png.68574770a9e0747488ef594650c8699e.png

Is this issue known / solved in later fw-releases?

Greetings, Anton

Link to comment
Share on other sites

  • Replies 6
  • Created
  • Last Reply

Top Posters In This Topic

The internal servo, interpolation, and commutation routines all operate with fixed-point arithmetic, 24-bit and 48-bit, for maximum speed.

User programs, motion and PLC (and on-line math), use 48-bit floating-point arithmetic (48 bits with a 36-bit mantissa and a 12-bit exponent) regardless of the “source” register format (intermediate formats are all floating-point values).

The PMAC “value interpreter” is limited to passing values in the range (+/-)2^^(+/-)35. Values outside this range are truncated so there would be a loss of fidelity in the least significant digits with integer calculations that large. This is unavoidable.

Link to comment
Share on other sites

As a “workaround”, you could break up your unity increments to “x/y” definitions, where “y” is the least significant 24 bits, but you will need to handle the rollover “manually”. When the “y” register reaches 2^^24 - 1 (16,777,215) set it to zero and increment the “x” register (carry one). Then continue to increment the “y” register until the next “manual rollover” is needed.

Link to comment
Share on other sites

  • 2 weeks later...

Hi Steve!

How does this correlate with Curts post, where he says [.] P and Q variables can represent count values up to 64 trillion with no loss of whole-count resolution [.]. This would be way higher than 2^35 counts.

Or is this rather owed to the PMCA "value interpreter" as you mentioned latetly?

 

Link to comment
Share on other sites

Posted (edited)

OK.

So these here are the maximum ranges for any 48-bit floating point number without loss of "counts" from smallest to biggest in both directions (since any value passes the PMACs value interpreter):

image.png.6def075fa3f4789a23401aac37da623c.png

Right? (comprehension question: but shouldn't it rather be +34.359.738.367)

If I need to go bigger, your workaround mentioned above is the only way?

Edited by sutty
Link to comment
Share on other sites

You are “mixing your metaphors”, so to speak. Your original post was about the “D” definition “Long Fixed-Point signed (two's complement) integer” not PMAC 48-bit FP. My answer was in reference to that. It is true that the PMAC 48-bit FP may have no loss of fidelity but its only internal, the PMAC input and display “value interpreter” prevents any “external” usage.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...