Ladder logic and Siege of Puebla (1847)

This article is about the programming language. For the FIRST competition, see Ladder Logic.

Ladder logic was originally a written method to document the design and construction of relay racks as used in manufacturing and process control. Each device in the relay rack would be represented by a symbol on the ladder diagram with connections between those devices shown. In addition, other items external to the relay rack such as pumps, heaters, and so forth would also be shown on the ladder diagram. See relay logic.

Ladder logic has evolved into a programming language that represents a program by a graphical diagram based on the circuit diagrams of relay logic hardware. Ladder logic is used to develop software for programmable logic controllers (PLCs) used in industrial control applications. The name is based on the observation that programs in this language resemble ladders, with two vertical rails and a series of horizontal rungs between them. While ladder diagrams were once the only available notation for recording programmable controller programs, today other forms are standardized in IEC 61131-3.

Contents 1 Overview 2 Example of a simple ladder logic program 2.1 Logical AND 2.2 Logical AND with NOT 2.3 Logical OR 2.4 Industrial STOP/START 2.5 Complex logic 2.6 Additional functionality 3 Limitations and successor languages 4 See also 5 References 6 External links

Overview Part of a ladder diagram, including contacts and coils, compares, timers and monostable multivibrators

Ladder logic is widely used to program PLCs, where sequential control of a process or manufacturing operation is required. Ladder logic is useful for simple but critical control systems or for reworking old hardwired relay circuits. As programmable logic controllers became more sophisticated it has also been used in very complex automation systems. Often the ladder logic program is used in conjunction with an HMI program operating on a computer workstation.

The motivation for representing sequential control logic in a ladder diagram was to allow factory engineers and technicians to develop software without additional training to learn a language such as FORTRAN or other general purpose computer language. Development, and maintenance, was simplified because of the resemblance to familiar relay hardware systems. Implementations of ladder logic have characteristics, such as sequential execution and support for control flow features, that make the analogy to hardware somewhat inaccurate. This argument has become less relevant given that most ladder logic programmers have a software background in more conventional programming languages.

Manufacturers of programmable logic controllers generally also provide associated ladder logic programming systems. Typically the ladder logic languages from two manufacturers will not be completely compatible; ladder logic is better thought of as a set of closely related programming languages rather than one language. (The IEC 61131-3 standard has helped to reduce unnecessary differences, but translating programs between systems still requires significant work.) Even different models of programmable controllers within the same family may have different ladder notation such that programs cannot be seamlessly interchanged between models.

Ladder logic can be thought of as a rule-based language rather than a procedural language. A "rung" in the ladder represents a rule. When implemented with relays and other electromechanical devices, the various rules "execute" simultaneously and immediately. When implemented in a programmable logic controller, the rules are typically executed sequentially by software, in a continuous loop (scan). By executing the loop fast enough, typically many times per second, the effect of simultaneous and immediate execution is achieved, if considering intervals greater than the "scan time" required to execute all the rungs of the program. Proper use of programmable controllers requires understanding the limitations of the execution order of rungs. Example of a simple ladder logic program

The language itself can be seen as a set of connections between logical checkers (contacts) and actuators (coils). If a path can be traced between the left side of the rung and the output, through asserted (true or "closed") contacts, the rung is true and the output coil storage bit is asserted (1) or true. If no path can be traced, then the output is false (0) and the "coil" by analogy to electromechanical relays is considered "de-energized". The analogy between logical propositions and relay contact status is due to Claude Shannon.

Ladder logic has contacts that make or break circuits to control coils. Each coil or contact corresponds to the status of a single bit in the programmable controller's memory. Unlike electromechanical relays, a ladder program can refer any number of times to the status of a single bit, equivalent to a relay with an indefinitely large number of contacts.

So-called "contacts" may refer to physical ("hard") inputs to the programmable controller from physical devices such as pushbuttons and limit switches via an integrated or external input module, or may represent the status of internal storage bits which may be generated elsewhere in the program.

Each rung of ladder language typically has one coil at the far right. Some manufacturers may allow more than one output coil on a rung. —( )— A regular coil, energized whenever its rung is closed. —(\)— A "not" coil, energized whenever its rung is open. —— A regular contact, closed whenever its corresponding coil or an input which controls it is energized. —— A "not" contact, closed whenever its corresponding coil or an input which controls it is not energized.

The "coil" (output of a rung) may represent a physical output which operates some device connected to the programmable controller, or may represent an internal storage bit for use elsewhere in the program. Logical AND

------------------------------------( ) Key Switch 1 Key Switch 2 Door Motor

The above realizes the function: Door Motor = Key Switch 1 AND Key Switch 2

This circuit shows two key switches that security guards might use to activate an electric motor on a bank vault door. When the normally open contacts of both switches close, electricity is able to flow to the motor which opens the door. Logical AND with NOT

------------------------------------( ) Close Door Obstruction Door Motor

The above realizes the function: Door Motor = Close door AND NOT(Obstruction).

This circuit shows a push button that closes a door, and an obstruction detector that senses if something is in the way of the closing door. When the normally open pushbutton contact closes and the normally closed obstruction detector is closed (no obstruction detected), electricity is able to flow to the motor which closes the door. Logical OR

--+--------------+-----------------( ) | Exterior Unlock | Unlock | | +--------------+ Interior Unlock

The above realizes the function: Unlock = Interior Unlock OR Exterior Unlock

This circuit shows the two things that can trigger a car's power door locks. The remote receiver is always powered. The lock solenoid gets power when either set of contacts is closed. Industrial STOP/START

In common industrial latching start/stop logic we have a "start" button to turn on a motor contactor, and a "stop" button to turn off the contactor.

When the "start" button is pushed the input goes true, via the "stop" button NC contact. When the "run" input becomes true the seal-in "run" NO contact in parallel with the "start" NO contact will close maintaining the input logic true (latched or sealed-in). After the circuit is latched the "stop" button may be pushed causing its NC contact to open and consequently the input to go false. The "run" NO contact then opens and the circuit logic returns to its quiescent state.

--+------+--------( ) | start | stop run | | +------+ run

---------------------( ) run motor

The above realizes the function: run = ( start OR run ) AND ( NOT stop ) Note the use of parenthesis to group the logical OR function before evaluating the logical AND function (which has a higher order of operation priority). Also note the use of NOT to represent the "stop" NC contact logic.

This latch configuration is a common idiom in ladder logic. In ladder logic it is referred to as seal-in logic. The key to understanding the latch is in recognizing that "start" switch is a momentary switch (once the user releases the button, the switch is open again). As soon as the "run" solenoid engages, it closes the "run" NO contact, which latches the solenoid on. The "start" switch opening up then has no effect.

For safety reasons, an Emergency-Stop and/or Stop should be hardwired in series with the Start switch, and the relay logic should reflect this.

----------+----+---------( ) ES Stop | Start | Motor | | +----+ Run Complex logic

Here is an example of what two rungs in a ladder logic program might look like. In real world applications, there may be hundreds or thousands of rungs.

Typically, complex ladder logic is 'read' left to right and top to bottom. As each of the lines (or rungs) are evaluated the output coil of a rung may feed into the next stage of the ladder as an input. In a complex system there will be many "rungs" on a ladder, which are numbered in order of evaluation.

1. -------------+---------+----( ) Switch | HiTemp | A/C | | +---------+ Humid

2. ----------------------------( ) A/C Heat Cooling

Line 1 realizes the function: A/C = Switch AND ( HiTemp OR Humid )

Line 2 realizes the function: Cooling = A/C

Siege of Puebla (1847) and Ladder logic

Not to be confused with Battle of Puebla or Siege of Puebla (1863). Justin H. Smith's The War with Mexico

Following the Battle of Chapultepec, Santa Anna withdrew his forces from Mexico City, leading a portion in an attempt to take Puebla and cut off Scott's supply route from Veracruz. The Siege of Puebla began the same day Mexico City fell to Winfield Scott and lasted for 28 days:329 before a relief force fought its way into the city.

Contents 1 Background 2 Siege 3 See also 4 References 5 Additional Reading

Background

General Winfield Scott had a series of garrisons posted along the route from Veracruz to Mexico City to protect his supply lines. One of these garrisons was posted at the city of Puebla, roughly two-thirds of the way to Mexico City from the coast. The garrison was commanded by Major Thomas Childs, serving as a brevet colonel.:329 Childs had 500 soldiers to guard the city. After the fall of Mexico City, General Antonio López de Santa Anna renounced his presidency and split his forces, taking half of them to try to retake Puebla.:328,331 General Joaquín Rea commanded the Mexican guerrilla forces in the area around Puebla.:329 Siege

On the night of 13-14 September 1847, Rea's forces entered the city with 4,000 men.:329 The U.S. forces held the convent, Fort Loretto, and the citadel of San José.:329 Lieutenant-Colonel Samuel W. Black, commander of the First Pennsylvania, was put in command of the citadel, which also served as a hospital for 1,800 sick and wounded soldiers. The Mexicans drove off most of the city's cattle, but Childs was able to save enough to keep from starvation.:329 Rea demanded the garrison's surrender on 16 September, but Childs refused, leading Rea to attack San José, unsuccessfully.:329 Childs repulsed a second attack on 18 Sept.:329

Santa Anna arrived on 22 September, launched a 500 man attack on the convent, once again unsuccessfully, yet called for Childs to surrender, which he refused.:329 The attacks continued from 27 Sept. until 1 Oct.:329

At the end of September, Santa Anna departed with most of the Mexican forces to confront General Joseph Lane's relief column.:329 Santa Anna was defeated at the Battle of Huamantla, allowing Lane to raise the siege on 12 Oct.:331 See also Battles of the Mexican-American War
75+255 74 76 77