Servo tuning with voltage control
04 Jan 2019 01:22 #123445
by Vitran
Replied by Vitran on topic Servo tuning with voltage control
Great news overall. I have the XZW moving and within a very tight control. The PID values were:
P 150
I 0
D 0
FF0 0
FF1 1.5
FF2 0.005
I was having challenges with enabling the spindle, but I now have it going. I can spin the spindle using an open loop of:
However, the challenge is how to close the loop. The old code on the machine did not seem to let me change the speed.
It is likely the amount of code I have uploaded/recycled/repaired in the .hal file that is causing the issue. I will next try to make a new configuration using the PNCCONFIG to make the control loop for me.
P 150
I 0
D 0
FF0 0
FF1 1.5
FF2 0.005
I was having challenges with enabling the spindle, but I now have it going. I can spin the spindle using an open loop of:
addf scale.0 servo-thread
setp scale.0.gain 0.0025
net spindle-speed-scale motion.spindle-speed-out => scale.0.in
net spindle-speed-DAC scale.0.out => hm2_5i25.0.7i77.0.1.analogout5
However, the challenge is how to close the loop. The old code on the machine did not seem to let me change the speed.
It is likely the amount of code I have uploaded/recycled/repaired in the .hal file that is causing the issue. I will next try to make a new configuration using the PNCCONFIG to make the control loop for me.
Please Log in or Create an account to join the conversation.
04 Jan 2019 03:13 #123450
by Vitran
Replied by Vitran on topic Servo tuning with voltage control
I figured out some, but not all, of how to make it work. If I click spin forward it will give an output voltage of 1, then if I click the +, it will go to 10V. Same in reverse.
I do not think it is doing any form of PID control now. It only has a P of 1. Is there a tuning process for spindles? The Calibration window doesn't seem to let me control the spindle inputs. I suppose I could renumber the spindle to _8 so that it would show up. I will try that tomorrow.
I do not think it is doing any form of PID control now. It only has a P of 1. Is there a tuning process for spindles? The Calibration window doesn't seem to let me control the spindle inputs. I suppose I could renumber the spindle to _8 so that it would show up. I will try that tomorrow.
Please Log in or Create an account to join the conversation.
05 Jan 2019 00:28 - 05 Jan 2019 00:29 #123521
by Vitran
Replied by Vitran on topic Servo tuning with voltage control
Something odd is happening with the spindle control. I am noticing that the spindle vel-fb-rps is working, but the vel-fb-rpm is not.
What can cause this and/or how can I link the two?
What can cause this and/or how can I link the two?
#*******************
# SPINDLE S
#*******************
setp pid.s.Pgain [SPINDLE_9]P
setp pid.s.Igain [SPINDLE_9]I
setp pid.s.Dgain [SPINDLE_9]D
setp pid.s.bias [SPINDLE_9]BIAS
setp pid.s.FF0 [SPINDLE_9]FF0
setp pid.s.FF1 [SPINDLE_9]FF1
setp pid.s.FF2 [SPINDLE_9]FF2
setp pid.s.deadband [SPINDLE_9]DEADBAND
setp pid.s.maxoutput [SPINDLE_9]MAX_OUTPUT
setp pid.s.error-previous-target true
net spindle-index-enable <=> pid.s.index-enable
net spindle-enable => pid.s.enable
net spindle-vel-cmd-rpm => pid.s.command
net spindle-vel-fb-rpm => pid.s.feedback
net spindle-output <= pid.s.output
# ---PWM Generator signals/setup---
setp hm2_5i25.0.7i77.0.1.analogout5-scalemax [SPINDLE_9]OUTPUT_SCALE
setp hm2_5i25.0.7i77.0.1.analogout5-minlim [SPINDLE_9]OUTPUT_MIN_LIMIT
setp hm2_5i25.0.7i77.0.1.analogout5-maxlim [SPINDLE_9]OUTPUT_MAX_LIMIT
net spindle-output => hm2_5i25.0.7i77.0.1.analogout5
net spindle-enable => hm2_5i25.0.7i77.0.1.spinena
# ---Encoder feedback signals/setup---
setp hm2_5i25.0.encoder.00.counter-mode 0
setp hm2_5i25.0.encoder.00.filter 1
setp hm2_5i25.0.encoder.00.index-invert 0
setp hm2_5i25.0.encoder.00.index-mask 0
setp hm2_5i25.0.encoder.00.index-mask-invert 0
setp hm2_5i25.0.encoder.00.scale [SPINDLE_9]ENCODER_SCALE
net spindle-revs <= hm2_5i25.0.encoder.00.position
net spindle-vel-fb-rps <= hm2_5i25.0.encoder.00.velocity
net spindle-index-enable <=> hm2_5i25.0.encoder.00.index-enable
# ---setup spindle control signals---
net spindle-vel-cmd-rps <= motion.spindle-speed-out-rps
net spindle-vel-cmd-rps-abs <= motion.spindle-speed-out-rps-abs
net spindle-vel-cmd-rpm <= motion.spindle-speed-out
net spindle-vel-cmd-rpm-abs <= motion.spindle-speed-out-abs
net spindle-enable <= motion.spindle-on
net spindle-cw <= motion.spindle-forward
net spindle-ccw <= motion.spindle-reverse
net spindle-brake <= motion.spindle-brake
net spindle-revs => motion.spindle-revs
net spindle-at-speed => motion.spindle-at-speed
net spindle-vel-fb-rps => motion.spindle-speed-in
net spindle-index-enable <=> motion.spindle-index-enable
# ---Setup spindle at speed signals---
net spindle-vel-cmd-rps => near.0.in1
net spindle-vel-fb-rps => near.0.in2
net spindle-at-speed <= near.0.out
setp near.0.scale 1.000000
setp near.0.difference 3.333333
Last edit: 05 Jan 2019 00:29 by Vitran.
Please Log in or Create an account to join the conversation.
05 Jan 2019 00:42 #123522
by alan_3301
Replied by alan_3301 on topic Servo tuning with voltage control
add another scale with a gain of 60 and then
net spindle-vel-fb-rps => scale.x.in
net spindle-vel-fb-rpm <= scale.x.out
net spindle-vel-fb-rps => scale.x.in
net spindle-vel-fb-rpm <= scale.x.out
Please Log in or Create an account to join the conversation.
23 Jan 2019 12:35 #124661
by shameless
Replied by shameless on topic Servo tuning with voltage control
Hi
I feel confused about the *.hal. I have inserted the lcec. I just don't know how to make the motor run. Could you give me some advices or any examples?
I feel confused about the *.hal. I have inserted the lcec. I just don't know how to make the motor run. Could you give me some advices or any examples?
Please Log in or Create an account to join the conversation.
25 Jan 2019 21:34 #124860
by Vitran
Replied by Vitran on topic Servo tuning with voltage control
I am nowhere near knowledgeable about Linux CNC to give a full run down but here I will try.
HAL is where all the links happen. You say a pin has this name? Link it to something real like a hm2_5i25.0.7i77.0.0.output-00. You also load variables, like a scale. Loadrt scale.0. You can set the scale to a value in the ini file.
So when someone writes => scale.0.in, they are taking whatever is being put into scale.0 and multiplying it by the gain set on scale.0. That value can then be written to some other real or virtual pin.
So scale neess to be loaded, defined a gain, have a value put into it, then it can scale that value and give an output that you write to a pin.
HAL is where all the links happen. You say a pin has this name? Link it to something real like a hm2_5i25.0.7i77.0.0.output-00. You also load variables, like a scale. Loadrt scale.0. You can set the scale to a value in the ini file.
So when someone writes => scale.0.in, they are taking whatever is being put into scale.0 and multiplying it by the gain set on scale.0. That value can then be written to some other real or virtual pin.
So scale neess to be loaded, defined a gain, have a value put into it, then it can scale that value and give an output that you write to a pin.
Please Log in or Create an account to join the conversation.
Time to create page: 0.065 seconds