cincinnati axis spindle question
- PCW
-
- Away
- Moderator
-
- Posts: 18537
- Thank you received: 5081
(Many if not most 1970's through 1980s CNC systems used DC servo motors)
Please Log in or Create an account to join the conversation.
- jlviloria
- Offline
- Elite Member
-
- Posts: 311
- Thank you received: 12
PLUS MAXPAK VS RELIANCE DRIVE SPINDLE
RELIANCE RPM III DC MOTOR.
believe that functions as a servomotor?
thanks
Please Log in or Create an account to join the conversation.
- andypugh
-
- Away
- Moderator
-
- Posts: 23316
- Thank you received: 4945
believe that functions as a servomotor?
It has 4-quadrant operation and (optionally) tacho feedback, so it ought to.
Do you have an encoder on the spindle?
Please Log in or Create an account to join the conversation.
- jlviloria
- Offline
- Elite Member
-
- Posts: 311
- Thank you received: 12
thanks
Please Log in or Create an account to join the conversation.
- andypugh
-
- Away
- Moderator
-
- Posts: 23316
- Thank you received: 4945
To switch between modes you should define two custom M-codes.
M101
!#/bin/bash
halcmd sets position-mode 1
M102
!#/bin/bash
halcmd sets position-mode 0
Initially I used the hal "orient" function, but it isn't quite right for the job, and I am not sure it is in the 2.5 release yet. This version of the HAL file uses conversion to int and a sample-hold to round-down to the nearest full rev of the encoder.
Some parts of the file are very specific to my 7i73 configuration. These will obviously need to be edited.
I have set the HAL file up using names= rather than count= for all components. This means that the file can be a completely separate HAL file is TWOPASS is set in the INI file.
However, this is only possible if the other HAL files use names= too.
It isn't that hard to swap. You can just change (for example) "loadrt and2 count=2" to "loadrt and2 names=and2.0, and2.1" and all the pin names stay the same in the rest of the file.
The HAL file references parameters in the INI file under a new [SPINDLE] section. This needs to exist, and contain the patameters.
The HAL file provided closed loop control of both speed and position.
I don't think position feedback on the C-axis is right in velocity mode, you may need to set the f-error to more than 180 degrees. (The C axis is graduated in degrees, the conversion is done using the often-overlooked gain pins in the sum2 component).
This code is for a VFD with 0 to 10V control and FWD REV buttons. If the drive uses -10 to +10V then the ABS function can be skipped.
This code is very unlikely to work on any machine without editing.
#Spindle
loadrt pid names=pos_pid,vel_pid
loadrt mux2 names=mode_sw
loadrt abs names=s_abs
loadrt and2 names=s_interlock
loadrt scale names=rps-to-rpm
loadrt not names=not_pos
loadrt or2 names=s_req
loadrt sample_hold names=pos_latch
loadrt conv_float_s32 names=conv.0
loadrt conv_s32_float names=conv.1
loadrt sum2 names=latched_pos
addf mode_sw servo-thread
addf pos_pid.do-pid-calcs servo-thread
addf vel_pid.do-pid-calcs servo-thread
addf s_abs servo-thread
addf rps-to-rpm servo-thread
addf s_interlock servo-thread
addf s_req servo-thread
addf pos_latch servo-thread
addf conv.0 servo-thread
addf conv.1 servo-thread
addf latched_pos servo-thread
addf not_pos servo-thread
setp hm2_7i43.0.gpio.008.is_output 1
setp hm2_7i43.0.gpio.008.is_opendrain 1
net spindle-forward => hm2_7i43.0.gpio.008.out
setp hm2_7i43.0.gpio.010.is_output 1
setp hm2_7i43.0.gpio.010.is_opendrain 1
net spindle-reverse => hm2_7i43.0.gpio.010.out
setp lowpass.0.gain 0.02
setp hm2_7i43.0.encoder.01.scale [SPINDLE]SCALE
setp hm2_7i43.0.pwmgen.00.output-type 1
setp hm2_7i43.0.pwmgen.pwm_frequency 350
setp hm2_7i43.0.pwmgen.00.scale 1
setp vel_pid.maxoutput 1
setp pos_pid.maxoutput 1
setp vel_pid.Pgain [SPINDLE]V_PGAIN
setp vel_pid.Igain [SPINDLE]V_IGAIN
setp vel_pid.FF0 [SPINDLE]V_FF0
setp pos_pid.Pgain [SPINDLE]P_PGAIN
setp pos_pid.Igain [SPINDLE]P_IGAIN
setp pos_pid.Dgain [SPINDLE]P_DGAIN
setp pos_pid.FF1 [SPINDLE]P_FF1
net spindle-vel-cmd motion.spindle-speed-out-rps => vel_pid.command
net spindle-speed-rps hm2_7i43.0.encoder.01.velocity => scale.0.in motion.spindle-speed-in
net spindle-speed-rps vel_pid.feedback
#Latch the spindle position in whole revs
net spindle-pos hm2_7i43.0.encoder.01.position => motion.spindle-revs
net spindle-pos conv.0.in latched_pos.in0
net spindle-int conv.0.out pos_latch.in
net spindle-int-out pos_latch.out conv.1.in
#subtract the whole revs from the position
net spindle-int-conv conv.1.out latched_pos.in1
setp latched_pos.gain1 -360.0
setp latched_pos.gain0 360
net spindle-pos-cmd axis.5.motor-pos-cmd => pos_pid.command
net spindle-pos-fb latched_pos.out => axis.5.motor-pos-fb pos_pid.feedback
net vel-cmd vel_pid.output => mode_sw.in0
net pos-cmd pos_pid.output => mode_sw.in1
net sw-cmd mode_sw.out => s_abs.in
net vfd-cmd s_abs.out => hm2_7i43.0.pwmgen.00.value
net spindle-forward s_abs.is-positive
net spindle-reverse s_abs.is-negative
#This signal should be set by halcmd or button or M100 command to set pos pode
net position-mode mode_sw.sel pos_pid.enable not_pos.in pos_latch.hold s_req.in0
net vel-mode not_pos.out vel_pid.enable
net spindle-index motion.spindle-index-enable => hm2_7i43.0.encoder.01.index-enable
net spindle-on-vel motion.spindle-on => s_req.in1
net guard-up <= hm2_7i43.0.gpio.020.in_not => s_interlock.in0
net spindle-on <= s_req.out => s_interlock.in1
net spindle-enable <= s_interlock.out => hm2_7i43.0.pwmgen.00.enable
Please Log in or Create an account to join the conversation.
- mariusl
-
- Offline
- Platinum Member
-
Do I understand this correct. You set the spindle up as a rotary axis "C" and effectively switch between a velocity and position PID for this axis?
Regards
Marius
www.bluearccnc.com
Please Log in or Create an account to join the conversation.
- andypugh
-
- Away
- Moderator
-
- Posts: 23316
- Thank you received: 4945
Andy
Do I understand this correct. You set the spindle up as a rotary axis "C" and effectively switch between a velocity and position PID for this axis?
That's the idea.
I have realised that a lot of it is much simpler if you set it as a wrapped rotary axis. You don't need the latches and such (I don't think).
Bear in mind that I don't really have suitable hardware for testing this arrangement.
Please Log in or Create an account to join the conversation.
- mariusl
-
- Offline
- Platinum Member
-
Regards
Marius
www.bluearccnc.com
Please Log in or Create an account to join the conversation.
- Rick G
-
- Offline
- Junior Member
-
- Posts: 26
- Thank you received: 155
This code is for a VFD with 0 to 10V control and FWD REV buttons. If the drive uses -10 to +10V then the ABS function can be skipped.
This sounds very interesting.
Are you saying you are using a VFD to drive an AC motor on the spindle for positional control (rotary axis with an encoder)?
How about heat and torque in this mode?
Rick G
Please Log in or Create an account to join the conversation.
- andypugh
-
- Away
- Moderator
-
- Posts: 23316
- Thank you received: 4945
Are you saying you are using a VFD to drive an AC motor on the spindle for positional control (rotary axis with an encoder)?
How about heat and torque in this mode?
I am saying that it can be done. I am not doing it with anything of mine at the moment, though it is likely that it would be a part of my toolchange on the Mill.
The VFD on my lathe is too crude to work well in this mode, a flux-vector drive is needed really.
Please Log in or Create an account to join the conversation.