Finally completed the next thing I was working on, an
advanced brake cylinder simulation.
By 'advanced' I mean the brake cylinder is not simulated as a static volume with a constant size. Instead, the size is allowed to change depending on the brake cylinder pressure and the settings you enter in. This has some interesting effects, like the brake cylinder pressure 'stalling' as the air pumped in/out of the brake cylinder causes the brake piston to extend/retract instead of causing the pressure to change. (If you pay attention to graphs of brake cylinder pressure vs time, this is where the curve 'flattens' around 5 psi or so.)
Some warning though; this more realistic brake cylinder does not follow the same (simplified) rules that many of us have gotten used to over the last 20 years. While the advanced brake cylinder parameters will be easy to implement in some cases, the code can only make so many guesses before 20 year old .wag file programming gets in the way and doesn't give the brake cylinder pressures you want.
To use the advanced brake cylinder simulation, enter correct values for the brake cylinder tokens I added over a month ago:
ORTSBrakeCylinderDiameter,
ORTSBrakeCylinderPistonTravel, and
ORTSNumberBrakeCylinders. Note that the piston travel is referenced at 50 psi, so if you have a brake cylinder you know reaches 8 inches of travel at 64 psi, the value you actually want to enter is about 7.5 psi.
Also, the old
ORTSCylinderSpringPressure token is useful here too: The brake cylinder will rapidly extend from 0 to 80% of the rated travel as the brake cylinder pressure reaches the spring pressure. If you don't define a pressure, then 5 psi is assumed by default and 5 psi is pretty typical, so don't worry too much if you aren't sure what to use.
The advanced simulation will consider the actual volume of the brake cylinder vs the volume of the auxiliary reservoir (don't forget, you can now set the aux res volume with
ORTSAuxiliaryResCapacity) unless the brake system has a relay valve of some sort. While this is more realistic, this does mean that an auxiliary res with the wrong size will result in the wrong brake cylinder pressures. As such, Open Rails will attempt to adjust the value of
ORTSBrakeCylinderPipingVolume automatically (this will only happen if you do NOT define a piping volume value) to give the expected brake cylinder pressures, depending on the TripleValveRatio used. While this can correct for an aux res that's too large for the brake cylinders (this happens in real life),
it can not correct for an auxiliary res that is too small. In such a case, a warning will be produced in the log file.
Of course, if you know what's going on you can manually change
ORTSBrakeCylinderPipingVolume to get the pressures you want
. Finding the best piping volume can be done with trial and error (bigger piping volume = lower brake cylinder pressures, and vice versa), or with math. This preposterous equation will give the piping volume required for a desired full service brake cylinder pressure (assuming you are working in PSI) from a certain brake pipe pressure:
If this equation returns a negative value, the auxiliary res volume is too small, and you will need to investigate a solution. This may involve setting a larger auxiliary reservoir volume, smaller brake cylinder volume, or converting the brake system to use a relay valve by adding a supply reservoir.
Also added in this update is
ORTSBrakeForceReferencePressure. Normally, when you enter a "MaxBrakeForce" or "ORTSMaxBrakeShoeForce", the force will only be achieved when the brake cylinder pressure is at the value set by BrakeCylinderPressureForMaxBrakeBrakeForce. Unfortunately, this is not very convenient as many measurements of brake force are not taken at the maximum pressure, but at a pressure somewhere in between 0 and maximum. This is where
ORTSBrakeForceReferencePressure comes into play. If ORTSBrakeForceReferencePressure ( 50 psi ) is set, then whatever force you enter in "ORTSMaxBrakeShoeForce" will now occur when the brake cylinder pressure is 50 psi instead of, say, 100 psi. Note that in this case, the "max" brake shoe force value isn't actually the maximum; if the brake cylinder pressure exceeds 50 psi the brake force will increase beyond whatever force you entered.
On a related note, BrakeCylinderPressureForMaxBrakeBrakeForce is now an entirely optional token. Not only was this serving the role of reference pressure (no longer required if you use the previous token I mentioned), this would also set the absolute maximum brake cylinder pressure that would ever occur, as if there was a safety valve. Sometimes a safety valve is not realistic, so now if an engine or wagon doesn't have BrakeCylinderPressureForMaxBrakeBrakeForce in its file (or if the pressure is set to 0 or negative), then the limit on brake cylinder pressure will be removed entirely. This is not to say the brake cylinder pressure will suddenly shoot off to 10000 psi; the pressure will still follow the air simulation, but it will never be blocked from climbing higher and higher if the simulation justifies it. I recommend using this on any equipment which does not have a limiting valve or safety valve attached to the brake cylinder (ie: most freight stuff).
Note that other pressure limiters, such as ORTSMaxServiceCylinderPressure and ORTSMaxTripleValveCylinderPressure, will still apply. Also, if you choose to remove the pressure limiter, remember to define an
ORTSBrakeForceReferencePressure so OR knows how to calculate the brake force. If there's no cylinder pressure limit and no reference pressure, the reference pressure will be assumed to be 64 psi, but that might not be what you want.
Edit: After typing out the equation for brake cylinder piping volume, I realized that this was making the feature hard to use for anyone except me, and that Open Rails could calculate this equation on its own. So I made it so; OR will now automatically calculate the piping volume to (try to) get the brake cylinder pressure you'd expect. TripleValveRatio ( 2.5 ) should be left in your files if you want OR to try and calculate the volume automatically. I'll do it manually, but I don't blame anyone for not wanting to do that.