8i20/BLDC component, limited spindle speed

More
8 years 3 months ago #114925 by blazini36
I added the math and still pulled a bunch of errors. Passing it on to a buddy of mine who at knows programming to see what he can do. He's not a wizard with linuxCNC but he has remote access to my other LinuxCNC machine as he's helping me out with that.

Please Log in to join the conversation.

More
8 years 3 months ago #114998 by blazini36
My friend got this to compile this morning. I show:

pins
Code:
halcmd: show pin *spindle-monitor* Component Pins: Owner Type Dir Value Name 17 bit OUT FALSE spindle-monitor.0.spindle-at-speed 17 float IN 0 spindle-monitor.0.spindle-command 17 float IN 0 spindle-monitor.0.spindle-feedback 17 bit IN FALSE spindle-monitor.0.spindle-is-on 17 bit OUT FALSE spindle-monitor.0.spindle-underspeed 17 s32 OUT 0 spindle-monitor.0.time

parameters
Code:
halcmd: show param *spindle-monitor* Parameters: Owner Type Dir Value Name 17 u32 RW 0x00000000 spindle-monitor.0.level 17 float RW 0 spindle-monitor.0.threshold 17 s32 RW 0 spindle-monitor.0.tmax 17 bit RO FALSE spindle-monitor.0.tmax-increased

Edit: had a slight misunderstanding of the function of the component at first. This is what I'm thinking of doing in HAL for this: (#= already connected signal)
Code:
loadrt spindle_monitor loadrt estop_latch addf spindle-monitor.0 servo thread addf estop_latch.0 servo thread net spindle-at-speed spindle-monitor.0.spindle-at-speed #(=> motion.spindle-at-speed) net spindle-vel-fb-rps spindle-monitor.0.spindle-feedback #(<= hm2_7i76e.0.encoder.00.velocity) net spindle-vel-cmd-rps spindle-monitor.0.spindle-command #(<= motion.spindle-speed-out-rps) net spindle-enable spindle-monitor.0.spindle-is-on #(<= motion.spindle-on) net E-stop-trigger spindle-monitor.0.spindle-underspeed => estop-latch.0.fault-in setp spindle-monitor.0.threshold 24000 #(400rpm drop))

If I'm reading the component right, it looks like the spindle-at-speed and spindle is on must be true once before the condition is met for the spindle-underspeed pin to go true when the underspeed is detected. For most cases I think this would work good, but I'm thinking this may ignore the case that the spindle stalls before it gets upto speed (belt jams or something). I think this would be solved if there were some time consideration (a parameter) given to set the condition of spindle-underspeed pin going true between the time that spindle-on and spindle-at-speed set level 2.

Any insight on the above Andy? I'll test/use it as is if the above looks correct since it will probably take care of 90% of my concerns anyway.

Please Log in to join the conversation.

More
8 years 3 months ago #115102 by blazini36
The above was wrong, some of the pins weren't quite what I thought they were, and estop_latch component was incorrect as well and I have no idea why I setp the threshold to 24000. I got it working but it was rather finicky until I put the hm2_7i76e.0.encoder.00.velocity pin through the lowpass component before going into spindle-monitor.0.spindle-feedback. I need to do a bit more testing tomorrow, but it seems pretty good so far for basic stall protection.

Please Log in to join the conversation.

More
8 years 3 months ago #115137 by andypugh
too late, but there is an undocumented "include" command for comp files that puts the #include statement close to the top of the generated C file, which can help.

Please Log in to join the conversation.

More
8 years 3 months ago #115190 by blazini36
Well this is what my friend came up with, no issues with it compiling now. Any thoughts on adding a time pin prior to it hitting the level that can set the underspeed pin? I had to throw "not" in there to invert the output, my current hal additions:
Code:
loadrt lowpass names=lowpass.monitor loadrt spindle_monitor loadrt not addf lowpass.monitor servo-thread addf spindle-monitor.0 servo-thread addf not.0 servo-thread net spindle-at-speed => motion.spindle-at-speed net spindle-vel-fb-rps-fltr <= lowpass.monitor.out net spindle-vel-cmd-rps-abs <= motion.spindle-speed-out-rps-abs net spindle-enable <= motion.spindle-on net spindle-fault-stop-inv => motion.enable # ---Setup spindle monitor for motor protection--- net spindle-at-speed <= spindle-monitor.0.spindle-at-speed net spindle-vel-fb-rps-fltr => spindle-monitor.0.spindle-feedback net spindle-vel-cmd-rps-abs => spindle-monitor.0.spindle-command net spindle-enable => spindle-monitor.0.spindle-is-on net spindle-fault-stop not.0.in <= spindle-monitor.0.spindle-underspeed net spindle-fault-stop-inv <= not.0.out #detect rpm drop# setp spindle-monitor.0.threshold 7 setp lowpass.monitor.gain .005

Attachment not found

Please Log in to join the conversation.

More
8 years 3 months ago #115203 by Ketsai

Please Log in to join the conversation.

More
8 years 2 months ago #115713 by blazini36
Even without the extra frills this is a pretty handy component, I'm kinda surprised there isn't anything like it (that I know of) in source.

What would it take to get this included?

Please Log in to join the conversation.

More
8 years 2 months ago #116039 by andypugh

blazini36 wrote: What would it take to get this included?


Create a "pull request" on GitHub.

linuxcnc.org/docs/html/code/contributing-to-linuxcnc.html

Though simply adding a new file (rather than patching original files) can be done, I think, directly.

Please Log in to join the conversation.

More
8 years 2 months ago #116659 by blazini36
Created a pull request. I'm not all that familiar with adding to Git but I think it's right, not sure if I'm supposed to write a full description like what's in the docs or not. Credit to you of course.

Please Log in to join the conversation.

Time to create page: 0.126 seconds
Powered by Kunena Forum