《PLC电梯控制英文文献》由会员分享,可在线阅读,更多相关《PLC电梯控制英文文献(23页珍藏版)》请在金锄头文库上搜索。
1、PLCPLC电梯控制英文文献电梯控制英文文献2.5 System Block DiagramA Programmable Controller is a specialized computer.Since it is a computer, it has all thebasic component parts that any other computer has; a Central Processing Unit,Memory, InputInterfacing and Output Interfacing.A typical programmable controller block
2、 diagram is shown inFigure 2.5.Figure 2.5Programmable Controller Block DiagramThe Central Processing Unit (CPU) is the control portion of the PLC. It interprets theprogram commands retrieved from memory and acts on those commands.In present day PLCsthis unit is a microprocessor based system.The CPU
3、is housed in the processor module ofmodularized systems.Memory in the system is generally of two types; ROM and RAM.The ROM memory containsthe program information that allows the CPU to interpret and act on the Ladder Logic programstored in the RAM memory.RAM memory is generally kept alive with an o
4、n-board battery sothat ladder programming is not lost when the system power is removed.This battery can be astandard dry cell or rechargeable nickel-cadmium type. Newer PLC units are now available withElectrically Erasable Programmable Read Only Memory (EEPROM) which does not require abattery.Memory
5、 is also housed in the processor module in modular systems.Input units can be any of several different types depending on input signals expected asdescribed above.The input section can accept discrete or analog signals of various voltage andcurrent levels.Present day controllers offer discrete signa
6、l inputs of both AC and DC voltagesfrom TTL to 250 VDC and from 5 to 250 VAC.Analog input units can accept input levels suchas 10 VDC, 5 VDC and 4-20 ma. current loop values.Discrete input units present each input tothe CPU as a single 1 or 0 while analog input units contain analog to digital conver
7、sion circuitryand present the input voltage to the CPU as binary number normalized to the maximum countavailable from the unit.The number of bits representing the input voltage or current depends23upon the resolution of the unit.This number generally contains a defined number of magnitudebits and a
8、sign bit.Register input units present the word input to the CPU as it is received (Binaryor BCD).Output units operate much the same as the input units with the exception that the unit iseither sinking (supplying a ground) or sourcing (providing a voltage) discrete voltages orsourcing analog voltage
9、or current.These output signals are presented as directed by the CPU.The output circuit of discrete units can be transistors for TTL and higher DC voltage or Triacsfor AC voltage outputs. For higher current applications and situations where a physical contactclosure is required, mechanical relay con
10、tacts are available. These higher currents, however, aregenerally limited to about 2-3 amperes.The analog output units have internal circuitry whichperforms the digital to analog conversion and generates the variable voltage or current output.2.6 Update - Solve the Ladder - UpdateWhen power is appli
11、ed to a programmable logic controller, the PLCs operation consists oftwo steps: (1) update inputs and outputs and (2) solve the ladder.This may seem like a verysimplistic approach to something that has to be more complicated but there truly are only thesetwo steps.If these two steps are thoroughly u
12、nderstood, writing and modifying programs andgetting the most from the device is much easier to accomplish.With this understanding, thethings that can be undertaken are then up to the imagination of the programmer.You will notice that the “update - solve the ladder” sequence begins after startup.The
13、 actualstartup sequence includes some operations transparent to the user or programmer that occurbefore actual PLC operation on the user program begins.During this startup there may beextensive diagnostic checks performed by the processor on things like memory, I/O devices,communication with other d
14、evices (if present) and program integrity.In sophisticated modularsystems, the processor is able to identify the various module types, their location in the systemand address.This type of system analysis and testing generally occurs during startup beforeactual program execution.2.7 UpdateThe first t
15、hing the PLC does when it begins to function is update I/O.This means that alldiscrete input states are recorded from the input unit and all discrete states to be output aretransferred to the output unit.Register data generally has specific addresses associated with it forboth input and output data
16、referred to as input and output registers.These registers are availableto the input and output modules requiring them and are updated with the discrete data.Since thisis input/output updating, it is referred to as I/O Update.The updating of discrete input and outputinformation is accomplished with t
17、he use of input and output image registers set aside in the PLCmemory.Each discrete input point has associated with it one bit of an input imageregister.Likewise, each discrete output point has one bit of an output image register associatedwith it.When I/O updating occurs, each input point that is O
18、N at that time will cause a 1 to be setat the bit address associated with that particular input.If the input is off, a 0 will be set into the bitaddress.Memory in todays PLCs is generally configured in 16 bit words.This means that oneword of memory can store the states of 16 discrete input points.Th
19、erefore, there may be anumber of words of memory set aside as the input and output image registers.At I/O update, thestatus of the input image register is set according to the state of all discrete inputs and the statusof the output image register is transferred to the output unit.This transfer of i
20、nformationtypically only occurs at I/O update.It may be forced to occur at other times in PLCs which havean Immediate I/O Update command.This command will force the PLC to update the I/O at othertimes although this would be a special case.One major item of concern about the first output update is th
21、e initial state of outputs.Thisis a concern because their may be outputs that if initially turned on could create a safety hazard,particularly in a system which is controlling heavy mechanical devices capable of causing bodilyharm to operators.In some systems, all outputs may need to be initially se
22、t to their off state toinsure the safety of the system.However, there may be systems that require outputs to initially beset up in a specific way, some on and some off.This could take the form of a predetermined setupor could be a requirement that the outputs remain in the state immediately beforepo
23、wer-down.More recent systems have provisions for both setup options and even a combinationof the two.This is a prime concern of the engineer and programmer and must be defined as thesystem is being developed to insure the safety of personnel that operate and maintain theequipment.Safety as related t
24、o system and program development will be discussed in a laterchapter.2.8 Solve the LadderAfter the I/O update has been accomplished, the PLC begins executing the commandsprogrammed into it.These commands are typically referred to as the ladder diagram.The ladderdiagram is basically a representation
25、of the program steps using relay contacts and coils.Theladder is drawn with contacts to the left side of the sheet and coils to the right.This is aholdover from the time when control systems were relay based.This type of diagram was usedfor the electrical schematic of those systems.A sample ladder d
26、iagram is shown in Figure 2-6.4Figure 2.6Sample Ladder DiagramThe symbols used in Figure 2.6 may be foreign at this point, so a short explanation will benecessary.The symbols at the right of the ladder diagram labeled CR1, CR2, CR3 and CR4 andare circular in shape are the software coils of the relay
27、s.The symbols at the left which look likecapacitors, some with diagonal lines through them, are the contacts associated with the coils.Thesymbols that look like capacitors without the diagonal lines through them are normally opencontacts.These are analogous to a switch that is normally off.When the
28、switch is turned on, thecontact closes.The contact symbols at the left that look like capacitors with diagonal linesthrough them are normally closed contacts.A normally closed contact is equivalent to a switchthat is normally turned on.It will turn off when the switch is actuated.As can be seen in F
29、igure 2.6, contact and coil position is as described above.Also, one cansee the reason for the term ladder diagram if the rungs of a stepladder are visualized.In fact, eachcomplete line of the diagram is referred to as one rung of logic.The actual interpretation of thediagram will also be discussed
30、later although some explanation is required here.The contactconfiguration on the left side of each rung can be visualized as switches and the coils on the rightas lights.If the switches are turned on and off in the proper configuration, the light to the rightwill illuminate.The PLC executes this pro
31、gram from left to right and top to bottom, in thatorder.It first looks at the switch (contact) configuration to determine if current can be passed tothe light (coil).The data for this decision comes from the output and input image registers.Ifcurrent can be passed, the light (coil) will then be turn
32、ed on.If not, the light (coil) will be turnedoff.This is recorded in the output image register.Once the PLC has looked at the left side oftherung it ignores the left side of the rung until the next time it solves that particular rung. Once5the light (coil) has been either turned on or off it will re
33、main in that state until the next time thePLC solves that particular rung.After solving a rung, the PLC moves on to solve the next rung inthe same manner and so forth until the entire ladder has been executed and solved.One rule thatis different from general electrical operation is the direction of
34、current flow in the rung.In aladder logic, rung current can only flow from left to right and up and down; never from right toleft.As an example, in the ladder shown in Figure 2.7, coil CR1 will energize if any of thefollowing conditions exist:Figure 2.7Illustration of allowed current flow in ladder
35、rung1. CR7 is off, CR6 is on.2. CR7 is off, CR2 is on, CR5 is on.3. CR7 is off, CR2 is on, CR3 is on.4. CR1 is on, CR4 is on, CR3 is on.5. CR1 is on, CR4 is on, CR5 is on.You will notice that the current flow in the circuit in each of the cases listed above is fromleft to right and up and down. CR1
36、will not energize in the case listed below:CR1 is on, CR4 is on, CR2 is on, CR6 is on, CR5 is off, CR3 is off, CR7 is on.This is because current would have to flow from right to left through the CR2 contact.This is not allowed in ladder logic even though current could flow in this direction if we we
37、re tobuild it with real relays.Remember, we are working in the software world not the hardwareworld.To review, after the I/O update, the PLC moves to the first rung of ladder logic.It solves thecontact configuration to determine if the coil is to be energized or de-energized.It then energizesor de-e
38、nergizes the coil.After this is accomplished, it moves to the left side of the next rung andrepeats the procedure.This continues until all rungs have been solved.When this procedure iscomplete with all rungs solved and all coils in the ladder set up according to the solution of eachrung, the PLC pro
39、ceeds to the next step of its sequence, the I/O update.6At I/O update, the states of all coils which are designated as outputs are transferred from theoutput image register to the output unit and the states of all inputs are transferred to the inputimage register.Note that any input changes that occ
40、ur during the solution of the ladder areignored because they are only recorded at I/O update time.The state of each coil is recorded tothe output image register as each rung is solved. However, these states are not transferred to theoutput unit until I/O update time.Figure2.8 Scan CycleThis procedur
41、e of I/O update and solving the ladder diagram and I/O update is referred to asscanning and is represented in Figure 2.8. The period between one I/O update and the next isreferred to as one Scan.The amount of time it takes the PLC to get from one I/O update to thenext is referred to as Scan Time.Sca
42、n time is typically measured in milliseconds and is related tothe speed of the CPU and the length of the ladder diagram that has to be solved.The slower theprocessor or the longer the ladder diagram, the longer the scan time of the system.The speed atwhich a PLC scans memory is referred to as Scan R
43、ate.Scan rate units are usually listed inmsec/K of memory being utilized for the program.As an example, if a particular PLC has a ratedscan rate of 8 msec/K and the program occupies 6K of memory, it will take the PLC 48 msec tocomplete one scan of the program.71.1 MotivationProgrammable Logic Contro
44、llers (PLC), a computing device invented by Richard E. Morleyin 1968, have been widely used in industry including manufacturing systems, transportationsystems, chemical process facilities, and many others. At that time, the PLC replaced thehardwired logic with soft-wired logic or so-called relay lad
45、der logic (RLL), a programminglanguage visually resembling the hardwired logic, and reduced thereby the configuration timefrom 6 months down to 6 days Moody and Morley, 1999.Although PC based control has started to come into place, PLC based control will remainthe technique to which the majority of
46、industrial applications will adhere due to its higherperformance, lower price, and superior reliability in harsh environments. Moreover, according toa study on the PLC market of Frost and Sullivan 1995, an increase of the annual sales volumeto 15 million PLCs per year with the hardware value of more
47、 than 8 billion US dollars has beenpredicted, though the prices of computing hardware is steadily dropping. The inventor of thePLC, Richard E Morley, fairly considers the PLC market as a 5-billion industry at the presenttime.Though PLCs are widely used in industrial practice, the programming of PLC
48、based controlsystems is still very much relying on trial-and-error. Alike software engineering, PLC softwaredesign is facing the software dilemma or crisis in a similar way. Morley himself emphasized thisaspect most forcefully by indicating Moody and Morley, 1999, p. 110:If houses were built like so
49、ftware projects, a single woodpecker could destroy civilization.”Particularly, practical problems in PLC programming are to eliminate software bugs and toreduce the maintenance costs of old ladder logic programs. Though the hardware costs of PLCsare dropping continuously, reducing the scan time of t
50、he ladder logic is still an issue in industryso that low-cost PLCs can be used.In general, the productivity in generating PLC is far behind compared to other domains, forinstance, VLSI design, where efficient computer aided design tools are in practice. Existentsoftware engineering methodologies are
51、 not necessarily applicable to the PLC based softwaredesign because PLC-programming requires a simultaneous consideration of hardware andsoftware. The software design becomes, thereby, more and more the major cost driver. In manyindustrial design projects, more than SO0/a of the manpower allocated f
52、or the control systemdesign and installation is scheduled for testing and debugging PLC programs Rockwell, 1999.In addition, current PLC based control systems are not properly designed to support thegrowing demand for flexibility and reconfigurability of manufacturing systems. A furtherproblem, impe
53、lling the need for a systematic design methodology, is the increasing softwarecomplexity in large-scale projects.1.2 Objective and Significance of the ThesisThe objective of this thesis is to develop a systematic software design methodology for PLCoperated automation systems. The design methodology
54、involves high-level description based onstate transition models that treat automation control systems as discrete event systems, a stepwisedesign process, and set of design rules providing guidance and measurements to achieve asuccessful design. The tangible outcome of this research is to find a way
55、 to reduce theuncertainty in managing the control software development process, that is, reducingprogramming and debugging time and their variation, increasing flexibility of the automationsystems, and enabling software reusability through modularity. The goal is to overcomeshortcomings of current p
56、rogramming strategies that are based on the experience of theindividual software developer.Design Theory DevelopmentToday, the primary focus of most design research is based on mechanical or electricalproducts. One of the by-products of this proposed research is to enhance our fundamentalunderstandi
57、ng of design theory and methodology by extending it to the field of engineeringsystems design. A system design theory for large-scale and complex system is not yet fullydeveloped. Particularly, the question of how to simplify a complicated or complex design taskhas not been tackled in a scientific w
58、ay. Furthermore, building a bridge between design theoryand the latest epistemological outcomes of formal representations in computer sciences andoperations research, such as discrete event system modeling, can advance future development inengineering design.Application in Logical Hardware DesignFro
59、m a logical perspective, PLC software design is similar to the hardware design ofintegrated circuits. Modern VLSI designs are extremely complex with several million parts and aproduct development time of 3 years Whitney, 1996. The design process is normally separatedinto a component design and a sys
60、tem design stage. At component design stage, single functionsare designed and verified. At system design stage, components are aggregated and the wholesystem behavior and functionality is tested through simulation. In general, a completeverification is impossible. Hence, a systematic approach as exe
61、mplified for the PLC programdesign may impact the logical hardware design.PLCPLC ( programmable logical controller ) face ever more complex challenge these days.Where once they quietly relays and gave an occasional report to a corporate mainframe, they arenow grounded into cells, give new jobs and n
62、ew languages, and are forced to compete against agrowing array of control products. For this year s annual PLC technology update, we queriedPLC makers on these topics and more.Programming languagesHigher level PLC programming languages have been around for some time, but lately theirpopularity has b
63、een mushrooming. As Raymond Lavelle, vice president and general manager,Siemens Energy and Automation. Inc, Programmable Controls Division, points out : ” Asprogrammable controls are being used for more and more sophisticated operations, languagesother than ladder logic become more practical, effici
64、ent, and powerful. For example, its verydifficult to write a trigonometric function using ladder logic. ” Languages gaining acceptanceinclude Boolean, control system flowcharting, and such function chart languages as Graphtecand its variations. And theses increasing interest in languages like C and
65、BASIC.PLCs in process controlThus far, PLCs have not been used extensively for continuous process control. Will thiscontinue? ”The feeling that I ve gotten, ” says Ken Jeannette, manager, product planning,Series One and Series Six products, at GE Frame North America, is that PLCs will be used inthe
66、process industry but not necessarily for process control.”Several vendors-obviously betting that the opposite will happen-have introduced PLCsoptimized for process applications. Rich Ryan ,manager, commercial marketing, Allen-BradleyProgrammable Controls Div, cites PLCs increasing use in such indust
67、ries as food, chemicals,and petroleum. Ryan feel there are two types of applications in which theyre appropriate.”One,he says, is where the size of the process control system thats being automated doesnt justifyDCSdistributed control systems.With the starting price tags of those products being relat
68、ivelyhigh, a programmable controller makes sense for small, low loop count applications. Theseconds where you have to integrate the loop closely with the sequential logic. Batch controllersere prime examples, where the sequence and maintaining the process variable are intertwined soclosely that the
69、benefits of having a programmable controller to do the sequential logicoutweighs some of the disadvantages of not having a distributed control system.”Bill Barkovtz, president of Triconex, predicts that all future controllers that come out in theprocess control system business will embrace a lot mor
70、e PLC technology and a lot more PLCfunctionality than they ever did before.”The Programmable Logic ControllerJohn R. Hackworth, Frederick D. Hackworth, Jr.Programmable Logic Controllers: Programming Methods andApplications. 2.52.8,The Programmable Logic Controller,John R. Hackworth, Frederick D. Hac
71、kworth, Jr.First Edition. London: Prentice Hall, 2003.3550可编程逻辑控制器约翰 R Hackworth,弗雷德里克 D Hackworth.可编程逻辑控制器:编程方法及应用.2.52.8,可编程逻辑控制器,约翰 R Hackworth,弗雷德里克 D Hackworth.第一版. 伦敦:普伦蒂斯霍尔出版社,2003,35502.5系统框图中央处理器输入输出开关,继电接触器等离散离散连续寄存器连续寄存器继电器,灯等分压器,反馈电压等指轮开关,编码器等可编程控制器是一种专用的计算机。因为它是一台计算机,它就应该具有其它 计 算 机 的 基
72、本 组 成 部 分 :中 央 处 理 单 元 , 存 储 器 , 输 入 接 口 和 输 出 接 口 。一 个典型的可 编程控制器框 图 如图 2.5 所 示 。存储器只读存储器&随机存储器模拟显示控制电压等数字显示图 2.5可编程控制器 框图中 央 处 理 单 元 ( CPU ) 是 PLC 的 控 制 部 分 。 它 解 释 来 自 存 储 器 的 程 序 指 令 并且 按 这 些 指 令 执 行 操 作 。 现 在 PLC 的 中 央 处 理 单 元 是 一 个 基 于 微 处 理 器 的 系 统,被置于模块化系统的处理器模块中。系统存储器大致分为两类:只读存储器和随机存储器。只读存储器
73、包含程序信 息 , 通 过 这 些 程 序 信 息 , CPU 可 以 解 释 和 执 行 存 储 在 随 机 存 储 器 中 的 梯 形 图 程序。随机存储器一般都有板上电源维持 ,这样系统掉电时 ,梯形图程序不会丢失 。这种电 源 可以是 标准的 干电池 或可 充 电 的 镍 - 镉 电池 。新 型的 PLC 存 储 单元 使用 电可擦除 可编程只读存 储器( EEPROM ),这 就 不需 要专 门 的电 源维 持 。 内存 也设 在模块化系统中的处理器模块内。输 入 单 元 有 若 干 不 同 类 型 , 所 用 类 型 根 据 前 述输 入 信 号 需 求 选 择 。输 入 部 件可
74、 以 接收 多 种 不 同电 压 和 电 流等 级 的 离 散 信 号 或 模 拟 信 号 。现 有 的 控 制 器 提 供 交流和直 流离散电压信 号输入 ,直 流电 压 范围 从 TTL 电 平到 250V ,交 流 电压 范围 从5V 到 250V 。 模 拟 输 入 单 元 可 以 接 收 的 输 入 范 围 如 10 伏 直 流 电 , 5 伏 直 流 电 和4-20 毫安 电流环。 离散 输入 单 元把每 个 输入 信号 以 单 一 的 1 或 0 输 入 到 CPU ,然而模拟输入单元要包含模拟信号向数字信号转换的电路,并且以二进制码输入到CPU ,且 此 二进制码规 格化到该单
75、 元所 能 提供 的最 大 精度 。输入 电压 或 电流 所用 数的 位 数 依 该 单 元 处 理 能 力 而 定 , 而 且 这 些 数通 常 包 含 了特 定 的 数 值 位 和 符 号 位 。输入寄存 单元把接收到 的字 输入 (二 进制 或 BCD 码 ) 送到 CUP 。输出单元的运作和输入单元大致相同,不同之处就是该单元可作为离散电压信 号 的拉 电 流 端 ( 提 供 一 个 公 共 地 )或 者 灌 电 流端 ( 提 供 一 个 固 定 电 压 ) 或 者 作为模 拟电 压或 电流 的 拉电 流端。 输 出 单 元 的 输 出 信号 由 CPU 控 制 发 出 。离 散信 号
76、输 出 单 元 的 电 路 可 以 是 晶 体 管, 输 出 TTL 电 平 和 更 高 的 直 流 电 压 , 或 者 是 双 向 器件,适用于交流电压输出。对于需要更高电流的应用场合,电气上的触点闭合必不 可 少 , 这 样 可 用 机 械式 继 电 接 触 装 置 。 然 而 , 这 些 较 高 的 电 流 一 般 限 于 23 安培。模拟输出单元内部有数模转换电路,能产生可变的电压或电流输出。2.6 刷新处理梯形图刷新可 编程逻辑控制 器 上 电后,其 运作 包 含两 个阶 段 :( 1 )刷 新输 入 和输 出( 2 )解 读 梯 形 图 。这 对 复 杂 问 题 来 说似 乎 是
77、一 个 非 常 简 单 的解 决 方 法 , 事 实 上 就 只 有这 两 步 。如 果 能 彻 底 理 解 这 两 个 步 骤 ,就 很 容 易 完 成 编 写 和 修 改 程 序 并 充 分 利 用此器件了。基于这一理解, 接下来的工作就有赖于程序员的思维了。你 将会注意到 ,“刷 新- 解读 梯形 图 ”流程 在 启动 后就 开 始 。事 实 上 ,启 动流 程还 包 括 一 些 对 用 户 或 程 序 员 透 明 的 操 作 , 这 些 操 作 在 PLC 运 行 用 户 程 序 前 就 开 始运行。在启动期间,处理器可能会进行大范围的故障诊断,诊断的项目诸如存储器 、 输 入 输 出
78、 设 备 、 与 其 它 设 备 ( 如 果 有 ) 的 交 互 状 态 和程 序 的 完 整 性 等 。 在 先进 的 模 块 化 系 统 中 , 处 理 器 能 够 识 别 的 各 种 模 块 的 类 型 ,及 它 们 在 系 统 中 的 位 置和地址。这类系统分析和测试 操作一般发生在真正执行程序之前的启动过程中。2.7刷新PLC 开始运作时的首要 操作 就是 刷新 I/O 。这就 意味 着通过输入单元 ,所有 的离散输入状态被记录,而且所有将要输出的离散状态被转移到输出单元。通常有一些特定地址来寄存数据,这些地址与 输入和输出数据 相关,称为输入和输出寄存器 这些寄存器与 输入和输出模
79、块 相 连并且通过离散数据来更新 。由于 这是输入/ 输出 的更新, 因而它被称为 I/O 刷 新。 离散 输入 和输出信息 的 刷新是利用 PLC 存储器中开辟的输入和输出映像寄存器来完成的。对于 每一个离散输入点 ,在输入映像寄存器中都有一位与之相联。同样,对于 每一个离散输 出点,在输出映像寄存器中都 有一位与之相 联 。当 I/O 刷 新时 ,如 果输入点输入的是“ 开”信 号,那么与之相联 的位地址内容 被置 “1”。如 果输 入点 输入 的是 “关 ”信 号,那 么相 应的位地址内 容被置 “0 ”。现在, PLC 存 储器字长大都是 16 位 。这 意 味着 ,内 存的一个字可存
80、 储 16 个离散输入点 的状 态信 息。 因 而,内存中可能会有一定数量的字 被预留,作为输入和输出 映像寄存器 。在 I/O 刷 新时 ,输 入映像 寄存 器的 状态 根据 所有离散输入的状态信息变化, 输出映像寄存器的状态被送至输出单元。这种状态信息的转 变 通常只发生在的 I/O 刷新 阶段 。 但是 ,在 PLC 工 作 的其 它时 段, 当有I/O 立即刷新命令时,状态 信息 的转 变也 可以 被强 制进 行。 作为 一种 特殊 情况 ,这条命令将 会迫使 PLC 在其它任何时候刷新 I/O 。对于初次输出刷新,需要注意的主要一项是输出 的初始状态。这是因为,如果初始状 态为“ 开
81、启”,输出 点可 能的 输出 就有 可能 产生 安全 隐患 ,特 别 是在重 型机械装置 的控制系统中 ,机械装置 可能 会对 操作 员造 成人 生伤 害 。在一 些系 统中 ,为确保系统安全,所有的输出可能都需初始化为 “关闭”状态。然而,也有一些系统的输 出需要以特殊 方式初始化 一 些开启 ,一些 关闭 。这 可以采 取预 先设定的方式或要求输出保持掉电前一瞬间的状态来实现。最近一些系统提供 这两个设置选项而且甚至提供两者的组合。这是工程师和程序员首要关注 的问题,并且开发系统时,应对此详细说明,以 确保操作和维护设备人员的安全。 有关系统和程序开发的安全问题将在后续章节讨论。2.8梯形
82、图程序处理输 入输出刷新完 成后 ,PLC 开始执 行 编入 的指 令 。这 些 指 令 通常 称为 梯 形 图 ,该 梯 形 图 基 本 上 使 用 继 电 器触 点 和 线 圈编 程 。画 梯 形 图 时 触 点 放 在 页 面 左 侧 , 线圈 放 在 页 面 右 侧 。 这 是 基 于继 电 器 的控 制 系 统的 延 续 。 以 前 , 这 类 图 作 为 系 统 的电气原理 图。一个示例 梯形图如图 2.6 所 示。图 2.6 梯 形 图 示 例图 2.6 中 使用的符号 在 这里可 能不 好理 解 ,这 样一 个 简要 解释 是 必要 的 。梯形图右侧 标有 CR1, CR2,
83、CR3 和 CR4 的 圆形 符 号是 继电 器 的软 线圈 。在梯形 图 左 侧 ,看起来像电容器而且一些还加有斜线的符号是与线圈相关的接点。那些与电容器相似并且没有斜线通过的符号为常开接点,就类似于关闭的开关。当开关开时,接点就闭合。那些与电容器相似并且有斜线通过的符号为常闭接点。一个常闭接点就相当于一个一直打开的开关,如果开关开动接点就关闭。在 图 2.6 中 可以 看到接点和 线圈 的 位置 如图 上 所述 。同样 ,如果 你 注意 到活 梯的 横 档 , 就 会 明 白 为 什 么 称 之 为 梯 形 图 。事 实 上 , 图 中 每 一 个 完 整 的 横 线 条 都 指代一个有逻
84、辑意义的梯级。梯形图的阐述也将会在后面讨论,在这也需要进行一些 必 要 的 解 释 。 每 个 横 档 左 边 的 接 点 可 被 视 作 开 关 , 右 边 的 线 圈 可 被 视 作 灯 。如果 对 应 的 开 关 打 开 或 关 闭, 右 边 的 灯 就 会 亮 。PLC 按 从 左 至 右 、 从 上 至 下 的 顺 序执行此 程序 。它 首先检 查开关(接点 )配置 ,然后 判定 是 否有 电流 通 过灯( 线圈 )。判定的依据来源于输入输出映像寄存器中的数据。如果有电流通过,灯(线圈)将会得电。反之,灯(线圈)将会失电。这也将会记录到输出映像寄存器。一旦PLC 对 横 档 左 侧
85、元 件 检 查 完 毕 , 它 就 会 跳 过 检 查 , 直 到 再 次 处 理 时 又 开 始 检 查 。而 且 一 旦 灯 ( 线 圈 ) 得 电 或 失 电 , 此 状 态 将 一 直 保 持 , 直 到 下 次 PLC 处 理 此 横 档为 止 。 处 理 完 一 个 阶 梯 后 ,PLC 用 同 样 的 方 式 处 理 下 个 阶 梯 , 如 此 反 复 进 行 直 到整个梯形图被执行和处理完毕。在此,一个不同于一般电气运作的原则就是横档中电流的流向。在梯形逻辑中,电流流向只能是从左至右,从上至下,绝不能从右至左。作 为一个例子 ,在图 2.7 所 示的 梯 形图 中 ,如果 下
86、列任 何一 个 条件 满足 线 圈 CR1将会得电:图 2.7 梯 形 横 档 中 电 流 允 许 流 向1. CR7 关,CR6 开2. CR7 关,CR2 开,CR5 开3. CR7 关,CR2 开,CR3 开4. CR1 开,CR4 开,CR3 开5. CR1 开,CR4 开,CR5 开你 将 会 注 意 到 , 对 于 以 上 列 表 中 每 种 情 况 , 电 路 中 电 流 流 向 都 是从 左 至 右 , 从 上至下。在 如下所列情况 中 CR1 将 不 会得 电:CR1 开 , CR4 开 ,CR2 开, CR6 开, CR5 关, CR3 关, CR7 开这 是因 为电 流将
87、 不 得 不从 右至 左流 经 CR2 接 点 。 即使 我 们 用真 正 继 电 器 来搭 建 ,电流可以有这种流向,但在梯形逻辑中这是不允许的。应当记住,我们是在软件环境下工作而不是硬件环境。如 前 所 述 , 输 入 输 出 刷 新 完 毕 后 ,PLC 转 向 梯 形 逻 辑 中 的 第 一 个 阶 梯 , 处 理输入输出处理梯形图接点元 件 ,判定 线圈将得电 或失电 ,然后 使线 圈 得电 或失 电 。完 成此 操 作后 ,PLC转向下个阶梯,重复前面步骤,这样持续到所有阶梯被处理完毕。当处理所有阶梯的过 程完毕 ,并且 梯形图中所 有的 线 圈都 已根 据 处理 的每 个 阶梯
88、设定 ,那 么 PLC就进入到 其下一个阶段 I/O 刷新 。I/O 刷新阶段 ,所有输出 线圈的 状态 从输 出 映像 寄存 器 转移 到到 输 出单 元 ,同时所有输入状态被转移到输入映像寄存器。注意,在处理梯形图期间,输入的任何变化 将被忽略,因 为它们只有 在 I/O 刷新 阶段 才 被记 录。 在 处理 每一 阶 梯时 ,每个线圈 的状态将被记 录至输出映 像寄 存 器 。然 而 ,这些 状 态直 到 I/O 刷 新阶 段才 被转移至输出单元。输入/输出刷新输入状态转移至输入映像寄存器输出映像寄存器转移至输出单元图 2.8循环扫描这 种 I/O 刷新、处理 梯形图再 到 I/O 刷
89、新的 过程 称 为扫 描, 其 描述 如图 2.8 。前一次 I/O 刷 新和下次刷 新之间的 时段 称为 一次 扫 描 。PLC 从前 一次 I/O 刷 新到 下次 刷 新 所 用 的 时 间 称 为 扫 描 时 间 。扫 描 时 间 通 常 以 毫 秒 为 单 位来 衡 量 ,而 且 扫 描时间与 CPU 的运 行速度和所 要处 理 的梯 形图 的 长度 有关 。 PLC 扫描 存 储器 的速 度称 为 扫 描 速 度 。 扫 描 速 度 单 位 通 常 为 毫 秒 /K 程 序 正 在 使 用 的 内 存 。 例 如 , 如 果 某一 PLC 扫描速 度为 8 毫 秒/K ,程 序占 用
90、 8K 的内 存 ,那么 PLC 将 会用 48 毫 秒完 成一次程序扫描。1.1 动力1968 年,Richard E. Morley 创造出了新一代工业控制装置可编程逻辑控制器(PLC),现在,PLC 已经被广泛应用于工业领域,包括机械制造也、运输系统、化学过程设备、等许多其他领域。初期可编程控制器只是用一种类似于语言的软件逻辑于代替继电器硬件逻辑,并且使开发时间由 6 个月缩短到 6 天。虽然计算机控制技术已经产生,但是 PLC 控制因为它的高性能、成本低、并且对恶劣的环境有很强的适应能力而在工业控制的广泛应用中保持优势。而且,尽管硬件的价格在逐渐下跌,据估计,根据 Frost 和 Su
91、llivan 对 PLC 市场的调查研究表明,每年销售硬件的价格要比销售 PLC 的价格(一千五百万)至少多出八十亿美元。PLC 的创造者 Richard E.Morley 十分肯定的认为目前 PLC 市场是一个价值五十亿的工业虽然 PLC 广泛应用于工业控制中,PLC 控制系统的程序依然和语法有关。和软件过程一样,PLC 的软件设计也以同样的方式会遇到软件错误或危机。Morley 在演讲中着重强调了这个方面。如果房子建造的像软件过程一样,那么仅仅一只啄木鸟就可以摧毁文明。特别的,PLC程序要解决的实际问题是消除软件错误和减少老式梯形逻辑语言的花费。尽管 PLC 的硬件成本在继续下降,但是在工
92、业控制上减少梯形逻辑的扫描时间仍然是一个问题,以至于可以用到低耗时的 PLC。一般来说,和其他领域相比生产 PLC 的周期要短很多。例如,在实践中,VISI 设计是一种有效的计算机辅助设计。PLC 不需要使用目前的以软件设计为基础软件工程方法论,因为 PLC 程序要求对软件和硬件搜都要考虑到。因此,软件设计越来越成为花费动力。在许多的工业设计工程中,超过的人力分配给了控制系统设计和安装,并且他们要对。PLC程序测试和排除错误,再者,PLC 控制系统不适合设计对适应性和重构有越来越多要求的生产系统。一个更深入的问题是在大规模的工程中软件越来越复杂,促使要有一个系统化的设计方法论。1.2 主题的客
93、观性和重要性。主题的客观性是为 PLC 自动控制系统建立一个系统化的软件设计方法论。这个设计方法论包括以状态转换模型为基础的精确的描述,这个转台转换模型是自动控制系统的抽象系统。方法论还包括一个逐步的设计过程,并且要设置一个设计规则,这样才能为一个成功的设计提供导向和方法。这项研究的真正目的是找到一个减少控制软件发展过程的不稳定性的方法,也就是说,减少程序和调试时间以及他们的变化,以增强自动控制系统的适应性,并且通过调整软件使得软件可以再度使用。这样的目的是为了克服目前程序策略的不足之处,而目前的程序策略是以个人软件开发者的经验为基础的。设计理论发展目前,大部分设计研究的主要焦点都集中在机械和
94、电子产品上。这种有目的性的研究产生了一个副产品,就是通过推广这中研究到系统工程设计领域,从而加固了我们对设计理论和技巧的基本理解。针对大规模和复杂系统的系统设计理论并没有成熟。尤其是,对如何简化一个繁冗而复杂的设计任务这一问题,仍然没有被科学的处理。而且,正在设计理论和代表计算机科学及运筹学研究的认识论结果之间构建一条桥梁,这样的具体应该是逻辑硬件电路设计。在逻辑硬件设计方面的应用从逻辑学的角度来看,可编程逻辑控制器(PLC)的软件设计类似与集成电路的硬件设计。现代超大规模集成电路设计(Very Large Scale Integration-VLSI)是及其复杂的,一个集成电路一般有几百万个
95、晶体管,而且产品开发周期大都三年左右。设计过程一般都分成局部功能块设计和系统设计两个阶段。在局部功能块设计阶段,单个功能将被设计出来,并予以验证。在系统设计阶段,所有功能块都将被整合起来,整个系统行为特性和功能将会通过仿真形式加以测试。一般来说,所有部分都完全的验证是不可能的。因此,统计学可以作为可编程逻辑控制器(PLC)设计的一个例子,并有可能影响逻辑硬件设计。PLCPLC(可编程逻辑控制器)现在面临着甚至更加复杂的难题。曾经 PLC 取代继电器并且丢对共同的计算机主机提供不时的信息。现在,她被分解成单元模块,并分给新的任务和应用新的语言。而且被迫与越来越多的一系列控制产品相竞争。每年一度的
96、最新 PLC 技术会上,我们调查 PLC 生产者关于以下这些问题。编程语言高级 PLC 编程语言已经在有些方面很普及。但是最近高级编程语言已经迅速发展。西门子的总经理兼生产部长指出:“可编程控制在被广泛的应用与于精密操作,除了梯形图逻辑以外的编程语言变得更加使用、有效和强大。例如,用梯形图逻辑写一个三角函数公式是非常困难的。” 被接收的语言包括 Boolean, 控制系统流程图编制,和如公式编制语言Graphtec 和与它类似的语言,并且还有增加的重要语言如 C 语言和 BASIC 语言。过程控制中的 PLCPLC 还没有广泛的应用于过程控制中。是否会一直这样下去呢?美国南部 Fancy 的经
97、理 Ken Jeannette 说:“我觉得 PLC 将被用于过程控制但是对于过程控制又不是必须的。”一些厂家已经将 PLC 的优化程序应用于过程控制中,他们十分确定 PLC 不会广泛用于过程控制这样的事情是不会发生的。Rich Ryan 经理提到 PLC 在食品、化学和石油等工业领域越来越多的应用。他认为 PLC 适合应用于场合有两种,他说:“第一,过程控制系统的型号不适合离散控制系统,刚开始这些产品的价格非常的高。而一个可编程控制器以它的体积小,价格低顺理成章的被应用。第二,你必须把电路和逻辑紧密的结合爱来。例如,一组基本的控制器,连续的过程变量紧密的互相联系在一起,以至于用可编程控制器来完成一系列的逻辑胜过没有离散控制器的系统。”