Simulating 4PDT Latching Relays in Ladder Logic for Rail

David Krause14 min read
HMI ProgrammingSiemensTutorial / How-to
Licensed PE Working through this on a live machine? A Maine-licensed engineer can take it from here — included with IMD hardware, by the hour for everything else. Book an engineer

Overview: Why 4PDT Latching Relays Appear in Rail Signaling

Railroad block-signaling systems designed in the 1950s and 1960s relied heavily on latching, multi-pole relays to drive wayside color-light signals (red/yellow/green). The dominant contact form was the 4PDT (4-Pole Double-Throw) — also marketed as a 4PDT latching relay or "polarized/neutral stick relay" — because each energized coil could switch up to four independent circuits simultaneously. A typical wayside searchlight or position-light head was driven by two or three of those poles, with the remaining poles feeding line-drop compensation, repeater relays, and approach-lighting circuits.

When these electromechanical systems are re-implemented in a PLC (Programmable Logic Controller) or a logic module such as the Siemens LOGO! 8 (LOGO! 8.3) system manual, each physical 4PDT becomes a coil tag with eight derived contacts (four NO + four NC). Engineers who migrate the original drawings usually start from a 1-pole (SPST) or 2-pole (DPDT) ladder example and then ask how to expand that snippet to four poles while keeping the circuit readable and scan-cycle deterministic.

Engineering note: Real wayside signaling is safety-critical and falls under AREMA C&S Manual Volume 4, Part 7, and (in the U.S.) 49 CFR §236. Any modern re-implementation in a PLC must be reviewed by a qualified railroad signal engineer and validated against the latest FRA rules. This article covers the logic mapping only and is intended for laboratory simulation, museum displays, model railroads, and educational study — not for in-service trackside hardware.

4PDT Contact Architecture and Terminal Pinout

A 4PDT relay provides four independent changeover (Form-C) contact sets driven by a single coil. Each pole has three terminals:

  • COM — the common (wiper) terminal.
  • NO — normally open (make) contact; closes when the coil is energized.
  • NC — normally closed (break) contact; opens when the coil is energized.

For a 14-pin (octal-style) plug-in 4PDT such as the Omron G4Q-212A-US-DC24 or the Weidmüller DRM series, the pinout follows this convention:

Pin Function Pin Function
1 Coil + 8 Pole 1 NO
2 Coil – 9 Pole 2 COM
3 Pole 1 COM 10 Pole 2 NO
4 Pole 1 NC 11 Pole 2 NC
5 Pole 3 COM 12 Pole 3 NO
6 Pole 3 NC 13 Pole 4 COM
7 Pole 4 NC 14 Pole 4 NO

Pin numbering varies by manufacturer, so always cross-check the datasheet. A 12-pin automotive-style 4PDT (commonly sold as 55-380 or 40-202-4P) uses a different layout but maintains the COM/NO/NC triad per pole.

Coil and Contact Ratings That Matter for Simulation

When you move the circuit into a PLC, the analog voltage and current no longer constrain the logic. However, the logical constraints still apply:

  • Coil pick-up voltage: typically 75 % of nominal (e.g., 18 VDC for a 24 VDC coil).
  • Drop-out voltage: typically 30–40 % of nominal.
  • Operate time: 15–30 ms (typical 4PDT at rated voltage).
  • Release time: 5–15 ms.
  • Contact bounce: 1–2 ms (silver-cadmium oxide contacts).

Inside a PLC, a typical scan is 1–10 ms, so two scan cycles cover operate and release. If you need to emulate contact bounce for high-speed simulation, you must add a TON (on-delay) of 2–5 ms on the simulated contact output.

Ladder Logic Fundamentals for Simulating a Single Relay

Before scaling to 4PDT, build a correct 1-pole model. The canonical self-holding (latch) circuit uses a holding contact in parallel with the start input:


      I_Start    I_Stop    H_Coil
  ───┤/├────────┤ ├───────┤ ├────( COIL )───
                  │
                  │
        H_Coil    │
  ───────┤ ├──────┘

In Siemens LOGO! 8 this is implemented with the SF01 (set/reset latching relay) function block from the special-function library. According to the LOGO! 8.3 system manual, SF01 has four inputs:

Input Meaning
S Set (energize the coil)
R Reset (de-energize)
Trg Trigger for retentive save
Par Parameter pin

The equivalent rung for a single pole, single throw using LOGO! Soft Comfort is:

  • I1 → S input of SF01
  • I2 (NC, fail-safe) → R input of SF01
  • SF01.Q → Q1 (coil driver)
  • SF01.Q → M1 (NO contact simulation)
  • ¬SF01.Q → M2 (NC contact simulation)

From here, scaling to a 4PDT is simply a matter of repeating the contact query four times against the same SF01.Q bit.

SPST → DPDT → 4PDT Mapping Table

Use the table below as a reference when migrating a relay schematic. The "Tag name" column shows a naming convention that scales to hundreds of relays: R3xx for the coil, R3xx_NO_n / R3xx_NC_n for the derived contacts.

Topology Poles NO contacts in ladder NC contacts in ladder Typical ladder-element count
SPST 1 1 (R3xx_NO_1) 0 1 rung with self-hold + 1 contact
SPDT (Form C) 1 1 (R3xx_NO_1) 1 (R3xx_NC_1) 1 rung + 2 contact queries
DPDT (2 Form C) 2 2 (R3xx_NO_1..2) 2 (R3xx_NC_1..2) 1 rung + 4 contact queries
4PDT (4 Form C) 4 4 (R3xx_NO_1..4) 4 (R3xx_NC_1..4) 1 rung + 8 contact queries

Notice the logical symmetry: the coil is built once, the contacts are read everywhere. This is the same model that Allen-Bradley Logix 5000 uses when you wrap a coil in an AOI (Add-On Instruction) — the coil sets a tag, and downstream logic uses that tag as a normal BOOL.

Latching (Self-Hold) Implementation Details

Railway stick relays are latching for a reason: a momentary loss of battery should not darken a wayside signal. The electromechanical design uses either a magnetic-latch (no holding current) or a neutral stick (auxiliary contact holds the coil through its own contact). The ladder equivalent must mirror this behavior.

Option A — Magnetic-Latch Equivalent (Set/Reset Latch)

Use SF01 (Siemens LOGO!) or OTL/OTU (Allen-Bladley) with a set-dominant priority. This matches a polarized stick relay that holds position on power loss:

// LOGO! Soft Comfort FBD syntax
B01 = SF01 (S = I1, R = I2, Par = "Retentive=ON")
Q1  = B01.Q            // coil driver to physical output
M10 = B01.Q            // NO contact pole 1
M11 = NOT(B01.Q)       // NC contact pole 1
M12 = B01.Q            // NO contact pole 2
M13 = NOT(B01.Q)       // NC contact pole 2
M14 = B01.Q            // NO contact pole 3
M15 = NOT(B01.Q)       // NC contact pole 3
M16 = B01.Q            // NO contact pole 4
M17 = NOT(B01.Q)       // NC contact pole 4

Option B — Neutral-Stick Equivalent (Sealed-in Holding Contact)

This is closer to the original drawings because it shows the auxiliary contact explicitly. In ladder:


      I1_Track_Voltage   I2_ResetPB_NC   M10_HoldAux
  ────┤ ├────────────────┤/├─────────────┤ ├────────( M_Coil )───
                                                  │
                                                  │
                                  M10_HoldAux     │
  ────────────────────────────────┤ ├─────────────┘

Here M_Coil is the simulated coil tag, and M10_HoldAux is one of the four NO contacts wired in parallel with the start input. This shape is the one most often requested by people migrating vintage railroad drawings.

Polarized vs Neutral Contacts

Many 1950s stick relays used a polarized contact — a biased armature whose direction of motion depended on the polarity of the coil voltage. The circuit cared about +24 V vs –24 V. In a modern PLC this is captured by using two tags per pole (a forward and a reverse indicator) and a polarity-detect function block. The Siemens LOGO! 8.3 manual section 4.4.12 covers analog threshold switches that can discriminate +24 V from –24 V when the input is wired through a divider.

For purely neutral 4PDT relays (the common case for block detection in the '60s), a single BOOL tag per pole is sufficient because the contact state is determined only by whether the coil is energized, not by which polarity drove it.

Tip: If you are porting a circuit that explicitly shows a diode on the coil (a "diode-steered" or "polarized" stick), your PLC should treat the coil as two separate set signals (S_Plus and S_Minus) OR'd into a single coil tag and a single reset.

Step-by-Step: Building a 4PDT Ladder Snippet in LOGO! Soft Comfort

  1. Open LOGO! Soft Comfort 8.3 and create a new project. Select the LOGO! 8.3 base module (6ED1052-1xx08-0BA1) so you have 8 digital inputs and 4 relay outputs available.
  2. Drop an SF01 block from the Special Functions list. Wire input I1 to S (set) and I2 (NC) to R (reset). Set parameter Retentive = ON to mimic the magnetic-latch behavior of the original hardware.
  3. Connect SF01.Q to Q1 so the physical output reflects the coil state — this is useful for a status LED on the front panel.
  4. Add four NO and four NC queries on the four downstream rungs. In FBD, use direct connections to flags M1..M4 (NO) and inverted connections to M5..M8 (NC). In Ladder view, drop normally-open and normally-closed contacts labelled SF01.Q in series with whatever the next-stage logic requires.
  5. Compile and simulate with F5 (Start Simulation). Toggle I1 to see all eight contacts follow in real time. Use the Watch Table (Tools → Watch Table) to confirm that M1..M8 change state within one scan.
  6. Download to LOGO! via Ethernet. Press ESC + OK to confirm; the project uploads and the existing retentive state is preserved.

Verification: How to Prove the Ladder Matches the Original Schematic

Once the rung is built, validate it with the following four checks before integrating into the larger circuit:

  1. Functional check — With the simulation running, press I1 (set). All four NO flags (M1..M4) must rise within one scan; all four NC flags (M5..M8) must fall. Press I2 (reset). Reverse the assertion.
  2. Power-cycle retention — Force a power-down of the LOGO! (Tools → Simulation → Reset). Confirm that all eight contact tags retain their previous state if SF01 was configured retentive; they should reset to the de-energized state if not.
  3. Race-condition check — Press I1 and I2 simultaneously. With set-dominant SF01, the coil should remain set. With reset-dominant, the coil should reset. Document which behavior you have, because railroad drawings usually assume a specific priority.
  4. Cross-platform parity — Re-implement the same 4PDT in a second environment (e.g., Allen-Bradley MicroLogix 1400 with the MicroLogix 1400 user manual) using OTL/OTU and verify that the contact states match rung-for-rung. This catches hidden gotchas such as scan-order dependencies.

Troubleshooting Matrix

Symptom Likely root cause Fix
All four NO contacts stay false even though Q1 is true SF01.Q was wired to a digital output only; the contact queries were not added to the downstream rungs. Drop four NO contacts labelled with the coil tag in the rungs that need them, or assign flag bits M1..M4 in FBD.
NC contacts do the same thing as the NO contacts The NC was implemented as a direct read of the coil tag instead of an inverted read. Use a normally-closed contact (─┤/├─) in ladder, or use the B_NOT function in FBD.
Relay chatters between set and reset I1 (start) and I2 (stop) are physically wired to the same button, or the track-voltage sense is unstable. Add a TON (on-delay) of 20–50 ms on the set input, or debounce the input with a 1 Hz low-pass filter on the analog channel.
States are lost on power cycle but the original relay would have held SF01 was not configured retentive. In LOGO! Soft Comfort open SF01 → Parameters → set Remanence = ON. On Allen-Bradley, mark the coil tag as Retained.
Simulation runs in Soft Comfort but not on the hardware LOGO! Project was downloaded in Simulation mode; firmware mismatch (LOGO! 8.0 firmware against a Soft Comfort 8.3 project). Check Device → Properties: LOGO! firmware ≥ FS04 for Soft Comfort 8.3. Upgrade with the LOGO! Web Loader Tool.
Scan time becomes too long with hundreds of relays Each relay is implemented as eight individual rungs with no grouping. Build a UDF (User-Defined Function block) that encapsulates the coil + 8 contacts as one block; instantiate it per signal aspect.

Scaling to Hundreds of Relays (Model-Railroad / Museum Block)

Most of the inquiry is about "hundreds of these relays" being simulated inside a single controller. Practical ceiling numbers for common platforms:

Platform Max program blocks / tags Typical 4PDT count Reference
Siemens LOGO! 8.3 (BM + EMs) 400 function blocks, 250 flags ~30–40 4PDTs (each uses 9 blocks: 1 SF01 + 8 contact refs) LOGO! 8 manual
Siemens S7-1200 (CPU 1214C) 50 KB load, 1024 DB Hundreds of 4PDTs as AOI instances S7-1200 system manual
Allen-Bradley MicroLogix 1400 20 KB user program ~50 4PDTs (4 KB ladder each) MicroLogix 1400 manual
Allen-Bradley CompactLogix 5380 Several MB program Effectively unlimited 4PDTs CompactLogix 5380 manual
Codesys / Beremiz soft-PLC Limited by host CPU Limited only by RAM and execution-time budget CODESYS IEC 61131-3 page

For "hundreds of relays" the only realistic targets are the S7-1200/1500 family, CompactLogix/ControlLogix, or a soft-PLC. On the LOGO! you can chain three base modules and still get only ~120 4PDTs in the best case, which is usually insufficient for a full block instrument.

Encapsulating the 4PDT as a Reusable Block

On any IEC 61131-3 platform, wrap the 4PDT in a function block so each physical stick relay becomes one instance call. The interface in Structured Text is:

FUNCTION_BLOCK FB_StickRelay4PDT
VAR_INPUT
  S        : BOOL;   // Set (track voltage present)
  R        : BOOL;   // Reset (loss of battery / operator clear-down)
  ResetDom : BOOL := FALSE; // TRUE = reset-dominant
END_VAR
VAR_OUTPUT
  NO_1..NO_4 : BOOL;
  NC_1..NC_4 : BOOL;
END_VAR
VAR RETAIN
  Coil : BOOL;
END_VAR
IF ResetDom THEN
  IF R THEN Coil := FALSE;
  ELSIF S THEN Coil := TRUE; END_IF;
ELSE
  IF S THEN Coil := TRUE;
  ELSIF R THEN Coil := FALSE; END_IF;
END_IF;
NO_1 := Coil; NO_2 := Coil; NO_3 := Coil; NO_4 := Coil;
NC_1 := NOT Coil; NC_2 := NOT Coil;
NC_3 := NOT Coil; NC_4 := NOT Coil;
END_FUNCTION_BLOCK

Instantiate FB_StickRelay4PDT for every signal aspect and read Inst.NO_2, Inst.NC_4, etc., exactly as you would read a physical relay contact. The ladder in the calling program becomes identical to the original drawing because the contacts are queried by name, not built rung by rung.

Notes on Edge Cases and Field-Proven Caveats

  • First-scan semantics. When the controller powers up, the coil tag is FALSE by default (unless retentive). If the original relay was mechanically latched in the "picked" position when power was last removed, you must re-establish that state with an initialization rung that asserts the appropriate coil tag at first scan.
  • Survivability of feedback. Many 1950s circuits use a contact of the relay itself as an interlock on another relay's coil. This is automatically preserved by the simulation if you read the contact query outputs; do not duplicate the coil logic in the downstream rung.
  • Diode logic on the original drawing. Diode AND/OR networks (typical of US&S Style-14 searchlight circuits) must be replaced with explicit AND/OR contacts because the PLC will treat two parallel contacts as OR, not as diode-isolated AND. Add a 50 ms contact-debounce if a diode was used as a "free-wheeling" path.
  • Polarity-steered stick. If the original coil had a polarized armature, simulate it as two set inputs (one per polarity) feeding an OR-gate in front of the SF01. The reset input is shared.
  • Scan-time vs. relay release time. A real 4PDT releases in 5–15 ms. If the downstream logic expects to "see" the NC contact close before the NO contact reopens (make-before-break vs. break-before-make), add a 5 ms TON on the NO output to model the gap.

Commissioning Checklist

  1. Inventory every 4PDT in the original schematic; assign each one a unique instance name (Aspect_Red, Aspect_Yellow, Repeater_North, …).
  2. Decide for each instance whether the latch is retentive (magnetic-latch equivalent) or volatile (neutral-stick with auxiliary holding contact).
  3. Build FB_StickRelay4PDT once and instantiate it for every relay in the system. Verify that the total instance count is within the platform's limit.
  4. Run a global simulation in which every input is forced OFF; confirm that all NC contacts are TRUE and all NO contacts are FALSE.
  5. Apply power (set) to one relay at a time and confirm that exactly its eight contact flags change.
  6. Document the priority (set-dominant vs. reset-dominant) and lock the parameter — this is the behavior the original stick relay had and changing it is a functional change to the circuit, not a refactor.

FAQ

How do I represent a 4PDT contact in ladder logic without writing eight separate rungs?

Wrap the coil + eight derived contacts in a single function block (e.g., FB_StickRelay4PDT) and instantiate it once per physical relay. The ladder in the calling program then queries the four NO and four NC outputs by name, exactly as it would read physical relay terminals.

Which Siemens LOGO! function block replaces an old latching stick relay?

Use SF01 (Set/Reset latching relay). Configure the Set input to the track-voltage sense, the Reset input to a normally-closed clear-down pushbutton, and enable Remanence to mimic the magnetic-latch behavior. See the LOGO! 8 system manual §4.3.1.

Can I simulate a polarized stick relay (one that depends on coil polarity) in a PLC?

Yes. Treat each polarity as a separate set input (S_plus, S_minus) OR-ed in front of a single coil tag, with a shared reset. The four NO and four NC contact outputs behave the same as for a neutral stick; the difference is that the input wiring is polarity-aware.

How many 4PDT relays can a LOGO! 8.3 realistically simulate?

About 30–40 instances per base module because each one consumes roughly nine program blocks (1 SF01 + 8 contact references). To get into the hundreds you need an S7-1200/1500, CompactLogix, or a soft-PLC where the 4PDT is encapsulated in a single function block and reused.

Why does my simulation chatter between set and reset?

Either the start and stop inputs are physically the same signal, the track-voltage sense is debounced incorrectly, or the SF01 priority is wrong. Add a 20–50 ms on-delay (TON) on the set input and verify the Set/Reset priority matches the original drawing (set-dominant is the usual choice for 1950s stick relays).

Back to blog