THC Control


Results 1 to 7 of 7

Thread: THC Control

  1. #1
    Registered
    Join Date
    Jan 2012
    Location
    us
    Posts
    33
    Downloads
    0
    Uploads
    0

    Default THC Control

    I came across several posts while looking for thc control and thought I'd share what worked for me. My machine is servo controlled but this should also work with steppers. I programmatically change my Z axis input mode and tuning parameters from encoder to ADC while in thc mode and back when not in thc mode. I do it in VB6 but it could just as well be done in C.
    Feed the arc voltage (dived and isolated) into an ADC channel and tune it with Kmotion Step Response. For tuning I mounted a pot on the zaxis with a short arm and then tweaked it in while cutting. My testing was done on .125 steel at a 30 degree angle at 100 in/min. It follows within about +- .5 volts. For antidive I wrote a small C program(see below) that monitors the adc voltage and disables the Zaxis as needed. The only problem I had was my first isolator, an FC-33 from Automation Direct had an unpublished 3hz responce time which is WAY too slow.

    #include "KMotionDef.h"
    main()
    {
    double mx;
    double mn;
    double wt;
    double pv;
    int thcflag;
    int dflag;
    int i;
    dflag=0;
    for (;
    {
    thcflag=persist.UserData[10]; //motion flag 0 or 1
    mx=(double)persist.UserData[1]; //max voltage in adc units
    mn=(double)persist.UserData[2]; //min voltage
    wt=Time_sec()+.001; //ms
    pv=0;
    i=0;
    while (Time_sec()<wt)
    {
    //average the volts
    i++;
    pv=pv+ADC(0);
    }
    pv=pv/i;
    if (thcflag==1) //auto height control flag is on
    {
    if (pv>mx || pv<mn)
    {
    DisableAxis(3);
    dflag=1;
    }
    else
    {
    if (dflag==1) EnableAxis(3);
    dflag=0;
    }

    }
    }
    }

    Similar Threads:


  2. #2
    Member TomKerekes's Avatar
    Join Date
    May 2006
    Location
    USA
    Posts
    4045
    Downloads
    0
    Uploads
    0

    Default

    Hi sdavenport,

    Thanks for sharing this.

    Another approach you might consider is that instead of switching feedback modes for the Z axis channel you could leave the Z axis with encoder feedback but wrap an analog position loop around it (dual loop). In some cases this can be more stable and easier to tune than using the analog feedback directly - for example the case where the analog feedback is very slow like with your first isolator. If you would like to pursue this let me know and I can provide more details. But it sounds like you have things working well using the analog feedback directly.

    Regards

    Regards
    TK http://dynomotion.com


  3. #3
    Registered
    Join Date
    Jan 2012
    Location
    us
    Posts
    33
    Downloads
    0
    Uploads
    0

    Default

    Tom,
    Yes, I'd like to try the dual loop. Or at least understand the concept. Would it be similar to MoveRel based on the error?
    Shannon



  4. #4
    Member TomKerekes's Avatar
    Join Date
    May 2006
    Location
    USA
    Posts
    4045
    Downloads
    0
    Uploads
    0

    Default

    Hi Shannon,

    One example I recall was with a CO2 Laser cutting tool which needed to follow the surface being cut. In this case an analog sensor (LVDT) was used to measure the relative surface height in Z. The Z axis also could operate in a normal absolute height mode using standard encoder feedback. First the Z axis was configured and tuned to operate as a normal Z axis servo (or this could be a stepper axis). But then there was a mode that allowed a dual loop configuration. Two servo loops were configured in cascade. The outer loop was an analog servo loop axis channel. The Output of this axis channel was used to command the normal Z axis Channel. A few lines of looping C code are required to tie the two axis channels together. This works well because you can tune and test both loops independently and all the parameters (PID, Filters, etc) are available for both loops. M codes were used to switch between the two modes (absolute encoder height and relative analog height). In absolute mode the GCode was commanded normally using X Y Z. In relative mode G Code was commanded in X Y A. Where A was typically a constant value that determined the desired focus height but could also be changed on-the-fly. Attached are the files that were used (.c extensions change to .txt). The C Code simply adjusts the commanded Dest of the Z axis. The disadvantage of this is that the Dest changes in small steps every other Servo Sample period. But most Servos are slow enough to just filter this out so it seems to work fine. I don’t think your idea of commanding MoveRel commands would be good because trying to plan a 3rd order max Jerk, Accel, and Vel trajectory for such a short distance and then trying to blend it into a new trajectory ~5K times per second might cause problems. I think MoveExp might work well and be an improvement. The problem is similar to an MPG (see MPGSmooth.c) where delta “steps” are happening at random sizes, directions, and times.

    I would love to see a video of your machine cutting :}

    Regards

    Attached Files Attached Files
    Regards
    TK http://dynomotion.com


  5. #5
    Registered
    Join Date
    Jan 2012
    Location
    us
    Posts
    33
    Downloads
    0
    Uploads
    0

    Default

    Hi Tom,
    I understand the concept now and I looked at the examples.
    In this line, ch2->Dest -= ch3->Output; I understand you are setting the inner loops input to the outer loops output. Are Dest and Output Kflop functions or properties? My C is not good either, what does -=, -> do?

    I'll do a short video in the near future.

    Shannon



  6. #6
    Member TomKerekes's Avatar
    Join Date
    May 2006
    Location
    USA
    Posts
    4045
    Downloads
    0
    Uploads
    0

    Default

    Hi Shannon,

    Yes this line of C code adjusts the commanded destination of the inner loop by the output of the outer loop. This commands the inner loop to move at a velocity proportional to the Output of outer loop.

    The fields "Output" and "Dest" are variables in the Axis Channel Structure.

    C is a structured language that can group a number of variables into a structure. It also has a concept of "pointers" where a variable can be something that points (contains the address of) to something rather than the thing itself. These are some of the most complicated concepts of the C language but also the most powerful (and dangerous).

    In our example:

    ch3->Output

    ch3 is a pointer that points to the data structure for axis channel #3. Output is a member of an axis channel data structure. So this expression tells the compiler to go to the structure that ch3 is pointing to and extract the data member Output from it.

    The -= operator performs a "decrement by" operation. As a shorthand way of writing:

    X = X - Y;

    you may write:

    X -= Y;


    BTW here is a post from our Yahoo Group with some links to video tutorials available on the Internet


    Regards

    Regards
    TK http://dynomotion.com


  7. #7
    Registered
    Join Date
    Jan 2012
    Location
    us
    Posts
    33
    Downloads
    0
    Uploads
    0

    Default

    Thanks very much Tom for the C lesson. I took a quick look at the video tutorials and will try to free up some time at my day job to dig in and learn C. I'll try the dual loop method as soon as I can.
    Shannon



Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


About CNCzone.com

    We are the largest and most active discussion forum for manufacturing industry. The site is 100% free to join and use, so join today!

Follow us on


Our Brands

THC Control

THC Control