Maximum velocity for the motor movement

In summary, Joan attempted to create a trajectory from point x0 to x1, given a maximum acceleration and a speed entered by the user. However, she ran into problems because she could not find the real vmax and it took ages to calculate the vmax if the user entered a very big value for vmax initially.
  • #1
Joan M
Gold Member
13
0
Hello all,

First of all let me say this is my first post here and I don't know if I'm placing it into the right forum/place. If I'm doing something wrong or similar, please let me know and I'll try to solve it asap.

This is not homework, but it is for sure introductory level so I've thought it was right to write it here.

Again, if it is not the right place just let me know.

1. Homework Statement

I'm creating a small program to move a motor. That movement will have to be performed using the trapezoid profile in order to keep it soft at the beginning and at the end.

In my case I'm trying to create a trajectory from point x0 to x1 given a maximum acceleration and a speed (which is entered by the user and therefore it can be much higher than what is allowed by the system).

The available data is:
  • vmax = desired maximum speed (it can be impossible to reach).
  • v0 = initial speed.
  • vf = final speed (usually it will be 0).
  • a = acceleration (to accelerate and brake, we will use the same).
  • x0 = initial position.
  • xf = destination position.

Homework Equations


See in the attempt at a solution where I've pasted a piece of code and all the comments to make it easier to follow.

The Attempt at a Solution


Code:
  ta = Abs((vmax - v0) / a)   ' Acceleration time
  da = (v0 * ta) + (0.5 * a * ta * ta)    ' Distance while accelerating
  tf = Abs((vmax - vf) / a)  ' Braking time.
  df = (vf * tf) + (0.5 * a * tf * tf)  ' Distance while braking.
  If (da + df > dist) Then  ' If the acceleration and braking distances are bigger than the complete travel we have problems...
    If (v0 = vf) Then  ' If initial and final speeds are the same...
      taux = (Sqr((a * dist) + (v0 * v0)) - v0) / a   ' then I can calculate the time it will take to reach the real maximum speed
      vmax = v0 + a * taux   ' and at the end I can calculate the maximum speed
    Else  ' but... if both speeds are not coincident...
      DistTotal = xf - x0 - da - df  ' Here I'm getting the total distance that is traveled.
      RelAccDec = da / (da + df)  ' The relationship between the acceleration and deceleration stages.
      dist_corr_acc = DistTotal * RelAccDec  ' The correction factor for the acceleration stage.
      da = da + dist_corr_acc  ' The real distance traveled during acceleration.
      dist_corr_dec = DistTotal * (1 - RelAccDec) ' the correction factor for braking.
      df = df + dist_corr_dec  ' the real distance traveled during braking.

      taux = (Sqr((a * dist) + (v0 * v0)) - v0) / a  ' This should give me the time the acceleration stage takes.
      vmax = v0 + (a * taux)  ' and this the maximum speed reached during the acceleration (which will be the maximum speed used to move the motor).
    End If
  End If

The solution works with two big flaws:

  1. We can not find the real vmax (just something close to it as we are drecreasing always by 1).
  2. It will take ages to calculate the vmax if the user enters a very big value for vmax initially.
taux is not getting the right value... can someone here tell me which formula is the right one to get the desired result?

I've been looking at formulas for two days and now I'm obfuscated and I've decided to search for help.
I've seen this forum and I've thought to write this here and see what happens.

Usually in the forums I participate I try to help and so, but I'm afraid here I won't be able to help a lot, but I'll try to snoop around and see if I can give something to the community.

Well, thank you for your time and for helping.

Joan.
 
Last edited:
Physics news on Phys.org
  • #2
Hi Joan M, Welcome to Physics Forums.

Are we to assume that the user doesn't choose initial or final speeds that exceed vmax? In other words, you take care of input error checking elsewhere?

You should be able to solve algebraically for the acceleration and deceleration timings so you don't have to "hunt" for them in code. I'd suggest first assuming that vmax won't be reached and solving for the acceleration and deceleration times (so no coasting between acceleration and deceleration phases) and then checking to see if the vmax would be exceeded. If not, you're done. Otherwise choose a coasting speed (could be vmax) and then fit your trapezoid.

Only the basic kinematic equations are required.
 
  • Like
Likes Joan M
  • #3
Hi qneill,

the user won't be able to introduce the initial or final speeds that exceed vmax as (in this case ) the final speed will always be 0 and the initial speed can be 0 or the speed the last movement was using at the moment the new one has been introduced so the maximum value will be vmax.

I've updated my original post.

Of course I agree what you say, it's much better using a straight formula to get the desired result than hunting it in the code... The problem with that is that I don't remember/know the right one.

As you will see now in the code there is a good approach to the problem.

The issue is that even I get the right distances (acceleration and braking) I can't get the right amount of time to accelerate and therefore the vmax.

Could you take a look at it and tell me which formula is the one that would solve that?

Thank you very much.
 
  • #4
Joan M said:
Of course I agree what you say, it's much better using a straight formula to get the desired result than hunting it in the code... The problem with that is that I don't remember/know the right one.

That's something you could work on here if you were so inclined. Only basic kinematic equations are required (manipulated appropriately with a bit of algebra, of course).

Joan M said:
The issue is that even I get the right distances (acceleration and braking) I can't get the right amount of time to accelerate and therefore the vmax.

First, I notice at the start of your code:

df = (vf * tf) + (0.5 * a * tf * tf) ' Distance while braking.

you have the acceleration as a for braking. It should be -a, since it's decelerating (acceleration is negative while braking). Further, you have the velocity going into the braking maneuver as vf. That's the final speed, not the speed going into the braking maneuver. It should be vmax, since that's the speed you've assumed for calculating your times.

I also notice that you take specific cases like vf = vo, which is not an ideal approach. You still need to handle the cases where vf ≠ vo, which is the general case and would include vf = vo.

Your code doesn't say what happens for the case (da + df ≤ dist), you've closed off the IF statement that would detect this without proving the ELSE clause to handle it.

It's not clear to me how you arrived at some of the equations that you're using. For example, how did you arrive at:

taux = (Sqr((a * dist) + (v0 * v0)) - v0) / a

for "the time it will take to reach the real maximum speed" ? Can you show us how you derived this? It seems to me that the units don't match in the terms.
 
  • Like
Likes Joan M
  • #5
Hi again gneill (sorry for writing your name wrong before).

gneill said:
df = (vf * tf) + (0.5 * a * tf * tf) ' Distance while braking.
you have the acceleration as a for braking. It should be -a, since it's decelerating (acceleration is negative while braking). Further, you have the velocity going into the braking maneuver as vf. That's the final speed, not the speed going into the braking maneuver. It should be vmax, since that's the speed you've assumed for calculating your times.
I'm interested in the absolute value for the braking distance therefore is easier to have the acceleration positive, anyway I could put the acceleration negative (as it should be) and call abs to get the absolute value.
I've calculated the time it will take to go from max to vf just before, and this gives me the time. so then I can calculate correctly the df.
In the Excel file I'm using to test it, both da and df work well.

gneill said:
I also notice that you take specific cases like vf = vo, which is not an ideal approach. You still need to handle the cases where vf ≠ vo, which is the general case and would include vf = vo.
Of course you are right, I have to handle the other cases, but as my solution to the other cases is that bad, this save computer cycles in that specific case (which is not a good approach at all but is still better than nothing).

gneill said:
Your code doesn't say what happens for the case (da + df ≤ dist), you've closed off the IF statement that would detect this without proving the ELSE clause to handle it.
Have to disagree here... If there is no need to calculate the special case where the vmax can't be reached then the first four lines solve perfectly the issue without needing to continue processing the code inside the first IF clause.

gneill said:
It's not clear to me how you arrived at some of the equations that you're using. For example, how did you arrive at:

taux = (Sqr((a * dist) + (v0 * v0)) - v0) / a

for "the time it will take to reach the real maximum speed" ? Can you show us how you derived this? It seems to me that the units don't match in the terms.
Neither to me... I've found this searching the Internet... tried it and it worked perfectly when the v0 is equal than vf, but it stops working when v0 is different than vf.

It's not a matter of wanting to do it but knowing how to do it...

Now it seems that if I could calculate correctly the time it will take to move from x0 to da starting at v0 then I could calculate easily the vmax using the last formula in my code: vmax = v0 + (a * taux)

Can you spot the problem on this formula? taux = (Sqr((a * dist) + (v0 * v0)) - v0) / a

Thank you very much for your patience.

Joan.
 
  • #6
Joan M said:
Have to disagree here... If there is no need to calculate the special case where the vmax can't be reached then the first four lines solve perfectly the issue without needing to continue processing the code inside the first IF clause.
What about the case where vmax is reached and yet da + df < dist?

Joan M said:
Can you spot the problem on this formula? taux = (Sqr((a * dist) + (v0 * v0)) - v0) / a
To me it looks like it's missing a factor of two (the whole thing should be multiplied by two). The formula will only work when the initial and final speeds are the same (v0). You'll need to find a different formula for when the speeds are different. I'm not sure how your DistTotal, RelAccDec, Dist_corr_acc, and so on are functioning.
 
  • Like
Likes Joan M
  • #7
gneill said:
What about the case where vmax is reached and yet da + df < dist?
Then the first four lines in the code are enough to get the right values. ta, da, tf and df will have the right values and we will get a trapezoid and not a triangle in the movement: we will reach the vmax and go a certain amount of time at vmax. I can promise you this works. :wink:

gneill said:
To me it looks like it's missing a factor of two (the whole thing should be multiplied by two). The formula will only work when the initial and final speeds are the same (v0). You'll need to find a different formula for when the speeds are different. I'm not sure how your DistTotal, RelAccDec, Dist_corr_acc, and so on are functioning.
In fact the original formula was
Code:
taux = (Sqr((2 * a * da) + (v0 * v0)) - v0) / a
but da was almost half of dist so I used dist at the beginning, now the code has the original formula.
This is giving a close result for vmax, but still far away, at least it is always bigger than what I expect, but of course it's awful having to loop to search for something that should be calculated... :sorry:

Thank you for your comments.
 
  • #8
I think I've understood why it is not working...

See:
Code:
ta = Abs((vmax - v0) / a)   ' Acceleration time
da = (v0 * ta) + (0.5 * a * ta * ta)    ' Distance while accelerating
tf = Abs((vmax - vf) / a)  ' Braking time.
df = (vf * tf) + (0.5 * a * tf * tf)  ' Distance while braking.
If (da + df > dist) Then  ' If the acceleration and braking distances are bigger than the complete travel we have problems...
  If (v0 = vf) Then  ' If initial and final speeds are the same...
    taux = (Sqr((a * dist) + (v0 * v0)) - v0) / a   ' then I can calculate the time it will take to reach the real maximum speed
    vmax = v0 + a * taux   ' and at the end I can calculate the maximum speed
  Else  ' but... if both speeds are not coincident...
    '******************************************************************
    '**** WRONG APPROACH STARTS HERE
    '******************************************************************
    DistTotal = xf - x0 - da - df  ' Here I'm getting the total distance that is traveled.
    RelAccDec = da / (da + df)  ' The relationship between the acceleration and deceleration stages.
    dist_corr_acc = DistTotal * RelAccDec  ' The correction factor for the acceleration stage.
    da = da + dist_corr_acc  ' The real distance traveled during acceleration.
    dist_corr_dec = DistTotal * (1 - RelAccDec) ' the correction factor for braking.
    df = df + dist_corr_dec  ' the real distance traveled during braking.
    taux = (Sqr((a * dist) + (v0 * v0)) - v0) / a  ' This should give me the time the acceleration stage takes.
    vmax = v0 + (a * taux)  ' and this the maximum speed reached during the acceleration (which will be the maximum speed used to move the motor).
    '******************************************************************
    '**** WRONG APPROACH ENDS HERE
    '******************************************************************
  End If
End If

When the da + df are bigger than the total distance and v0 and vf are not coincident I'm doing a proportional reduction which approximates the vmax to it's desired/needed value, but I can't simply do that...

The problem here I think is that part: I don't have to make a proportional reduction, I do need to find the position in which the acceleration movement and the deceleration movement are coincident once I will have this position then I should check the speed any of the movements has in that position. And that one should be vmax.

Now the issue is doing that.

I've found several examples out there on how to find that in a constant velocity movement, but I've not found any for constant acceleration movement.

Any help with that? A resource to learn how to do it, a sample, a formula...

Thank you very much!
 
  • #9
Joan M said:
Now the issue is doing that.

I've found several examples out there on how to find that in a constant velocity movement, but I've not found any for constant acceleration movement.

Any help with that? A resource to learn how to do it, a sample, a formula...

Thank you very much!
Maybe a graphical approach will help. On a velocity-time graph, you have a simple polygonal shape. You know the area total and some ordinates and slopes. What equations can you write?
 
  • Like
Likes Joan M
  • #10
haruspex said:
Maybe a graphical approach will help. On a velocity-time graph, you have a simple polygonal shape. You know the area total and some ordinates and slopes. What equations can you write?

_acc (means the acceleration stage data)
Code:
a_acc should be the inclination of the line.
x0_acc could be considered 0
xf_acc is unknown.
v0_acc should be the intersection of the accelerating line with the vertical axis (given we consider x0 = 0).
vf_acc is the vmax I'm searching.
t0_acc could be considered 0.
tf_acc is the time it will take to accelerate to reach the desired vmax (not the reachable one).

_dec (means the deceleration stage data)
Code:
a_dec is the inclination of the line and it's the same than -a_acc.
x0_dec is unknown.
xf_dec is the distance I want to move the motor.
v0_dec is the vmax I'm searching.
vf_dec is 0 as we will stop at the end. t0_dec is 0.
tf_dec is the time it will take to go from the unreachable vmax to the vf.

But I don't know how to proceed with all this...

Thank you for your post haruspex.
 
  • #11
Joan M said:
_acc (means the acceleration stage data)
Code:
a_acc should be the inclination of the line.
x0_acc could be considered 0
xf_acc is unknown.
v0_acc should be the intersection of the accelerating line with the vertical axis (given we consider x0 = 0).
vf_acc is the vmax I'm searching.
t0_acc could be considered 0.
tf_acc is the time it will take to accelerate to reach the desired vmax (not the reachable one).

_dec (means the deceleration stage data)
Code:
a_dec is the inclination of the line and it's the same than -a_acc.
x0_dec is unknown.
xf_dec is the distance I want to move the motor.
v0_dec is the vmax I'm searching.
vf_dec is 0 as we will stop at the end. t0_dec is 0.
tf_dec is the time it will take to go from the unreachable vmax to the vf.

But I don't know how to proceed with all this...

Thank you for your post haruspex.
Let a be the magnitude of the acceleration and deceleration.
If it starts at speed v0 and accelerates for time t0, what speed is reached and how far does it go?
If it then decelerates for time t1 down to speed v1, what second expression does that give you for the peak speed, and what total distance is covered?
 
  • Like
Likes Joan M
  • #12
haruspex said:
Let a be the magnitude of the acceleration and deceleration.
If it starts at speed v0 and accelerates for time t0, what speed is reached and how far does it go?
If it then decelerates for time t1 down to speed v1, what second expression does that give you for the peak speed, and what total distance is covered?
I don't know t0 neither t1... and both times are different if we start from a v0 that is different than vf...

I'm sorry, but I can't see what you are suggesting...

Thank you for posting!
 
  • #13
Joan M said:
I don't know t0 neither t1
I know that. That's the beauty of algebra, you can write down relationships between variables without knowing any values.
The first two lines of code in your first post in the thread contain the two equations you need to answer my questions in post #11. The main difference is that there your vmax was a known quantity; now it will be the unknown speed reached.
 
  • Like
Likes Joan M
  • #14
haruspex said:
I know that. That's the beauty of algebra, you can write down relationships between variables without knowing any values.
The first two lines of code in your first post in the thread contain the two equations you need to answer my questions in post #11. The main difference is that there your vmax was a known quantity; now it will be the unknown speed reached.
first of all, English is not my first language so, whatever can be understood in these next lines it's from respect.

I know the equations, but simply I'm not understanding what you try to tell me...

I've been struggling to get this for days, the practice I have with that is 0 after years of not doing it. So, even I don't pretend anyone here to solve the issue for me, a little example and a small guide on the right steps to do it would be great.

Could you try to give a more detailed answer please?

Thank you very much!
 
  • #15
Joan M said:
first of all, English is not my first language so, whatever can be understood in these next lines it's from respect.

I know the equations, but simply I'm not understanding what you try to tell me...

I've been struggling to get this for days, the practice I have with that is 0 after years of not doing it. So, even I don't pretend anyone here to solve the issue for me, a little example and a small guide on the right steps to do it would be great.

Could you try to give a more detailed answer please?

Thank you very much!
If it starts at speed v0 and accelerates at rate a for time t0 what speed is reached? I know you can answer this because it is represented in the first line of the code in post #1. Call this speed vp.

If, having reached that speed, it decelerates (accelerates at -a) for time t1 it is to reach speed v1. We can run that backwards: if it is moving at speed v1 and accelerates at a for time t1 it will reach speed vp. So we have exactly the same equation as before, but now with t1 and v1 instead of t0 and v0.

Post those two equations and I'll help with the next step.
 
  • Like
Likes Joan M
  • #16
haruspex said:
If it starts at speed v0 and accelerates at rate a for time t0 what speed is reached? I know you can answer this because it is represented in the first line of the code in post #1. Call this speed vp.

If, having reached that speed, it decelerates (accelerates at -a) for time t1 it is to reach speed v1. We can run that backwards: if it is moving at speed v1 and accelerates at a for time t1 it will reach speed vp. So we have exactly the same equation as before, but now with t1 and v1 instead of t0 and v0.

Post those two equations and I'll help with the next step.

Ok,
If I understood you well we do have this:

Code:
vp = v0 + (a * t0)  // Velocity at the intersection point (vp) equals the initial speed (v0) + the acceleration (now it is positive) multiplied by the run time (t0).
vp = v1 - (a * t1)  // and Velocity at the intersection point (vp) equals the initial speed (v1) + the acceleration (now it is negative) multiplied by the run time (t1).

Is that right?

PS: Thank you again.
 
  • #17
Joan M said:
Ok,
If I understood you well we do have this:

Code:
vp = v0 + (a * t0)  // Velocity at the intersection point (vp) equals the initial speed (v0) + the acceleration (now it is positive) multiplied by the run time (t0).
vp = v1 - (a * t1)  // and Velocity at the intersection point (vp) equals the initial speed (v1) + the acceleration (now it is negative) multiplied by the run time (t1).

Is that right?

PS: Thank you again.
Not quite. There should be no sign change.
Now write expressions for the distances moved during the two phases.
 
  • Like
Likes Joan M
  • #18
haruspex said:
Not quite. There should be no sign change.
Now write expressions for the distances moved during the two phases.
OK, so:

Code:
vp = v0 + (a * t0)  // Velocity at the intersection point (vp) equals the initial speed (v0) + the acceleration (now it is positive) multiplied by the run time (t0).
vp = v1 + (a * t1)  // and Velocity at the intersection point (vp) equals the initial speed (v1) + the acceleration (now it is negative) multiplied by the run time (t1).

d0 = x00 + (v00 * t0) + (0.5 * a0 * t0 * t0)    // Distance while accelerating = the initial space + the initial velocity at the current time + half of the acceleration * current time ^2
d1 = x01 + (v01 * t1) + (0.5 * a1 * t1 * t1)    // Distance while braking = the initial space + the initial velocity at the current time + half of the acceleration * current time ^2

Corrected the sign at the second equation and added both equations for the space/distance run.

Everything OK?

Thanks again.
 
  • #19
haruspex said:
Maybe a graphical approach will help. On a velocity-time graph, you have a simple polygonal shape. You know the area total and some ordinates and slopes. What equations can you write?
This is an excellent idea, and I can offer a suggestion to simplify writing equations from the geometry. If we choose units for velocity and distance such that the acceleration is unity, then all slopes in the velocity versus time plots will be 1 or -1, corresponding to 45 degree angles so that every triangle that appears will be a 45° equilateral triangle. That means the size of any velocity change is equal in magnitude to the time change it occurred over in this unit system.

To convert the "real world" given values to these working units divide the velocities and distance values by the magnitude of the real world acceleration. For example, if the actual acceleration is 5 m/s2 then the given values:

##v_o = 10~m/s~~;~~v_f = 25~m/s~~;~~x_o = 30~m~~;~~x_f = 500~m##

become our "unitless" working quantities:

##v_o = 2~~;~~v_f = 5~~;~~x_o = 6~~;~~x_f = 100##

To convert values back to the real-world values, simply multiply by the same value (5 in this example). Since the time units are not scaled, times calculated in the converted unit system will reflect "real world" times, which is handy because you're looking for acceleration control times.

Here's a sample of a plot that depicts a final velocity greater than the initial velocity and where the motor speed had to go negative (moving backwards) in order to achieve the desired total distance (perhaps the required distance of travel was too close to the start location in order to match both distance and velocity with a simple positive acceleration followed by a deceleration). Remember that that velocity and time measurements are interchangeable thanks to the acceleration being unity and all slopes being 1:

upload_2017-2-11_9-21-0.png


Areas under the curve (between the curve and the horizontal time axis) represent distance (Δx), and areas below the 0 velocity axis represent negative distances. The total change in position achieved is the sum of the all the areas "under" the curve. In the diagram, the green areas represent positive velocities and increasing distance, while the blue areas are negative velocities and decreasing distance. Summing the areas is made easy by the equal leg lengths of 45° right triangles:

##Δx = \frac{v_o^2}{2} + \frac{v_f^2}{2} - t_1^2##

which is easy to solve for ##t_1##. We can also easily pick out that the maximum speed is equal to ##t_1##, and is a negative speed in this instance.

If there's a speed limit to be enforced then finding the times where the curve hits the limit is simple, again thanks to the 45° triangles. The amount of coasting time to insert can be determined from the area of the triangle "clipped" by the maximum speed limit.
 
  • Like
Likes Joan M
  • #20
Joan M said:
OK, so:

Code:
vp = v0 + (a * t0)  // Velocity at the intersection point (vp) equals the initial speed (v0) + the acceleration (now it is positive) multiplied by the run time (t0).
vp = v1 + (a * t1)  // and Velocity at the intersection point (vp) equals the initial speed (v1) + the acceleration (now it is negative) multiplied by the run time (t1).

d0 = x00 + (v00 * t0) + (0.5 * a0 * t0 * t0)    // Distance while accelerating = the initial space + the initial velocity at the current time + half of the acceleration * current time ^2
d1 = x01 + (v01 * t1) + (0.5 * a1 * t1 * t1)    // Distance while braking = the initial space + the initial velocity at the current time + half of the acceleration * current time ^2

Corrected the sign at the second equation and added both equations for the space/distance run.

Everything OK?

Thanks again.
In your distance equations you are conflating two different forms. You can have either the displacement form:
Δx=v0Δt+½aΔt2
Or the position form:
x=x0+v0Δt+½aΔt2
Your d0, d1 are displacements, so you don't need the x00 and x01.

You can eliminate vp between the first two equations to get an equation for t1 in terms of t0.
You are given a total distance, d0+d1, so adding the two distance equations gives you another equation relating the two times.
Two equations, two unknowns; solve.
 
  • Like
Likes Joan M
  • #21
haruspex said:
In your distance equations you are conflating two different forms. You can have either the displacement form:
Δx=v0Δt+½aΔt2
Or the position form:
x=x0+v0Δt+½aΔt2
Your d0, d1 are displacements, so you don't need the x00 and x01.

You can eliminate vp between the first two equations to get an equation for t1 in terms of t0.
You are given a total distance, d0+d1, so adding the two distance equations gives you another equation relating the two times.
Two equations, two unknowns; solve.

haruspex, first of all, thank you for your patience...

OK, let's try it:

Code:
// STAGE A
// First the speed equations to find t1 in terms of t0
vp = v0 + (a0 * t0)  // Acceleration stage
vp = v1 + (a1 * t1)  // Brake stage
v0+(a0*t0) = v1+(a1*t1)  // vp = vp
t1=((v0-v1)+(a0*t0))/a1  // Get the t1 in terms of t0 (braking time in terms of accelerating time).

// STAGE B
// Now let's try to do the same for the postitions:
d0 = (v00 * t0) + (0.5 * a0 * t0 * t0) // Distance while accelerating.
d1 = (v01 * t1) + (0.5 * a1 * t1 * t1) // Distance while braking.
D = (v00 * t0) + (0.5 * a0 * t0 * t0) + (v01 * t1) + (0.5 * a1 * t1 * t1)  // Total distance is the sum of both equations.

// STAGE C
// I understand here that we should use the t1 from the velocity equations now...
D = (v00 * t0) + (0.5 * a0 * t0 * t0) + (v01 * (((v0-v1)+(a0*t0))/a1)) + (0.5 * a1 * (((v0-v1)+(a0*t0))/a1) * (((v0-v1)+(a0*t0))/a1))

/* STAGE D 
v00 is the velocity at the start of the acceleration movement. I have it.
a0 is the acceleration in the acceleration stage. I have it.
t0 is the time at the end of the movement.  <-- I don't have it
v01 is the velocity at the start of the braking movement. <-- I don't have it, in fact this is what I'm searching, isn't it?
v1 is the velocity at the end of the braking movement.  I have it.
a1 is the acceleration in the braking stage. I have it.
D is the total distance traveled.  I have it.*/

Is everything right till here? Probably not as I still have two unknowns here...
In case everything is right...What should I do to continue with the solution?

Thank you!
 
  • #22
Joan M said:
haruspex, first of all, thank you for your patience...

OK, let's try it:

Code:
// STAGE A
// First the speed equations to find t1 in terms of t0
vp = v0 + (a0 * t0)  // Acceleration stage
vp = v1 + (a1 * t1)  // Brake stage
v0+(a0*t0) = v1+(a1*t1)  // vp = vp
t1=((v0-v1)+(a0*t0))/a1  // Get the t1 in terms of t0 (braking time in terms of accelerating time).

// STAGE B
// Now let's try to do the same for the postitions:
d0 = (v00 * t0) + (0.5 * a0 * t0 * t0) // Distance while accelerating.
d1 = (v01 * t1) + (0.5 * a1 * t1 * t1) // Distance while braking.
D = (v00 * t0) + (0.5 * a0 * t0 * t0) + (v01 * t1) + (0.5 * a1 * t1 * t1)  // Total distance is the sum of both equations.

// STAGE C
// I understand here that we should use the t1 from the velocity equations now...
D = (v00 * t0) + (0.5 * a0 * t0 * t0) + (v01 * (((v0-v1)+(a0*t0))/a1)) + (0.5 * a1 * (((v0-v1)+(a0*t0))/a1) * (((v0-v1)+(a0*t0))/a1))

/* STAGE D
v00 is the velocity at the start of the acceleration movement. I have it.
a0 is the acceleration in the acceleration stage. I have it.
t0 is the time at the end of the movement.  <-- I don't have it
v01 is the velocity at the start of the braking movement. <-- I don't have it, in fact this is what I'm searching, isn't it?
v1 is the velocity at the end of the braking movement.  I have it.
a1 is the acceleration in the braking stage. I have it.
D is the total distance traveled.  I have it.*/

Is everything right till here? Probably not as I still have two unknowns here...
In case everything is right...What should I do to continue with the solution?

Thank you!
Yes, that looks ok. Your last equation is a quadratic in the unknown t0. Solve it.

Edit: just noticed you are saying you still have two unknowns. The velocity at the start of braking was vp. That was eliminated. Your remaining two velocities are the ones you know, at the very start and the very end.
 
Last edited:
  • Like
Likes Joan M
  • #23
haruspex said:
Yes, that looks ok. Your last equation is a quadratic in the unknown t0. Solve it.

Edit: just noticed you are saying you still have two unknowns. The velocity at the start of braking was vp. That was eliminated. Your remaining two velocities are the ones you know, at the very start and the very end.
I've tried it and...
Code:
// STAGE A
vp = v0 + (a0 * t0)  // Acceleration stage
vp = v1 + (a1 * t1)  // Brake stage
v0+(a0*t0) = v1+(a1*t1)  // vp = vp
t1=((v0-v1)+(a0*t0))/a1  // Get the t1 in terms of t0 (braking time in terms of accelerating time).  ==> Note v0 is the starting speed and v1 is the ending speed.

// STAGE B
d0 = (v00 * t0) + (0.5 * a0 * t0 * t0) // Distance while accelerating.
d1 = (v01 * t1) + (0.5 * a1 * t1 * t1) // Distance while braking.
D = (v00 * t0) + (0.5 * a0 * t0 * t0) + (v01 * t1) + (0.5 * a1 * t1 * t1)  // Total distance is the sum of both equations.

// STAGE C
D = (v00 * t0) + (0.5 * a0 * t0^2) + (v01 * (((v0-v1)+(a0*t0))/a1)) + (0.5 * a1 * (((v0-v1)+(a0*t0))/a1) * (((v0-v1)+(a0*t0))/a1))
3000 = (2300*t) + (1000 * t^2) + (0) + (-1000 * (2300+2000*t)/-2000) * (2300+2000t)/2000
3000 = 1000t^2  + 2300t + (1150 + 1000t) * (1.15 + t)
3000 = 2000t^2 + 4600t + 1322.5
0 = 2000t^2 + 4600t - 1677.5

Then after executing the quadratic equation solver (it will be fun to implement it)... but this is a formula that (don't ask me why) I remember...

I've got 0.32...

And afterwards, applying the formula vmax = v0 + (t*a)

I've got the right result.

PERFECT!

Now let's spend the rest of the sunday trying to implement it.

Thank you very much haruspex.

Let's hope I'll get this running soon.
 
  • #24
haruspex said:
Yes, that looks ok. Your last equation is a quadratic in the unknown t0. Solve it.

Edit: just noticed you are saying you still have two unknowns. The velocity at the start of braking was vp. That was eliminated. Your remaining two velocities are the ones you know, at the very start and the very end.
Everything working as expected with a much more simple code now...
Thank you again.
 

What is the maximum velocity for motor movement?

The maximum velocity for motor movement depends on various factors such as the type of motor, the load it is carrying, and the power source. It is usually expressed in revolutions per minute (RPM) or meters per second (m/s).

How is the maximum velocity for motor movement determined?

The maximum velocity for motor movement is determined through calculations and testing. Factors such as motor torque, power supply, and load requirements are considered to determine the maximum speed the motor can achieve without overheating or damaging its components.

What happens if the maximum velocity for motor movement is exceeded?

If the maximum velocity for motor movement is exceeded, it can lead to various issues such as motor overheating, decreased efficiency, and even damage to the motor or its components. It is important to operate the motor within its specified maximum velocity to ensure its optimal performance and longevity.

Can the maximum velocity for motor movement be increased?

In some cases, the maximum velocity for motor movement can be increased by adjusting the motor's power supply, gearing, or other factors. However, this should only be done after careful consideration and testing to ensure the motor can handle the increased speed without any negative consequences.

How does the maximum velocity for motor movement affect the motor's overall performance?

The maximum velocity for motor movement is an important factor in determining the motor's overall performance. Operating the motor at its maximum velocity for extended periods of time can lead to decreased efficiency, increased wear and tear, and potential damage. It is important to consider the motor's maximum velocity when selecting and using it for a specific application.

Similar threads

  • Introductory Physics Homework Help
Replies
13
Views
960
  • Introductory Physics Homework Help
Replies
4
Views
958
  • Introductory Physics Homework Help
Replies
4
Views
2K
  • Introductory Physics Homework Help
Replies
8
Views
2K
  • Introductory Physics Homework Help
Replies
2
Views
5K
  • Introductory Physics Homework Help
Replies
2
Views
5K
  • Introductory Physics Homework Help
Replies
4
Views
7K
  • Introductory Physics Homework Help
Replies
1
Views
2K
Replies
4
Views
6K
Back
Top