Exemplo n.º 1
0
func FsmOnFloorArrival(newFloor int) {
	E.Floor = newFloor

	driver.ElevSetFloorIndicator(newFloor)

	if ShouldStop(E) && E.Behaviour == MOVING {
		driver.ElevSetMotorDirection(int(STOP))
		driver.ElevSetDoorLight(true)
		E = ClearOrdersInDirection(E)
		TimerStart()
		SetAllLights(E)
		E.Behaviour = DOOROPEN
	}
}
Exemplo n.º 2
0
func fsm_onFloorArrival(newFloor int) {
	lastFloorTime = time.Now().Unix()
	elevator.Floor = newFloor
	Driver.ElevSetFloorIndicator(newFloor)
	switch elevator.Behaviour {
	case EB_Moving:
		if requests_shouldStop(elevator) {
			Driver.ElevSetMotorDirection(int(D_Idle))
			Driver.ElevSetDoorLight(true)
			elevator = requests_clearAtCurrentFloor(elevator)
			timer_start(3000 * time.Millisecond)
			setAllLights()
			elevator.Behaviour = EB_DoorOpen
		}
		break
	default:
		break
	}
}