Followers 0

# Using "seconds" units for MAM instruction

## 5 posts in this topic

Hello! I have a plc program where I need to start and finish an MAM instruction based on a set amount of time. I am trying to calculate the speed of the motor based on the time but when I do, its always off by some milliseconds which I cannot have. I thought this was due to not considering acceleration time but changing acceleration does not change how long it takes the instruction to complete. Is there a more reliable way to perform this? Currently I have my speed units set to seconds which I thought would work (and did improve it slightly) but there is still a slight offset in time. If there is no reliable way to do this, is there a reliable way to predict what the offset in time may be? or what is even causing the offset? thank you in advance.

Edit: Or should using seconds work fine, and its more likely something else in my program?

Edited by Nathanb

#### Share this post

##### Share on other sites

Hello! I am new to plcs and I cannot find any good sources on how the "seconds" units works on the MAM instruction. Say I set it to 1 second to move a distance of 1, it should simply move 1 unit in 1 second right? Or if the distance were 2, it would still run for 1 second for an average of 0.5 seconds per "unit". If I am right, does it already take into consideration how long it takes to accelerate? How does it work in acceleration? If I set acceleration to 0.1 would it accelerate to the constant velocity in that amount of time, or is something different?

I have tried testing it, but it seems to be off a few milliseconds each time I try (adjusting acceleration does not affect it)

thank you in advance.

edit: the offset in time is always either 8 or 9 ms

Edited by Nathanb

#### Share this post

##### Share on other sites

@Nathanb I am no motion guru but a couple simple simple questions.

1.     First is your MAM in a Continuous or Periodic task?

2.     Second what is the Scan Time of your task which houses the MAM?

1 person likes this

#### Share this post

##### Share on other sites
On 3/11/2021 at 2:06 PM, BobLfoot said:

@Nathanb I am no motion guru but a couple simple simple questions.

1.     First is your MAM in a Continuous or Periodic task?

2.     Second what is the Scan Time of your task which houses the MAM?

1. The MainTask is Continuous

2. Looking at Task Properties, the "Max" is 0.45 and the "Last" goes between 0.025 and 0.027 (with occasional increases to around 0.08)

Edited by Nathanb

#### Share this post

##### Share on other sites

@Nathanb again while I am not a motion guru, if conditions permit I would setup a 10ms periodic task and place your MAM control logic in that.  This way you're guaranteed that every 10 ms your MAM will be evaluated and action taken.  Just a thought.

## Create an account or sign in to comment

You need to be a member in order to leave a comment

## Create an account

Sign up for a new account in our community. It's easy!

Register a new account

## Sign in

Already have an account? Sign in here.

Sign In Now
Followers 0