- Posts: 74
- Thank you received: 1
Servo tuning with voltage control
7 years 9 months ago - 7 years 9 months ago #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.
image missing https://i.imgur.com/fkqPV5v.png
What can cause this and/or how can I link the two?
image missing https://i.imgur.com/fkqPV5v.png
What can cause this and/or how can I link the two?
Code:
#*******************
# 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: 7 years 9 months ago by Vitran.
Please Log in or Create an account to join the conversation.
7 years 9 months ago #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.
7 years 9 months ago #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.
7 years 9 months ago #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.248 seconds