For track power
Command
You could do this with a 24VDC relay,bridge rectifier and capacitor. With DCS add a choke. I run conventional and use a separate 24VDC power supply for relay power made with an 18 volt brick,a bridge rectifier and capacitor. When charged to peak this is 24VDC.
Conventional
You could do it with a 5 volt relay hooked to a 7805 regulator circuit.
Dale H