示例#1
0
文件: fsm.go 项目: stianlaa/SLH2016
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
	}
}
示例#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
	}
}