SCALETHCAD component
02 Apr 2017 03:52 #90754
by rodw
SCALETHCAD component was created by rodw
I've been a bit frustrated with working with a THCAD-10 that has a 10 volt range as its a pain to do the calculations required to display torch voltage on the screen using HAL commands so I wrote my first HAL component.
scalethcad simplifies all of this and does all of the maths internally without you having to resort to a calculator. I found this really hard when I first set up my HAL file and I had to relearn it all over again to write this.
You use it something like this
volt-divider is an external torch voltage divider card which in my case is built in to my plasma cutter.
thcad-divide is set to the same value as the links on the THCAD board (I'm using 1/32 so its set to 32)
The other feature provided is to take an input from an analog M68 input or a GUI input for target_voltage and scale an output as a velocity that can be used as a feedback for Dewey's pid based torch height control. If I've got my head around Dewey's code, it is something like:
I've included the source and a text file of the documentation page. In my case I've interfaced this with the gmocappy plasma screen and it was really easy to setup. I have a 16:1 voltage divider in my plasma cutter and I've used an external resistor to scale the THCAD-10 range to 20 volts. The config I've used might be a bit confusing as I kept the THCAD-10 range at 10 volts and changed the voltage divider to 32:1. I probably should have set them as 20 volts and 16:1 but results would not change.
I wanted to also provide the ability to change the target-velocity using an M68 command and make it also update the GUI setting. I found I could not set a value to an input pin within the component so if anybody has a solution to that, please let me know and I'll add it in.
Please provide feedback if you give it a try. I think I've got the maths right.
I think its a candidate for inclusion in LCNC but I don't know how to go about that so if you can guide me on setting up my own git, please let me know. There is probably other things that it could be used for.
Hopefully, the attachments will stick.
scalethcad simplifies all of this and does all of the maths internally without you having to resort to a calculator. I found this really hard when I first set up my HAL file and I had to relearn it all over again to write this.
You use it something like this
loadrt scalethcad names=thcad10
addf thcad10 servo-thread
setp thcad10.thcad-0-volt-freq 122900
setp thcad10.thcad-max-volt-freq 925700
setp thcad10.thcad-divide 32
setp thcad10.thcad-fullscale 10
setp thcad10.volt-divider 32
net encoder-vel thcad10.velocity-in <= hm2_7i76e.0.encoder.00.velocity
net target-voltage thcad10.target-volts <= plasma.Target-Voltage
net curvolt thcad10.torch-volts => plasma.hal-lbl-cur-volt
volt-divider is an external torch voltage divider card which in my case is built in to my plasma cutter.
thcad-divide is set to the same value as the links on the THCAD board (I'm using 1/32 so its set to 32)
The other feature provided is to take an input from an analog M68 input or a GUI input for target_voltage and scale an output as a velocity that can be used as a feedback for Dewey's pid based torch height control. If I've got my head around Dewey's code, it is something like:
net commanded-velocity thcad10.target-velocity => zo.command
I've included the source and a text file of the documentation page. In my case I've interfaced this with the gmocappy plasma screen and it was really easy to setup. I have a 16:1 voltage divider in my plasma cutter and I've used an external resistor to scale the THCAD-10 range to 20 volts. The config I've used might be a bit confusing as I kept the THCAD-10 range at 10 volts and changed the voltage divider to 32:1. I probably should have set them as 20 volts and 16:1 but results would not change.
I wanted to also provide the ability to change the target-velocity using an M68 command and make it also update the GUI setting. I found I could not set a value to an input pin within the component so if anybody has a solution to that, please let me know and I'll add it in.
Please provide feedback if you give it a try. I think I've got the maths right.
I think its a candidate for inclusion in LCNC but I don't know how to go about that so if you can guide me on setting up my own git, please let me know. There is probably other things that it could be used for.
Hopefully, the attachments will stick.
The following user(s) said Thank You: tommylight
Please Log in or Create an account to join the conversation.
06 Apr 2017 11:17 #90966
by rodw
Replied by rodw on topic SCALETHCAD component
Based on some input from John the Islander on another plasma thread, I've incorporated a lowpass filter to this component. To me, this makes sense as the encoder input is already in this component and my goal is to simplify the building blocks of a plasma build in hal so the functionality is clear and not obscured.
If somebody could review and test, it would be great!
Also, if somebody could suggest an appropriate default gain value, I will add it to the example.
For instructions on how to use the lowpass settings in this component, please refer to this man page
linuxcnc.org/docs/html/man/man9/lowpass.9.html
If somebody could review and test, it would be great!
Also, if somebody could suggest an appropriate default gain value, I will add it to the example.
For instructions on how to use the lowpass settings in this component, please refer to this man page
linuxcnc.org/docs/html/man/man9/lowpass.9.html
Please Log in or Create an account to join the conversation.
Moderators: snowgoer540
Time to create page: 0.065 seconds