View more

View more

View more

### Image of the Day Submit

IOTD | Top Screenshots

### The latest, straight to your Inbox.

Subscribe to GameDev.net Direct to receive the latest updates and exclusive content.

# acceleration and deceleration

Old topic!

Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

9 replies to this topic

### #1nycjay  Members

Posted 24 July 2001 - 09:42 AM

hi. i am doing an opnegl/c++ model of a hard disk. basically, i have a disk, and an arm that swings over it. right now i just rotate the arm to the correct degree to be over the appropriate sector. my professor now wants me to make it more realistic, to make the arm accelerate and decelerate when it moves from one track to another. can anyone point me in a good direction to do this? thanks in advance for your help. Jason

### #2Alamar  Members

Posted 24 July 2001 - 10:36 AM

You can do some physics research...or just simplify things...

Currently, you might have movement like...

PositionX += SpeedX;

Acceleration would just be...

SpeedX += AccelerationX;

That''s the basics of it, simplified even, but your post doesn''t have enough information for me to know if this''d even be usseful for you.

If you''re just moving the arm by certain degrees every second, you could also just calculate everything beforehand and move it dependant on those calculations...

Like...You know that PositionX needs to move 40 units, and that it''ll take 12 seconds...

PositionX = 0;
SpeedX = 1;
AccelerationX = 1;
Time = 0;

while( Time < 12 )
{
PositionX += SpeedX;
SpeedX += AccelerationX;
if( Time == 3 ) AccelerationX = 0;
else if( Time == 6 ) AccelerationX = -1;
Time++;
}

Go ahead, plug it in and see what you get...The object will speed up to 5 units per second, then slow down to 0 units per second, and will have moved 40 units.

G''luck,
-Alamar

PS. If that seems complicated, go with the initial suggestion and research some physics...

### #3Dean Harding  Members

Posted 24 July 2001 - 01:46 PM

I wouldn''t have thought that the acceleration of the head would have much overall impact on the hard disk (i.e. you wouldn''t really notice the acceleration/deceleration) especially since the head only moves a very small distance before it gets to where it was going...

War Worlds - A 3D Real-Time Strategy game in development.

### #4Strife  Members

Posted 24 July 2001 - 02:44 PM

Yeah, why don''t you just tell your professor that you added acceleration when you really didn''t

He''d never notice

Got Slack?
Commander M

### #5nycjay  Members

Posted 25 July 2001 - 07:55 AM

I know that it will be hard to see. Basically, he wants to use this app as an example to show to an into operating systems class. i will have sliders to control the speed of the disk and the arm (and hopefully it''s performance) so the students can see how efficiently different read/write algorithms work with different hardware. i am going to try and put in some of the above code, and see where it gets me. thanks for the help and advice though...
jason

ps. he tols me that the acceleration does play an effect in the real world. the mechanism for moving the arm with the head on it has to take it into account so it knows how much power to give the mechanism. i am at a loss, be he says its important ?? oh well

### #6a2k  Members

Posted 25 July 2001 - 11:14 AM

it is important. what if the disk accesses several sectors that require the movement of the arm everywhere. the arm spends lots of time accelerating and decelerating. if the arm has to read from a sector at the edge, and then the next one near the center of the disk (sweeping) the entire disk, the acceleration and deceleration time has a lesser effect since the time the arm has to move outproportions the time for accel and decel.

a2k

### #7LilBudyWizer  Members

Posted 25 July 2001 - 11:56 AM

Just out of curiosity I went and checked out a drive on Seagate''s web site. The track per inch was 21,368 and with 16,383 cylinders. That makes about .7667 inches. A full seek takes 17.8ms which is an average velocity of around 43.07 inches/second. The average, 1/3 of the tracks, is 31.17 inches/second and a single track seek is .039 inches/second. So apparently the time it takes to accelerate to the maximum velocity is large relative to the distance between two tracks. I would think the acceleration curve would look something like M*R*T*e^(1-R*T) where M is the maximum acceleration and R is the reciprical (eek sp?) of the time it takes to reach the maximum acceleration. That would make it M*1*e^0 or M at that time.

Posted 26 July 2001 - 04:13 AM

Very simple system is like this:

float speed=1.00;
#define PER_MOVEMENT 0.15
#define MAX_SPEED 5.0
#define MIN_SPEED 0.0
float characterpos=50.0;
BOOL accelerate;
int direct;

...

void gameloop() {
...

characterpos+=(direct*speed);
if(accelerate) {
if(speed speed+=PER_MOVEMENT;
} else {
if(speed>MIN_SPEED)
speed-=PER_MOVEMENT;
}
...
}

In serious projects, I recommend you don''t use this. But if anyone wants quick and fast system, this would be good.

### #9Shannon Barber  Moderators

Posted 26 July 2001 - 02:36 PM

You need to know how much umph the drive can supply, and the mass distribution of the heads. From that you can calculate the moment of interia, and then given the umph characteristics of the drive you can calculate rotational accelerations and velocities. Finally you can calculate the position of the heads.

Magmai Kai Holmlor
- Not For Rent

### #10LilBudyWizer  Members

Posted 26 July 2001 - 05:15 PM

Well, I thought it would be easy to come up with a curve that would approximate the average velocity versus the number of cylinders being traversed. Perhaps it is, but not for me. A few more data points would certainly go a long ways. I think I would argue that if he wants an accurate simulation then he needs to give you that equation and otherwise he needs to be happy with something that looks good. Even with that it would be a bit of a challenge to come up with an linear acceleration/decelleration and maximum velocity that would always get you where you are going at the right time.

Old topic!

Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.