项目选题:
电梯调度算法的实现和测试
项目背景:
Imagine we’re building a tall office building, it has the following configuration about elevators:
Building has 21 floors, 4 elevators, many passengers use these elevators everyday (passenger weight: average 70kg. max 120kg, min 45kg).
Other constant data: Elevator speed, door open/close time, passenger time for going in/out of the elevator. We can make reasonable assumptions about these.
The building has 21 floors, from floor 0, 1, ... to 20. Floor 0 is the underground parking level, floor 1 is the lobby level. Most people come in/out the building via these 2 floors.
Elevator name |
Service floor list |
Passenger limit |
Weight limit |
1 |
1, 10-20 |
12 |
1000 kg |
2 |
0-10 |
10 |
1000 kg |
3 |
1, 10-20 |
20 |
1500 kg |
4 |
0-20 |
20 |
2000 kg |
需求分析:
功能需求
1、四台电梯同时工作
2、随机在各楼层生成乘客信息
3、开始工作后不能有乘客无法抵达目的楼层
4、生成并记录个乘客抵达目的地的总用时
性能需求
1、具有高可靠性和容错能力
2、具有安全检查机制
项目目标:
1、程序模块化设计
2、记录每个人的总路程时间
3、完成测试
UML图
将本次实验对象确定为电梯,乘客,楼层
因为有大量的相关多个对象操作,所以也可以将操作设为一个对象类
这样分类后,各物体类中只存在类的属性和检索类的数据的方法,将修改数据的操作都放在操作类内,这样分类后产生的UML图如下:
时间及任务划分:
第一周:设计大致模块。
第二周:每人进行相关知识的学习,并讨论细化程序。
第三至五周:分工完成程序。
第六至七周:测试并优化程序,根据情况增加相应功能模块。
第八周:进行最后微调并检查。