Jump to content
OMRON Forums

Multiple Independent Coordinate Systems


hendraprimasyahputra

Recommended Posts

Hi all,

 

I want to have multiple coordinate system in my system. Currently i have 5 actuator. Here how i assign them in motion program :

 

&1
#1->1X
#2->1Y
#3->1Z

&2
#5->1A
#6->1B

 

As you can see, i have 2 coordinate system. In my motion program i want to execute them simulaneously. For example X and A ( but with different feedrate ). But it fails when i try using this program :

 

OPEN PROG 3 CLEAR
INC
LINEAR
DWELL 1000
F 1000 X 10000 F 10000 A 16383 
DWELL 1000 
F 1000 X -10000 F 10000 A -16383
DWELL 1000
CLOSE

 

Only one coordinate system is executed. Anybody can help me ? I need to know how to assign different feedrate on multiple coordinate system. Thx

Link to comment
Share on other sites

  • Replies 18
  • Created
  • Last Reply

Top Posters In This Topic

Can you give us more details of what trying to accomplish ?

 

Do the X and A axes need to start move at same time ?

 

Do they need to finish each move at SAME time ?

 

Why different feedrates for X and A during the move ?

 

Here is Example to run SAME motion program in 2 CS at same time :

&1#1->1X ;now motor 1 is X axis in CS1

&2#5->1X ;now motor 5 is X axis in CS2

 

Open Prog 3 clear close

Inc Linear

X1000 F(Q1) ;Q1 can be different value in CS1 and CS2 see manual

Close

 

&1B3R&2B3R ;here start both CS1 and CS2 to run same program

 

-this will run same program in both CS1 and 2 and use different feedrate Q1 for each, they will not be coordinated and motors will not be done with moves at same time...

 

Here is Example to run different moves in different CS like Prog 3 you show.

 

&1#1->1X

&2#5->1A

 

Open Prog 3 clear

...

X1000 F1000

Close

 

Open Prog 4 clear

...

A16383 F500

Close

 

&1B3R&2B4R ;will start programs at same time but may be done at different time

 

--here you are running different feedrates in different CS and starting them at same time, but they are not coordinated with each other.

 

--- to coordinate between CS programs you could have some Flag variables that hold up execution in the motion program until they are set, and they are set by each CS as it completes a move...

 

--But I don't think any of the above examples help to solve your problem... they just answer the questions.

 

Give us a bit more detail of what you are trying to accomplish and maybe there is a better way to get it done.

 

Feedrates are usually a result of some Vector calculation so that each coordinated axis will run at a different velocity so as to start and stop at same time - they move together.

 

It might be that you do NOT want motor 5 A axis to be in the CS since you want it to start with X but not run at same rate to it's destination... you may want to have motor 5 controlled by a PLC outside the CS and have a flag that is set in the motion program when you want Motor 5 to make a move, and it can then do so at it's own Jog rate. So it can start with M1 in the program but run on to it's own endpoint at it's own rate. By using flag variables you can get some coordination between the CS1 program and the Seperate Motor 5 A axis as needed.

 

 

Thanks...

mike

Link to comment
Share on other sites

In my case i want to do an error calculation of X-Axis motion and put the error value as the input of A-Axis command to do an error compensation of X-Axis. This X and A actuator actually a stacked actuator in my system ( you can see in my previous post about close loop piezo, i put my system in that thread ). The purpose is to have more precise and accurate movement.

I decided to use the PLC program to monitor my XY motion and doing error calculation in the PLC program loop. Right now the program running well to do error calculation, but when i comeback to motion program ( to do simutaneous movement ), i got problem on specifiying the feedrate. Here is my program :

 

OPEN PROG 2 CLEAR
INC
LINEAR
F 20000
A 16383
DWELL 5000
F 100 
X 500 A(P6) ------>> in this step i want to have different feedrate but   in the same execution time.
DWELL 1000
X -500 A(P6)  
DWELL 1000
CLOSE

OPEN PLC 2 CLEAR
P0 = M161/(I108*32)
P1 = M162/(I108*32)
P2 = M261/(I108*32)
P3 = M262/(I108*32)
P4 = P0-P1
P5 = P2-P3
P6  = P4*-52
P7  = P5*52
CLOSE

 

As you can see in my program, i want to execute X axis and A axis simultaneously but with different feedrate. I try to execute this program in single coordinate system setting, but i failed. So i decided to have another coordinate system for that. Anybody can help me ?

 

 

 

Link to comment
Share on other sites

Ok makes sense.

 

But I'm curious why does A have to be a different Feedrate from X ?

-you want it to get done quicker ?

 

Why not just move A commands to the PLC where you are calc it's correction moves ?

 

So in the PLC you can just command A with a jog command... and

set the jog rate I522 = the speed you want it to move...

 

I see no reason why A has to be in the CS with X ?

 

If it does... for other moves this could be done with a Phantom motor and have Motor 5 follow it then disengage when not need to follow.

 

--- So remove Motor 5 from CS.

--- In your PLC add lines to Jog it

#5J=P6

Link to comment
Share on other sites

hendraprimasyahputra and Unit101,

 

Please remember that the error calculation PLC is using real-time data at real-time. The motion program is using the data ahead of time for trajectory calculation, so even if the data is placed in motion program with support of alternate feedrate and FRAXinf out axis A, the data used for calculation is a few cycles behind when the axis A actually outputs the calculated moves.

 

The better way is, as Unit101 suggested, to use CMD"JOG=*" command in the same error calculating PLC. Just remember that you may want to reduce the Ix92 for the motor.

 

Regards,

 

Link to comment
Share on other sites

I tried this code for my PLC loop. I can view my M572 and M672 on the watch window, but motor 5 and 6 can't jog.

 

OPEN PLC 2 CLEAR
P0	= M161/(I108*32)
P1	= M162/(I108*32)
P2	= M261/(I108*32)
P3	= M262/(I108*32)
P4	= P0-P1
P5	= P2-P3
P6 	= P4*-52
P7  = P5*52
M572= P6
M672= P7
CMD"#5J=*#6J=*"
CLOSE

 

Maybe wrong syntax or the cycle is too fast. Any idea in this ?

Link to comment
Share on other sites

I tried this code for my PLC loop. I can view my M572 and M672 on the watch window, but motor 5 and 6 can't jog.

 

OPEN PLC 2 CLEAR
P0	= M161/(I108*32)
P1	= M162/(I108*32)
P2	= M261/(I108*32)
P3	= M262/(I108*32)
P4	= P0-P1
P5	= P2-P3
P6 	= P4*-52
P7  = P5*52
M572= P6
M672= P7
CMD"#5J=*#6J=*"
CLOSE

 

Maybe wrong syntax or the cycle is too fast. Any idea in this ?

 

in addition, i also got negative sign value, when P6 and P7 indication negative value. The jog command from the PLC can't work. I need solution on this, thx.

Link to comment
Share on other sites

I tried this code for my PLC loop. I can view my M572 and M672 on the watch window, but motor 5 and 6 can't jog.

 

OPEN PLC 2 CLEAR
P0	= M161/(I108*32)
P1	= M162/(I108*32)
P2	= M261/(I108*32)
P3	= M262/(I108*32)
P4	= P0-P1
P5	= P2-P3
P6 	= P4*-52
P7  = P5*52
M572= P6
M672= P7
CMD"#5J=*#6J=*"
CLOSE

 

Maybe wrong syntax or the cycle is too fast. Any idea in this ?

 

in addition, i also got negative sign value, when P6 and P7 indication negative value. The jog command from the PLC can't work. I need solution on this, thx.

 

I made a mistake, actually the PLC program was'nt looping, how to make the PLC program to loop ?

Link to comment
Share on other sites

Answers to Questions:

 

1. how to make the PLC program to loop ?

-PLC's loop by nature of how they work, if a plc is enabled in the pmac once each scan of the PLC's the logic in the plc will be executed.

-if the plc has a while loop for other blocking statement it will run to that logic and next time start at that point

-PMAC PLC's work just like traditional PLC's in other controllers

-please refer to the user manual for details and basics of PLC use

 

-also note that once you give the jog command J=* it will run until the motor reaches the destination, you don't have to keep sending the command over and over, unless you want to update the destination each time

 

2. but motor 5 and 6 can't jog. ??

-make sure the MOTORS 5 & 6 are NOT defined in the CS

-if they are in the CS ($1#5->1A) as the A or B axis then they will not

be able to JOG while the CS is running a Motion program

-this is true even if they are not moving or commanded to move

-if they are in the CS while it is running a program direct jogging is not allowed so they will ignore any jog commands in the PLC at this time

 

Other Idea...

-So I think you want to:

-NOT have Motor 5 and 6 defined in the CS with other motors

-Have a PLC that runs logic when needed to move motors for correction during a program

-So likely you want to have some flag varialbe that when is true tells the PLC it is time to do M5 correction

-might look like this:

-so now the PLC with M5 correction will only run when M1 in program is doing a move

 

Undefine All

&1#1->1X

I5=2

Enable PLC 2

&1B222R

 

Open Prog 222 clear

Linear

Inc

M900 == 1 ;tell PLC2 now to run correction with M5

X1000 F250 ;make program move with M1

M900 == 0 ;turn off correction with M5

close

 

OPEN PLC 2 CLEAR

;correction PLC - only do correction with M5 is moving in program

IF(M900 = 0)

#5J/#6J/

Endif

 

IF(M900 = 1)

P0 = M161/(I108*32)

P1 = M162/(I108*32)

P2 = M261/(I108*32)

P3 = M262/(I108*32)

P4 = P0-P1

P5 = P2-P3

P6 = P4*-52

P7 = P5*52

M572= P6

M672= P7

CMD"#5J=*#6J=*"

Endif

CLOSE

 

 

 

 

Link to comment
Share on other sites

It didn't work with #5J=* command, but it worked with M561=P6 setup.

I don't know why it can't work #5J=* command.

 

Another question now, because the PLC program always looping and always updating my values ( it is done in very fast ), it makes my actuator vibrates a lot. How can i control the loop time ? For example to make it slow or faster.

 

Thank you

 

 

Link to comment
Share on other sites

You could use a timer in your plc logic so that it only sends

the actual motion command every x milliseconds. Then by

adjusting some variable could get the control result with delay

that seems to work best.

 

At least 2 ways to use a timer in your code:

1. insert a In Line timer using the While statement in your PLC

-this will hold up execution in the PLC for a give time each time it is cycled thru - this is simpler but will prevent all the PLC code from running each cycle, if this is ok it will work fine.

 

... example of how to create a Inline timer....

 

#define Delay1 i6512

#define msec1 *8388608/I10while(i6512>0)Endw

 

OPEN PLC 2 CLEAR

;correction PLC - only do correction with M5 is moving in program

IF(M900 = 0)

#5J/#6J/

Endif

 

IF(M900 = 1)

P0 = M161/(I108*32)

P1 = M162/(I108*32)

P2 = M261/(I108*32)

P3 = M262/(I108*32)

P4 = P0-P1

P5 = P2-P3

P6 = P4*-52

P7 = P5*52

M572= P6

M672= P7

 

Delay1= 1000 msec1 ;this will hold up execution for 1 second

 

CMD"#5J=*#6J=*"

Endif

 

2. Create in a separate PLC a timer/counter with some Millisecond rate, so that every so many milliseconds it increments a counter variable. Then in your PLC set this counter value to 1 which activates it in the the timer plc and each time thru your PLC look to see it increment, when it is at or above some value you want to delay, set it back to 1 and do what is needed in your PLC. This will allow the whole PLC to run every time but the desired logic to delay will only happen when at some timed rate of x milliseconds.

 

 

 

 

Link to comment
Share on other sites

hendraprimasyahputra,

 

There are a few points I wanted to clarify since this thread is getting longer than expected:

 

1. There are a few syntax problems in your PLC which I will point out in the following code section:

Undefine All		// Make sure there are no motors/axis defined in any coordinate system
&1#1->1X		// Define motor 1 as axis X which will run the motion program (slow acting axis)
I5=2			// Allow background PLCs to execute
Enable PLC 2		// Enable PLC 2. This will start cycling through PLC2 if it's not already running.
//------------------NEW-LINE-----------------------------------------------------------
M900->*			// Make sure M900 doesn't have a definition and it is a self-referncing M-variable
		// or the value of the register it is pointing to may affect your handshaking routine
		// between your PLC and motion program
//-------------------------------------------------------------------------------------


//------------------NEW-LINE-----------------------------------------------------------
&1A			// Make sure motors in coordinate system 1 are closed loop
//-------------------------------------------------------------------------------------
&1B222R			// Execute motion program 1.



Open Prog 222 clear
Linear
Inc
M900 == 1 ;tell PLC2 now to run correction with M5
X1000 F250 ;make program move with M1
M900 == 0 ;turn off correction with M5
//------------------NEW-LINE-----------------------------------------------------------
Dwell 0			// You need a Dwell0 after synchronous M-variable assignment
		// if there is no motion command exists after the assignment
		// remember that the synchronous assignment takes place at the start
		// of next motion block
//-------------------------------------------------------------------------------------
close

OPEN PLC 2 CLEAR
;correction PLC - only do correction with M5 is moving in program
IF(M900 = 0)
//------------------Correction-----------------------------------------------------------
CMD"#5J/#6J/"		// "#5J/#6j/" are online commands. In order to execute them from a PLC
		// they should be quoted and executed using COMMAND/CMD command.
//-------------------------------------------------------------------------------------
Endif

IF(M900 = 1)
P0 = M161/(I108*32)
P1 = M162/(I108*32)
P2 = M261/(I108*32)
P3 = M262/(I108*32)
P4 = P0-P1
P5 = P2-P3
P6 = P4*-52
P7 = P5*52
M572= P6
M672= P7
CMD"#5J=*#6J=*"
Endif
CLOSE 

 

2. You mentioned that the CMD"#5J=*#6J=*" approach did not work. I'm not sure exactly what you mean by "did not work". If you meant that it didn't do what you had in mind, then I can understand but here is what I understand from your approach:

 

In the PLC you're calculating the following error of motor 1 and 2 and then you're applying a gain and assigning it as the position of motor 5 and 6. There are a few major points that I have to point out:

 

A. The following error for each motor is calcualted and held in a register noted in Turbo Software Reference manual Memory Map section. For example for motor 1 and 2 they are: D:$91 and D:$111 (See Turbo Software Reference Manual, Page: 476) So you can save time and not calculate it in the PLC.

 

B. You're commanding motors 5 and 6 to following error of motor 1 and 2 hoping to cancel out the following error of motors 1 and 2. In order to do such an approach, your motors 5 and 6 should run a much faster servo loop than motors 1 and 2 since these motors are trying to act upon a command that gets updated every time the servo calcuations are executed for motor 1 and 2. In order to achieve what you're trying to do, I would have the following suggestions:

 

(I) Increase your servo rate of the controller (Servo Clock Divider and I10)

(II) Use the servo extension (Ixx60) on motors 1 and 2 to run them at your current servo rate.

(III) Tune motors 5 and 6 at the new rate.

(IV) Slave the motors 5 and 6 to following error of motor 1 and 2 using ECT and Ixx05, Ixx06. Your Ixx07 would be your gain variable.

(V) If your correction has to be more elaborate than a simple gain, you can make a virtual motor, lower number than 5 and 6 so their calcuations are done before motors 5 and 6 every sevo cycle, and slave motor 5 and 6 to output of the virtual motors which will give you full PID control on correction value.

 

I hope these suggestions are be helpful.

 

Regards,

Link to comment
Share on other sites

2. You mentioned that the CMD"#5J=*#6J=*" approach did not work. I'm not sure exactly what you mean by "did not work". If you meant that it didn't do what you had in mind, then I can understand but here is what I understand from your approach:

 

If i use the CMD"#5J=*#6J=*" approach , the PLC can't loop. I can't regain new value. But if i use M561=P6*(I108*32), it works but i can't control the speed.

Link to comment
Share on other sites

2. You mentioned that the CMD"#5J=*#6J=*" approach did not work. I'm not sure exactly what you mean by "did not work". If you meant that it didn't do what you had in mind, then I can understand but here is what I understand from your approach:

 

If i use the CMD"#5J=*#6J=*" approach , the PLC can't loop. I can't regain new value. But if i use M561=P6*(I108*32), it works but i can't control the speed.

 

hendraprimasyahputra,

 

If you continuously send CMD commands from a PLC without a delay/timer loop, it is possible to over run the buffer which will cause your background tasks not to respond. You need to implement a timer, even one servo cycle should be sufficient, to allow other background tasks to execute in addition to CMD buffer to be flushed.

 

Unit101 had posted a timer solution earlier in this thread.

 

Regards,

Link to comment
Share on other sites

  • 3 weeks later...

Hi,

 

Finally i managed to have the independent coordinate systems. Here is my code :

 

close					; close all opened buffer	
delete gather				; delete unwanted gathered values
undefine all				; undefine all coordinates system	

&1					; coordinate system 1 X/Y/Z : 0.16 micrometer
#1->1X															
#2->1Y
#3->1Z
&2					; coordinate system 2 A/B   : 0.003 micrometer	
#5->1A
#6->1B

I5 = 2					; allow background PLC program to work

OPEN PROG 1 CLEAR   			; open program 1
INC					; incremental mode
INC(R)					; incremental for radius
CIRCLE1					; clockwise circular interpolation
F 500					; feedrate 1.6 micrometer/second
I 625 J 0				; 100 micron radius circular movement
CLOSE					; close program

OPEN PROG 2 CLEAR                  	; open program 2
While (1 > 0)				; do forever
 INC					; incremental mode		
 LINEAR				; linear mode
 F 32000				; piezo speed 96 micrometer/second
 P0 = M5003				; get error val from PLC
 P1 = M5007				; get error val from PLC	
 A(P0) B(P1)				; execute command 	
 DWELL 5				; wait for 5 ms for settling
EndWhile				; end loop
CLOSE					; end program		

OPEN PLC 2 CLEAR			; open PLC prog
M5000 = M161*0.16/(I108*32)		; get X-Axis command position
M5001 = M762*0.15625/(I108*32)		; get X-Axis actual position	
M5002 = M5000-M5001			; get X error val	
M5003 = M5002*-328			; set X piezo command	
M5004 = M261*0.16/(I108*32)		; get Y-Axis command position
M5005 = M862*0.15625/(I108*32)		; get Y-Axis actual position
M5006 = M5004-M5005			; get Y error val
M5007 = M5006*328			; set Y piezo command		
CLOSE					; close PLC

 

in this case, i need to run the program by using &1b1r&2b2r.

But after testing this code, i found that i need to control the servo cycle. As you can see prog 2 and PLC program are looping.

How can i know the loop cycle time ?

How fast the PLC refresh the value ?

Which variables i need to change to control the cycle ?

please guide me on this.

 

Thank you ^_^

Link to comment
Share on other sites

hendraprimasyahputra,

 

Your PLC 2 is going to cycle a lot faster than your while loop in your program 2 since you have a dwell of 5 milliseconds in your while loop in your motion program. If you add a counter in your PLC you can see how fast it is cycling.

 

However, notice that your PLC is calculating the values based upon real time values of commanded and actual position. Then sends the data to motion program which will take this data and generates the path which will be used by servo LATER. This will generate a delay between your calculation and resulted movement on your machine. If you want faster response, you have to feed the calculated values directly to piezo servo loop and not through a motion program.

 

Regards,

Link to comment
Share on other sites

i dont get the idea of "feed the calculated values directly to piezo servo loop and not through a motion program".

 

do you mean to feed it by accessing M-var through PLC loop ?

 

 

Yes. You can also use Ixx40 pre-filter to smooth out the motion if commanded position is modified as discreet values other than a planned trajectory which it is in your case.

 

You also want to use PLC 0 or PLCC 0 or user written servo to calculate the commanded position every servo cycle (I8=0). This way you have a deterministic execution of your code.

 

Regards,

 

 

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.

×
×
  • Create New...