Elvas Tower: Smooth signal lamp transitions - Elvas Tower

Jump to content

  • 2 Pages +
  • 1
  • 2
  • You cannot start a new topic
  • You cannot reply to this topic

Smooth signal lamp transitions Patch Rate Topic: -----

#1 User is offline   YoRyan 

  • Conductor
  • Group: Posts: Active Member
  • Posts: 391
  • Joined: 19-February 20
  • Gender:Male
  • Location:California, United States
  • Simulator:Open Rails/unstable
  • Country:

Posted 26 April 2020 - 09:35 AM

Another small feature I've been working on: Smooth on/off transitions for signal lamps. This works automatically for all lights on all kinds of signals. Below, I've attached animations showing before and after the patch. (Open the preview window to get them to play.)

If all looks good, I will submit a Trello request and GitHub PR.

Attached thumbnail(s)

  • Attached Image: sig_abrupt.gif
  • Attached Image: sig_smooth.gif


#2 User is offline   R H Steele 

  • Executive Vice President
  • Group: Status: R.I.P. or just Retired
  • Posts: 3,562
  • Joined: 14-March 13
  • Gender:Male
  • Location:known universe
  • Simulator:Open Rails
  • Country:

Posted 26 April 2020 - 10:15 AM

View PostYoRyan, on 26 April 2020 - 09:35 AM, said:

Another small feature I've been working on: Smooth on/off transitions for signal lamps. This works automatically for all lights on all kinds of signals. Below, I've attached animations showing before and after the patch. (Open the preview window to get them to play.)

If all looks good, I will submit a Trello request and GitHub PR.


Elegant, nice work.

#3 User is offline   longiron 

  • Open Rails Developer
  • Group: Posts: Elite Member
  • Posts: 3,236
  • Joined: 25-July 08
  • Gender:Male
  • Location:Manasquan, NJ
  • Simulator:Open Rails, MSTS editors
  • Country:

Posted 26 April 2020 - 10:38 AM

Very nice addition.

#4 User is offline   ebnertra000 

  • Superintendant
  • Group: Posts: Elite Member
  • Posts: 1,258
  • Joined: 27-February 17
  • Gender:Male
  • Location:East-Central Minnesota
  • Simulator:OR/TSRE
  • Country:

Posted 26 April 2020 - 10:54 AM

I've been thinking about this a little bit too. (Big surprise, right?) Is it adjustable? LED lights are increasingly common, and have no transition phase that incandescent lights have

#5 User is offline   R H Steele 

  • Executive Vice President
  • Group: Status: R.I.P. or just Retired
  • Posts: 3,562
  • Joined: 14-March 13
  • Gender:Male
  • Location:known universe
  • Simulator:Open Rails
  • Country:

Posted 26 April 2020 - 10:56 AM

View Postebnertra000, on 26 April 2020 - 10:54 AM, said:

I've been thinking about this a little bit too. (Big surprise, right?) Is it adjustable? LED lights are increasingly common, and have no transition phase that incandescent lights have


Good point. Should be considered. Smooth Transition for incandescents though.

#6 User is offline   YoRyan 

  • Conductor
  • Group: Posts: Active Member
  • Posts: 391
  • Joined: 19-February 20
  • Gender:Male
  • Location:California, United States
  • Simulator:Open Rails/unstable
  • Country:

Posted 26 April 2020 - 11:21 AM

As of now it is not adjustable and hard-coded to 1/2-second transition times. Good point about LED lights.

How about an additional property in the sigcfg.dat file, like this?

LightsTab ( ...
	LightsTabEntry (
		"Red Light"
		colour ( 255 255 16 16 )
		OnOffTime ( 0.5 ) // or 0, 1, 1.5, etc.
	)
)

To be honest, it's such a nice effect that I'd like all signals to transition by default. ^_^

#7 User is offline   R H Steele 

  • Executive Vice President
  • Group: Status: R.I.P. or just Retired
  • Posts: 3,562
  • Joined: 14-March 13
  • Gender:Male
  • Location:known universe
  • Simulator:Open Rails
  • Country:

Posted 26 April 2020 - 11:40 AM

 YoRyan, on 26 April 2020 - 11:21 AM, said:

As of now it is not adjustable and hard-coded to 1/2-second transition times. Good point about LED lights.

How about an additional property in the sigcfg.dat file, like this?

LightsTab ( ...
	LightsTabEntry (
		"Red Light"
		colour ( 255 255 16 16 )
		OnOffTime ( 0.5 ) // or 0, 1, 1.5, etc.
	)
)

To be honest, it's such a nice effect that I'd like all signals to transition by default. ^_^


This is WAY out of my experience, but aren't all the new OR parameters that modify or are added to existing MSTS files supposed to start with ORTS...or does that not apply to sigcfg.dat files...just asking?

#8 User is offline   YoRyan 

  • Conductor
  • Group: Posts: Active Member
  • Posts: 391
  • Joined: 19-February 20
  • Gender:Male
  • Location:California, United States
  • Simulator:Open Rails/unstable
  • Country:

Posted 26 April 2020 - 11:45 AM

If they are, I had no idea. Still the new guy here. :)

In summary - new sigcfg.dat property that defaults to 0.5 seconds.

#9 User is offline   Csantucci 

  • Member, Board of Directors
  • Group: Posts: Elite Member
  • Posts: 7,442
  • Joined: 31-December 11
  • Gender:Male
  • Country:

Posted 26 April 2020 - 12:03 PM

Hi Ryan,
yes, all ORTS specific parameters are required to start with ORTS... you couldn't know that, but your learning curve is steep ;)
I also thought at leds, and so I agree in having a parameter to define transition time.

#10 User is offline   YoRyan 

  • Conductor
  • Group: Posts: Active Member
  • Posts: 391
  • Joined: 19-February 20
  • Gender:Male
  • Location:California, United States
  • Simulator:Open Rails/unstable
  • Country:

Posted 26 April 2020 - 06:10 PM

Okay, I propose that the new property be called "ORTSOnOffTime" and that it reside in the SignalType block, just like Kuju's SigFlashDuration:

SignalTypes ( ...
	SignalType ( "BNSF3Light"
		SignalFnType ( NORMAL )
		SignalLightTex ( "BNSF ltex" )
		SigFlashDuration ( 0.5 0.5 )
		ORTSOnOffTime ( 1.0 ) // in seconds
		...
	)
	...
)

Once again, defaulting to 0.5 seconds if not explicitly specified.

#11 User is offline   Railcat 

  • Hostler
  • Group: Posts: Active Member
  • Posts: 53
  • Joined: 19-January 12
  • Gender:Male
  • Simulator:Open Rails
  • Country:

Posted 27 April 2020 - 05:13 PM

Like this topic I sent:
http://www.elvastowe...__fromsearch__1

I suggest to divide this parameter into two parts. One is ORTSOnTime, another is ORTSOffTime. If the light is a flashing one, time will be the sum.

#12 User is offline   YoRyan 

  • Conductor
  • Group: Posts: Active Member
  • Posts: 391
  • Joined: 19-February 20
  • Gender:Male
  • Location:California, United States
  • Simulator:Open Rails/unstable
  • Country:

Posted 27 April 2020 - 06:50 PM

Are there signals with asymmetric fade-in and fade-out times?

#13 User is offline   ebnertra000 

  • Superintendant
  • Group: Posts: Elite Member
  • Posts: 1,258
  • Joined: 27-February 17
  • Gender:Male
  • Location:East-Central Minnesota
  • Simulator:OR/TSRE
  • Country:

Posted 28 April 2020 - 06:17 AM

I'm going to check thursday, but it seemed to me that fading out took longer than fading in

#14 User is offline   YoRyan 

  • Conductor
  • Group: Posts: Active Member
  • Posts: 391
  • Joined: 19-February 20
  • Gender:Male
  • Location:California, United States
  • Simulator:Open Rails/unstable
  • Country:

Posted 04 May 2020 - 12:20 PM

I've reviewed some videos of flashing signals and I have yet to see a signal that fades out slower or quicker than it fades in. I don't believe this is a scenario we have to worry about.

If there are no further concerns, I will submit a Trello card:

  • All signals will fade on/off by default.
  • The default fade time will be 0.5 seconds 0.2 seconds (be conservative with the new effect).
  • The ORTSOnOffTime property in the SignalType block will control the fade time.


#15 User is offline   markus_GE 

  • Executive Vice President
  • PipPipPipPipPipPipPipPipPip
  • Group: ET Admin Group
  • Posts: 4,862
  • Joined: 07-February 13
  • Gender:Male
  • Location:Leoben, Styria, Austria, Europe
  • Simulator:ORTS / MSTS
  • Country:

Posted 04 May 2020 - 03:24 PM

 YoRyan, on 04 May 2020 - 12:20 PM, said:

I've reviewed some videos of flashing signals and I have yet to see a signal that fades out slower or quicker than it fades in. I don't believe this is a scenario we have to worry about.
[...]


I have only now stumbled upon this thread (well, I have done so earlier, but ignored it http://www.elvastower.com/forums/public/style_emoticons/default/whistling.gif ), otherwise, I would have replied to that issue a little earlier ;)

By coincidence, I'm currently in the process of studying for an exam in electrical engineering on May-18 (just part of my degree program, even though it's the last exam before I can finally start my BSc thesis). And in doing so, I also learned a lot about electromagnetic coils, which are the usual form the filament in a traditional light bulb takes.

WRT real signal lights, we are usually talking traditional light bulbs, I guess, but not LEDs, since LEDs usually switch on and off instantaneously. Only traditional bulbs (and maybe - I cannot say that for sure - halogen bulbs etc.) CAN exhibit the fading behavior upon switching them on and off, but that depends on the type of current you use them in. In a typical household electrical installation, everything is run on AC, which will prevent the fading effect from occurring (but that's a different story). In signal installations, much of the time the lights run on DC - at least according to what little I have read about signals in the US which often run from batteries that always yield DC.

When a DC current is switched on in a circuit containing a light bulb (IE a coil), the coil will build a magnetic field around itself, which gobbles up a lot of the energy supplied by the current. The magnetic field will slowly stabilize at a certain intensity and while getting there, its formation will take ever less energy, thus increasing the current available for heating the filament, which will make it glow and consequently radiate energy - mostly as heat and to some minor degree as light, too (that's why bulbs are so inefficient - about 96% of the input energy is radiated as heat!). Since the current keeps increasing only slowly, though, so will the amount of light emitted and you get a fading effect.

When the current is shut off again, the energy stored in the magnetic field will start to "bleed off" again by inducting a current in the coil. Said current starts at the same value of the DC run through the coil before and diminishes ever further until the magnetic field is depleted. However, this diminishing current still is a current, thus providing energy to keep the filament glowing. Of course, as the intensity of the current decreases, so will the light and there you have the fading effect again.

Now, what does this have to do with the time it takes for the fading effect to complete in each direction? - The increase and decrease of the current can be described using specific forms of a natural exponential function, which take a constant as the exponent to indicate the half-life period (IE the time in which the current has reached half of its maximum value). That constant is the dependent on the inductance of the coil, which is a constant as well. Actually, the increasing current's function is defined as 1-dec, where dec is the decreasing current's function. Thus, both the increasing and decreasing currents' functions take the same half-life constant which means the fade in and fade out time must be the same.

http://www.elvastower.com/forums/public/style_emoticons/default/sign_sorry.gif for the lengthy post, but I just found it cool to be able to put my newly acquired knowledge to good use, aside from writing another silly exam http://www.elvastower.com/forums/public/style_emoticons/default/pleasantry.gif

I just hope this is not too hard to understand, while still trying to be scientifically correct. It took me more than two days to wrap my head around the processes when switching on and off a current through a coil. http://www.elvastower.com/forums/public/style_emoticons/default/curiousPC.gif

Cheers, Markus

  • 2 Pages +
  • 1
  • 2
  • 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