![六层电梯设计_第1页](http://file3.renrendoc.com/fileroot_temp3/2022-4/10/f43ff404-bd0a-4900-a33f-08f26848cda0/f43ff404-bd0a-4900-a33f-08f26848cda01.gif)
![六层电梯设计_第2页](http://file3.renrendoc.com/fileroot_temp3/2022-4/10/f43ff404-bd0a-4900-a33f-08f26848cda0/f43ff404-bd0a-4900-a33f-08f26848cda02.gif)
![六层电梯设计_第3页](http://file3.renrendoc.com/fileroot_temp3/2022-4/10/f43ff404-bd0a-4900-a33f-08f26848cda0/f43ff404-bd0a-4900-a33f-08f26848cda03.gif)
![六层电梯设计_第4页](http://file3.renrendoc.com/fileroot_temp3/2022-4/10/f43ff404-bd0a-4900-a33f-08f26848cda0/f43ff404-bd0a-4900-a33f-08f26848cda04.gif)
![六层电梯设计_第5页](http://file3.renrendoc.com/fileroot_temp3/2022-4/10/f43ff404-bd0a-4900-a33f-08f26848cda0/f43ff404-bd0a-4900-a33f-08f26848cda05.gif)
版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
1、VHDL数字系统设计与测试 学 院 通信工程学院 学 号 题 目 六层电梯设计 姓 名 一、设计要求与功能 1.设计要求(1)完成6个楼层多用户的载客服务控制。 (2)对于载客请求,遵循同向优先的原则。 (3)能够响应提前关电梯门和延时关电梯门的请求。 (4)显示电梯的运行情况,楼层运行方向。2.设计功能本文涉及了一个六层电梯控制系统,基本功能如下:(1)每层电梯入口处设有上下请求开关,电梯内设有顾客到达层次的停站请求开关。(2)设有电梯入口处位置指示装置及电梯运行模式(上升或下降)指示装置。(3)电梯每秒
2、升(降)一层楼。(4)电梯到达有停站请求的楼层,经过1秒电梯门打开,开门指示灯亮,开门4秒后,电梯门关闭(开门指示灯灭),电梯继续进行,直至执行完最后一个请求信号后停留在当前层。(5)能记忆电梯内外所有请求,并按照电梯运行规则按顺序响应,每个请求信号保留至执行后消除。(6)电梯运行规则:当电梯处于上升模式时,只响应比电梯所在位置高的上楼请求信号,由下而上逐个执行,直到最后一个上楼请求执行完毕;如果高层有下楼请求,则直接升到由下楼请求的最高层,然后进入下降模式。当电梯处于下降模式时则与上升模式相反。(8)人数超载或超重用一按钮代替,高电平有效,超载时电梯不能运行,并有相应指示。 (9)
3、事故报警按钮高电平有效,事故报警不能运行,并有指示灯,信号保留至事故消除(10)电梯初始状态为一层开门状态。二、总体设计方案控制器的功能模块如图1所示,包括主控制器、楼层选择器、状态显示器、译码器和楼层显示器。乘客在电梯中选择所要到达的楼层,通过主控制器的处理,电梯开始运行,状态显示器显示电梯的运行状态,电梯所在楼层数通过译码器译码从而在楼层显示器中显示。由于其他模块相对简单很多,所以主控制器是核心部分。 图1 总体设计方案三、设计思路电梯控制器运用状态机的设计方法,思路比较清晰。可以将电梯等待的每秒钟以及开门、关门都看成一个独立的状态。由于电梯又是每秒上升或下降一层,所以就可以通过一个统一的
4、1秒为周期的时钟来触发状态机。根据电梯的实际工作情况,可以把状态机设置7个状态,分别是“电梯停留在第1层”、“开门”、“关门”、“开门等待4秒”、“上升”、“下降”和“停止状态”。各个状态之间的转换条件可由上面的设计要求所决定。各状态机之间转换图如图2: 图2状态机转换图四、原理图说明电梯控制器为其中的核心部件,控制其电梯的运行情况,而其控制则由按钮来决定,通过按钮指示灯判断电梯的工作状态及显示其运行情况。当按钮为高电平时,电梯开始工作,并通过按钮信号灯决定电梯的运行。电梯所处位置显示通过译码器,再通过数据选择器显示到数码管上。udsig和doorlight显示电梯门和电梯的状态。stopli
5、ght6.1 fuplight6.1 fdnlight6.1 显示按钮指示。Reset按钮使电梯恢复到初始位置。楼层position变化相应的数码管也跟着变。其顶层原理图如图3:图3顶层原理图各功能模块如下:1) 电梯主控制模块电梯控制器为其中的核心部件,控制其电梯的运行情况,而其控制则由按钮来决定,通过按钮指示灯判断电梯的工作状态及显示其运行情况。 图4 电梯主控制模块电梯主控制模块端口说明:buttonclk 按钮时钟信号 liftclk 电梯时钟信号 reset 复位键 f1upbutton 一楼上楼按钮 f2upbutton 二楼上楼按钮 f3upbutton 三楼上楼按钮f4upbu
6、tton 四楼上楼按钮 f5upbutton 五楼上楼按钮f2dnbutton 二楼下楼按钮 f3dnbutton 三楼下楼按钮f4dnbutton 四楼下楼按钮 f5dnbutton 五楼下楼按钮 f6dnbutton 六楼下楼按钮 stop1button 电梯内部一楼按钮stop2button 电梯内部二楼按钮 stop3button 电梯内部三楼按钮stop4button 电梯内部四楼按钮 stop5button 电梯内部五楼按钮stop6button 电梯内部六楼按钮 fuplight6.1 每楼层上升指示灯fdnlight6.1 每楼层下降指示灯 stoplight6.1 电梯内部楼
7、层指灯 position2.0 楼层位置显示 doorlight 电梯门状态显示 udsig 电梯上升下降显示2)分频器模块通过分频器将高频转换为低频,即buttonclk,通过此时钟信号控制电梯信号灯。当按钮为高电平时,电梯开始工作,并通过按钮信号灯决定电梯的运行。 图5 分频器模块模块端口说明:clk_in 电源输入端 div_out 分频后时钟输出端3) 译码器模块 图6译码器模块aaa2.0 楼层位置输出端 bbb3.0 译码输出端4)数据选择器模块 图 7 数据选择器模块数据选择器将译码器输出显示到数码管上,来表示电梯所处层数数据选择器模块端口说明:input3.0 译码器输入端 o
8、utput6.0 数据选择器输出端五、源代码电梯程序:library ieee;use ieee.std_logic_1164.all;use ieee.std_logic_unsigned.all;use ieee.std_logic_arith.all;entity sixlift isport( buttonclk:in std_logic; -按钮时钟信号 liftclk: in std_logic; -电梯时钟信号 reset:in std_logic; -复位键 f1upbutton:in std_logic; -一楼上升按钮 f2upbutton:in std_logic; -二
9、楼上升按钮 f3upbutton:in std_logic; -三楼上升按钮 f4upbutton:in std_logic; -四楼上升按钮 f5upbutton:in std_logic; f2dnbutton:in std_logic; -二楼下降按钮 f3dnbutton:in std_logic; -三楼下降按钮 f4dnbutton:in std_logic; -四楼下降按钮 f5dnbutton:in std_logic; -五楼下降按钮 f6dnbutton:in std_logic; -六楼下降按钮 fuplight:buffer std_logic_vector(6 dow
10、nto 1); -上升指示灯 fdnlight:buffer std_logic_vector(6 downto 1); -下降指示灯 stop1button,stop2button,stop3button, stop4button, stop5button, stop6button:in std_logic; -电梯内部按钮 stoplight:buffer std_logic_vector(6 downto 1); -内部停止指示灯 position:buffer integer range 1 to 6; -楼层位置显示 doorlight:out std_logic; -电梯门指示灯
11、1 开 0关 udsig:buffer std_logic ); -0处于上升模式,1处于下降模式 end sixlift;architecture art of sixlift is type lift_state is (stopon1,dooropen,doorclose,doorwait4,up,down,stop); -电梯所处的7个状态signal mylift:lift_state; -内部电梯状态信号signal clearup:std_logic; -上升清除信号 signal cleardn:std_logic; -下降清除信号 begincontrollift:proce
12、ss(reset,liftclk) variable pos:integer range 1 to 6; -楼层位置变量 beginif reset='1' then mylift<=stopon1; -起始状态 clearup<='0' -上楼信号清除 cleardn<='0' -下楼信号清除 pos:=1; -处于一楼 position<=1; -处于一楼else if liftclk'event and liftclk='1' then -四秒后门关 case mylift is when s
13、topon1 => doorlight<='1' -电梯门开 position<=1; -电梯处于一楼 pos:=1; mylift<=doorwait4; when doorwait4 => mylift<=doorclose; when doorclose => doorlight<='0' -电梯门关 if udsig='0' then -电梯处于上升模式 if position=6 then if stoplight="000000" and fuplight="
14、;000000" and fdnlight="000000" then udsig<='1'mylift<=doorclose; else udsig<='1'mylift<=down; end if; elsif position=5 then if stoplight="000000" and fuplight="000000" and fdnlight="000000" then udsig<='0'mylift<=
15、doorclose; elsif stoplight(6)='1' or fdnlight(6)='1' then udsig<='0'mylift<=up; else udsig<='1'mylift<=down; end if; elsif position=4 then if stoplight="000000" and fuplight="000000" and fdnlight="000000" then udsig<='0
16、'mylift<=doorclose; elsif stoplight(5)='1' or stoplight(6)= '1' or fdnlight(6)='1' or fdnlight(5)='1' then udsig<='0'mylift<=up; else udsig<='1'mylift<=down; end if; elsif position=3 then if stoplight="000000" and fuplight=
17、"000000" and fdnlight="000000" then udsig<='0'mylift<=doorclose; elsif stoplight(4)='1' or stoplight(5)='1' or stoplight(6)= '1' or fdnlight(6)='1' or fdnlight(5)='1' or fdnlight(4)='1' then udsig<='0'mylift
18、<=up; else udsig<='1'mylift<=down; end if; elsif position=2 then if stoplight="000000" and fuplight="000000" and fdnlight="000000" then udsig<='0'mylift<=doorclose; elsif stoplight(3)='1' or stoplight(4)='1' or stoplight(5)
19、='1' or stoplight(6)= '1' or fdnlight(6)='1' or fdnlight(5)='1' or fdnlight(4)='1' or fdnlight(3)='1' then udsig<='0'mylift<=up; else udsig<='1'mylift<=down; end if; elsif position=1 then if stoplight="000000" and
20、fuplight="000000" and fdnlight="000000" then udsig<='0'mylift<=doorclose; else udsig<='0'mylift<=up; end if; end if; elsif udsig='1' then if position=1 then if stoplight="000000" and fuplight="000000" and fdnlight="0000
21、00" then udsig<='0'mylift<=doorclose; else udsig<='0' mylift<=up; end if; elsif position=2 then if stoplight="000000" and fuplight="000000" and fdnlight="000000" then udsig<='1'mylift<=doorclose; elsif stoplight(1)='1
22、39; or fuplight(1)='1' then udsig<='1'mylift<=down; else udsig<='0' mylift<=up; end if; elsif position=3 then if stoplight="000000" and fuplight="000000" and fdnlight="000000" then udsig<='1'mylift<=doorclose; elsif stop
23、light(1)='1' or stoplight(2)='1' or fuplight(1)='1' or fuplight(2)='1' then udsig<='1'mylift<=down; else udsig<='0' mylift<=up; end if; elsif position=4 then if stoplight="000000" and fuplight="000000" and fdnlight="
24、;000000" then udsig<='1'mylift<=doorclose; elsif stoplight(1)='1' or stoplight(2)='1' or stoplight(3)='1' or fuplight(1)='1' or fuplight(2)='1' or fuplight(3)='1' then udsig<='1'mylift<=down; else udsig<='0'
25、mylift<=up; end if; elsif position=5 then if stoplight="000000" and fuplight="000000" and fdnlight="000000" then udsig<='1'mylift<=doorclose; elsif stoplight(1)='1' or stoplight(2)='1' or stoplight(3)='1' or stoplight(4)='1
26、39; or fuplight(1)='1' or fuplight(2)='1' or fuplight(3)='1' or fuplight(4)='1' then udsig<='1'mylift<=down; else udsig<='0' mylift<=up; end if; elsif position=6 then if stoplight="000000" and fuplight="000000" and fdnli
27、ght="000000" then udsig<='1'mylift<=doorclose; else udsig<='1' mylift<=down; end if; end if; end if; when up => position<=position+1;pos:=pos+1; if position <6 and( stoplight(pos)='1' or fuplight(pos)='1') then mylift<=stop; elsif pos
28、=6 and (stoplight(pos)='1' or fdnlight(pos)='1') then mylift<=stop; else mylift<=doorclose; end if; when down => position<=position-1; pos:=pos-1; if position>1 and (stoplight(pos)='1' or fdnlight(pos)='1') then mylift<=stop; elsif pos=1 and (stoplig
29、ht(pos)='1' or fuplight(pos)='1') then mylift<=stop; else mylift<=doorclose;end if; when stop => mylift<=dooropen; when dooropen => doorlight<='1'if udsig='0' thenif position<6 and (stoplight(position)='1' or fuplight(position)='1'
30、) then clearup<='1'else clearup<='1'cleardn<='1'end if; elsif udsig='1' thenif position>1 and (stoplight(position)= '1' or fdnlight(position)='1') then cleardn<='1'else clearup<='1'cleardn<='1' end if;end if
31、;mylift<=doorwait1; end case; end if; end if;end process controllift;controllight:process(reset,buttonclk) begin if reset='1' then stoplight<="000000" fuplight<="000000"fdnlight<="000000" elsif buttonclk'event and buttonclk='1' then if cl
32、earup='1' then stoplight(position)<='0'fuplight(position)<='0' elsif f1upbutton='1' then fuplight(1)<='1' elsif f2upbutton='1' then fuplight(2)<='1' elsif f3upbutton='1' then fuplight(3)<='1' elsif f4upbutton='
33、;1' then fuplight(4)<='1' elsif f5upbutton='1' then fuplight(5)<='1' end if; if cleardn='1' then stoplight(position)<='0' fdnlight(position)<='0' elsif f2dnbutton='1' then fdnlight(2)<='1' elsif f3dnbutton='1'
34、 then fdnlight(3)<='1' elsif f4dnbutton='1' then fdnlight(4)<='1' elsif f5dnbutton='1' then fdnlight(5)<='1' elsif f6dnbutton='1' then fdnlight(6)<='1' end if; if stop1button='1' then stoplight(1)<='1' elsif stop2
35、button='1' then stoplight(2)<='1' elsif stop3button='1' then stoplight(3)<='1' elsif stop4button='1' then stoplight(4)<='1' elsif stop5button='1' then stoplight(5)<='1' elsif stop6button='1' then stoplight(6)<=
36、9;1' end if; end if;end process controllight;end art;分频器程序:library ieee;use ieee.std_logic_1164.all;use ieee.std_logic_unsigned.all;entity div is port( clk_in:in std_logic; div_out:out std_logic);end;architecture a of div is signal fre_N:integer range 0 to 10;signal clk_tmp:std_logic;begin div_o
37、ut<=clk_tmp;process(clk_in)begin if falling_edge(clk_in) then if fre_N>10 then fre_N<=0; clk_tmp<=not clk_tmp; else fre_N<=fre_N+1; end if; end if; end process;end a;译码器程序:library ieee;use ieee.std_logic_1164.all;use ieee.std_logic_unsigned.all;entity yima isport( aaa:integer range 1
38、to 6; bbb:out std_logic_vector(3 downto 0);end;architecture a of yima isbeginprocess(aaa)begin if aaa=1 then bbb<="0001" elsif aaa=2 then bbb<="0010" elsif aaa=3 then bbb<="0011" elsif aaa=4 then bbb<="0100" elsif aaa=5 then bbb<="0101"
39、; elsif aaa=6 then bbb<="0110"end if;end process;end a;数据选择器程序:library ieee;use ieee.std_logic_1164.all;entity led is port( input:in std_logic_vector(3 downto 0); output:out std_logic_vector(6 downto 0);end;architecture a of led is begin output<="0110000" when input="0
40、001" else "1101101" when input="0010" else "1111001" when input="0011" else "0110011" when input="0100" else "1011011" when input="0101" else "1011111" when input="0110" else "0000000"e
41、nd a;五、仿真结果与说明1.各模块仿真分析(1) 电梯控制模块a. 电梯报警的情形电梯在超载的时候发出警报信号同时不进行关门动作直至报警解除,同时从波形图可以看到延时关门和提前关门信号的作用图8 情况ab.当电梯停在初始状态时,高层有上升的请求图9所示仿真的是在第2层电梯外部有上升请求,也就是f2upbuttton信号的一个脉冲,可以看到电梯从一层上升到五层,position信号由1变到2,doorlight信号1表示开门,0表示关门。当乘客进入电梯以后,在电梯内部要求上升到第三层,也就是stop3button产生一个脉冲,电梯上升到第3层,开门4秒以后关门,停留在第三层,position
42、最后的值为3。在仿真图中看不到buttonclk,只显示为一条黑色的线,是因为采用了频率较大的时钟。再看fuplight信号灯,当五层有上升请求的时候,它的值由0变到16。(注意fuplight和fdnlight是6位的二进制向量,这里的“010000”,表示五层有请求;“000100”也就是4,表示三层有请求)。当电梯停留到第二层以后,表明该请求被响应,所以它的值变为0,由于没有下降请求信号,所以fdnlight信号灯的值一直都为0。当电梯处于第二层时,udsig=0,即此时若没有其他请求,电梯处于上升模式;当stop6button=1,即电梯内部按了三层请求时,电梯门灯灭电梯开始上升uds
43、ig=0,即处于上升模式10,抵达三层时,udsig=即无论什么请求电梯都开始下降,且doorlight=1,即灯亮,电梯门开。四秒之后灯灭,电梯门关。图9 情况bc.当电梯停在初始状态时,高层有下降的请求图10是有下降请求的情况,它是图7的继续,即当电梯停留在第一层的时候,假设在电梯外第四层有下降请求,这时候fdnlight信号灯由0变为8,说明第四层有下降请求。电梯下降到第四层,响应了下降请求,所以fdnlight信号灯清0。电梯开始下降,即udsig=1,抵达四楼后电梯门开,doorlight=1, 这时候,在电梯内部有一楼向上请求,接着电梯内部有三楼的请求,所以电梯继续下降,到达三层后
44、,电梯门开,四秒后电梯门关,又因为一楼有请求所以最终到达一楼停止响应,position信号的值保持在1,电梯处于上升模式。四秒后电梯门关。 图10 情况cd. 当电梯处于初始状态时,电梯在高层有向下和低层有上升同时的请求图10所示的仿真,原先电梯停留在第一层,电梯外第四层有下降请求,电梯上升到四层,乘客进入电梯以后要求下降到一层,此时,二层有下降请求,接着又有上升请求,电梯首先在二层停留。然后下降到一层。随后要响应二层上升请求,上升到二层,乘客进入电梯以后要求上升到三层,所以电梯最后的停留位置在三层。 图11 情况d(2) 译码器模块本模块的主要功能是将10进制数转换成4位二进数。当输入信号aaa=1时,输出bbb=0001;当输入信号aaa=2时,输出bbb=0010;当输入信号aaa=3时,输出bbb=0011;当输入信号aaa=4时,输出bbb=0100;当输入信号aaa=5时,输出bbb=0101;当输入信号aaa=6时,输出bbb=0110;其他都为0000;仿真波形如图12 图12 译码器仿真波形(3) 数据选择模块此模块的功能是根据输入不同的数据输出不同的数据,即由输入定输出,输出量通过数码管显示数据。当input=0001时, 输出 0110000, 数码管显示 1;当input=0010时, 输出 1101101, 数码管显示2;当input=
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 2025年警用防爆鞋项目可行性研究报告
- 2025年常温退浆酶项目可行性研究报告
- 2025年双线勾边毛巾项目可行性研究报告
- 2025年三极插头转多用插座项目可行性研究报告
- 2025至2030年中国激光功率监测器数据监测研究报告
- 2025至2030年扩口胀管器项目投资价值分析报告
- 2025至2030年啤酒辅料项目投资价值分析报告
- 2025至2030年分流器组件项目投资价值分析报告
- 2025至2030年五金餐台项目投资价值分析报告
- 2025年中国高分子金属修补剂市场调查研究报告
- 2025-2030年中国纳米氧化铝行业发展前景与投资战略研究报告新版
- 2025年度正规离婚协议书电子版下载服务
- 2025年贵州蔬菜集团有限公司招聘笔试参考题库含答案解析
- 煤矿安全生产方针及法律法规课件
- 2025年教科室工作计划样本(四篇)
- 【7历期末】安徽省宣城市2023-2024学年七年级上学期期末考试历史试题
- 春节后安全生产开工第一课
- 人教版(2024年新教材)七年级上册英语Unit 7 Happy Birthday 单元整体教学设计(5课时)
- 口腔粘膜常见疾病
- 酒店春节营销方案
- 高中物理选择性必修2教材习题答案
评论
0/150
提交评论