SEL, ESEL and MUX: Choosing Between Values, and Clamping with HLL

SEL, ESEL and MUX: Choosing Between Values, and Clamping with HLL

A MUX block with Selector left at its default of 0 does not pass In1 and does not fault the controller. 1756-RM006P says what it does instead: the value is invalid, which includes 0, so the instruction sets a bit in Status and holds Out at its current value. The number on the faceplate stays exactly where it was and nothing on the screen says it has stopped moving.

That is the shape of every failure in this group. These four blocks fail by holding or by clamping, never by stopping.

Which one you want, on the other hand, is decided in about ten seconds. Two inputs and a bit to pick between them is SEL. Up to eight inputs and a number to pick between them is MUX. Up to six inputs where the block should pick the highest, the lowest, the median or the mean, or where a faulted transmitter should be dropped automatically, is ESEL. And a value that must stay between two numbers is HLL, which is a limiter with alarm outputs rather than a selector at all.

The four blocks and the operand that decides each one, with the valid ranges and what happens outside them

MUX.Selector and the HLL limit pair are highlighted because both have a failure mode that produces a plausible number rather than an error.

None of them has a clock, and that is why they are safe anywhere

Every other instruction in this Process family carries a TimingMode, a DeltaT and a set of status bits about timing, because the arithmetic inside them depends on when they were last called.

These four do not have one, and the reason is worth a sentence.

There is no DeltaT member on SEL, ESEL, MUX or HLL, because none of them integrates, differentiates or filters anything — each one is a pure function of the values on its inputs at the moment it executes, and calling one twice in a scan produces the same answer twice. So the only timing question left is order, and a function block routine does not execute top to bottom; it executes in the order the wiring implies, and 1756-RM006P sets that out plainly — the controller latches all data values in IREFs, executes the blocks in the order determined by how they are wired, then writes the OREFs. If a selected value has to be clamped before it reaches a loop, wire the ESEL output into the HLL input and the wiring settles the order for you. If instead you copy through intermediate tags, the order is whatever the compiler worked out, and a one-scan delay will appear somewhere and be invisible until the day it matters. Allen-Bradley function block goes into what decides that order and how to see it.

What happens when the selector is not what you meant

This is the section worth reading twice, because three of the six cases below produce a believable number.

Six selector cases across the four blocks and what the output does in each: In1, held, held, not updated, not updated, and clamped to the low limit

Only the first row is a real choice. The four highlighted rows all leave a stale or wrong value on the output with nothing but a Status bit to say so.

SEL is the exception, and the reason is that it has nowhere to go wrong.

SelectorIn is a BOOL, cleared gives In1, set gives In2, and there is no third state. That makes SEL the right block for a genuine two-way choice — local against remote setpoint, running against standby transmitter — and it makes MUX the wrong block for the same job, because a MUX with a DINT selector has seven values that are not what you meant and one that is.

MUX holds. ESEL, with ProgSelector or OperSelector at 0, does not update Out

Advertisement
at all.

The ESEL case is subtler than the MUX one and catches more people, because ProgSelector valid range is 0 to 6 and the default is 0. Zero is inside the valid range, so no ProgSelectorInv bit is set; the manual simply says that if ProgSelector is 0 the instruction does not update Out. A selector wired from an HMI that has not been written yet, or from a UDT member that was renamed and is now reading zero, leaves the last good value sitting on the output looking entirely normal. If the value feeds a setpoint, that setpoint is frozen and the loop will hold it perfectly.

The defence is one comparison and it costs nothing.

Bring SelectedIn back out of the ESEL and compare it against what the logic asked for.

It is the one output that tells you whether anything happened this scan. SelectedIn is the number of the input actually placed into Out, and in average select mode the manual says the instruction sets it to 0 — so a SelectedIn of 0 on a block that is not in average mode means the output was not updated this scan. That is a one-rung alarm and it is the only thing that separates a held value from a live one.

ESEL’s bad-health inputs, and the case for median over average

Six analogue inputs, six InnFault bits, and a rule that is more useful than it first looks.

For high, low, median and average select, a bad health indication on any input causes that input to be disregarded in the selection, which is more than a courtesy: it is the difference between three transmitters and one transmitter with two spectators. The manual’s own example: if SelectorMode is 1 for high select and In6 has the highest value but bad health, the next highest input with good health goes to the output. If every used input is bad, InsFaulted sets, the control algorithm does not execute, and Out is not updated — which is the same held-value behaviour as everywhere else in this group, and the same reason to watch for it.

An ESEL taking three level transmitters into a median, feeding an HLL clamp, feeding the SPProg of a PIDE, with LT303 reading high and its fault bit set

LT303 reads 88.1 against 62.4 and 61.9 on the other two. The median comes out at 62.4 whether or not the fault bit on In3 is set, and average select on the same three inputs gives 70.8.

Wire the InnFault bits from the analogue channel fault status rather than leaving them false.

That is the whole point of them, and it is the commonest omission in the group.

A 1756-IF8 channel that has gone open circuit publishes a fault status per channel, and an ESEL that is not told about it will happily select an underrange value as the lowest of three. Where those per-channel fault bits come from is covered in reading a 4-20 mA transmitter into a 1756-IF8, and for an RTD the open-circuit behaviour is different again and worked through in wiring a Pt100 into an analogue input.

Two more details on ESEL are easy to trip over and both are defaults.

InsUsed defaults to 1, so a block with six wired inputs and a default InsUsed considers only In1 in high, low, median and average modes. And for high or low select with two inputs equal, and for median select where more than one value could be the median, the instruction outputs the first found input — so SelectedIn on a flat process will sit on the lowest-numbered input and stay there, which is not a fault.

HLL, and the one case where it clamps the wrong way

HLL has three modes on SelectLimit: 0 uses both limits, 1 uses the high limit only, 2 uses the low limit only.

The alarm outputs follow the mode, which is the part people miss when they wire the block once and reconfigure it later. HighAlarm sets when In is at or above HighLimit and is disabled when SelectLimit is 2; LowAlarm sets when In is at or below LowLimit and is disabled when SelectLimit is 1. So a block that was configured for both limits and later changed to a high limit only still has a LowAlarm output sitting there, wired into an alarm summary, reading false forever and telling nobody that it has been switched off.

The case to know about is what happens when the two limits cross.

With SelectLimit at 0, if HighLimit is less than or equal to LowLimit the instruction sets a bit in Status and sets Out equal to LowLimit.

Not HighLimit, and not the input that arrived. LowLimit. A recipe download that writes 12.0 into HighLimit and 78.0 into LowLimit — two numbers in the wrong order in a spreadsheet — produces an output pinned at 78.0, which on a setpoint clamp is the top of the range rather than the bottom. It is a deterministic, documented behaviour and it is the opposite of what a safe default would be, so it is worth a comparison in the logic that writes those limits rather than a comment.

LimitsInv, Status bit 1, is what tells you. Nothing else will.

What they cost, which is nothing

LOGIX-RM002B puts the whole group in the noise on a ControlLogix 5580.

SEL runs in 0.172 µs, MUX in 0.236 µs, HLL in 0.278 µs, and ESEL somewhere between 0.315 µs in manual select and 0.668 µs in median select.

Median select is the most expensive of the four and it is still a fifth of a microsecond more than high select. Choose by behaviour.

Advertisement

What to check next

Go through the ESEL and MUX blocks in the project and write down what each selector is actually wired to. Anything wired to a tag that an HMI writes, or to a UDT member, wants a SelectedIn comparison behind it, because a held output is the failure you will not see on a faceplate.

Then look at the InnFault inputs.

If they are unwired on a block that is choosing between redundant transmitters, the redundancy is decorative — the block cannot drop an input it has not been told is bad. And if the selected value ends up at an analogue output rather than at a loop setpoint, the clamping and the fail position at that end are a separate argument, worked through in an analogue output that drives a valve.

One note on language before you start typing. 1756-RM006P prints a structured text call for ESEL and for HLL, and states that SEL is not available in structured text — SEL is a function block element and nothing else. The MUX chapter’s Structured Text heading in the same revision repeats the ladder sentence rather than giving a call form, so check what Logix Designer actually offers on your version before you plan a structured text routine around it. If the routine is going to be structured text either way, structured text for people who write ladder covers the constructs you will need.