Author Topic: Loksound Advanced Programming - PumpUpAirAtStartup  (Read 1177 times)

Bob

  • Global Moderator
  • Full Member
  • *****
  • Posts: 162
    • Bob's web site
Loksound Advanced Programming - PumpUpAirAtStartup
« on: September 16, 2020, 07:27:28 PM »
Here's a quick and easy bit of sound slot programming to pump up the air reservoir when the engine starts up. Sure, the air pump comes mapped to a throttle function, but what if your crews are unlikely to manually pump up the air?

This sound slot doesn't prevent a train from moving right away, but operator instructions could include waiting for the air compressor to stop and charge the reservoir before pulling out of the yard.



Remember you can click on any image to see it full size.

The logic is simple. The sound slot starts running when the prime mover is started. Global share1 is set by the engine sound slot. It is a value of 0 when not running, and jumps to 2 when cranking begins. After that, it jumps to 9 at idle. At least that's how Share1 behaves in the EMD 567AB file S0711 does. How did I figure this out? By using the sound slot simulator for the 567BC sound slot.

At idle, the state advances from state cranking to state PumpAir. The red bar at the bottom of the state indicates that the state plays a sound; in this case it is the F7 Air Compressor 1 sound slot. Timer 1 (tmr1) is also initialized to ChargeTime and once in state PumpAir, it begins to decrement. Note that tmr1 can hold a value between 0 and 255.

When either the engine is stopped, or timer1 (tmr1) hits 0, the air compressor stops and returns back to Mute. Since this will be used in a MU pair of David's engines, I set ChargeTime to a different value in the file for his other F3.

Triggering this is simple.



In the row for F8, which we use to start and stop the prime mover, in the Sounds column this sound slot has been added to the other sound slots started when F8 is pressed.

Since I also program the playback speed of the prime mover to be different in each consisted unit, the air pumps in each engine will not thump in unison.

And that's all, folks!

Bob