(Solved) acorn PLC programming change. For dyn4 servo spindle control.

All things related to the Centroid Acorn CNC Controller

Moderator: cnckeith

SpacedmanSpiff
Posts: 25
Joined: Mon Nov 09, 2020 6:43 pm
Acorn CNC Controller: Yes
Allin1DC CNC Controller: No
Oak CNC controller: No
CNC Control System Serial Number: oc1c5708fb62-01224202901
DC3IOB: No
CNC12: Yes
CNC11: No
CPU10 or CPU7: No

(Solved) acorn PLC programming change. For dyn4 servo spindle control.

Post by SpacedmanSpiff »

I am running a DMM dyn4 for a spindle. ACORN commands this just fine with exception of manual control. If i am over 3000 rpm and hit the Spin Stop button ACORN set analog to zero and disables VFD enable. This causes the spindle to coast to a stop and produces and over volt issue with the DYN4.

i can command M3/M4 at full RPM without difficulty. As long as the enable is on or the RPM is less than 2500 rpm the DYN4 can handle it without issue.

so I need to do one of 2 things
A. delay the VFD disable long enough to allow the spindle to stop.
B. set the RPM down sufficiently to allow DYN4 to absorb the voltage from coasting to a stop.

The VFD enable sequence is still pretty murky to me. However I think I have the set down option figgered out.

Can a PLC guru take a look and critique the code below ?

;==============================================================================
StandardSpindleStage
;==============================================================================
IF (SpindleEnableOut_M || SpinStart_M ) && !SpinStop_M
THEN SET SpindleEnableOut_M
IF !((SpindleEnableOut_M || SpinStart_M ) && !SpinStop_M) THEN RST SpindleEnableOut_M
IF SpindleEnableOut_M THEN (VFDEnable_O)
IF SpindleEnableOut_M && !SpindleDirectionOut_M && SpindleBrakeTimer THEN (SpinFWD)
IF SpindleEnableOut_M && SpindleDirectionOut_M && SpindleBrakeTimer THEN (SpinREV), (VFDDirection_O)
IF !SpindleEnableOut_M &&TwelveBitSpeed_W<2500 then (DoSpindleStop)
IF !SpindleEnableOut_M && TwelveBitSpeed_W >2500 THEN (TwelveBitSpeed_W =1000)
IF TwelveBitSpeed_W =1000 THEN set T99
IF !SpindleEnableOut_M && T99 then (DoSpindleStop)

;IF !SpindleEnableOut_M THEN (DoSpindleStop)


Thanks and All the best
Sean
Last edited by SpacedmanSpiff on Sun Nov 22, 2020 6:56 pm, edited 1 time in total.
cncsnw
Posts: 3835
Joined: Wed Mar 24, 2010 5:48 pm

Re: acorn PLC programming change.

Post by cncsnw »

While it is reasonable to assume that "DoSpindleStop" is a thing that stops the spindle, that is not the case. It is just a status flag used in some parts of the CNC12 software to indicate whether the spindle is running or not.

Actually stopping the spindle is done by the PLC, when it turns off the SpinFWD or SpinREV output relay.

Also, "TwelveBitSpeed_W" is the number sent to the 12-bit DAC to generate the 0-10V signal. It ranges from 0 to 4095, regardless of how many RPM your spindle happens to turn when the PLC sends 10V to the drive. Suppose that your maximum RPM is 8000: then 2500 RPM would require 10V * 2500/8000 = 3.125V, and "TwelveBitSpeed_W" would be 0.3125*4095 = 1280.

I would not bother trying to make it dependent on the RPM command. That is unnecessarily convoluted.

In short, instead of using coil-style outputs for SpinFwd and SpinRev, use SET commands to turn them on when the spindle should start and run. Then, when SpindleEnableOut_M turns off, start a timer, giving it a suitable setpoint (maybe 2000ms). When SpindleEnableOut_M turns on, cancel that timer. When the timer reaches its setpoint, RST SpinFwd and SpinRev.

That way, the standard speed-control logic will manage the analog output -- reducing it to zero when SpindleEnableOut_M turns off -- but the modified start/stop logic will maintain the drive enable long enough for the drive to decelerate the motor.

I am still assuming here that you would get the same fault condition if you ran:
M3 S4500
and then stopped the spindle with:
M5

I assume that, because there is no difference, in terms of PLC logic, between starting and stopping the spindle in manual mode with Spin Start and Spin Stop; and starting and stopping the spindle in auto mode with M3 and M5.
SpacedmanSpiff
Posts: 25
Joined: Mon Nov 09, 2020 6:43 pm
Acorn CNC Controller: Yes
Allin1DC CNC Controller: No
Oak CNC controller: No
CNC Control System Serial Number: oc1c5708fb62-01224202901
DC3IOB: No
CNC12: Yes
CNC11: No
CPU10 or CPU7: No

Re: acorn PLC programming change.

Post by SpacedmanSpiff »

Ok I think I have a murky understanding of what you are attempting to teach.

Yes M5 generates the same fault. I was not ramping the RPM up in MDI high enough to set the fault on the DYN4.

I ruminated on your suggestion pretty much all day. I agree that you would be able to set a timer and etc....however what do you think of this idea ?
moving the line that resets the VFD enable out memory bit to the end of the stage. That would allow the spinforward or backwards command to accomplish the speed control and then shut the VFD enable down the next loop through......Nope. still need the timer as we are humming along at mhz....
OK, timer it is.
==============================================================================
StandardSpindleStage
;==============================================================================
IF (SpindleEnableOut_M || SpinStart_M ) && !SpinStop_M
THEN SET SpindleEnableOut_M, SET (VFDEnable_O)
IF !((SpindleEnableOut_M || SpinStart_M ) && !SpinStop_M) THEN RST SpindleEnableOut_M, set VFDdisableTimer_T
IF SpindleEnableOut_M && !SpindleDirectionOut_M && SpindleBrakeTimer THEN (SpinFWD)
IF SpindleEnableOut_M && SpindleDirectionOut_M && SpindleBrakeTimer THEN (SpinREV), (VFDDirection_O)
IF !SpindleEnableOut_M && VFDdisableTimer_T THEN RST(VFDEnable_O), RST VFDdisableTimer_T, (DoSpindleStop)

thoughts and critiques welcome.
and thank you for your time and effort.
Sean
cncsnw
Posts: 3835
Joined: Wed Mar 24, 2010 5:48 pm

Re: acorn PLC programming change.

Post by cncsnw »

Don't bother trying to rewrite the code that manages SpindleEnableOut_M. Just work with it after the standard logic has turned it on and off.

Does your system use the output named "VFDEnable_O" to send the run command to the drive? Or does it use the output named "SpinFWD", and perhaps also the output named "SpinREV"? Unfortunately, the code in "StandardSpindleStage" is trying to do spindle control in at least two different ways simultaneously, so it is a little convoluted.

When you use SET and RST, the target bit does not have parentheses around it.
You need to assign a preset time (number of milliseconds) to the timer.
Appending "Timer" and appending "_T" are two different ways of showing readers that a token is a timer. It is redundant to use both.

Code: Select all

;==============================================================================
                                StandardSpindleStage
;==============================================================================
IF (SpindleEnableOut_M || SpinStart_M ) && !SpinStop_M
  THEN SET SpindleEnableOut_M
IF !((SpindleEnableOut_M || SpinStart_M ) && !SpinStop_M) THEN RST SpindleEnableOut_M
IF SpindleEnableOut_M THEN SET VFDEnable_O, RST VFDDisableTimer
IF  SpindleEnableOut_M  && !SpindleDirectionOut_M && SpindleBrakeTimer THEN SET SpinFWD
IF  SpindleEnableOut_M  && SpindleDirectionOut_M && SpindleBrakeTimer THEN  SET SpinREV, SET VFDDirection_O
IF !SpindleEnableOut_M THEN (DoSpindleStop), VFDDisableTimer = 2000, SET VFDDisableTimer
IF VFDDisableTimer THEN RST VFDEnable_O, RST SpinFWD, RST SpinREV, RST VFDDirection_O
SpacedmanSpiff
Posts: 25
Joined: Mon Nov 09, 2020 6:43 pm
Acorn CNC Controller: Yes
Allin1DC CNC Controller: No
Oak CNC controller: No
CNC Control System Serial Number: oc1c5708fb62-01224202901
DC3IOB: No
CNC12: Yes
CNC11: No
CPU10 or CPU7: No

Re: acorn PLC programming change.

Post by SpacedmanSpiff »

Dear Cncsnw,
Thank you much !!
All is well in my world at the moment. I am goofing with alternative code just to further my understanding so again thank you for providing that sample !

Sean
Pete Rondeau
Posts: 33
Joined: Thu Oct 03, 2019 12:59 pm
Acorn CNC Controller: Yes
Allin1DC CNC Controller: No
Oak CNC controller: No
CNC Control System Serial Number: none
DC3IOB: No
CNC12: Yes
CNC11: No
CPU10 or CPU7: No
Location: South Central Pennsylvania
Contact:

Re: (Solved) acorn PLC programming change. For dyn4 servo spindle control.

Post by Pete Rondeau »

Thanks for this! This fixed my issue as well (but I'm a bit disappointed in myself that I couldn't figure out the PLC programming.)

Pete
Follow my progress on YouTube
martyscncgarage
Posts: 9914
Joined: Tue Mar 28, 2017 12:01 pm
Acorn CNC Controller: Yes
Allin1DC CNC Controller: Yes
Oak CNC controller: No
CNC Control System Serial Number: none
DC3IOB: No
CNC12: Yes
CNC11: Yes
CPU10 or CPU7: Yes
Location: Mesa, AZ

Re: (Solved) acorn PLC programming change. For dyn4 servo spindle control.

Post by martyscncgarage »

Pete Rondeau wrote: Tue Dec 08, 2020 9:28 pm Thanks for this! This fixed my issue as well (but I'm a bit disappointed in myself that I couldn't figure out the PLC programming.)

Pete
Pete, have you tried rigid tapping yet? Have you done enough yet to test the performance of the spindle?
Reminder, for support please follow this post: viewtopic.php?f=20&t=383
We can't "SEE" what you see...
Mesa, AZ
martyscncgarage
Posts: 9914
Joined: Tue Mar 28, 2017 12:01 pm
Acorn CNC Controller: Yes
Allin1DC CNC Controller: Yes
Oak CNC controller: No
CNC Control System Serial Number: none
DC3IOB: No
CNC12: Yes
CNC11: Yes
CPU10 or CPU7: Yes
Location: Mesa, AZ

Re: (Solved) acorn PLC programming change. For dyn4 servo spindle control.

Post by martyscncgarage »

Those of you with Dyn4, was it suggested that you put a regenerative resistor on the T3 terminals of DYN4?
Excerpt from the DYN4 manual:
Regen1.JPG
Regen2.JPG
Reminder, for support please follow this post: viewtopic.php?f=20&t=383
We can't "SEE" what you see...
Mesa, AZ
Pete Rondeau
Posts: 33
Joined: Thu Oct 03, 2019 12:59 pm
Acorn CNC Controller: Yes
Allin1DC CNC Controller: No
Oak CNC controller: No
CNC Control System Serial Number: none
DC3IOB: No
CNC12: Yes
CNC11: No
CPU10 or CPU7: No
Location: South Central Pennsylvania
Contact:

Re: (Solved) acorn PLC programming change. For dyn4 servo spindle control.

Post by Pete Rondeau »

Hey Marty,
No, I haven't tried tapping. I still need to add a spindle encoder before I can do that.

I asked about the resistor twice. Once when I purchased the components and a second time when I was having trouble tuning it. Both times I was told it shouldn't need it. Based on my experience with other drives and the results I was getting I decided it was worth a try. I obtained one from Mouser based off of their specs rather than having the delay of customs.
Now,my Mitsubishi drives all have a parameter you can tweak if you add an external resistor so I kinda expected the same thing here but I see no option to tell the drive to make use of the resistor. It doesn't feel to me that adding the resistor has made any change whatsoever.

Pete
Follow my progress on YouTube
martyscncgarage
Posts: 9914
Joined: Tue Mar 28, 2017 12:01 pm
Acorn CNC Controller: Yes
Allin1DC CNC Controller: Yes
Oak CNC controller: No
CNC Control System Serial Number: none
DC3IOB: No
CNC12: Yes
CNC11: Yes
CPU10 or CPU7: Yes
Location: Mesa, AZ

Re: (Solved) acorn PLC programming change. For dyn4 servo spindle control.

Post by martyscncgarage »

Pete Rondeau wrote: Wed Dec 09, 2020 10:33 am Hey Marty,
No, I haven't tried tapping. I still need to add a spindle encoder before I can do that.

I asked about the resistor twice. Once when I purchased the components and a second time when I was having trouble tuning it. Both times I was told it shouldn't need it. Based on my experience with other drives and the results I was getting I decided it was worth a try. I obtained one from Mouser based off of their specs rather than having the delay of customs.
Now,my Mitsubishi drives all have a parameter you can tweak if you add an external resistor so I kinda expected the same thing here but I see no option to tell the drive to make use of the resistor. It doesn't feel to me that adding the resistor has made any change whatsoever.

Pete
The resistor is for dumping energy. It is automatically activated by the drive. It is also used if the incoming voltage is higher than "normal"
The other poster said he was having Over Voltage faults when shutting down the servo from a high speed....that is why I suggested it.

DYN4 has an Encoder output that is compatible with the Acorn Encoder input. IF you belted the spindle motor to the spindle at 1:1 with a timing belt, then in "theory" it should work. I tried this on a small lathe. 750W servo. Tuning the setup was challenging. It was much easier to go the traditional route of a small 3 phase motor and VFD, along with an encoder belted to the spindle at 1:1

Many people try the DMM Dyn4/Servo solution in hopes of either saving themselves the time and trouble of fitting up a traditional encoder to the spindle correctly or a "C axis" I am interested in seeing a video of someone who successfully implemented it with a write up. I want to see the machine peck tap in a block of machinable wax....

Marty
Reminder, for support please follow this post: viewtopic.php?f=20&t=383
We can't "SEE" what you see...
Mesa, AZ
Post Reply