You would need some way to detect the DCC address of the locomotive in question. Then you'd need a DCC-connected programmable system, like an Arduino, to send a command to the DCC bus to slow down ...
Q: I'm considering converting my N scale diesel fleet to DCC. I have a concern about getting realistic sound in N scale locomotives. On videos of model railroads I have watched, the diesel ...
This module implements the DCC protocol for controlling model trains using a Raspberry Pi. It is able to output direction and speed DCC-encoded packets on one of the GPIO pins (see example below).