JMRI: Light Documentation
What are Lights?
Lights are digital output bits that function as on/off switches. Lights were created to provide easy control for fascia panel lights and scenery lighting. Lights can also be used for any purpose that requires an on/off switch. A light can be used, for example, to activate an electromagnetic decoupler for a pre-determined time in response to a fascia panel button. Originally developed for use with C/MRI, Lights currently are also implemented on Loconet (Digitrax) and Oaktree systems.
Lights share available digital output bits with Turnouts. Either a Light or a Turnout, but not both, can control a specific digital output bit. Since Lights lack the feedback structure of Turnouts, Lights should not be used to control track switches (Turnouts) on the layout; only Turnouts should be used to control track switches. For historical reasons, Signal Head appearances are defined using Turnouts, even though they may actually be physical lights. So Turnouts should be used to reference the digital output bits used with JMRI Signal Heads. Lights should be used if you need a simple mechanism to control scenery lighting or panel lights, or for other on/off tasks where the control mechanisms of Lights fit the need.
Optionally a Light may be controlled in one of four ways: it may be controlled by a sensor, by a turnout, by the JMRI fast clock, or switched on for a specified time by a sensor. When a Light is created, or when it is read from a configuration file, the Light is 'activated'; it is set up to monitor automatically any changes in state of its control sensor, turnout, or fast clock. When the controlling sensor, turnout, or clock changes in a user-specified way, the Light is switched on or off. Lights can also be controlled by Logix, if more complicated control logic is needed.
The Light Table contains an 'Enabled' column. For a Light to be triggered by its control sensor, the fast clock, or its control turnout, it must be "enabled", that is, its check box in the 'Enabled' column must be checked. You can uncheck this box to temporarily disable a Light from being triggered, i.e. prevent it switching when its control mechanism fires.
Switching a Light On or Off
Lights may be turned on or off by clicking the button in the State column of the Light Table. A Light may be set up to follow the state of a track switch (turnout), on when the turnout is closed, and off when it is thrown, or vice versa. A light may be set to follow the state of a block occupancy sensor, on when the sensor is active, and off when it is inactive, or vice versa. A Light may also be set by a fascia panel button if a sensor for that button is defined as the control sensor. A light may be configured to follow the JMRI fast clock, on for a specified time period, then off. A Light may also be controlled from a Logix, as the action of one of its conditionals. If you need more powerful logic to control your Light, consider using a Logix.
Note that enabled/disabled applies only to a Light's automated control mechanism. A 'disabled' state will not prevent a Light from being turned on or off using the button in the Light Table or from being controlled by a Logix.
Saving Lights to disk
Lights are saved in your layout configuration file, along with turnouts,
sensors, signal heads, etc. To store this information on disk, use Store
Configuration... in the File menu at the top of the Light
Table (or other tables from the Tools menu), or select Store Panel...
in the Panel menu. Note that the enabled/disabled state of each Light
is not saved in the configuration file. When Lights are loaded from a
configuration file, they are all enabled.
Adding a new Light
To add a new Light, follow this procedure:
Click Light Table in the Tools menu to bring up the Light Table, and click the Add... button at the bottom of the table to bring up the Add/Edit Light window.
Enter a system name, according to the JMRI convention. The first letter designates your hardware system ('L' for loconet, 'C" for C/MRI, etc.), and the second letter must be 'L' for Light. These are followed by a number that gives the hardware address of the digital output bit being referenced. Examples of valid system addresses are: CL1004, and LL401, assuming you have the hardware for the addressed digital output bits.
Enter a user name. Any string of characters that is different from the user name of other Lights will be accepted, but it's wise to use a string that describes the intended use of the Light.
Select the control type from the options in the popup menu. When you change the control type, different options appear on the two lines below. Control options are discussed in more detail below.
Enter the required information to complete the control definition in the fields that appear. If you need to enter a sensor name or a turnout name, you must enter the name (system name or user name) of an existing sensor or turnout. Caution: if you enter a user name, be careful about changing the user name of your sensor or turnout. A simple change of user name could break your Light control definition.
Next is the notes area of the Add/Edit Light window. This is where instructions and error messages will appear as you create or edit a Light. Always check this area to see if things went as expected.
Click the Create button at the bottom of the window. If everything is fine, a message stating "New Light added ... " will be displayed in the notes area. If there is trouble with anything, an error or warning message will be displayed in the notes area; you should then correct the error and click Create again.
Editing an existing Light
To edit an existing Light, follow this procedure:
- Edit of an existing Light may be started in either of two ways:
- Click on a Light's Edit button in the Light Table.
- Enter the system name of the Light to be edited in the Add/Edit Light window and click the Edit button at the bottom of the Add/Edit Light window. This must be the same as the system name shown in the Light Table.
- Make whatever changes or additions you need to the information in the dialog. Note that the system name of the edited Light may not be changed, but the user name may be changed. Other items are as described above.
- After making changes to the Light information, click Update to change the selected Light. If everything is fine, a message stating "Light updated ... " will be displayed in the notes area. If there is any trouble, an error or warning message will be displayed in the notes area, and the update is stopped for you to correct the error and click Update again.
- Click Cancel to exit edit mode without changing the selected Light. If the Add/Edit Light window is dismissed (closed) while in edit mode, Cancel is automatically selected, and no changes are made to the selected Light.
Automated Control Options for LightsThe operation of a Light can be controlled in the following ways:
By Sensor - The Light will be turned on when the sensor changes to active or inactive, depending upon the choice made in the 'Sense for ON' popup menu, and it will be turned off, when the sensor reverses state. Specify the sensor by entering its name (system name or user name) in the 'Sensor Name' field. This option has a number of uses, including setting a fascia panel light to follow block occupancy. That is useful, for example, for monitoring train position in a hidden staging area.
By Fast Clock - The Light will be turned on when the fast clock reaches the time entered in 'Time On' and will be turned off when the fast clock reaches the time entered in 'Time Off'. The times are entered in "hh:mm" format, where "hh" is hours and "mm" is minutes for a 24-hour clock. One use of this option is to turn on and off scenery lighting, street lights, house lights, etc. to simulate night time on the layout.
By Turnout Status - The Light will be turned on when the turnout changes to closed or thrown, depending upon the choice made in the 'Status for ON' popup menu, and it will be turned off, when the turnout reverses its status. Specify the turnout by entering its name (system name or user name) in the 'Turnout Name' field. This option may be used to set a fascia panel light to follow the status of a turnout. That is useful, for example, for monitoring the status of hidden turnouts.
By Timed ON - The Light will be turned on when the trigger sensor changes to active, and it will be turned off, when the specified time has elapsed. Specify the trigger sensor by entering its name (system name or user name) in the 'Trigger Sensor Name' field. Enter the time the Light is to remain on (in milliseconds) in the 'Duration ON' field. This option has a number of uses, it was originally designed to turn on an electromagnetic decoupler in response to a fascia pushbutton, but it can also be used for other types of layout animation, for example, to control the ringing of a crossing bell when a train enters a block.
A variable light allows for a variable number of intensities between on and off. The typical use would be for layout lighting simulating the changes for the time of day and night. Only some forms of lights have the ablity to be variable. Examples would include Internal and PowerLine devices. A number of configuration options are available for variable lights below.
A variable light is adjusted by an intensity setting. The range of the intensity is from 0.00 for full off to 1.00 which is full on. User entry for the intensity will either user the floating point value or the percentage value of 0% to 100%.
Depending on the hardware used, some variable lights will make an initialization adjustment when switching from simple on/off mode to using intensity settings. On such devices this will not be needed again as long as only intensity setting commands are used. Mixing on/off commands may require the initialization to occur again.
A variable light has three types of operators:
- This operation will turn a variable light on. It will over-ride any current intensity and set the intensity to 1. If there are any transition effects enabled, they will be ignored and intensity will go to the maximum amount.
- This operation will turn a variable light off. It will over-ride any current intensity and set the intensity to 0. If there are any transition effects enabled, they will be ignored and intensity will go to the maximum amount.
- Set Intensity
- This operation will set a target intensity for the light. If the interface supports transition effects and they are configured, the light will make a controled transition from the current setting to the new setting.
Variable Light Settings
These settings adjust how the 'set intensity' command is used.
- Minimum Intensity:
- A value 0 to 100 (percent) that sets the lowest amount of light that will be output by a dim command. An explicit off command will ignore this value.
- Maximum Intensity:
- A value 0 to 100 (percent) that sets the highest amount of light that will be output by a dim command. An explicit on command will ignore this value.
- Transition Time:
- Number of fast minutes to go from 0% to 100% intensity. A value of zero will cause the device to change from one intensity to new intensity as fast as the device is able to do so.