BVEStation

Author Topic: Modifying Program Source Code To Allow Dynamic Brake in Air Brake w/ P-Release  (Read 10733 times)

Offline Fan Railer

  • Global Moderator
  • Dispatcher
  • ****
  • Posts: 897
  • Gender: Male
  • Train Developer
    • View Profile
    • Fan Railer's YouTube Channel
As some of you may know, in real life, on locomotive hauled trains, i.e, Amtrak, NJT, the brake system is set up as an Air Brake with Partial release, (equivalent of old AMUE system in the NYCS). And, in real life, the dynamic / regenerative brakes are actuated based on the the air pressure in the brake pipe.

However, in OpenBVE, if you set a train's brake system to the AB w/ PR setting (which is indicated by the value "2" in the "brake type" command in the train.dat file), the dynamic brakes do not operate. I have identified the source code file in the program that dictates how trains operate under certain settings. It is the "TrainManager" file, found in the "old code" -> "OpenBve" -> "openBVE" -> "SourceCode" -> "BVE" -> "Program Files" -> "C Drive" (or whatever drive you have the BVE directory installed.
But the problem is, I am having trouble deciphering which lines of code need to be changed, and how many need to be changed, at that. So far, the only specific section I have identified is the following:
Quote
// deceleration provided by brake
         double pressureratio = Train.Cars[CarIndex].Specs.AirBrake.BrakeCylinderCurrentPressure / Train.Cars[CarIndex].Specs.AirBrake.BrakeCylinderServiceMaximumPressure;
         DecelerationDueToBrake = pressureratio * Train.Cars[CarIndex].Specs.BrakeDecelerationAtServiceMaximumPressure;
         // deceleration provided by motor
         if (Train.Cars[CarIndex].Specs.BrakeType != CarBrakeType.AutomaticAirBrake && Math.Abs(Train.Cars[CarIndex].Specs.CurrentSpeed) >= Train.Cars[CarIndex].Specs.BrakeControlSpeed & Train.Specs.CurrentReverser.Actual != 0 & !Train.Specs.CurrentEmergencyBrake.Actual) {
            double f = (double)Train.Specs.CurrentBrakeNotch.Actual / (double)Train.Specs.MaximumBrakeNotch;
            double a = Train.Cars[CarIndex].Specs.MotorDeceleration;
            DecelerationDueToMotor = f * a;
         } else {
            DecelerationDueToMotor = 0.0;
         }

But regardless of any changes I make to it, the operation in openBVE does not change; the dynamics refuse to actuate when the train brake mode is set to Air Brake w/ Partial Release. If anyone here was involved in the development of the source code or knows anyone who was, I would be grateful to hear their input on my situation.

Offline ipac

  • Head Admin
  • Dispatcher
  • ******
  • Posts: 646
    • View Profile
I haven't really looked at the code in a while, and I dont think I can really help much, but I'll offer some input, perhaps it'll give you some ideas or something.

That piece of code seems to be dictated by the fact that the train has to be moving, so when the train actually runs, the code segment will run upon braking.  It then calculates the Deceleration factor from the brake/notch and the motor deceleration, which is probably defined by the train.dat

I dont really see anything relating to brake type, other than the fact that its using it to decide whether or not to speed up or slow down the deceleration.

I would suggest taking a look at what Train.Cars.Specs is, and retrace it, perhaps you'll find something within that class.
BVEStation.

Offline Dr. Subway18

  • Operator
  • ***
  • Posts: 441
  • Gender: Male
  • proud 1999 Kenworth W900B owner(NTC cummins, 10sp)
    • View Profile
Dynamic braking is the use of the electric traction motors of a vehicle as generators when slowing. It is termed rheostatic if the generated electrical power is dissipated as heat in brake grid resistors, and regenerative if the power is returned to the supply line. Dynamic braking lowers the wear of friction-based braking components, and additionally regeneration reduces energy consumption. so in a standard MU train the dynamic brake is not based off air pressure.  (Diesel locomotive such as a Freight train or passenger)
« Last Edit: March 06, 2013, 12:10:54 am by Dr. Subway18 »

Offline Dj Hammers

  • Head Admin
  • Supervisor
  • ******
  • Posts: 1,034
  • Gender: Male
  • 7 Years of Developing for openBVE!
    • View Profile
    • My YouTube Channel
Dynamic braking is the use of the electric traction motors of a vehicle as generators when slowing. It is termed rheostatic if the generated electrical power is dissipated as heat in brake grid resistors, and regenerative if the power is returned to the supply line. Dynamic braking lowers the wear of friction-based braking components, and additionally regeneration reduces energy consumption. so in a standard MU train the dynamic brake is not based off air pressure. 
At least in SMEEs, the level of dynamic braking is controlled by the output of a air pressure sensor in the brake pipe. When a SMEE is braking, there is never 100% dynamic braking, it's always blended with air braking.

Offline Dr. Subway18

  • Operator
  • ***
  • Posts: 441
  • Gender: Male
  • proud 1999 Kenworth W900B owner(NTC cummins, 10sp)
    • View Profile
At least in SMEEs, the level of dynamic braking is controlled by the output of a air pressure sensor in the brake pipe. When a SMEE is braking, there is never 100% dynamic braking, it's always blended with air braking.
I was talking about A standard diesel loco, not NYC stock. but that's correct

Offline Fan Railer

  • Global Moderator
  • Dispatcher
  • ****
  • Posts: 897
  • Gender: Male
  • Train Developer
    • View Profile
    • Fan Railer's YouTube Channel
I was talking about A standard diesel loco, not NYC stock. but that's correct
I'm not sure how familiar you are with the subject, but the way that NJT has their locomotives configured is as I described. The generalized control stand does have a combined power handle that supposedly can be used for dynamic / regen brake only, but it is not standard practice to use it. This is evident from watching the engineer operate the train from the cab car. The independent brake handle is solely used for braking purposes, and yet, when you observe from the exterior of the train, the dynamics (on diesels) and the regen brake (on the ALPs) are obviously working.

Because the brake value design used by NJT is not self lapping (ie, set brake notches), pressure distribution is regulated manually through manipulation of the brake stand through the various brake application positions (release, hold, service, suppression). From this observation, you can logically conclude that the dynamic brake actuation then varies with the actual air pressure in the part of the system that contains the electric brake actuator, while a combination of lockout valves and inshot valves on the locomotive keep actual pressure in the brake cylinder to a minimum as to maximize the blend brake priority to the dynamic portion when the train is within the proper speed range.

The point is here, that the manual lapping option in OpenBVE, the way it is currently coded in the source code, does not allow the electric brake to operate at all. That is what I am trying to change.

Offline Dj Hammers

  • Head Admin
  • Supervisor
  • ******
  • Posts: 1,034
  • Gender: Male
  • 7 Years of Developing for openBVE!
    • View Profile
    • My YouTube Channel
Exactly. I think that there needs to be a BrakeType 3 that allows for blended air-dynamic braking.

Offline rstar

  • Operator
  • ***
  • Posts: 257
  • Gender: Male
  • MailMan
    • View Profile
Tonight I'm uploading some Air Brake System for SMEE and NTT train that I got from my school.
And Yes I go to TTHS so we have MTA RCI books and WH and GE Overhaul Repair books and Car maintenance's book.
So If you some need proof or help I would take a picture and post it.  8)
« Last Edit: March 06, 2013, 12:45:43 pm by rstar »

Offline Fan Railer

  • Global Moderator
  • Dispatcher
  • ****
  • Posts: 897
  • Gender: Male
  • Train Developer
    • View Profile
    • Fan Railer's YouTube Channel
Exactly. I think that there needs to be a BrakeType 3 that allows for blended air-dynamic braking.
Lol, so wanna joint me on the quest that is the journey through the indecipherable maze that is the TrainManager source code? haha.

Offline rstar

  • Operator
  • ***
  • Posts: 257
  • Gender: Male
  • MailMan
    • View Profile



there you go

Offline Fan Railer

  • Global Moderator
  • Dispatcher
  • ****
  • Posts: 897
  • Gender: Male
  • Train Developer
    • View Profile
    • Fan Railer's YouTube Channel
Yea, I know it's been more than a year, but I'm still looking at the code for this issue. In the mean time though, I've come up with a temporary solution:
OpenBVE HD: Bombardier ALP Locomotive Panel Animation Progress (Animated Brake Gauges)
OpenBVE How-To HD: Operating Non-Self-Lapping Brakes with Manual Application of Dynamic Brakes
Excerpt from the train readme file:
Quote
Brakes are non-self lapping; there is also no automatic application of the dynamic brake.

Brake positions are Service (SRV; apply brake pressure), Lap (LAP; hold brake pressure), and Release (REL; release brake pressure)

To use "dynamic brakes", place throttle in neutral, throw reverser into the R position, and move throttle between N and P2 depending on the level of dynamic braking desired.

Do not use a higher throttle position than P2 during dynamic braking if you value realism.

Also, be sure to bring throttle back to neutral below 5 mph, as that is the speed around which the dynamic brakes cut out in real life.

Finally, don't forget to throw the reverser back into the F position before you throttle up to accelerate again.

Maximum deceleration in emergency (72psi) is ~4.5 km/h/s or 2.8 mphps.
Maximum deceleration in full service (65psi) is ~4.25 km/h/s or 2.64 mphps.
I should note that this only works with the safety systems disabled (no ATS/ATC).