Mori Seiki SL1 Turret PLC

All things related to the Centroid Acorn CNC Controller

Moderator: cnckeith

Obsidian
Posts: 48
Joined: Tue Dec 03, 2019 10:40 pm
Acorn CNC Controller: Yes
Allin1DC CNC Controller: No
Oak CNC controller: No
CNC Control System Serial Number: 780473A92571-0930192501
DC3IOB: No
CNC12: Yes
CNC11: No
CPU10 or CPU7: No

Re: Mori Seiki SL1 Turret PLC

Post by Obsidian »

Alright I'm at the final stage of the turret code to set the requested tool position. For the cnctch.mac, Since I have an axis driven turret I'm going to have to set an Axis move until #96007 == #96008. I have #96007 set a current tool position word and #96008 as requested tool position word. How should I go about writing this?



Current report attached.

Code: Select all

;------------------------------------------------------------------------------
; Filename: cnctch.mac
; Description: Tool change request macro
; Notes:
; Requires: 
; I/O:

;------------------------------------------------------------------------------
#100 = #96007

IF #50001                        		;Prevent lookahead from parsing past here
IF #4201 || #4202 THEN GOTO 1000 		;Skip macro if graphing or searching
IF (#4120 == #100) THEN GOTO 1000      	;Skip macro if already at position
N100                             		;Insert your code between N100 and N1000  

M94 /11                           		;Turn on Output to Open Turret
M107
M107
M107							 		;Send requested tool number to PLC program
M101 /70015                      		;Wait for memory bit ToolChangeComplete_M
IF #50001								;Prevent lookahead from parsing past here
#101 = #96006							;Get current turret position
G10 P1950 R[#101]						;Set parameter 950 to current turret position
G4 P0.5							 		;Wait 0.5 seconds
M95 /11							 		;Turn off Output to Close Turret


N1000                            		;End of Macro

Code: Select all

;------------------------------------------------------------------------------
                              AtcSequentialStage
;------------------------------------------------------------------------------
IF !(ToolTurretPosBit3) && !(ToolTurretPosBit4) && !(ToolTurretPosBit5) && SV_MACHINE_PARAMETER_161 >= 1 THEN TurretBits_W = 28
IF !(ToolTurretPosBit1) && !(ToolTurretPosBit4) && !(ToolTurretPosBit5) && SV_MACHINE_PARAMETER_161 >= 1 THEN TurretBits_W = 25
IF !(ToolTurretPosBit1) && !(ToolTurretPosBit2) && !(ToolTurretPosBit5) && SV_MACHINE_PARAMETER_161 >= 1 THEN TurretBits_W = 19
IF !(ToolTurretPosBit2) && !(ToolTurretPosBit3) && !(ToolTurretPosBit5) && SV_MACHINE_PARAMETER_161 >= 1 THEN TurretBits_W = 22
IF !(ToolTurretPosBit2) && !(ToolTurretPosBit4) && !(ToolTurretPosBit5) && SV_MACHINE_PARAMETER_161 >= 1 THEN TurretBits_W = 26
IF !(ToolTurretPosBit1) && !(ToolTurretPosBit3) && !(ToolTurretPosBit5) && SV_MACHINE_PARAMETER_161 >= 1 THEN TurretBits_W = 21
IF !(ToolTurretPosBit1) && !(ToolTurretPosBit2) && !(ToolTurretPosBit4) && SV_MACHINE_PARAMETER_161 >= 1 THEN TurretBits_W = 11
IF !(ToolTurretPosBit1) && !(ToolTurretPosBit2) && !(ToolTurretPosBit3) && SV_MACHINE_PARAMETER_161 >= 1 THEN TurretBits_W = 7

IF TurretBits_W == 28 THEN CurrentTurretPosition_W = 1
IF TurretBits_W == 25 THEN CurrentTurretPosition_W = 2
IF TurretBits_W == 19 THEN CurrentTurretPosition_W = 3
IF TurretBits_W == 22 THEN CurrentTurretPosition_W = 4
IF TurretBits_W == 26 THEN CurrentTurretPosition_W = 5
IF TurretBits_W == 21 THEN CurrentTurretPosition_W = 6
IF TurretBits_W == 11 THEN CurrentTurretPosition_W = 7
IF TurretBits_W == 7  THEN CurrentTurretPosition_W = 8

IF True THEN BTW TurretBits_W ToolTurretPosBit1 5

IF TRUE THEN SV_PLC_CAROUSEL_POSITION = CurrentTurretPosition_W
IF TRUE THEN RequestedTurretPosition_W = SV_TOOL_NUMBER
IF (CurrentTurretPosition_W == RequestedTurretPosition_W) THEN SET ToolChangeComplete_M
IF (RequestedTurretPosition_W != CurrentTurretPosition_W) THEN RST ToolChangeComplete_M
Attachments
report_780473A92571-0930192501_2020-11-25_22-32-44.zip
(724.51 KiB) Downloaded 110 times


Obsidian
Posts: 48
Joined: Tue Dec 03, 2019 10:40 pm
Acorn CNC Controller: Yes
Allin1DC CNC Controller: No
Oak CNC controller: No
CNC Control System Serial Number: 780473A92571-0930192501
DC3IOB: No
CNC12: Yes
CNC11: No
CPU10 or CPU7: No

Re: Mori Seiki SL1 Turret PLC

Post by Obsidian »

Okay here's how I did it. In the PLC code I set the ToolChangeComplete_M memory bit to be active when the current tool position matched the requested tool position word value. From there when the ToolChangeComplete_M was true it activates an Output. Using this output as a switch I tied the NC side of the relay to and input and the common with 24v. When ToolChangeComplete_M is true, it activates the output which then activates the Input. From there in the tool change request macro I had it set the requested tool change value with M107 and then do the Axis movement at 50ipm until it detects the ToolChangeComplete_M input change at input40. Still need to add a few safeguards in the code to keep it from doing a tool change at the wrong time.

Code: Select all

;------------------------------------------------------------------------------
; Filename: cnctch.mac
; Description: Tool change request macro
; Notes:
; Requires: 
; I/O:

;------------------------------------------------------------------------------
#100 = #96007

IF #50001                        		;Prevent lookahead from parsing past here
IF #4201 || #4202 THEN GOTO 1000 		;Skip macro if graphing or searching
IF (#4120 == #100) THEN GOTO 1000      	;Skip macro if already at position
N100                             		;Insert your code between N100 and N1000  


M107
M94 /11                                 ;Open Turret Output
G4 P1.5                                 ;Wait 1.5 seconds
M105 /A P-40 F50                   ;Rotate Turret @ 50IPM Until Input 40 is Close. Input 40 is off when current tool position W7 = requested tool pos W8.
M101 /70015                          ;Wait for memory bit ToolChangeComplete_M [MEM15]
IF #50001				     ;Prevent lookahead from parsing past here
#101 = #96007			     ;Get current turret position. #96007 is Word W7
G10 P1950 R[#101]		     ;Set parameter 950 to current turret position
G4 P0.5				     ;Wait 0.5 seconds
M95 /11				     ;Turn off Output to Open Turret
M94 /12                                 ;Turn On Output to Close Turret
G4 P1.5                                  ;Wait 1.5 seconds
M95 /12                                 ;Turn off Output to Close Turret


N1000                            		;End of Macro

Code: Select all

;------------------------------------------------------------------------------
                              AtcSequentialStage
;------------------------------------------------------------------------------
IF !(ToolTurretPosBit3) && !(ToolTurretPosBit4) && !(ToolTurretPosBit5) && SV_MACHINE_PARAMETER_161 >= 1 THEN TurretBits_W = 28
IF !(ToolTurretPosBit1) && !(ToolTurretPosBit4) && !(ToolTurretPosBit5) && SV_MACHINE_PARAMETER_161 >= 1 THEN TurretBits_W = 25
IF !(ToolTurretPosBit1) && !(ToolTurretPosBit2) && !(ToolTurretPosBit5) && SV_MACHINE_PARAMETER_161 >= 1 THEN TurretBits_W = 19
IF !(ToolTurretPosBit2) && !(ToolTurretPosBit3) && !(ToolTurretPosBit5) && SV_MACHINE_PARAMETER_161 >= 1 THEN TurretBits_W = 22
IF !(ToolTurretPosBit2) && !(ToolTurretPosBit4) && !(ToolTurretPosBit5) && SV_MACHINE_PARAMETER_161 >= 1 THEN TurretBits_W = 26
IF !(ToolTurretPosBit1) && !(ToolTurretPosBit3) && !(ToolTurretPosBit5) && SV_MACHINE_PARAMETER_161 >= 1 THEN TurretBits_W = 21
IF !(ToolTurretPosBit1) && !(ToolTurretPosBit2) && !(ToolTurretPosBit4) && SV_MACHINE_PARAMETER_161 >= 1 THEN TurretBits_W = 11
IF !(ToolTurretPosBit1) && !(ToolTurretPosBit2) && !(ToolTurretPosBit3) && SV_MACHINE_PARAMETER_161 >= 1 THEN TurretBits_W = 7

IF TurretBits_W == 28 THEN CurrentTurretPosition_W = 1
IF TurretBits_W == 25 THEN CurrentTurretPosition_W = 2
IF TurretBits_W == 19 THEN CurrentTurretPosition_W = 3
IF TurretBits_W == 22 THEN CurrentTurretPosition_W = 4
IF TurretBits_W == 26 THEN CurrentTurretPosition_W = 5
IF TurretBits_W == 21 THEN CurrentTurretPosition_W = 6
IF TurretBits_W == 11 THEN CurrentTurretPosition_W = 7
IF TurretBits_W == 7  THEN CurrentTurretPosition_W = 8

IF True THEN BTW TurretBits_W ToolTurretPosBit1 5

IF TRUE THEN SV_PLC_CAROUSEL_POSITION = CurrentTurretPosition_W
IF TRUE THEN RequestedTurretPosition_W = SV_TOOL_NUMBER
IF (CurrentTurretPosition_W == RequestedTurretPosition_W) THEN SET ToolChangeComplete_M
IF (CurrentTurretPosition_W != RequestedTurretPosition_W) THEN RST ToolChangeComplete_M
IF ToolChangeComplete_M THEN SET ToolChangeComplete_O
IF !ToolChangeComplete_M THEN RST ToolChangeComplete_O


cncsnw
Community Expert
Posts: 4565
Joined: Wed Mar 24, 2010 5:48 pm

Re: Mori Seiki SL1 Turret PLC

Post by cncsnw »

Using a servo motor to drive a turret with absolute-position switches gives you an odd hybrid, with several choices.

I think I would use the switches (decoded as discussed above) to figure out where you are starting from; but then calculate the distance (number of positions) required to get to the desired destination, and do a "G0 G91 A__" move to drive the servo that number of positions. That will be a lot simpler than trying to run the servo an indeterminate distance while waiting for the PLC to tell you it has arrived.

If you want to stick with your method (M105), you can ditch the external wiring by having M105 watch a memory bit instead. For example, if "ToolChangeComplete_M" were defined as MEM31, then you could move until it gets set using 'M105/A P-70031 F50". That should have the added benefit of stopping the movement at least one scan sooner.


Obsidian
Posts: 48
Joined: Tue Dec 03, 2019 10:40 pm
Acorn CNC Controller: Yes
Allin1DC CNC Controller: No
Oak CNC controller: No
CNC Control System Serial Number: 780473A92571-0930192501
DC3IOB: No
CNC12: Yes
CNC11: No
CPU10 or CPU7: No

Re: Mori Seiki SL1 Turret PLC

Post by Obsidian »

cncsnw wrote: Fri Nov 27, 2020 11:27 pm Using a servo motor to drive a turret with absolute-position switches gives you an odd hybrid, with several choices.

I think I would use the switches (decoded as discusses above) to figure out where you are starting from; but then calculate the distance (number of positions) required to get to the desired destination, and do a "G0 G91 A__" move to drive the servo that number of positions. That will be a lot simpler than trying to run the servo an indeterminate distance while waiting for the PLC to tell you it has arrived.

If you want to stick with your method (M105), you can ditch the external wiring by having M105 watch a memory bit instead. For example, if "ToolChangeComplete_M" were defined as MEM31, then you could move until it gets set using 'M105/A P-70031 F50". That should have the added benefit of stopping the movement at least one scan sooner.
This would actually be ideal. I wasn't sure if you could use a memory bit in place of the input on that code. I agree that I could have done absolute position with the servo but figuring out the turns/rev was going to be a little tricky. The mechanics of the turret is interesting as it has a zone of disengagement for a few revolutions between tools. I think they did this to remove any kind of load on the internal drive gear when the turret returns to lock.

This is the code now.

Code: Select all

;------------------------------------------------------------------------------
; Filename: cnctch.mac
; Description: Tool change request macro
; Notes:
; Requires: 
; I/O:

;------------------------------------------------------------------------------
#100 = #96007

IF #50001                        		;Prevent lookahead from parsing past here
IF #4201 || #4202 THEN GOTO 1000 		;Skip macro if graphing or searching
IF (#4120 == #100) THEN GOTO 1000      	;Skip macro if already at position
N100                             		;Insert your code between N100 and N1000  


M107
M94 /11                                 ;Open Turret Output
G4 P1.5                                 ;Wait 1.5 seconds
M105 /A P-70015 F50              ;Rotate Turret @ 50IPM until memory bit 15 is active. 
M101 /70015                          ;Wait for memory bit ToolChangeComplete_M [MEM15]
IF #50001				     ;Prevent lookahead from parsing past here
#101 = #96007			     ;Get current turret position. #96007 is Word W7
G10 P1950 R[#101]		     ;Set parameter 950 to current turret position
G4 P0.5				     ;Wait 0.5 seconds
M95 /11				     ;Turn off Output to Open Turret
M94 /12                                 ;Turn On Output to Close Turret
G4 P1.5                                  ;Wait 1.5 seconds
M95 /12                                 ;Turn off Output to Close Turret


N1000                            		;End of Macro


Obsidian
Posts: 48
Joined: Tue Dec 03, 2019 10:40 pm
Acorn CNC Controller: Yes
Allin1DC CNC Controller: No
Oak CNC controller: No
CNC Control System Serial Number: 780473A92571-0930192501
DC3IOB: No
CNC12: Yes
CNC11: No
CPU10 or CPU7: No

Re: Mori Seiki SL1 Turret PLC

Post by Obsidian »

So added another sensor to check if the turret is unlocked before trying to move to the next position. Now im on to optimizing the tool change time and looking to add some logic to have it change rotate direction based on how close the current tool is to the next requested tool. One issue I'm having now is having to add a small dwell time of 1 second between the M94 /11 and the M101 /70016 or it will not work on the next tool change. It seems to skip right past the M94 /11 on consecutive tool changes.

Code: Select all

;------------------------------------------------------------------------------
; Filename: cnctch.mac
; Description: Tool change request macro
; Notes:
; Requires: 
; I/O:

;------------------------------------------------------------------------------
#100 = #96007

IF #50001                        		;Prevent lookahead from parsing past here
IF #4201 || #4202 THEN GOTO 1000 		;Skip macro if graphing or searching
IF (#4120 == #100) THEN GOTO 1000      	;Skip macro if already at position
N100                             		;Insert your code between N100 and N1000  


M107
M94 /11                                 ;Open Turret Output
G4 P1                                       ;Wait 1 Second
M101 /70016                             ;Wait for Turret Open Input
G4 P1                     		        ;Wait 1 Seconds
M105 /A P-70015 F50                     ;Rotate Turret @ 50IPM unit MEM15 bit is active.
G4 P1
M95 /11
G4 P1
M94 /12                                 ;Turn On Output to Close Turret
G4 P1                                   ;Wait 1 second
M95 /12                                 ;Turn off Output to Close Turret
IF #50001								;Prevent lookahead from parsing past here
#101 = #96007							;Get current turret position
G10 P1950 R[#101]						;Set parameter 950 to current turret position





N1000                            		;End of Macro


cncsnw
Community Expert
Posts: 4565
Joined: Wed Mar 24, 2010 5:48 pm

Re: Mori Seiki SL1 Turret PLC

Post by cncsnw »

Can you post a current report?

Without that, we can't see what your PLC program does with W7, MEM15, MEM16, SV_M94_M95_11 and SV_M94_M95_12.

If you are testing the turret using MDI or a CNC program, are you using the full 4-digit tool number? Remember that "T1", "T2", "T8" etc. are all commands to change to turret position zero, just with different offsets selected.


Obsidian
Posts: 48
Joined: Tue Dec 03, 2019 10:40 pm
Acorn CNC Controller: Yes
Allin1DC CNC Controller: No
Oak CNC controller: No
CNC Control System Serial Number: 780473A92571-0930192501
DC3IOB: No
CNC12: Yes
CNC11: No
CPU10 or CPU7: No

Re: Mori Seiki SL1 Turret PLC

Post by Obsidian »

Sorry about that, I did make a minor change since the last compile.
Attachments
report_780473A92571-0930192501_2020-12-04_17-56-03.zip
(605.84 KiB) Downloaded 121 times


cncsnw
Community Expert
Posts: 4565
Joined: Wed Mar 24, 2010 5:48 pm

Re: Mori Seiki SL1 Turret PLC

Post by cncsnw »

I don't immediately see the issue with M94/11 and M101/70016. You might have to use the PLC Detective Logic Analyzer to see what is happening there.

It is conventional to put at least a short dwell time after M107, to ensure that the PLC program has received the new SV_TOOL_NUMBER value before you do anything that depends on it (such as compare it with the current position, in order to decide whether any movement is necessary). However, in your case waiting for the turret to unlock should introduce sufficient delay even if you did not have a G4 in there.

You should use BTW to read the turret position bits, instead of just testing to see if at least three switches are off. The discrete bit tests you are using are prone to momentary false readings during transition, if one sensor opens before the next closes; and also prone to a false reading if one or more sensors fail open. Using BTW to read all five bits will be less prone to false readings.

Here is a logic puzzle. How is:

Code: Select all

IF OpenToolTurret_M THEN (OpenToolTurretPD)
IF (OpenToolTurretPD && !OpenToolTurret && OpenToolTurret_M) THEN SET OpenToolTurret
IF (OpenToolTurret && !OpenToolTurret_M) THEN RST OpenToolTurret
usefully different from:

Code: Select all

IF OpenToolTurret_M THEN (OpenToolTurret)
?

In either case, doesn't OpenToolTurret turn on when OpenToolTurret_M turns on, and turn off when OpenToolTurret_M turns off?
Last edited by cncsnw on Sat Dec 05, 2020 9:14 pm, edited 1 time in total.
Reason: Corrected "WTB" to "BTW"


Obsidian
Posts: 48
Joined: Tue Dec 03, 2019 10:40 pm
Acorn CNC Controller: Yes
Allin1DC CNC Controller: No
Oak CNC controller: No
CNC Control System Serial Number: 780473A92571-0930192501
DC3IOB: No
CNC12: Yes
CNC11: No
CPU10 or CPU7: No

Re: Mori Seiki SL1 Turret PLC

Post by Obsidian »

Yah that's a bit of an excessive check in that code hah so that's fixed now. Adding that dwell time right after M107 was the key.


cncsnw
Community Expert
Posts: 4565
Joined: Wed Mar 24, 2010 5:48 pm

Re: Mori Seiki SL1 Turret PLC

Post by cncsnw »

For what it's worth, the original version allows for the possibility that code elsewhere in the PLC program might turn "OpenToolTurret" off while the "OpenToolTurret_M" request remains on, assuming that in that case we do not want the "OpenToolTurret_M" request to cause the output to turn back on, unless and until the request is removed, and then reasserted.

But that is clearly not the case here, because there is no other logic in the PLC program -- at least, not logic that you appear to be using -- that attempts to control the OpenToolTurret output.


Post Reply