📜  项目理念 |智能电梯

📅  最后修改于: 2022-05-13 01:57:41.760000             🧑  作者: Mango

项目理念 |智能电梯

介绍:

如今,在大型建筑中,传统电梯的等待时间更长,行驶时间更长,耗电量更大。因此,需要开发一种算法来减少上述问题。我在 Smartron 实习时完成了这个项目。我开发了一种算法,可以减少电梯中的等待和行驶时间。

我在这个项目中使用了物联网的概念以及 Arduino 微控制器的使用。

概念框架:

电梯的键盘位于大楼大堂的电梯外。建筑物特定楼层的所有电梯在大堂入口处都有一个公共键盘。当一个人在键盘上按下他想要的楼层时,系统会为他分配一个电梯(在该楼层或更靠近该楼层)。

电梯是如何分配给用户的?

当用户在键盘上按下他想要的楼层时,系统会执行以下步骤:

1) 检查该楼层是否有电梯,如果是,则分配电梯。
2)如果不是,则检查用户是想从当前楼层到上层还是下层。
3) 然后它分配正在上升并更靠近该楼层的电梯。

该算法的主要限制是电梯最多可停靠 4 个站点。因此,当它检查电梯时,它会检查电梯是否已达到最大停靠点。

系统是什么以及它是如何工作的?

每个电梯都连接到主从配置中的 Arduino。每个电梯都是主 Arduino 的奴隶,负责将电梯分配给用户。

每个电梯都维护一个队列(数据结构)。队列中元素的数量是电梯可以停靠的最大数量。

队列中的第一个元素是它的当前楼层。后续元素按顺序是其目的地。

主站检查每个队列并从队列的第一个元素中获取所有电梯的位置。

当当前元素和下一个元素之间的差异为正时,提升会向上,反之亦然。

我使用 Arduino IDE 进行编程和动手 Arduino 套件进行测试。

该项目是智能电梯的POC,可用于智能电梯的进一步研究(使用人工智能使其真正智能)。

伪代码:
掌握:

// declare arrays for the slaves(queues are implemented using arrays)
void setup(){
  SPI.begin;   // Begin SPI protocol
  digitalWrite(SS,HIGH);
  SPI.begin();
  SPI.setClockDivider(SPI_CLOCK_DIV8);
}
void loop(){
  // create as many functions as there are keypads in the building.
  // inside each function
  keypad1(){
    // take keypad input.
    // check all the filters and assign a lift 
    SPI.transfer(destination);  // goes to selected slave 
    enqueue(destination); // added to selected slave queue
  }
  Keypad2(){
    // take keypad input.
    // check all the filters and assign a lift 
    SPI.transfer(destination);  // goes to selected slave 
    enqueue(destination); // added to selected slave queue
  }
}

Slave code:

// declare array for the slave (queue is implemented using array)
void setup(){
  pinMode(MISO,OUTPUT);
  SPCR |= _BV(SPE);  // turn on slave mode
  SPCR |= _BV(SPIE);  // turn on interrupt
}
ISR(SPI_STC_vect){
  // receive destination from master
  // add to the queue 
}
void loop(){
  // always looks at the first element of the queue and goes to that floor. 
  // when the destination is reached, it is deleted from queue
  // inform master about deletion so that it can update the queue for this slave
} ?

真挚地,
斯里哈沙