Results 1 to 7 of 7

Math Help - automated mill

  1. #1
    Newbie
    Joined
    Jan 2014
    From
    Norway
    Posts
    6

    automated mill

    Hi
    I have autoamted a conventional milling machine with gear motors with enkoders and vfd's.
    i have made a program for this lathe that makes a circle, and this has worked quite nicely, but sometimes i get
    some irregularities, and today i stumbled over the main culprit of the errors.
    in the hmi i can set the start and stop degrees of the circle, for when i only want to mill a section of a circle.
    when i start the program it sets the start location as the center of the circle and i calculate the x,y coordinates for positioning before the circle program starts.

    x coordinates from x=cos(startradians)*radius of circle
    and y coordinates from y=sin(startradians)*radius of circle.

    the errors i get is when startdegrees are either 90,180,270,360
    example for a startdegree of 90 and a circle radius of 50 i get an x value of 3,06 where it should be 0.
    the y value is correct with 50.

    am i missing something basic here maybe?

    thanks,
    Frank
    Follow Math Help Forum on Facebook and Google+

  2. #2
    MHF Contributor
    Joined
    Nov 2013
    From
    California
    Posts
    2,199
    Thanks
    847

    Re: automated mill

    can you post the exact code you use for converting degrees to radians. Are you using fixed or floating point arithmetic?

    Where do your sin and cos functions come from? Are they in a library included with the mill controller software? Do you have a way of examining the values for x and y other than where the milling head starts? Do you have debugging facilities for your program?

    short story is that your formulas are correct but the devil is always in the details.

    Is your error consistent? Will you always get the same error with 90 deg. for example?
    Follow Math Help Forum on Facebook and Google+

  3. #3
    Newbie
    Joined
    Jan 2014
    From
    Norway
    Posts
    6

    Re: automated mill

    all mathematical functions i use are included in the programming software library. i use omron plc and program in structured text.
    floating point
    yes i continually monitor the values of x and y and calculate the angle relating to circle center.
    startradians:=deg_to_rad(startgrader); /* deg_to_rad() is the included function in software
    XyRad:= ATAN(y_pos/x_pos);


    yep, errors are consistent and only for the 4 extremities of the circle, if i have 89,999 degrees i get an accurate x,y posistion

    Frank
    Follow Math Help Forum on Facebook and Google+

  4. #4
    MHF Contributor
    Joined
    Nov 2013
    From
    California
    Posts
    2,199
    Thanks
    847

    Re: automated mill

    Quote Originally Posted by FrankAarre View Post
    all mathematical functions i use are included in the programming software library. i use omron plc and program in structured text.
    floating point
    yes i continually monitor the values of x and y and calculate the angle relating to circle center.
    startradians:=deg_to_rad(startgrader); /* deg_to_rad() is the included function in software
    XyRad:= ATAN(y_pos/x_pos);


    yep, errors are consistent and only for the 4 extremities of the circle, if i have 89,999 degrees i get an accurate x,y posistion

    Frank
    dollars to donuts it's the ATAN function that's glitching when fed zeros. Can you write a function, say my_deg_to_rad() that checks for those 4 cases and outputs the correct values for those 4 cases rather than calling deg_to_rad(), and calling deg_to_rad() if the input is not one of those 4 cases?
    Follow Math Help Forum on Facebook and Google+

  5. #5
    Newbie
    Joined
    Jan 2014
    From
    Norway
    Posts
    6

    Re: automated mill

    i wrote a small program to test just the math,
    the ATAN() function doesn't have anything to do with the positioning where the error occurs, the deg_to_rad() function also seemed to give me the correct radian number
    the ATAN() also seemed to produce the correct radian.
    Looks like the SIN() and COS() functions that errs where the X and Y values should be 0, now that i know i can override this, but i don't like the idea that this error exist. I'm going to have a talk with the support at Omron about this.
    i attached a pdf of functions included in library.

    Frank
    Attached Files Attached Files
    Follow Math Help Forum on Facebook and Google+

  6. #6
    Newbie
    Joined
    Jan 2014
    From
    Norway
    Posts
    6

    Re: automated mill

    i calculate the x and y vectors as
    Xv:= -SIN(XyRad)*Frekvens_Auto;
    Yv:= COS(XyRad)*Frekvens_Auto;
    where Frekvens_Auto is the desired overall speed of movement.
    i suppose i get a wrong speed here too for those exact posistions, but i don't think it will make a measurable difference.

    Frank
    Follow Math Help Forum on Facebook and Google+

  7. #7
    Newbie
    Joined
    Jan 2014
    From
    Norway
    Posts
    6

    Re: automated mill

    Turns out it was me who overlooked something, i only saw the first few digits of the number, had i looked more closely i would have noticed the e-006 as in -2,185669e-006, which brings it close enough to zero for me.
    Follow Math Help Forum on Facebook and Google+

Similar Math Help Forum Discussions

  1. Automated Budgeting System Balancing equation
    Posted in the Algebra Forum
    Replies: 0
    Last Post: March 20th 2012, 07:07 PM

Search Tags


/mathhelpforum @mathhelpforum