Smooth signal lamp transitions Patch
#1
Posted 26 April 2020 - 09:35 AM
If all looks good, I will submit a Trello request and GitHub PR.
#2
Posted 26 April 2020 - 10:15 AM
YoRyan, on 26 April 2020 - 09:35 AM, said:
If all looks good, I will submit a Trello request and GitHub PR.
Elegant, nice work.
#4
Posted 26 April 2020 - 10:54 AM
#5
Posted 26 April 2020 - 10:56 AM
ebnertra000, on 26 April 2020 - 10:54 AM, said:
Good point. Should be considered. Smooth Transition for incandescents though.
#6
Posted 26 April 2020 - 11:21 AM
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
Posted 26 April 2020 - 11:40 AM
YoRyan, on 26 April 2020 - 11:21 AM, said:
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
Posted 26 April 2020 - 11:45 AM
In summary - new sigcfg.dat property that defaults to 0.5 seconds.
#9
Posted 26 April 2020 - 12:03 PM
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
Posted 26 April 2020 - 06:10 PM
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
Posted 27 April 2020 - 05:13 PM
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
Posted 27 April 2020 - 06:50 PM
#13
Posted 28 April 2020 - 06:17 AM
#14
Posted 04 May 2020 - 12:20 PM
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 seconds0.2 seconds (be conservative with the new effect). - The ORTSOnOffTime property in the SignalType block will control the fade time.
#15
Posted 04 May 2020 - 03:24 PM
YoRyan, on 04 May 2020 - 12:20 PM, said:
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