- Posts: 22011
- Thank you received: 7491
Another plasma component...
- tommylight
- Offline
- Moderator
-
Less
More
7 years 9 months ago #125444
by tommylight
Replied by tommylight on topic Another plasma component...
Got some time this evening to set up a test environment, so far consisting of a 6i25 and a 7i77, will add the THCAD and a 7i84 tomorrow, wire the switches to simulate breakaway and float switch etc etc. 7i84 is there just in case i mess up something ( i very rarely do ) with inputs and outputs.
Got my screens working properly and Linuxcnc on 64 bit Preempt-RT (again
) so now i need to make some time to get on with it.
BTW, here is the link to how Linuxcnc looks on that setup
forum.linuxcnc.org/51-ot-posts/35943-pro...reenshot-ever#125441
Regards,
Tom
Got my screens working properly and Linuxcnc on 64 bit Preempt-RT (again
BTW, here is the link to how Linuxcnc looks on that setup
forum.linuxcnc.org/51-ot-posts/35943-pro...reenshot-ever#125441
Regards,
Tom
The following user(s) said Thank You: phillc54
Please Log in or Create an account to join the conversation.
- phillc54
- Offline
- Platinum Member
-
Less
More
- Posts: 5711
- Thank you received: 2100
7 years 9 months ago #125450
by phillc54
Cheers, Phill.
Replied by phillc54 on topic Another plasma component...
That screen is AWESOME...tomylight wrote:
BTW, here is the link to how Linuxcnc looks on that setup
Cheers, Phill.
The following user(s) said Thank You: tommylight
Please Log in or Create an account to join the conversation.
- rodw
- Offline
- Platinum Member
-
Less
More
- Posts: 12170
- Thank you received: 4153
7 years 9 months ago - 7 years 9 months ago #125456
by rodw
Replied by rodw on topic Another plasma component...
I'm looking forward to seeing what Tommy achieves with this.
I spent a bit of time today working on the component I use for scaling the voltage from the THCAD. It already has a lowpass filter built into it and now I'm working on a moving average of the arc volts from 3-1000 consecutive readings. Comparing the dv/dt between the current period and the moving average should allow us to sense if the torch crosses into a void.
For Phil's benefit, this is the moving average code which receives torch volts, arcOK and buffer size as parameters. I've had this working but have changed it so we can define the number of readings to average which are read into a fixed buffer so it might need a bit of cleaning up yet. I did not want to use any dynamically allocated memory which is how I'd normally write something like this.
We do some fancy pointer footwork to calculate the total and average without resorting to any for loops
I spent a bit of time today working on the component I use for scaling the voltage from the THCAD. It already has a lowpass filter built into it and now I'm working on a moving average of the arc volts from 3-1000 consecutive readings. Comparing the dv/dt between the current period and the moving average should allow us to sense if the torch crosses into a void.
For Phil's benefit, this is the moving average code which receives torch volts, arcOK and buffer size as parameters. I've had this working but have changed it so we can define the number of readings to average which are read into a fixed buffer so it might need a bit of cleaning up yet. I did not want to use any dynamically allocated memory which is how I'd normally write something like this.
We do some fancy pointer footwork to calculate the total and average without resorting to any for loops
Warning: Spoiler!
Code:
#define BUFSIZE 1000 // maximum number of readings to average torch volts
double buf[BUFSIZE];
float avgarcvolts(double tvolts, int iscutting, int buffersize)
{
// Calculates the moving average of buffersize readings
static double *b, *p = &buf[0]; // pointers for beginning of buffer and current position
static double *e = &buf[buffersize]; // 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
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 this one)
}
wascutting = iscutting; //and save the state
if(numreadings)
return(sumvolts/(double)numreadings); // return Average volts
else
return (0.0); // catch divide by zero errors
}
Last edit: 7 years 9 months ago by rodw.
The following user(s) said Thank You: phillc54
Please Log in or Create an account to join the conversation.
- andypugh
- Offline
- Moderator
-
Less
More
- Posts: 19899
- Thank you received: 4655
7 years 9 months ago #125458
by andypugh
Replied by andypugh on topic Another plasma component...
Whilst your method will return a true moving-average it is often sufficient just to use
(for a notional 10 point average)
new = 0.9 * old + 0.1 * latest
Or, for variable gain:
new = (1 - G) * old + (G) * latest
(for a notional 10 point average)
new = 0.9 * old + 0.1 * latest
Or, for variable gain:
new = (1 - G) * old + (G) * latest
The following user(s) said Thank You: rodw
Please Log in or Create an account to join the conversation.
- rodw
- Offline
- Platinum Member
-
Less
More
- Posts: 12170
- Thank you received: 4153
7 years 9 months ago #125459
by rodw

I'm not really sure if plasma is an application I'd like to use approximations. There are a number of places I would like to use this. It would be fine for sampling the voltage to establish the command signal for PID control (Currently I only take a single point reading).
But now I have the technique, there are other signal processing techniques mentioned in the literature that I may extend the algorithm to include. But one step at a time.
Replied by rodw on topic Another plasma component...
Andy, thanks for shooting down my cool non-looping algorithm down in flames with a single line of codeandypugh wrote: Whilst your method will return a true moving-average it is often sufficient just to use
(for a notional 10 point average)
new = 0.9 * old + 0.1 * latest
Or, for variable gain:
new = (1 - G) * old + (G) * latest
I'm not really sure if plasma is an application I'd like to use approximations. There are a number of places I would like to use this. It would be fine for sampling the voltage to establish the command signal for PID control (Currently I only take a single point reading).
But now I have the technique, there are other signal processing techniques mentioned in the literature that I may extend the algorithm to include. But one step at a time.
Please Log in or Create an account to join the conversation.
- phillc54
- Offline
- Platinum Member
-
Less
More
- Posts: 5711
- Thank you received: 2100
7 years 8 months ago #125897
by phillc54
Replied by phillc54 on topic Another plasma component...
I have been unable to have access to my workshop since late December so have not made any more progress on my table. I have completed the structure, the water tray/storage which is pneumatically controlled and all the axes (which are working from a test setup). All I have left to do is build the control box and connect it all together then I will finally be ready for testing. I am not sure when I will be able to get back to it.
In the meantime I have been playing around with QtVCP which has recently been pushed to master branch and it looks really promising for the construction of custom GUI's.
I have now included a sample QtVCP GUI (which is still very much a work in progress and incomplete) in the repo. It can be found in sim/qtvcp_screens/plasmac.
Cheers, Phill
In the meantime I have been playing around with QtVCP which has recently been pushed to master branch and it looks really promising for the construction of custom GUI's.
I have now included a sample QtVCP GUI (which is still very much a work in progress and incomplete) in the repo. It can be found in sim/qtvcp_screens/plasmac.
Cheers, Phill
The following user(s) said Thank You: tommylight, rodw
Please Log in or Create an account to join the conversation.
Moderators: snowgoer540
Time to create page: 1.183 seconds