Useful Plasma Thread

More
8 years 2 months ago #115934 by Grotius
Replied by Grotius on topic Useful Plasma Thread
@Rod,

I just tried to boot into Linux on my desk PC but it failed for some reason and left me at the command prompt.

Russian Anonimouses. :woohoo: Are they into the bios ? They will eat your desktop pc in one day....

Thanks for your post Rod. I will investegate your diagram carefully.

I have made a short example of code for logging the program for 5 seconds with 0.1 seconds interval time.
Here off we can make multiple calculations for making the best choice for the machine by itself. User's can select type of calculation.
Code:
component Voltage_data_Position_logger ".."; description """ Todo """; author "Grotius CNC Machines"; license "GPLv2 or greater"; option singleton yes; // Input Pins pin in bit Enable "Enable this function"; pin in bit Do_calculation "Do your calculation"; pin in float Time_gone_by "For example 0.1 sec"; pin in float Voltage_in "For example 260 volts and changing"; pin out float Timeplus "Timeplus is one step forward on system : fperiod"; pin out bit Sha_the_bitcoins "This line is for google bot's"; // Output Pins pin out float Perfect_value "Calcutated Perfect Output Voltage"; pin in bit Hit_the_button "Use this voltage value in your currently running program right now !! "; // Global Variables // 1 second 0.1 sec scale : variable float T1; variable float T2; variable float T3; variable float T4; variable float T5; variable float T6; variable float T7; variable float T8; variable float T9; variable float T10; // 2 second : variable float T11; variable float T12; variable float T13; variable float T14; variable float T15; variable float T16; variable float T17; variable float T18; variable float T19; variable float T20; // 3 second : variable float T21; variable float T22; variable float T23; variable float T24; variable float T25; variable float T26; variable float T27; variable float T28; variable float T29; variable float T30; // 4 second : variable float T31; variable float T32; variable float T33; variable float T34; variable float T35; variable float T36; variable float T37; variable float T38; variable float T39; variable float T40; variable double Time_resolution; //the time starting and counting up. The past is inluded. variable double Timeplus; //the time when we variable float First_second; //holds the best volt value of first second. function _; ;; #include "rtapi_math.h" FUNCTION(_) { if(Enable){ x = Time_gone_by // in this case input float 0.1 sec. Timeplus += fperiod; if(Timeplus = fperiod + x){T1 = Voltage_in;} // log first voltage. if(Timeplus = fperiod + (2*x)){T2 = Voltage_in;} // log second voltage. if(Timeplus = fperiod + (3*x)){T3 = Voltage_in;} // and so on we go. // automate // So we have 40 times a voltage stored in variable every 0.1 second.. That is nice !!! // Now we can do a nice calculation's to make improvements for linuxcnc users. //Calculation of first second is starting here : if(Do_calculation){(First_second = ((T1 + T2 + T3 + T4 + T5 + T6 + T7 + T8 + T9 + T10) / 10);} //And expand this. if(!Hit_the_button){;} //if you don't hit the button okey... if(Hit_the_button){Perfect_value = Voltage_in;} // This was easy ... if(Do_calculation){Perfect_value = ((First_second + Second_second + Thirth_second + Fourth_second + Fifth_second)/5);} // this is just like minmax. // So we can make a nice voltage output value. We can also write a log in external files if we want to. // Dataloggers is expensive equipment !! } }




@Tommy,

the 5 second's or longer can display your cutting charts. After cutting, the chart's can say if you was a good cutter or a bad cutter.
The ultimate line stay's stady. But fluctuence's have to be avoid. Kerf crossing and corner lock is one of them.
At the logging every 0.1 second. The machine can make a desicion on the past logging. Will i go this way, or wil i go for improvement? Users can select a cutting chart. I think there will be 3 charts. 3 types of calculating. I think logaritme i will also try to use for fun, if possible.

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

More
8 years 2 months ago #115936 by rodw
Replied by rodw on topic Useful Plasma Thread
Russians or Dutch, I'm not sure.... :)

fperiod is not guaranteed to be exact if the thread is early or late so testing for equality is not going to work every time. you need to do a if... else if... else if ... and test for > T1, T2 etc. Steal The buffer approach using pointers I shared and see how you go. Just change the BUFFSIZE to 5000.
The following user(s) said Thank You: Grotius

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

More
8 years 2 months ago - 8 years 2 months ago #115937 by Grotius
Replied by Grotius on topic Useful Plasma Thread
@Rod,

Was it a linux mint desktop environment? :whistle:

So yes, why not switch to debian? :side:
Still having russian anonimouses, switch to Kali and strike back. :woohoo:

I also think that the THC component should be kept totally separate from the touchoff component.


First i thought also to build in blocks, i agree.
But now i think, if the component stay's structurized, it's easy to implement. Some guy's have 1000 lines of C code. :woohoo:

From what i know now, the touch off procedure takes about a max of 20-25 line's of C code. This is easely to implement in the same component. When i got it finished, i will show it to you coming day's. It's hot on my to do llst.

I think he confirms my thinking about keeping the actual THC component on a seperate thread where it can be running at a slower time frame

I agree when it has no probe function included (touch off)

The attached chart shows what happens to torch voltage when crossing a kerf (data from a hal plot at 200 Mhz sample time:

Hmm 200 Mhz.. This diagram looks to fast to make a conclusion for me. I can't figur out what the scaling value's are, sorry.
If i can see a chart of a periode of time T versus volts V, i can imagine how the arc is responding.

Torchsample.3 is a nice piece of code. I must get a lession of c code to get as good as you !!

Steal The buffer approach using pointers I shared and see how you go. Just change the BUFFSIZE to 5000.

I will remind this, nice info. This week i will get some time to program and learn of your code examples, hopely i don't have to cook indonesian hot chicken. :laugh:
Last edit: 8 years 2 months ago by Grotius.

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

More
8 years 2 months ago #115942 by rodw
Replied by rodw on topic Useful Plasma Thread
Sorry, I was not clear. The graph is not of arc voltage. It shows the change in voltage per second (dV/dT) so the full scale is 2000 volts per second. THe X axis is just a count of 200 Mhz Steps.

And there is no need to buy a data logger. You can use the Halsampler and sample components and log data to a file every servo thread cycle for further analysis in a spreadsheet. I captured 16000 readings of torch voltage using this method.

So I want to recapture the dV/dT data using Halsampler.

An alternative to a seperate thread is to skip a number of servo thread cycles. This is easy to do using a counter and modulo division something like
Code:
#define SKIP_PERIODS 10 // check something every 10 cycles int counter = 0; counter +=1; if(!(counter % SKIP_PERIODS)){ // do something }
where counter % SKIP_PERIODS will be Zero every 10th count

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

More
8 years 2 months ago #115959 by Grotius
Replied by Grotius on topic Useful Plasma Thread
Thanks Rod,

This example helps me :
Code:
typedef enum {ONE, TWO, THREE} State_T; State_T state = ONE; switch(state){ case ONE: state = TWO; break; case TWO: state = THREE; break; case THREE: Case3_is_working = 1; break;

Then this one : return 1;
Sometimes is see return 0;
And when to use static variables.

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

More
8 years 2 months ago - 8 years 2 months ago #115961 by rodw
Replied by rodw on topic Useful Plasma Thread
Grotius, you will be a C champion in no time!

By default variables defined in a procedure are thrown away and the memory released when you exit the function so the memory can be reused. The static modifier defines the variable in static memory so it is not thrown away and retains its value when the function is next called. You can use global variables but that is a bit messy if a procedure is the only one that needs the variable.

Procedures can optionally return a value and the type is defined in the prototype. heres a simple example that returns the sum of 2 values:
Code:
int summer(int a, int b) { return (a+b); }

so you might write
Code:
answer = summer(a,b);

Butt often the return value is used to denote an error occurred.. Generally 1 for an error or 0 for valid result
say it was an error if a or be was > 100, we might return the answer by reference like this
Code:
int summer(int a, int b, int *ans) { if (a > 100 || b >100) return 1; ans = a+b; return(0); }

and you might call it like this:
Code:
int answer; retval = summer(a,b, &answer); if(retval) printf("Invalid values passed to summer\r\n"); else printf("answer = ' %d", answer);

Through the magic of pointers, if valid values are passed, answer will still have the correct answer!

Finally, often we don't bother with the intermediate value (retval in the example) and would often write it like this:
Code:
int answer; if(summer(a,b, &answer)); printf("Invalid values passed to summer\r\n"); else printf("answer = ' %d", answer);

Its up to you to decide what the error numbers are. Sometimes -1 is used. Often there will be a whole host of equates defined so different errors can be identified.
Last edit: 8 years 2 months ago by rodw.

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

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