These two schematic wiring diagrams show how to make a latching relay circuit. This creates a basic memory function... the relay 'remembers' which switch was pressed last.
In these circuits, the 'Set' switch is any normally-open switch or relay contact, such as an MRD1 train detector. The 'Reset' switch is any normally-closed switch or relay contact. When the 'Set' switch is pressed, the relay turns on. The relay stays on even after the 'Set' switch has been released because the relay coil (connections K1 and K2) now receives power through its own contact (connections 2C and 2NO).
When the 'Reset' switch is pressed, power to the relay coil is interrupted, causing the relay to turn off. This breaks the connection through contact 2C-2NO, so the relay stays off.
This type of memory circuit is called 'volatile' memory because when the power supply is turned off, the relay returns to its off state. When the power supply is turned back on, the relay will stay in its off state until the 'Set' switch is pressed.
The relay used here is any standard relay with two or more sets of contacts, or 'poles' (DPDT, 3PDT, 4PDT, etc.) such as the MRAPR auxiliary power relay. The MRAPR relay includes diodes across the coil to protect the switch contacts from 'flyback' voltage, and it can be used in both AC and DC circuits.
See the note about switch contact ratings.
This first schematic is a circuit where the 'Set' switch has priority. This means that if both the 'Set' and 'Reset' switches are pressed at the same time, the relay will turn on.