NatriumDecoder: a software for OpenDecoder (Sodium vapor lamps)

    This firmware simulates the unique features of sodium vapor lamps. Sodium Vapour Lamps. These are initially dim after power is first applied, and require a period of ramping up before full brightness is achieved. They also glow for a short period after being turned off. This decoder models this typical time course.

    Again, this software works as a simple accessory decoder, and only basic DCC packets are evaluated, neither the DCC reset packet or the broadcast packets are implemented. The setting of the operating modes, and the setting the address, is accomplished by simply by pressing the programming-button and sending a command. There are four modes:
      0 Very fast dimming.
      1 Accelerated simulation, but still observable.
      2 Normal simulation, with a imperceptible rise to full brightness.
      3 Very slow simulation
      4 reserved
      5 reserved
      6 reserved
      7 reserved

The Programming

    The setting of the operating modes, and the address, is done by pressing the programming-button, and sending a DCC-command. The contents of the first DCC-packet received will determine the decoder's mode and address.
    1. Press the programming-button for at least 100ms, the LED will begin to glow and this indicates that the decoder is ready to receive a programming command.
    2. Send a DCC-packet, The decoder takes its base address from this command according to the following rule:

          Base Address = (broadcast address - 1) / 4. (the rest of the packet will be ignored)

      The decoder is programmed to the following addresses: Base Address * 4 + 1 to Base Address * 4 + 4

      The above "the rest", together with the "coil" (red or green) used to set the mode:
        0 2 4 6
        Switch 1 Switch 2 Switch 3 Switch 4
        1 3 5 7
    Example: Send DCC-packet with an address of 18, which represents a base address of 4 -- the decoder will "listen" on addresses 17-20, and will run in Mode 2. .

The Commands

    The Sodium Decoder only responds to "on" commands, and ignores "off" commands, as some command stations, such as Intellibox (R) do not send "off" commands. Therefore the following are used to mimic shut-off of the lamps.
      Sodium decoder
      0 All the lamps simultaneously switch to 15% brightness and then gradually dim to zero.
      1 All the lamps simultaneously switch to 15% brightness and then dim up to full brightness.
      2 All the lamps randomly switch to 15% brightness and then gradually dim to zero. The switching occurs in an interval of 160 ms.
      3 As in 1, but the switching-on is random within a time interval of 160ms.
      4 Like 2.
      5 Like 3, but also varies the the initial dimming to the range 15% to 25% randomly.
      6 Like 2
      7 As in 5, but will also may randomly select a light to mimic a light at the end of its life. It will extinguish after a time and then restart.