Lagunmatic 3516-SX Retrofit

More
8 years 2 months ago #115752 by giz
Replied by giz on topic Lagunmatic 3516-SX Retrofit
Should be +/- 10v. My spindle vfd has inputs for both FWD and REV but I am only sending one single (to the FWD) and it responds as expected to M3 and M4

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

More
8 years 2 months ago #115756 by andypugh
You don't need the abs then.
Code:
loadrt abs addf abs.0.servo-thread net spindle-cmd mux2.0.out abs.0.in net spindle-cmd-abs abs.0.out pwmgen.0.value net spindle-pwm pwmgen.0.pwm hm2_5i25.0.7i77.0.1.analogout5 net spindle-fwd abs.0.is-positive hm2_5i25.0.7i77.0.1.analogout5 net spindle-rev abs.0.is-negative hm2_5i25.0.7i77.0.1.analogout5

Can all be replaced by
Code:
net spindle-cmd pwmgen.0.pwm hm2_5i25.0.7i77.0.1.analogout5

But you will need to make the pid names consistent.
The following user(s) said Thank You: giz

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

More
8 years 2 months ago #115791 by giz
Replied by giz on topic Lagunmatic 3516-SX Retrofit
Tonights update - still there there yet but I think it's getting close.

I standardized on pid.s and pid.1 for velocity and position respectively. I tried using the code above but ran into a couple issues - first it seems like I needed to loadrt pwgen (not sure if I did it correctly) and then once I got past that stage the config loaded with this error:

Code:
Signal 'spindle-cmd' of type 'bit' cannot add pin 'hm2_5i25.0.7i77.0.1.analogout5' of type 'float'

Ok - this didn't seem right so I commented that line out and decided to trace and confirm all the signals just to make sure the logic was happening correctly. Using this diagram I opened all the pertinent HAL Meter boxes and ran two tests:

1. I turned the spindle by hand and ensured all the pins appeared to be reading encoder, velocity, position information correct [PASSED]
2. Feed it codes through the MDI to verify the position/velocity mode logic is working [PASSED]

I took "screenshots" to show the values and confirmation (yes I took a photo of my monitor because I'm completely stupid when it comes to Linux!!) I sent M19 R50 Q20 for the orient command and M3 S400 for the velocity command.

Ok so this seems good so far. At this point I am getting a value out of mux2.0.out fore each scenario but I cannot successfully pass it to hm2_5i25.0.7i77.0.1.analogout5.

For reference, here is the spindle portion of my HAL file. Yes it is a complete disaster from all the cut/paste/comment out experiments.

lagunmatic.hal
Code:
#******************* # SPINDLE S #******************* loadrt pwmgen output_type=0 addf pwmgen.update servo-thread setp pid.s.Pgain [SPINDLE]P setp pid.s.Igain [SPINDLE]I setp pid.s.Dgain [SPINDLE]D setp pid.s.bias [SPINDLE]BIAS setp pid.s.FF0 [SPINDLE]FF0 setp pid.s.FF1 [SPINDLE]FF1 setp pid.s.FF2 [SPINDLE]FF2 setp pid.s.deadband [SPINDLE]DEADBAND setp pid.s.maxoutput [SPINDLE]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]OUTPUT_SCALE setp hm2_5i25.0.7i77.0.1.analogout5-minlim [SPINDLE]OUTPUT_MIN_LIMIT setp hm2_5i25.0.7i77.0.1.analogout5-maxlim [SPINDLE]OUTPUT_MAX_LIMIT #net spindle-output => hm2_5i25.0.7i77.0.1.analogout5 net spindle-enable => hm2_5i25.0.7i77.0.1.spinena ##### net spindle-pos pid.1.feedback orient.0.position net spindle-vel pid.s.feedback hm2_5i25.0.encoder.05.velocity net spindle-vel-cmd motion.spindle-speed-out pid.s.command net spindle-vel-pid pid.s.output mux2.0.in0 net spindle-pos pid.1.feedback orient.0.position near.0.in1 hm2_5i25.0.encoder.05.position net spindle-pos-cmd orient.0.command pid.1.command near.0.in2 net spindle-angle motion.spindle-orient-angle orient.0.angle net spindle-pos-pid pid.1.output mux2.0.in1 setp near.0.difference 0.0005 net spindle-in-pos-raw near.0.out edge.0.in #not needed v2.8+, use orient.0.is-oriented net spindle-in-pos edge.0.out motion.spindle-is-oriented # this switches modes net orient-mode motion.spindle-orient orient.0.enable pid.1.enable mux2.0.sel net velocity-mode motion.spindle-on pid.s.enable pwmgen.0.enable net orient-dir motion.spindle-orient-mode orient.0.mode #loadrt pwmgen output_type=0 #addf pwmgen.update servo-thread #addf pwmgen.make-pulses base-thread #net spindle-speed-cmd motion.spindle-speed-out => pwmgen.0.value #net spindle-on motion.spindle-on => pwmgen.0.enable # Set the spindle's top speed in RPM setp pwmgen.0.scale 10000 net spindle-cmd pwmgen.0.pwm hm2_5i25.0.7i77.0.1.analogout5 # Tune the PID from the INI values setp pid.1.Pgain [SPINDLE]PGAIN_P setp pid.1.Igain [SPINDLE]IGAIN_P setp pid.1.Dgain [SPINDLE]DGAIN_P setp pid.1.FF0 [SPINDLE]FF0_P setp pid.1.FF1 [SPINDLE]FF1_P ##### # ---Encoder feedback signals/setup--- setp hm2_5i25.0.encoder.05.counter-mode 0 setp hm2_5i25.0.encoder.05.filter 1 setp hm2_5i25.0.encoder.05.index-invert 0 setp hm2_5i25.0.encoder.05.index-mask 0 setp hm2_5i25.0.encoder.05.index-mask-invert 0 setp hm2_5i25.0.encoder.05.scale [SPINDLE]ENCODER_SCALE #net spindle-revs <= hm2_5i25.0.encoder.05.position #net spindle-vel-fb-rps <= hm2_5i25.0.encoder.05.velocity net spindle-index-enable <=> hm2_5i25.0.encoder.05.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-pos => motion.spindle-revs net spindle-at-speed => motion.spindle-at-speed net spindle-vel => motion.spindle-speed-in net spindle-index-enable <=> motion.spindle-index-enable # ---Setup spindle at speed signals--- sets spindle-at-speed true

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

More
8 years 2 months ago #115804 by andypugh
You don't need the pwm, just get rid of it.

Make the change I suggested 2 posts back, you don't need the abs, or the other stuff around there.

I don't see any evidence of the mux2 that is used to switch between the two PID control outputs.

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

More
8 years 2 months ago #115805 by giz
Replied by giz on topic Lagunmatic 3516-SX Retrofit
My file is a mess but I did get get rid of the abs section and mux2 is in there. In the screenshots mux2.0.out is correctly passing mux2.0.in0 or mux2.0.in1 based on which mode I'm in.

It seems like I should be able to directly assign mux2.0.out to analogout5?

If I get that done, and analogout5 has a single but the spindle does not move, is it reasonable to assume there is an issue with the PID gain values and move on to tweaking those?

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

More
8 years 2 months ago #115808 by andypugh

giz wrote: It seems like I should be able to directly assign mux2.0.out to analogout5?


Yes, that is what you need
Code:
net spindle-cmd mux2.0.out

Or, put it on one line
Code:
net spindle-cmd mux2.0.out hm2_5i25.0.7i77.0.0.analogout5

(I am making up the pin names there, you need to check them against your actual HAL)

Is the spindle-enable being set in both cases?

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

Time to create page: 0.413 seconds
Powered by Kunena Forum