Sunday, September 26, 2021

Elevator Senarios

 



enum elevatorStatus{Moving,Idle,Stopped}

enum elevatorDirection{Up,Down}

elevator 

{

currentflor 

Status -moving ,idle stopped

CurrentDirection- up down 

}



sortedlist CurrentDirectionList

SortedList OtherPressUp

SortedList OtherPressDown



ExternalRequest

{

floor

direction 

}


InternalRequest

{

floor

direction 

}



- addToProcessingFloor(ExternalRequest) //SomeonePressingButton from outside

-switch{

case Idle:

CurrentDirectionList.Add()

case Moving:

if(Up)

//up

ExternalRequest.Up

if(currentfloor<ExternalRequest.floor)

CurrentDirectionList.Add()

else AddTO OtherPressUp

else //down

ExternalRequest.Down

if(currentfloor>ExternalRequest.floor)

CurrentDirectionList.Add()

else OtherPressDown

case Stopped:

CurrentDirectionList.Add()

}

- WhenIdel()

case Moving:

if(Up)

//up

CurrentDirectionList= OtherPressDown

CurrentDirection =down

else //down

CurrentDirectionList= OtherPressDown

          CurrentDirection =down


-addToProcessingFloor(InternalRequest)//Somepress button side

-switch{

case Idle:

CurrentDirectionList.Add()

case Moving:

if(Up)

//up

if(currentfloor<InternalRequest.floor)

CurrentDirectionList.Add()

    else AddTO OtherPressDown

else //down

if(currentfloor<InternalRequest.floor)

CurrentDirectionList.Add()

else OtherPressUP

case Stopped:

CurrentDirectionList.Add()

}

No comments:

Post a Comment