Elvas Tower: AI Lighting Conditions - Elvas Tower

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

AI Lighting Conditions "Rule 17" Logic Rate Topic: -----

#1 User is offline   Traindude 

  • Foreman Of Engines
  • Group: Posts: Contributing Member
  • Posts: 950
  • Joined: 17-November 13
  • Gender:Male
  • Location:Seattle, WA
  • Simulator:Open Rails
  • Country:

Posted 08 May 2026 - 01:06 AM

After having the ability for multiple sets of conditions per light was added to ORTS, I have begun programming my AI trains' lighting with "Rule 17 logic." Rule 17 refers to how the headlights should be operated according to the American Railroads' Consolidated Code of Operating Rules:

Quote

17. The headlight must be displayed to the front of trains by night and at any time the view is obscured by storm or fog and while passing through tunnels and snowsheds. It must be extinguished when a train turns out to meet another train and has stopped clear of the main track, or is standing to meet a train at the end of double or three or more tracks or a junction.

When an engine is running backward, a white light must be displayed by night on the rear of the tender.

S-17. When a train is to take siding to meet an opposing train, and the headlight of the train which is to take siding fails before train is clear of main track, or if view of headlight is obscured by cars or other obstructions, a member of the crew must be immediately sent ahead on main track to stop opposing train until main track is clear. Until the headlight of a train turned out to meet another train is
extinguished, it is an indication that the main track is obstructed. The opposing train must approach prepared to stop before passing the headlight and if the head end of train is clear of main track, may
proceed only at restricted speed to the point where the main track may be obstructed.

17 ( A ). When the headlight fails enroute, a white light must be used in its place, the bell rung continuously while moving, the whistle sounded frequently, and the train dispatcher notified at the first opportunity.

17 ( B ). Headlights must not be dimmed in foggy or stormy weather, or when closely approaching or passing over public crossings at grade, or when other conditions make it inadvisable.

Headlights should be dimmed under conditions outlined below:
In yards where yard engines are employed and at stations where switching is being done;
At stations when closely moving behind or when standing behind another train;
On double or three or more tracks when approaching train in the opposite direction;
While standing on main track awaiting arrival of an approaching train that is to take siding, but not until approaching train dims its headlight as a signal for the standing train to do likewise;
When passing engine or rear of train, to afford identification of moving train;
At other times to permit passing of signals or when the safety of employes or others requires.

17 ( C ). On gas-electric, diesel-electric and electric powered trains, when full power headlight is not required it must be burning dim during daylight hours, except as prescribed by Rule 17.


While we're not at the point where ORTS can have AI trains' lights react to the presence of other trains just yet, I have perfected the requirement of auto-dimming of the headlights while stopped. Here are the conditions I use for the "Bright" or "High Beam" setting, while the train is in motion:
For the front:
Conditions (
        Service ( 2 ) Comment ( *** Train In Service *** )
	Unit ( 2 ) Comment ( *** Unit at Front of Train; Not Flipped *** )
	Control ( 1 ) Comment ( *** AI Train *** )
	Reverser ( 5 ) Comment ( *** Reverser in Forward or Neutral *** )
	Brake ( 1 ) Comment ( *** Brake Released -- Presumed in Motion *** )
            )
Conditions (
        Service ( 2 ) Comment ( *** Train In Service *** )
	Unit ( 4 ) Comment ( *** Unit at Rear of Train; Flipped *** )
	Control ( 1 ) Comment ( *** AI Train *** )
	Reverser ( 5 ) Comment ( *** Reverser in Forward or Neutral *** )
	Brake ( 1 ) Comment ( *** Brake Released -- Presumed in Motion *** )
            )


...and for the rear (if applicable):
Conditions (
        Service ( 2 ) Comment ( ** Train in Service ** )
	Unit ( 3 ) Comment ( ** Unit at Rear of Train; Not Flipped ** )
	Control ( 1 ) Comment ( ** AI Train ** )
	Reverser ( 2 ) Comment ( ** Reverser in Reverse Position Only ** )
	Brake ( 1 ) Comment ( ** Brake Released -- Presumed In Motion ** )
            )
Conditions (
        Service ( 2 ) Comment ( ** Train in Service ** )
	Unit ( 5 ) Comment ( ** Unit at Front of Train; Flipped ** )
	Control ( 1 ) Comment ( ** AI Train ** )
	Reverser ( 2 )  Comment ( ** Reverser in Reverse Position Only ** )
	Brake ( 1 ) Comment ( ** Brake Released -- Presumed In Motion ** )
            )


Here's the conditions for the "Dim" or "Low Beam" setting when the train is stopped:
For the front:
Conditions (
            Service ( 2 ) Comment ( *** Train In Service *** )
            Unit ( 2 ) Comment ( *** Unit at Front of Train; Not Flipped *** )
            Control ( 1 ) Comment ( *** AI Train *** )
            Reverser ( 5 ) Comment ( *** Reverser in Forward or Neutral *** )
            Brake ( 2 ) Comment ( *** Brake Applied -- Presumed Stopped *** )
            )
 Conditions (
            Service ( 2 ) Comment ( *** Train In Service *** )
            Unit ( 4 ) Comment ( *** Unit at Rear of Train; Flipped *** )
            Control ( 1 ) Comment ( *** AI Train *** )
            Reverser ( 5 ) Comment ( *** Reverser in Forward or Neutral *** )
            Brake ( 2 ) Comment ( *** Brake Applied -- Presumed Stopped *** )
            )

...and the rear:
Conditions (
        Service ( 2 ) Comment ( ** Train in Service ** )
	Unit ( 3 ) Comment ( ** Unit at Rear of Train; Not Flipped ** )
	Control ( 1 ) Comment ( ** AI Train ** )
	Reverser ( 2 ) Comment ( ** Reverser in Reverse Position Only ** )
	Brake ( 2 ) Comment ( ** Brake Applied -- Presumed Stopped ** )
            )
Conditions (
        Service ( 2 ) Comment ( ** Train in Service ** )
	Unit ( 5 ) Comment ( ** Unit at Front of Train; Flipped ** )
	Control ( 1 ) Comment ( ** AI Train ** )
	Reverser ( 2 ) Comment ( ** Reverser in Reverse Position Only ** )
	Brake ( 2 ) Comment ( ** Brake Applied -- Presumed Stopped ** )
            )


If you wanted the headlights to remain on high-beam mode while stopped in inclement weather (as mentioned in the full text from the rule book), you would of course use the Weather ( ) condition, setting the value to 1 for low-beam mode:
Comment ( Front Light )
Conditions (
            Service ( 2 ) Comment ( *** Train In Service *** )
            Unit ( 2 ) Comment ( *** Unit at Front of Train; Not Flipped *** )
            Control ( 1 ) Comment ( *** AI Train *** )
            Reverser ( 5 ) Comment ( *** Reverser in Forward or Neutral *** )
            Brake ( 2 ) Comment ( *** Brake Applied -- Presumed Stopped *** )
            Weather ( 1 ) Comment ( *** Clear Weather Only *** )
            )
 Conditions (
            Service ( 2 ) Comment ( *** Train In Service *** )
            Unit ( 4 ) Comment ( *** Unit at Rear of Train; Flipped *** )
            Control ( 1 ) Comment ( *** AI Train *** )
            Reverser ( 5 ) Comment ( *** Reverser in Forward or Neutral *** )
            Brake ( 2 ) Comment ( *** Brake Applied -- Presumed Stopped *** )
            Weather ( 1 ) Comment ( *** Clear Weather Only *** )
            )
Comment ( Rear Light )
Conditions (
        Service ( 2 ) Comment ( ** Train in Service ** )
	Unit ( 3 ) Comment ( ** Unit at Rear of Train; Not Flipped ** )
	Control ( 1 ) Comment ( ** AI Train ** )
	Reverser ( 2 ) Comment ( ** Reverser in Reverse Position Only ** )
	Brake ( 2 ) Comment ( ** Brake Applied -- Presumed Stopped ** )
        Weather ( 1 ) Comment ( *** Clear Weather Only *** )
            )
Conditions (
        Service ( 2 ) Comment ( ** Train in Service ** )
	Unit ( 5 ) Comment ( ** Unit at Front of Train; Flipped ** )
	Control ( 1 ) Comment ( ** AI Train ** )
	Reverser ( 2 ) Comment ( ** Reverser in Reverse Position Only ** )
	Brake ( 2 ) Comment ( ** Brake Applied -- Presumed Stopped ** )
        Weather ( 1 ) Comment ( *** Clear Weather Only *** )
            )


...then program the high-beams with an extra set of conditions for rain and snow, like this:
Comment ( *** Front Light *** )
Conditions (
        Service ( 2 ) Comment ( *** Train In Service *** )
	Unit ( 2 ) Comment ( *** Unit at Front of Train; Not Flipped *** )
	Control ( 1 ) Comment ( *** AI Train *** )
	Reverser ( 5 ) Comment ( *** Reverser in Forward or Neutral *** )
	Brake ( 1 ) Comment ( *** Brake Released -- Presumed in Motion *** )
            )
Conditions (
        Service ( 2 ) Comment ( *** Train In Service *** )
	Unit ( 4 ) Comment ( *** Unit at Rear of Train; Flipped *** )
	Control ( 1 ) Comment ( *** AI Train *** )
	Reverser ( 5 ) Comment ( *** Reverser in Forward or Neutral *** )
	Brake ( 1 ) Comment ( *** Brake Released -- Presumed in Motion *** )
            )
Conditions (
        Service ( 2 ) Comment ( *** Train In Service *** )
	Unit ( 2 ) Comment ( *** Unit at Front of Train; Not Flipped *** )
	Control ( 1 ) Comment ( *** AI Train *** )
	Reverser ( 5 ) Comment ( *** Reverser in Forward or Neutral *** )
	Brake ( 2 ) Comment ( *** Brake Applied -- Presumed Stopped *** )
        Weather ( 2 ) Comment ( *** Rainy Weather *** )
            )
Conditions (
        Service ( 2 ) Comment ( *** Train In Service *** )
	Unit ( 4 ) Comment ( *** Unit at Rear of Train; Flipped *** )
	Control ( 1 ) Comment ( *** AI Train *** )
	Reverser ( 5 ) Comment ( *** Reverser in Forward or Neutral *** )
	Brake ( 2 ) Comment ( *** Brake Applied -- Presumed Stopped *** )
        Weather ( 2 ) Comment ( *** Rainy Weather *** )
            )
Conditions (
        Service ( 2 ) Comment ( *** Train In Service *** )
	Unit ( 2 ) Comment ( *** Unit at Front of Train; Not Flipped *** )
	Control ( 1 ) Comment ( *** AI Train *** )
	Reverser ( 5 ) Comment ( *** Reverser in Forward or Neutral *** )
	Brake ( 2 ) Comment ( *** Brake Applied -- Presumed Stopped *** )
        Weather ( 3 ) Comment ( *** Snowy Weather *** )
            )
Conditions (
        Service ( 2 ) Comment ( *** Train In Service *** )
	Unit ( 4 ) Comment ( *** Unit at Rear of Train; Flipped *** )
	Control ( 1 ) Comment ( *** AI Train *** )
	Reverser ( 5 ) Comment ( *** Reverser in Forward or Neutral *** )
	Brake ( 2 ) Comment ( *** Brake Applied -- Presumed Stopped *** )
        Weather ( 3 ) Comment ( *** Snowy Weather *** )
            )
Comment ( *** Rear Light *** )
Conditions (
        Service ( 2 ) Comment ( ** Train in Service ** )
	Unit ( 3 ) Comment ( ** Unit at Rear of Train; Not Flipped ** )
	Control ( 1 ) Comment ( ** AI Train ** )
	Reverser ( 2 ) Comment ( ** Reverser in Reverse Position Only ** )
	Brake ( 1 ) Comment ( ** Brake Released -- Presumed In Motion ** )
            )
Conditions (
        Service ( 2 ) Comment ( ** Train in Service ** )
	Unit ( 5 ) Comment ( ** Unit at Front of Train; Flipped ** )
	Control ( 1 ) Comment ( ** AI Train ** )
	Reverser ( 2 )  Comment ( ** Reverser in Reverse Position Only ** )
	Brake ( 1 ) Comment ( ** Brake Released -- Presumed In Motion ** )
            )
Conditions (
        Service ( 2 ) Comment ( ** Train in Service ** )
	Unit ( 3 ) Comment ( ** Unit at Rear of Train; Not Flipped ** )
	Control ( 1 ) Comment ( ** AI Train ** )
	Reverser ( 2 ) Comment ( ** Reverser in Reverse Position Only ** )
	Brake ( 2 ) Comment ( ** Brake Applied -- Presumed Stopped ** )
        Weather ( 2 ) Comment ( *** Rainy Weather *** )
            )
Conditions (
        Service ( 2 ) Comment ( ** Train in Service ** )
	Unit ( 5 ) Comment ( ** Unit at Front of Train; Flipped ** )
	Control ( 1 ) Comment ( ** AI Train ** )
	Reverser ( 2 )  Comment ( ** Reverser in Reverse Position Only ** )
	Brake ( 2 ) Comment ( ** Brake Applied -- Presumed Stopped ** )
        Weather ( 2 ) Comment ( *** Rainy Weather *** )
            )
Conditions (
        Service ( 2 ) Comment ( ** Train in Service ** )
	Unit ( 3 ) Comment ( ** Unit at Rear of Train; Not Flipped ** )
	Control ( 1 ) Comment ( ** AI Train ** )
	Reverser ( 2 ) Comment ( ** Reverser in Reverse Position Only ** )
	Brake ( 2 ) Comment ( ** Brake Applied -- Presumed Stopped ** )
        Weather ( 3 ) Comment ( *** Snowy Weather *** )
            )
Conditions (
        Service ( 2 ) Comment ( ** Train in Service ** )
	Unit ( 5 ) Comment ( ** Unit at Front of Train; Flipped ** )
	Control ( 1 ) Comment ( ** AI Train ** )
	Reverser ( 2 )  Comment ( ** Reverser in Reverse Position Only ** )
	Brake ( 2 ) Comment ( ** Brake Applied -- Presumed Stopped ** )
        Weather ( 3 ) Comment ( *** Snowy Weather *** )
            )


I just thought I'd share my insight on how I'd set up these conditions. Let me know what you guys think of my idea!

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users