Author Topic: LokSound advanced programming - GP9 radiator fans  (Read 2274 times)

Bob

  • Global Moderator
  • Full Member
  • *****
  • Posts: 162
    • Bob's web site
LokSound advanced programming - GP9 radiator fans
« on: August 18, 2020, 02:48:50 PM »
This discussion may not be for everyone. Writing a decoder sound slot is advanced work that requires patience while dealing with with very incomplete documentation. Still, I find it rewarding when "a plan comes together."
There should be a more prototypical way to play radiator fan sounds than just randomly.

The sound file is S0786, an EMD 567C for a V5L decoder. The target locomotives are a pair of Red Caboose GP9s for the NR&W with brass frames and P&D drives.

The RC GP9 kit is an early model with 4 fans. On the prototype, as water temperature rises, first the shutters behind the cab open up, then the fans come on one-by-one. I'm not modeling all of this, since I don't want to use 4 sound slots in the simulation. For now it's "Keep it simple" with a single set of shutters and only one fan sound.

The new sound slot is named Radiator Fan Logic 2 (Logic 1 didn't work...)  Under Function Mapping, it is activated when the engine is started and it exits when the engine shuts down. Click on any image below to enlarge it to reading size.



Exploring the sound slots in the file, I found both a radiator fan sound and shutter open/close sounds. Since the prototype turns on fans as a function of water temperature, it seems like one approach might be to create a loose simulation of water temperature based on time spent in different throttle notches.

We will need a few resources:
1. A way to define some constant values we will use
2. A timer
3. A way to find out the current throttle notch
4. A way to accumulate water temperature

1. First, to the constants. We define those in the sound slot itself. Look at Constant Values to the left of the slot. Pretty much all of these were empirically derived based on what I liked to hear in the sound slot simulator.



2. In a sound slot there are several timers, each of which is local to that sound slot. So we don't need to concern ourselves with sharing timers or for the most part other resources other than share<n>, where <n> is a digit. On a state transition in a sound slot, a timer appears as "tmr1" etc.

3. A way to discover the current throttle notch. So far, every V5 diesel file I've examined consistently uses the same values of share1. Once the engine finishes its start up,

A. Idle = 9
B. Run 1 = 13
C. Run2 = 16
D. Run 3 = 19 (seeing a pattern here?)
E. Run 4 = 22
F. Run 5 = 25
G. Run 6 = 28
H. Run 7 = 31
I. Run 8 = 34

In the next post we will discover a way to model radiator water temperature and start/stop the fans and shutters in a somewhat more prototypical way.


david

  • Global Moderator
  • Newbie
  • *****
  • Posts: 45
Re: LokSound advanced programming - GP9 radiator fans
« Reply #1 on: August 19, 2020, 09:29:29 AM »
I'm so glad you're on the A&O team, Bob, as it's all geek to me.
David

Bob

  • Global Moderator
  • Full Member
  • *****
  • Posts: 162
    • Bob's web site
Re: LokSound advanced programming - GP9 radiator fans
« Reply #2 on: August 22, 2020, 03:36:50 PM »
Now it is time for the theory of operation. Here is just the flow chart for the sound slot.



When F8 is on and the engine starts, the slot moves from Mute to FanOff. While in FanOff, Timer 1 (tmr1) decrements. When it hits zero, the slot jumps to one of 4 states where User1 (u1) is then incremented by an amount as a function of the throttle notch as communicated through global variable share1. U1 represents the estimated water temperature. When temperature exceeds a threshold, flow jumps to ShuttersOpen. This state is colored yellow because it plays a sound, that of radiator shutters opening. When that sound is finished, the state jumps to Fan init, which plays the radiator fan winding up.

State jumps to FanOn, which plays the fan on sound. Periodically when tmr1 decrements to 0, this side of the flow chart jumps to one of 4 states that decrement water temperature u1, faster at idle than notch 8.

Eventually the water cools off enough and it jumps to Fan end than Shuttersclose. It is also necessary to provide an "escape" path to turn off sounds should the engine be shut down while the fan is running. When the Auxiliary generator isn't spinning, there is no power to the fans.

In full disclosure, this isn't how a prototype 4-fan GP9 operates. When water temp exceeds a threshold, the forward shutters open. As temp rises, first fan1 then fan2 come on. After further rise, the end shutters open, followed likewise by fan3 and fan4.

I doubt that any A&O operators will notice, but I will. For that matter, I suspect that most will be so focused on operation that any fan coming on and off will be a nice touch.

So why muck with all this? I want to get better at sound programming, in anticipation of attempting to sequentially control the motorized fans on a C&LS Train Master. Henry's factory paint is exquisite and I don't have the heart to strip it, so it will stay in Reading green. The A&O is undergoing a motive power shortage as coal shipments have increased, so the TM represents leased power.
« Last Edit: August 22, 2020, 03:46:28 PM by Bob »

Craig

  • Jr. Member
  • **
  • Posts: 68
    • Rio Grande 3rd Division
Re: LokSound advanced programming - GP9 radiator fans
« Reply #3 on: August 22, 2020, 06:17:44 PM »
Very cool Bob. Thanks for the explanation on the logic too. Seems pretty straight forward in their logic.

I’ll be listening for this on your engine now Bob :)
Craig
A&O Track and Electrical Crew