Ejemplo n.º 1
0
        public double Seek(PositionVector newPosition)
        {
            if (!newPosition.isValid)
            {
                return 0;
            }

            direction = newPosition.Track > position.Track ? Direction.In : Direction.Out;

            double time = calculateSeek(newPosition);

            position.Track = newPosition.Track;
            position.Sector = newPosition.Sector;

            return time;
        }
Ejemplo n.º 2
0
        public double calculateSeek(PositionVector newPosition)
        {
            double time = (10 + 0.1 * Math.Abs(position.Track - newPosition.Track));

            if (newPosition.Sector >= position.Sector)
            {
                time += newPosition.Sector - position.Sector;
            }
            else
            {
                time += (8 - position.Sector) + newPosition.Sector;
            }

            //Include transfer time of 1 ms
            time++;

            return time;
        }
Ejemplo n.º 3
0
 public Disk()
 {
     tracks = new Track[250];
     position = new PositionVector(0, 0);
     direction = Direction.In;
 }
Ejemplo n.º 4
0
 public Seek(int arrivalTime, PositionVector position)
 {
     this.arrivalTime = arrivalTime;
     this.position = position;
 }