On Friday 08 May 2020 18:01:41 Jon Elson wrote:

> On 05/08/2020 04:04 PM, Dan Henderson wrote:
> > Thanks Jon and Chris!
> >
> > Jon do you have a code example of the Hal filter that is needed?
>
> # set up 4th DAC generator as a spindle speed control
> newsig spindle-speed float
> newsig spindle-DAC-cmd float
> newsig spindle-DAC-filt float
> newsig spindle-DAC-abs float
> linkps motion.spindle-speed-out => spindle-speed
> linksp spindle-speed => mult2.1.in0
> setp   mult2.1.in1 0.002457
> linkps mult2.1.out => spindle-DAC-cmd
> linksp spindle-DAC-cmd => lowpass.0.in
> linkps lowpass.0.out => spindle-DAC-filt
> setp lowpass.0.gain 0.005
> linksp spindle-DAC-filt => abs.0.in
> linksp spindle-DAC-abs => abs.0.out
> linksp spindle-DAC-abs => ppmc.0.DAC.03.value
>
That hal code is all, I assume, from your 2.5.4 install Jon.  everything but 
the setp has been deprecated, and I am not sure todays version of hal 
understands those commands. 

I believe that linksp and newsig have been replaced in general function with 
'net' which has its own newsig function as its first argument and which 
apparently assumes the properties of the 2nd argument, and can link all 
the rest of the arguments as targets to send the newsig's data to. Thats if 
I understand it properly.  Perhaps it can auto-translate ala TWOPASS as its 
loaded? IDK for sure as I have not tried to mix-n-match. 
The newer syntax is more compact

So the first 2 linkps statements then becomes a single:

net spindle-speed <= motion.spindle-speed-out => mult2.1.in0

And once 'spindle-speed' is set and is encountered in a new 'net' 
statement lower in the file because you need that data elsewhere it becomes:

net spindle-speed output2 output3 output4 etc etc etc

The '=>' and '<=' direction arrows are for human readability and are 
ignored by hal.  Me = ancient human with short term memory problems 
so I use them most of the time.

> This is for my PPMC analog boards, but ppmc.0.DAC.03.value
> is the speed value sent to the drive.
> lowpass.0.gain is set to 0.005, the name of the pin is a bit
> odd, as gain is actually what sets the time constant of the
> filter.  You will have to loadrt lowpass and then addf
> lowpass to the servo_thread
>
> mult2 sets up the speed factor so that the S word gives the
> right speed.
>
> Jon
this code is from a config I used quite some time, back, in 2014 TBE
to do this in my 7x12: (turn off word wrap in your reader)

# now spindle direction changes need a forced stop until it has stopped
# need an artificial zero speed for artificial offs when a dir change occurs
setp    mux2.0.in0                      0.00000 # zero speed when off
setp    wcomp.1.min                     2       # rpm, used as nearly stopped 
indicator
setp    wcomp.1.max                     1600    # rpm, use for runaway 
shutdown, feed into e-stop
# setup pid.0.command channel, with delay for startup surges, otherwise 
straight thru
# describe a "net" specifier line
# type  signal-name                     sig-src                         target1 
        target2         target3 etc
net     spindle-drive0                  motion.spindle-speed-out-rps    
mux2.0.in1      # active speed when not stopped
net     spindle-drive-switched          mux2.0.out                      
limit2.0.in     # mux feeds 0.000 into pid while stopping

# control acceleration of spindle, decel too
net     kill-spindle                    or2.0.out                       # 
lowpass.0.load
setp    limit2.0.maxv                   4                               # max 
delta speed per second
net     spindle-drive1                  limit2.0.out                    
abs.pid.in      # all fwd to logic
net     spindle-drive2                  abs.pid.out                     
pid.0.command
# now, we need to disable the probe when an axis is homing so we can use the 
probe as home contact.
net     dis-home0                       axis.0.homing                   
lut5.0.in-0
net     dis-home2                       axis.2.homing                   
lut5.0.in-1
setp    lut5.0.function                 0x10                            # 3 
input semi-xor?
net     home-out                        lut5.0.out                      # 
motion.probe-input

# Setup encoder for closed loop spindle speed control
setp    encoder.0.counter-mode          false   # counts quadrature when false, 
200 edges/rev from 50 slot disk
setp    encoder.0.index-enable          true
setp    encoder.0.x4-mode               true                            # 
smoother output?  Yes
setp    encoder.0.position-scale        200.00                          # of 
edges in wheel for 1 turn

# now use encoder-velocity, redescribe "net"
# type  signal-name             signal-src                      target1         
        target2                 target3
setp    scale.0.gain            60      # sets spindle display calibration, set 
at 10 rps=600 rpms
setp    scale.0.offset          0.0
net     spindle-feedback0       encoder.0.velocity              abs.vel.in      
scale.0.in

# do suicide brake staging with wcomp.0, disable if spindle on, and send its 
outputs to pin-8-9 of parport
net     spindle-rpm-filtered    abs.tachplus.out                wcomp.0.in      
wcomp.1.in
net     braking-med-spd         wcomp.0.out                     and2.8.in0      
or2.0.in0 #  med speed brakes
net     braking-slow-spd        wcomp.0.under                   and2.9.in0      
# low speed brakes

net     spindle-feedback2       abs.vel.out                     pid.0.feedback
net     tach-feed               scale.0.out                     limit2.1.in     
# to smooth tach a bit
net     tach-feed-abs           limit2.1.out                    abs.tachplus.in 
# feeds custom-postgui.hal
# is spindle turning?  Or overspeeding?
net     spindle-is-running      wcomp.1.out                     # not used, 
yet...
net     spindle-is-stopped      wcomp.1.under                   and2.4.in1
net     e-stop                  wcomp.1.over                    not.1.in
net     e-stop-inv              not.1.out                       
iocontrol.0.emc-enable-in
setp    edge.0.in-edge          false
setp    edge.0.out-width-ns     5000000         # in nanoseconds! long enough 
to see on halmeter

# now, M3->M4, or M4->M3 transition?  Catch both edges of motion.spindle-reverse
setp    edge.1.in-edge          false
setp    edge.2.in-edge          true
setp    edge.1.out-width-ns     5000000 # long enough to see on halmeter
setp    edge.2.out-width-ns     5000000 # ditto but once proved, shorten both 
to 5ms or less

# this is where we plug in the stopping brake delay lockout
# now make an M5 out of state change of motion.spindle-reverse
# detect both edges
# type  sig-name                sig-src                         target1         
target2         target3
net     spindle-ccw             motion.spindle-reverse          edge.1.in       
edge.2.in flipflop.1.data
net     yanother-spindle        and2.5.out                      and2.4.in0      
not.0.in
net     spindle-on-cmd          motion.spindle-on               and2.5.in1
net     dir-changedF            edge.1.out-invert               and2.6.in0
net     dir-changedR            edge.2.out-invert               and2.6.in1
net     spindle-M3-M4-disable   and2.6.out                      and2.5.in0
net     spindle-lockout         and2.4.out                      flipflop.0.data 
edge.0.in
net     spindle-off             not.0.out               flipflop.0.reset        
flipflop.1.reset or2.0.in1

# this one was not right, if use edge.out, no reverse startup from stopped, 
# with invert, it starts in rev, stutters while reverseing, grrrr.
net     spindle-on-edge         edge.0.out-invert               flipflop.0.clk  
flipflop.1.clk
net     spindle-switch          flipflop.0.out          pwmgen.0.enable 
pid.0.enable    mux2.0.sel      not.2.in
# if spindle on, turn off and's
net     spindle-switch-not      not.2.out                       and2.8.in1      
and2.9.in1

# now, 11/5/13 add brake kill if spindle is on, stop rattling relays when 
spindle running.
net     switched-med-brakes     and2.8.out                      
parport.0.pin-08-out
net     switched-slow-brakes    and2.9.out                      
parport.0.pin-09-out

# required by axis
net     dumbsig                 motion.spindle-speed-out

This actually used two different relays and resistors for braking. Worked but 
not
to my liking, so I threw more sheckles at it in later 2014 and bought a 
pwm-servo
amp from Jon which after one mod, has worked very well since. Deserves to be 
said
that it Just Works.  And since this was a copy/paste, just pieces of the file, 
it
is incomplete and will need a batch of loadrt's and addf's added.
>
> > On Fri, May 8, 2020 at 3:58 PM Chris Albertson
> > <albertson.ch...@gmail.com>
> >
> > wrote:
> >> You have to compare the signals on BOTH sides of the interface to
> >> see what is happening.   The build-in halscope can only see what
> >> has crossed the interface.  Compare this to what is on the parallel
> >> port pins and also what is on the encoder side of the
> >> opto-isolators.
> >>
> >> If a new digital oscilloscope is out of budget then look at one of
> >> these: ebay.com/itm/USB-SALEAE-24M-8CH-Logic-Analyzer...
> >> <
> >> https://www.ebay.com/itm/USB-SALEAE-24M-8CH-Logic-Analyzer-24M-8-Ch
> >>annel-with-Buffer-Support-1-1-16/173828458153?hash=item2878fbc6a9:g:
> >>tDUAAOSwJiddkJ1E It is an 8-channel logic analyzer that is fast
> >> enough fo anything you will ever do with a machine tool of motion
> >> control.  It has no trouble sampling Mhz class square waves.   (The
> >> above is a Chinese clone of the actual Saleae unit.)
> >>
> >> Get the software for it here.  You can try the software without
> >> buying the hardware but obviously can't collect data.
> >> https://www.saleae.com/downloads/
> >>
> >> The oscilloscope is best because it shows the actual analog
> >> waveform but the analyzer has more channels and has very complex
> >> triggers and can de-code serial busses
> >>
> >> On Thu, May 7, 2020 at 3:45 PM Gene Heskett <ghesk...@shentel.net> wrote:
> >>> On Thursday 07 May 2020 17:39:32 Dan Henderson wrote:
> >>>> Why certainly Gene (see attached). I actually have it working a
> >>>> little better now. My spindle-at-speed LED will start going
> >>>> bonkers around 1200 rpm. I'm guessing this is when the counter
> >>>> "throws up it's hands and says - I quit!" lol. The spindle will
> >>>> operate all the way to around 4700 rpm but anything above this
> >>>> and the MC-2100 shuts it down -- must be some kind of voltage
> >>>> limiter kicking in then.
> >>>
> >>> The one time I tried to use one of them was a failure, it seemed
> >>> to have a mind of its own.  I made a power supply and bought one
> >>> of the pico systems pwm-servo's. Bulletproof but be sure and tell
> >>> Jon you are going to drive a PMDC spindle motor with it so he'll
> >>> add more toroids so it runs cooler when working continuously.
> >>>
> >>> That said, your config is as well laid out as any I've looked at,
> >>> and I don't see anything wrong at all. But I can also see how the
> >>> parport and its missing of the encoders signals could be all of
> >>> the higher speed problems.  The 4700 limit might be the pwmgen
> >>> going to 100% duty, losing the 0% recharge pulse. You can check
> >>> that with halscope. I run more voltage than the mc2100 can muster,
> >>> so I can spin a treadmill motor up to where I worry about the cast
> >>> iron fan/pulley exploding but set limits somewhat below that,
> >>> probably around 7 grand max. Even though its geared 3/1 before it
> >>> gets near the spindle drive, its still too fast to cut steel.
> >>>
> >>> If you can set the encoder even lower you might get to a couple
> >>> thousand revs before the tach gets funkity.
> >>>
> >>> 18:40 here, I'd better go see what my missus wants for dinner.
> >>>
> >>>> On Thu, May 7, 2020 at 2:29 PM Gene Heskett
> >>>> <ghesk...@shentel.net>
> >>>
> >>> wrote:
> >>>>> On Thursday 07 May 2020 13:19:23 Dan Henderson wrote:
> >>>>>> I believe this is open loop. Isn’t PID only used in closed loop
> >>>>>> control?
> >>>>>
> >>>>> Its (the PID is) a waste of processor time if open loop. I don't
> >>>>> use one of those in any spindle run by a vfd, the vfd is
> >>>>> generally stiff enough control by itself. If I thread on that
> >>>>> machine, it will have a spindle encoder, but its only job is to
> >>>>> glue the axis motion being driven to cut the thread, to the
> >>>>> spindle rotation, in the case of a g33.1, going both in and out
> >>>>> of the hole. If you aren't useing a PID for the spindle, that
> >>>>> leaves motion I think.
> >>>>>
> >>>>> I think its time we saw your .hal file. Can you insert it into a
> >>>>> mail?
> >>>>>
> >>>>>> On Thu, May 7, 2020 at 11:03 AM Gene Heskett
> >>>>>> <ghesk...@shentel.net>
> >>>>>
> >>>>> wrote:
> >>>>>>> On Thursday 07 May 2020 11:27:57 Jon Elson wrote:
> >>>>>>>> On 05/06/2020 09:20 PM, Dan Henderson wrote:
> >>>>>>>>> I’ve confirmed the fluctuation occurs when spindle-at-speed
> >>>>>>>>> is configured. When I remove this feature, the spindle rpm
> >>>>>>>>> appears to stabilize. It’s almost like it gets caught in a
> >>>>>>>>> loop trying to chase its tail.
> >>>>>>>>
> >>>>>>>> This is VERY common in servo systems, and is due to delay in
> >>>>>>>> response of the object being controlled.
> >>>>>>>> You need to slow down the response of the PID to ignore the
> >>>>>>>> delay. This may be possible by adding
> >>>>>>>> D to it.
> >>>>>>>>
> >>>>>>>> Jon
> >>>>>>>
> >>>>>>> But my msg was that a near module generated spindle.N.at-speed
> >>>>>>> was never to be injected into any signal path leading back to
> >>>>>>> a PID. That near's output s/b only to that input to motion,
> >>>>>>> and possibly to an indicator led in the gui so the operator
> >>>>>>> can be advised if its acting funkity. Flickering could be worn
> >>>>>>> brushes in a brushed PMDC motor for instance.
> >>>>>>>
> >>>>>>> What you are describing as delays can often be fixed by the
> >>>>>>> proper re-ordering of the addf's involved for the oscillating
> >>>>>>> axis. That aspect of configuring LinuxCNC hasn't been
> >>>>>>> mentioned recently or I wouldn't even have included that
> >>>>>>> paragraph in my reply.
> >>>>>>>
> >>>>>>> And from Dan's description above, I think this is an entirely
> >>>>>>> different critter from a timeing delay.
> >>>>>>>
> >>>>>>> Cheers Jon & stay well, Gene Heskett
> >>>>>>> --
> >>>>>>> "There are four boxes to be used in defense of liberty:
> >>>>>>>   soap, ballot, jury, and ammo. Please use in that order."
> >>>>>>> -Ed Howdershelt (Author)
> >>>>>>> If we desire respect for the law, we must first make the law
> >>>>>>> respectable. - Louis D. Brandeis
> >>>>>>> Genes Web page <http://geneslinuxbox.net:6309/gene>
> >>>>>>>
> >>>>>>>
> >>>>>>> _______________________________________________
> >>>>>>> Emc-users mailing list
> >>>>>>> Emc-users@lists.sourceforge.net
> >>>>>>> https://lists.sourceforge.net/lists/listinfo/emc-users
> >>>>>>
> >>>>>> _______________________________________________
> >>>>>> Emc-users mailing list
> >>>>>> Emc-users@lists.sourceforge.net
> >>>>>> https://lists.sourceforge.net/lists/listinfo/emc-users
> >>>>>
> >>>>> Cheers, Gene Heskett
> >>>>> --
> >>>>> "There are four boxes to be used in defense of liberty:
> >>>>>   soap, ballot, jury, and ammo. Please use in that order."
> >>>>> -Ed Howdershelt (Author)
> >>>>> If we desire respect for the law, we must first make the law
> >>>>> respectable. - Louis D. Brandeis
> >>>>> Genes Web page <http://geneslinuxbox.net:6309/gene>
> >>>>>
> >>>>>
> >>>>> _______________________________________________
> >>>>> Emc-users mailing list
> >>>>> Emc-users@lists.sourceforge.net
> >>>>> https://lists.sourceforge.net/lists/listinfo/emc-users
> >>>
> >>> Cheers, Gene Heskett
> >>> --
> >>> "There are four boxes to be used in defense of liberty:
> >>>   soap, ballot, jury, and ammo. Please use in that order."
> >>> -Ed Howdershelt (Author)
> >>> If we desire respect for the law, we must first make the law
> >>> respectable. - Louis D. Brandeis
> >>> Genes Web page <http://geneslinuxbox.net:6309/gene>
> >>>
> >>>
> >>> _______________________________________________
> >>> Emc-users mailing list
> >>> Emc-users@lists.sourceforge.net
> >>> https://lists.sourceforge.net/lists/listinfo/emc-users
> >>
> >> --
> >>
> >> Chris Albertson
> >> Redondo Beach, California
> >>
> >> _______________________________________________
> >> Emc-users mailing list
> >> Emc-users@lists.sourceforge.net
> >> https://lists.sourceforge.net/lists/listinfo/emc-users
> >
> > _______________________________________________
> > Emc-users mailing list
> > Emc-users@lists.sourceforge.net
> > https://lists.sourceforge.net/lists/listinfo/emc-users
>
> _______________________________________________
> Emc-users mailing list
> Emc-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/emc-users


Cheers, Gene Heskett
-- 
"There are four boxes to be used in defense of liberty:
 soap, ballot, jury, and ammo. Please use in that order."
-Ed Howdershelt (Author)
If we desire respect for the law, we must first make the law respectable.
 - Louis D. Brandeis
Genes Web page <http://geneslinuxbox.net:6309/gene>


_______________________________________________
Emc-users mailing list
Emc-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/emc-users

Reply via email to