Modulo issues with ratio

Kataeb

Member
Join Date
Jan 2007
Location
www.livelovelebanon.com
Posts
632
We have a slave axis following a master axis in degrees. There is a Ratio between the two.
The issue is that we need to read the actual position of the slave, properly in degrees between 0 and 360.

For example if the Ratio is 0.5 then, when the master goes from 0 to 360 degrees, the slave moves from 0 to 180 degrees or from 180 to 360 degrees.
In this case we can multiply the slave drive position by 2, then do the Modulo 360 function to have it again between 0 and 360.

But when the Ratio is 2, the master going from 0 to 360 degrees, the slave goes from 0 to 360 degrees twice, so we should multiply the slave drive position by 0.5 and then the read slave position will be going up to 180 degrees only. Modulo will not help any more.
How can we solve this issue to have the slave position correct between 0 and 360?
 
...The issue is that we need to read the actual position of the slave, properly in degrees between 0 and 360.

This says you want to know the actual position of the slave.

...For example if the Ratio is 0.5 then, when the master goes from 0 to 360 degrees, the slave moves from 0 to 180 degrees or from 180 to 360 degrees.
In this case we can multiply the slave drive position by 2, then do the Modulo 360 function to have it again between 0 and 360.

But this says you multiply the slave drive position by 2, which means

  1. you already know the slave drive position., and
  2. The result,which you call "it" above, after the multiply and modulo operations, is the master position.
The second example, with a Ratio of 2, also starts with, and operates on, the slave drive position, which implies you already know the slave drive position.

It seems like you are operating on the known slave drive position to calculate the master position, but the initial statement says the opposite.

I am not sure the problem is defined clearly yet.
_
 
What I meant is that for any defined Ratio, the master always does 360 degrees per 1 cycle, while the slave does 360 * Ratio degrees per 1 cycle.
So, if we monitor the slave position with a trend graph, we will not see 360 degrees saw tooth curves.
To solve this issue, we have to do some calculations on the slave position, then the trend will show proper 360 degrees periodic curves, for both master and slave.

Also, this is used to check for any deviations between master and slave, taking into consideration the existing Ratio.
 
Last edited:
If the Ratio is greater than 1, then start with the slave drive position to calculate the master drive position.

If the Ratio is less than 1, then start with the slave drive position to calculate the master drive position.

But if you know both positions, then why do you need to calculate either?

I still think the issue is not clear: what do you know; what is measured; what is available; what is neither known nor measured nor available?

Could you show three examples of what you want the trend graph to look like: one trend for a ratio of 2; one trend for a ratio of 0.5; one trend for a ratio of 1.0. Please clearly label the axes and the plotted data.
_
 
Assuming you are calculating the unknown Master Drive Position from the known (measured or input) Slave Drive Position, you need to keep track of every time the Slave Drive position crosses the 0/360 boundary.


This can be done with two tags maintained within the PLC:

  • a Change In Slave Drive Position
  • the Previous Slave Drive Position i.e. the Slave Drive Position from the previous scan
  • a Slave Offset Quantity, initialized to zero.


Assuming you are sampling the Slave Drive Position frequently, calculate the

  • Change In Slave Drive Position := [current Slave Drive Position] - [Previous Slave Drive Position]
on every sample. If the change is 180deg or greater, subtract 360 from the Slave Offset value because the Slave Drive Position has rolled over from just less than 360 to just over 0; if the change is -180deg or less, add 360 to the Slave Drive Offset because the Slave Drive Position has rolled "under" from just over 0 to just less than 360; if the change is between -180deg and +180deg, then do nothing.

When you make the position calculation, add the Slave Drive Offset to the Slave Drive Position before dividing by the current Ratio, then that quotient modulo 360 will be the answer:

  • Master Drive Position := (([Slave Drive Position] + [Slave Drive Offset]) / Ratio) MODULO 360
It may be necessary to check how the MODULO operator works when it is applied to negative numbers.
 

Similar Topics

Hello. An absolute encoder on a rotary axis gives values in range -2147483648 to 2147483648. When value is > 2147483648 , the encoder value is...
Replies
20
Views
2,281
I have Siemens Simotion D445-2 FW4.4. I would like to use lineair axis with modulo (modulo length 1000). The reason for this is because I am...
Replies
1
Views
1,947
We want to implement an own written position controller in our servocontroller. We have our reasons to program the position controller and not use...
Replies
3
Views
1,408
I have to commision a servosystem where one of the axes has a modulus : it is a chain that keeps on turning in the same direction, comes back to...
Replies
1
Views
1,555
In my appelication I have a chain to feed in a packet of plates into a machine. The conveyor chain moves only in one direction, and has pins on...
Replies
5
Views
2,633
Back
Top Bottom