THC Velocity lock and void lock

More
14 Jul 2021 11:31 #214722 by phillc54
I like option 3. 

I managed to read through that doc. I think I will try out the simple way they do it and see how it plots. Nothing ventured nothing gained ...
Finding time is the problem.

Did I mention that I hate this new forum editor, I hope the coming update fixes it 

Please Log in or Create an account to join the conversation.

More
14 Jul 2021 11:37 #214724 by rodw
Agree its appalling. I did search and it could be related to a config error by our admins.
 

Please Log in or Create an account to join the conversation.

More
14 Jul 2021 14:00 #214740 by snowgoer540
+10000 on the new editor comments.  It's borderline unusable, certainly to edit a post, or even break up quoting.

I might recommend any suggestions that might even possibly help fix it be posted here:  forum.linuxcnc.org/36-using-this-forum-q...itor?start=10#213150

That thread at least had JT's attention. 

I try not to complain too hard about it, since it is free after all, but I do wish we could go back to when email was broken instead 
The following user(s) said Thank You: tommylight

Please Log in or Create an account to join the conversation.

More
14 Jul 2021 15:45 - 14 Jul 2021 16:08 #214758 by grijalvap
this is what I did  on the old THCSM.comp  attempt to solve the kerf crossing as you can see it does not take in to acount the speed or thickness
Now I see it should be included.
    

 

File Attachment:

File Name: thcsm_2021...4-2.comp
File Size:18 KB


Regarding the picture that RODW posted with the dip after the bump, I recall similar images, and I recall that my thinking was, look for the slope and follow the sequence:
set the lock at the first raising slope then unlock only on the next raising after one falling slope(never try),
I will try this this weekend.
 
Attachments:
Last edit: 14 Jul 2021 16:08 by grijalvap.

Please Log in or Create an account to join the conversation.

More
14 Jul 2021 20:50 #214775 by rodw
Pedro, please check your gmail account. I sent you some material.
The loopless averaging algorithm which should be called on each pass through the component is:
pin in  s32 num_readings = 100             "Number of readings for average volts (3-1000)";
#define BUFSIZE 1000 // maximum number of readings to average torch volts

double buf[BUFSIZE];
int reading_count;
float avgarcvolts(double tvolts, int iscutting, int buffersize)
{
    // Calculates the moving average of buffersize readings
    
    static double *b = &buf[0], *p = &buf[0];        // pointers for beginning of buffer and current position
    static double *e;   // pointer for end of buffer
    static int   wascutting = 0;        // cutting state last time
    static double sumvolts = 0.0;        // Sum of readings in buffer
    static int numreadings = 0;            // number of readings in buffer
    static int last_thc_active = 0;     // Save last state
    e =  &buf[buffersize];              // Initialise end pointer
    if(!iscutting && wascutting){
        // Torch just turned off, so reset the variables
        p = b;
        sumvolts = 0.0;
        numreadings = 0;
        wascutting = iscutting;         //and save the state
        return(0.0);
    }
    if(iscutting){                        // Arc_OK is on so lets start gathering data to average
        *p++ = tvolts;                    // Save volts to the buffer and increment pointer
        if(numreadings < buffersize)
            numreadings++;
        if(p > e)                        // if we've gone past the end of the buffer, wrap to the beginning
            p = b;
        sumvolts += tvolts;                // add the new reading
        if(numreadings >= buffersize)
            sumvolts -= *p;                // subtract the oldest reading (which is the one we are pointing at now)
    }
    wascutting = iscutting;             //and save the state
    if(numreadings)                    
        return(sumvolts/(double)numreadings);  // return Average volts
    else
        return (0.0);                    // catch divide by zero errors
}
note numreadings is a global variable set by a pin that sets the number of values to average from 3 to 1000. I used 100. If the buffer is not full, the average is based on the number read so far.


 

Please Log in or Create an account to join the conversation.

More
14 Jul 2021 20:56 #214776 by rodw
My current void lock code looks like this using the procedure shared earlier
     // Lets average the arc volts
         avgvolts =    avgarcvolts(tvolts, (int)arcokin, (int)reading_count);  
      average_volts = avgvolts;
          torch_volts = tvolts;
      dvdt = (tvolts - avgvolts)/fperiod;       // Calculate change in volts for this servo cycle.
      if(!thc_is_active)
        void_hold = 0;      
      movingup   = (last_dvdt <= dvdt ? 1:0);   // set flag if volts are moving up
      movingdown = (last_dvdt >  dvdt ? 1:0);   // set flag if volts are moving down
      if(movingup && dvdt > dvdt_threshold  && !void_hold  && thc_is_active){
          first_dvdt = dvdt;   // record the level the dvdt was at when activated
          trigger_volts = torch_volts;  // and save the trigger volts          
          void_hold = 1;         // hold the THC
      }
      else if(!gone_low && void_hold && (dvdt < (0.0 - dvdt_threshold)) && thc_is_active){  
        gone_low = 1;
      }
      else if(void_hold && gone_low && torch_volts <= trigger_volts && thc_is_active){ // holding and on our way up  
        void_hold = 0;
        first_dvdt = 0.0;
        trigger_volts = 0.0;
        gone_low = 0;
            
      }
      last_dvdt = dvdt;                // Save the last dvdt         

AND yes I agree with Pedro, you need to follow the states to enable the THC again. My code does that but its a bit obfuscated..The easy bit is turning it off!
 

Please Log in or Create an account to join the conversation.

More
14 Jul 2021 21:05 #214777 by rodw
The states I identified  for use in s a switch statement are
    typedef enum { WAIITNG, THC_ACTIVE, VOID_FOUND, VOID_LOW, VOID_END} State_V;
    State_V vstate = WAITING;
VOID_LOW is when the DV/DT has fallen below the trigger point
VOID_END is when the DV/DT has risen back to our cutting zone and THC can be enabled

Please Log in or Create an account to join the conversation.

More
14 Jul 2021 21:07 #214778 by grijalvap
Good, Thanks for the loop less average function, now I thinking to implement as component and use the enable disable input of PlasmaC to test and validate the code and after that maybe we can include code to PlasmaC.

thanks
The following user(s) said Thank You: rodw

Please Log in or Create an account to join the conversation.

More
14 Jul 2021 21:14 #214779 by rodw

Good, Thanks for the loop less average function, now I thinking to implement as component and use the enable disable input of PlasmaC to test and validate the code and after that maybe we can include code to PlasmaC.

thanks

Yes that was always my intention but an alternative I thought would be to add a second THC disable pin for user expansion so this could be added by a user easilly without breaking the plasmac config.
The state machine looks something like this (bugs and all)
    dvdt = (tvolts - avgvolts)/fperiod;       // Calculate change in volts for this servo cycle.   
    if(torch_on){
        //movingup   = (last_dvdt <= dvdt ? 1:0);   // set flag if volts are moving up  
        switch(vstate){
            case WAIITNG:
                if(thc_is_active){
                    vstate = THC_ACTIVE;
                }
                else{
                    break;
                }
            case THC_ACTIVE:
                //if(movingup && dvdt > dvdt_threshold)
                if(dvdt > dvdt_threshold){
                    first_dvdt = dvdt;
                    trigger_volts = torch_volts;          
                    void_hold = 1;               
                    vstate = VOID_FOUND;
                }
                break;
            case VOID_FOUND:
                if(dvdt < (0.0 - dvdt_threshold)){
                     vstate = VOID_LOW;
                }
                else{
                    break;
                }
            case VOID_LOW:
                if(torch_volts <= trigger_volts){
                    elapsed_time += fperiod;
                    if(elapsed_time >= final_delay){
                        void_hold = 0;
                        first_dvdt = 0.0;
                        trigger_volts = 0.0;
                        gone_low = 0;
                        elapsed_time = 0.0;
                        vstate = VOID_END;
                    }
                }
                break;
            case VOID_END:
                if(thc_is_active){
                    vstate = THC_ACTIVE;
                }
                else{
                    vstate = WAITING;
                }
                break;
         }
    }
    else{
        void_hold = 0;
        first_dvdt = 0.0;
        trigger_volts = 0.0;
        gone_low = 0;
        elapsed_time = 0.0;
        vstate = VOID_END;
    }
    last_dvdt = dvdt;                // Save the last dvdt         

Please Log in or Create an account to join the conversation.

More
14 Jul 2021 23:23 #214784 by phillc54
It would be nice if someone could post a few halscope plots cutting different thickness materials with THC disabled and crossing a kerf showing current velocity and arc voltage.

Please Log in or Create an account to join the conversation.

Moderators: snowgoer540
Time to create page: 0.147 seconds
Powered by Kunena Forum