Scaling power based on % of imposed velocity

More
09 Jun 2024 21:13 #302711 by sin-do-re
Hello!

im currently running a laser setup with qtplasmac where I impose the % power with a potentiometer and voltage display.

but I would like to impose power with the “Cut Amps” parameter from Qtplasmac. This seems to be the most common approach with qtplasmac.

the problem is that on “pierce” and slowdown, the laser leaves the material burned.

I’ve seen Chinese controllers connected to Lightburn or Rdworks to allow for “min-power” and “max-power”, dependant on the % of max velocity, so if the axis is really slow it will decrease the laser power.

How can this be achieved within linuxcnc? Is there a way to enable this function with qtplasmac while still having the max power to be imposed by “Cut-Amps”? Even if laser power is given somewhere else, is there a way to scale it in lower speeds?

in the picture, the problem is visible, but it is much worse in other materials.


any help will be greatly appreciated.
thanks in advance
Attachments:

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

More
09 Jun 2024 21:59 #302713 by PCW
You could use motion.current-vel and the scale component to do this in hal

A better option might be to pass the current velocity through the
lincurve component to allow linearization since there is probably
not an exact linear relation between velocity and power needed
for the best cut
 
The following user(s) said Thank You: tommylight

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

More
21 Jun 2024 10:40 - 21 Jun 2024 10:42 #303480 by sin-do-re
Replied by sin-do-re on topic Scaling power based on % of imposed velocity
thank you. ive seen your reply to my other post.

im considering this approach. could you please "criticize" it? haha
# Load the necessary HAL components
loadrt scale count=2
loadrt lincurve count=1
addf scale.0 servo-thread
addf scale.1 servo-thread
addf lincurve.0 servo-thread

# Capture the spindle speed output from the G-code command
net spindle-speed motion.spindle-speed-out => scale.1.in

# Connect the current velocity to lincurve
net current-vel motion.current-vel => lincurve.0.in

# Configure lincurve points for velocity to power scaling
setp lincurve.0.velocity-percent 0, 0.2, 0.4, 0.6, 0.8, 1.0  # Adjust these values for velocity percentages
setp lincurve.0.power-scale-percent 0.2, 0.3, 0.4, 0.6, 0.8, 1.0  # Adjust these values for scaling factors (20% at 0 velocity)

# Scale the spindle speed by the lincurve output
net power-scale lincurve.0.out => scale.0.in
net adjusted-power scale.0.out => scale.1.gain

# Scale the adjusted power to the 0-5V analog output range
setp scale.1.gain 5.0  # Adjust this value for the 0-5V range
net final-power scale.1.out => hm2_7i96s.0.7i96s.0.analogout0
Last edit: 21 Jun 2024 10:42 by sin-do-re.

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

More
21 Jun 2024 13:42 #303493 by PCW
That looks like basically what I was suggesting

The 7I96S pin name is not correct though, it should be something like:

net final-power scale.1.out hm2_7i96s.0.pwmgen.00.value

(you also need to enable the PWMgen)

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

More
21 Jun 2024 17:29 #303503 by sin-do-re
Replied by sin-do-re on topic Scaling power based on % of imposed velocity
this might be a dumb question but why is it called pwmgen if it is an analog output? is it because of the old 7i96 (without the "S"?)

i will try this out soon and update on the results

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

More
21 Jun 2024 20:52 #303513 by PCW
The isolated analog voltage output on the 7I96S
is generated by PWM.

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

More
05 Aug 2024 14:17 - 05 Aug 2024 14:21 #306999 by sin-do-re
Replied by sin-do-re on topic Scaling power based on % of imposed velocity
Hey. I've been trying this but no success entering the current velocity parameter into lincurve. i always get the same 2 types of errors, no matter how much i try to "juggle" the variable around. what can i do? ive been trying with motion.current-vel and qtplasmac.current-velocity  at first i tried directly, now im trying to pass it through a scale.2 first, but it gives me the same 2 errors.the errors are either that signal name motion.current-vel can’t be the same as a pin, and if I put a pin it says that motion.current-vel is already linked to such pin. Here is the Hal code: 

################### added

# Load the necessary HAL components
loadrt scale count=3
loadrt lincurve count=1 personality=6
addf scale.0 servo-thread
addf scale.1 servo-thread
addf scale.2 servo-thread
addf lincurve.0 servo-thread

# Capture the spindle speed output from the G-code command
net spindle-speed => scale.1.in

# Scale the velocity before feeding it to lincurve
net qtplasmac.current-velocity => scale.2.in 
setp scale.2.gain 1.0  # Adjust gain as needed
net scaled-velocity scale.2.out => lincurve.0.in

# Configure lincurve points for velocity to power scaling
setp lincurve.0.x-val-00 0.0  # Velocity percentage at 0%
setp lincurve.0.x-val-01 0.2  # Velocity percentage at 20%
setp lincurve.0.x-val-02 0.4  # Velocity percentage at 40%
setp lincurve.0.x-val-03 0.6  # Velocity percentage at 60%
setp lincurve.0.x-val-04 0.8  # Velocity percentage at 80%
setp lincurve.0.x-val-05 1.0  # Velocity percentage at 100%

setp lincurve.0.y-val-00 0.2  # Power scale at 20% for 0% velocity
setp lincurve.0.y-val-01 0.3  # Power scale at 30% for 20% velocity
setp lincurve.0.y-val-02 0.4  # Power scale at 40% for 40% velocity
setp lincurve.0.y-val-03 0.6  # Power scale at 60% for 60% velocity
setp lincurve.0.y-val-04 0.8  # Power scale at 80% for 80% velocity
setp lincurve.0.y-val-05 1.0  # Power scale at 100% for 100% velocity

# Scale the spindle speed by the lincurve output
net power-scale lincurve.0.out => scale.0.in
net adjusted-power scale.0.out => scale.1.gain

# Use scale to adjust the analog output voltage
net final-power scale.1.out => hm2_7i96s.0.pwmgen.00.value
Attachments:
Last edit: 05 Aug 2024 14:21 by sin-do-re. Reason: Add info

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

More
05 Aug 2024 14:35 - 05 Aug 2024 14:36 #307002 by PCW
It's a bit hard to tell because you don't have the line(s)
that caused the error in your hal file example.
Last edit: 05 Aug 2024 14:36 by PCW. Reason: sp

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

More
05 Aug 2024 15:32 #307006 by sin-do-re
Replied by sin-do-re on topic Scaling power based on % of imposed velocity
.hal:99: Signal name 'plasmac.current-velocity' must not be the same as a pin.  Did you omit the signal name?
7168
7178
Stopping realtime threads

complete hal file attached

 
Attachments:

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

More
05 Aug 2024 21:58 #307037 by rodw
you are missing a signal name after net and before the pin name.net my-plasmac-vel plasmac.current-velocity => scale.2.in

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

Time to create page: 0.195 seconds
Powered by Kunena Forum