• Skip to main content
  • Skip to search
  • Skip to footer
Cadence Home
  • This search text may be transcribed, used, stored, or accessed by our third-party service providers per our Cookie Policy and Privacy Policy.

  1. Community Forums
  2. Allegro X PCB Editor
  3. Calculation/precision issue with arc radius

Stats

  • Replies 4
  • Subscribers 158
  • Views 2458
  • Members are here 0
More Content

Calculation/precision issue with arc radius

archive
archive over 19 years ago

Hi,

I've got the following problem with some skill code I've written that should export more than one place bound per component to IDF.
The code so far seems stable, but I have issues with calculating the arc radius if it is not between 10 and 170 degrees or 0/180 degrees.

I've created a test case that exhibits the issue. It is attached as boards.zip it contains 2 board files. Case2.brd which is the original board in millimeters and micron_2decimals.brd which is a conversion of case2.brd with 2 decimal points. Looking at this there should be precisely a factor 1000 in difference, this is however not the case, I can get better precision after the translation. Here's the arc data that I can get out using the attached skill program

Arc data        millimeters        microns
Center x        -1.06                -1059.77
Center y        -0.122                -122.36
Radius            0.151                150.52
x1                 -0.98                 -980.0
y1                  -0.25                -250.0
x2                -1.14                -1140.0             
y2                0.005                5.0
Load the skill program and run ns_idf to get files named boardname.emp/emn and temp_ptc.emp/emn (the last is the Cadence IDF output)
Look in the boardname.emp file to see the data above, they're listed just below the line with the arc radius in the boardnameemp file.
The boards.zip also contains an Excel spreadsheet that shows the calculation method. This is also written in the skill code, but in a rather complex system due to the fact that the angles has to be correct with respect to sign and degree. I've had customers looking at the output and this should be the only issue left to get the correct results.

Now using mathematics I can calculate the arc radius to the following
In millimeters (case2.brd) I get the angle to be -170.86
And in microns I get the angle to be -179.89

The weird thing here is that using the Cadence built in IDF export functionality gives the same figure in both cases, namely -179.798

So I'm looking for a  way to get more precision out of the board using millimeters.
Does anyone have any idea whats going on here? I'm just very curious as to how the built in Cadence IDF export can get the precision from the case2.brd to calculate the angle whereas I cannot do the same

Best regards,
Ole


Originally posted in cdnusers.org by ejlersen
boards.zip
  • Sign in to reply
  • Cancel
  • archive
    archive over 19 years ago

    Hi Ole,

    Your code is quite complex - and involves lots of floating point maths - so you will probably get lots of floating point rounding errors. See the discussion about that problem in this forum.

    I have written a similar routine for exporting IDF and get the same results as Cadence.
    See attached.

    Cheers, Dave


    Originally posted in cdnusers.org by Dave Elder
    IDF_putVertices.il
    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
  • archive
    archive over 19 years ago

    Hi Dave,

    Thanks very much for the code, although I've got problems figuring out how you actually calculate the angle. I've looked all over the documentation for the atan2 function but I cannot find anything about it, except that it takes 2 arguments but how will that help me?

    Another thing is the sign of the angle, it is consequently the wrong sign compared to running this on a larger board with several arcs. It may be easy to change, but as written above I've got some problems figuring out exactly what you do and why?
    I know my code is also pretty complex and this is due to the fact that getting the correct angle when using normal atan is dependent on the start and end points position relatively (depending on the quadrant of the coordinate system). I can see that you get the correct angle each time, only issue is the sign, so maybe you've got another approach than I have?

    I've attached an example that exhibits this issue so you can see it for your self. The angle figure is the same but the sign in your case is negative whereas it is positive in the Cadence case.

    Best regards,
    Ole


    Originally posted in cdnusers.org by ejlersen
    case3.zip
    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
  • archive
    archive over 19 years ago

    Hi Ole,

    I'll take a look at the angle sign issue. I have had problems with that in the past and possibly need to improve my code for it to work in every case.

    atan2 gets around the problem with atan where the adjacent line length is 0.
    i.e. atan(o / a) returns an "Attempted to divide by zero" error if a is 0. atan2(o a) correctly returns pi / 2 if a is 0.

    I don't know why atan2 isn't documented. I never use atan.

    Cheers, Dave


    Originally posted in cdnusers.org by Dave Elder
    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
  • archive
    archive over 19 years ago

    Hi Dave,

    Thanks for the explanation. This problem was actually one of the reasons I had to make the code more complex.


    Best regards,
    Ole


    Originally posted in cdnusers.org by ejlersen
    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
Cadence Guidelines

Community Guidelines

The Cadence Design Communities support Cadence users and technologists interacting to exchange ideas, news, technical information, and best practices to solve problems and get the most from Cadence technology. The community is open to everyone, and to provide the most value, we require participants to follow our Community Guidelines that facilitate a quality exchange of ideas and information. By accessing, contributing, using or downloading any materials from the site, you agree to be bound by the full Community Guidelines.

© 2025 Cadence Design Systems, Inc. All Rights Reserved.

  • Terms of Use
  • Privacy
  • Cookie Policy
  • US Trademarks
  • Do Not Sell or Share My Personal Information