Help with Acceleration Calculations in Visual Basic

  • Thread starter Thread starter bsharp
  • Start date Start date
Click For Summary

Discussion Overview

The discussion centers around calculations related to acceleration in a Visual Basic program. Participants are exploring how to determine the time and distance required to accelerate from one velocity to another at a specified rate of acceleration. The focus is on the implementation of these calculations in code.

Discussion Character

  • Technical explanation
  • Mathematical reasoning
  • Homework-related

Main Points Raised

  • One participant describes their approach to calculating the time it takes to accelerate to a specified velocity and the distance required for that acceleration, providing specific code snippets and calculations.
  • Another participant confirms that the equations and answers presented are correct, indicating agreement with the calculations.
  • A third participant suggests a clarification regarding the units used for velocity in the code, pointing out a potential inconsistency in the comments.
  • The original poster expresses a sentiment about the confusion between being correct and incorrect in their understanding of the calculations.

Areas of Agreement / Disagreement

There is some agreement on the correctness of the calculations presented, but there is also a suggestion for clarification regarding variable comments. The discussion does not appear to have any major unresolved disagreements.

Contextual Notes

Participants have not explicitly stated any assumptions or limitations regarding the calculations, and the discussion does not delve into potential edge cases or alternative methods for calculating acceleration.

bsharp
Messages
7
Reaction score
0
I am working on a project of my own and need a little help. I am writing a program in Visual Basic that involves some precise calculations of Acceleration. I have looked over quite a bit of information and examples on the web and I am more confused now than when I started. I am sure you all have been here at one point or another.

Basically I need to

1: Find the Time it takes to accelerate at a specified rate to a specified velocity from specified velocity.

2: Find the distance it takes to accelerate at a specified rate from a specified velocity to specified velocity

Below is what I have been playing around with in VB. I think I have confused my self.

'in inches per second/second
Dim MaxAcceleration As Double = 200

'in seconds
Dim MaxAcceltime As Double

'in inches
Dim MaxAcceldistance As Double


'inches per second/second
Dim MaxVelocity As Double = 6000
Dim SetVelocity As Double = 20
Dim IntVelocity As Double = 0
Dim AverageVelocity As Double


' The time it takes to go from 0 to Max Velocity in seconds
'Max Acceleration time
MaxAcceltime = ((MaxVelocity - IntVelocity) / MaxAcceleration)

' I get 30.0


' The Average Velocity
AverageVelocity = ((IntVelocity + MaxVelocity) / 2)

'I get 3000.0


'The distance required to go from 0 to Max Velocity
'MaxAccel Distance in inches
MaxAcceldistance = (AverageVelocity * MaxAcceltime)

' I get 90000.0
 
Engineering news on Phys.org
Nice work, bsharp. Your equations and answers are correct.
 
Looks good...

But you might want to edit the comment line on your velocity variables...
bsharp said:
'inches per second/second
Dim MaxVelocity As Double = 6000
Dim SetVelocity As Double = 20
Dim IntVelocity As Double = 0
Dim AverageVelocity As Double


units should be inches per second.
 
Thank you for the reply's. Some times thinking your incorrect and actually being correct is just as bad as thinking your correct and being incorrect. Although I guess it saves on finding out later on.
 

Similar threads

Replies
6
Views
4K
Replies
13
Views
4K
Replies
2
Views
1K
  • · Replies 15 ·
Replies
15
Views
3K
  • · Replies 9 ·
Replies
9
Views
3K
  • · Replies 18 ·
Replies
18
Views
2K
  • · Replies 10 ·
Replies
10
Views
3K
  • · Replies 3 ·
Replies
3
Views
1K
Replies
8
Views
3K
  • · Replies 5 ·
Replies
5
Views
3K