Elvas Tower: Trying to fix starting friction myself - Elvas Tower

Jump to content

  • 5 Pages +
  • 1
  • 2
  • 3
  • Last »
  • You cannot start a new topic
  • You cannot reply to this topic

Trying to fix starting friction myself Any advice is appreciated here Rate Topic: -----

#11 User is offline   steamer_ctn 

  • Open Rails Developer
  • Group: Posts: Elite Member
  • Posts: 1,980
  • Joined: 24-June 11
  • Gender:Male
  • Country:

Posted 11 January 2020 - 12:13 PM

View PostPerryPlatypus, on 10 January 2020 - 11:02 AM, said:

By the way, if you want another issue to get angry about, I think OR's handling of adhesion in snow/rain with the "Advanced Adhesion Model" is a problem that causes even more dramatic variations from reality, but unfortunately it too is a topic that is extremely hard to find good scholarly data on, especially related to modern heavy-haul freight operations... The problem is such that on an upcoming payware route release, we are going to have to stipulate to users that for snow and rain activities to work, they must use the default adhesion correction factor of 135% (or whatever it is), because using the "realistic" correction factor of 100% makes it physically impossible to run prototypical (certain tonnage and locomotives) heavy trains up mountain grades in the snow...

Can you provide some more detail on the trains that you are trying to run up the hill, and what is happening?

Locomotive types, tonnage, grade, etc?

Thanks

#12 User is offline   PerryPlatypus 

  • Fireman
  • PipPipPip
  • Group: Access 1 Open Rails Forums
  • Posts: 207
  • Joined: 13-January 10
  • Gender:Male
  • Location:Spokane, WA
  • Simulator:Open Rails
  • Country:

Posted 11 January 2020 - 09:00 PM

View Poststeamer_ctn, on 11 January 2020 - 12:13 PM, said:

Can you provide some more detail on the trains that you are trying to run up the hill, and what is happening?

Locomotive types, tonnage, grade, etc?

Thanks


Hi Peter,

Feel free to PM me or start a separate thread on the below if we don't want to pollute this thread with the discussion.

An example consist below, which can go up the steady 2.2% grade of Mullan Pass in real life at a steady 10 to 12 MPH during rain or snowfall.

Consist: A 125-car coal train configured as follows: 3 x ES44AC, 78 loaded coal cars (286,000 lbs each), 4 x SD70ACe mid-train (I have seen either 4 or 5 mid-train units in snow), 47 more loaded coal cars (286,000 lbs each), 1 x ES44AC on rear.

When I try to run this consist in OR during snowfall, it slips like crazy, cannot keep moving (quickly stalls out if I get a run at the hill at the bottom of the grade). I believe we are using realistic Curtius Kniffler adhesion numbers, because in clear weather we get spot-on starting and "continuous" tractive effort and very realistic speed compared to reality, but I'm curious to see the results you can get. Getting going from a stop on the grade is essentially impossible, and even keeping moving if you get a run at the hill seems impossible for me. Again, using 100% correction factor for adhesion, and adhesion proportional to snow/rain/fog turned ON.

#13 User is offline   steamer_ctn 

  • Open Rails Developer
  • Group: Posts: Elite Member
  • Posts: 1,980
  • Joined: 24-June 11
  • Gender:Male
  • Country:

Posted 11 January 2020 - 09:03 PM

Hi Sean,


Thanks I will PM you.

#14 User is offline   NickonWheels 

  • Conductor
  • Group: Posts: Active Member
  • Posts: 327
  • Joined: 05-December 19
  • Gender:Male
  • Simulator:ORTS
  • Country:

Posted 17 January 2020 - 09:43 AM

Updates on the subject...

I deleted ORTSFriction and am currently shifting everything done so far into the usual MSTSWagon file. From the first look I think that the old parts of the code (meaning the equation with ORTSBearingType) would still work outside of the new part in making, hopefully it then works too as it requires more lines in the wagon section to work; for the moment these being the three Davis lines plus ORTSStandstillFriction and ORTSMergeSpeed. I will get further onto describing this when I got it done for the moment.

#15 User is offline   NickonWheels 

  • Conductor
  • Group: Posts: Active Member
  • Posts: 327
  • Joined: 05-December 19
  • Gender:Male
  • Simulator:ORTS
  • Country:

Posted 17 January 2020 - 10:59 AM

After much reshuffling it still does not work, ORTS always reverts to the old equation. Is there anyone who can describe to me what is wrong here?

Maybe it works when kicking out the current code section but then the addition of mine would not be eligable for anything useful...

#16 User is offline   NickonWheels 

  • Conductor
  • Group: Posts: Active Member
  • Posts: 327
  • Joined: 05-December 19
  • Gender:Male
  • Simulator:ORTS
  • Country:

Posted 18 January 2020 - 12:51 AM

Weird!
I tested the code uploaded here with the Ruel Sub, ES44s and the built-in graincars and... Something strange is going on. The engines still work as they use the old equation, even the third one I converted with the new lines (but does not work for some reason); the wicked thing is that the graincars using the three Davis lines and bearing type (like the first two diesels) now show zero friction at all times! Though I have not changed anything in the old section...

It´s fair to say that ORTS looks more and more hopeless from the 'coding and actually make it work as intended' point of view. You can´t imagine how frustrating this is...

#17 User is offline   Csantucci 

  • Member, Board of Directors
  • Group: Posts: Elite Member
  • Posts: 7,460
  • Joined: 31-December 11
  • Gender:Male
  • Country:

Posted 18 January 2020 - 09:56 AM

Hi Nick,
I had a short look at your code. You might have made an error in this line
if (IsDavisFriction || IsORTSFriction == false)    // If Davis parameters are not defined in WAG file, then use default methods

In the original code there was
            if (IsDavisFriction == false)    // If Davis parameters are not defined in WAG file, then use default methods

Are you sure that your if clause is correct? Your if clause becomes true if IsDavisFriction is true or if IsORTSFriction is false. Maybe you wanted it true if IsDavisFriction is false or IsIRTSFriction is false? In such case your clause must be
if (IsDavisFriction == false || IsORTSFriction == false)    // If Davis parameters are not defined in WAG file, then use default methods

or, in a more compact way
if (!IsDavisFriction || !IsORTSFriction)    // If Davis parameters are not defined in WAG file, then use default methods


#18 User is offline   NickonWheels 

  • Conductor
  • Group: Posts: Active Member
  • Posts: 327
  • Joined: 05-December 19
  • Gender:Male
  • Simulator:ORTS
  • Country:

Posted 18 January 2020 - 10:04 AM

if ( !IsDavisFriction|| !IsORTSFriction )


This is meant to use the old MSTS friction setting if DavisFriction and ORTSFriction are both not in use. The real problem is that DavisFriction (the older part partly using ORTSBearingType) is still used instead of ORTSFriction even when the two new lines are present in the wagon section of the .eng/wag file. For unknown reason the new chunkof code is bypassed as ORTS seemingly does not know the new lines although they are defined just as the lines used in the current model.
// wag file data
        public string MainShapeFileName;
        public string FreightShapeFileName;
        public float FreightAnimMaxLevelM;
        public float FreightAnimMinLevelM;
        public float FreightAnimFlag = 1;   // if absent or >= 0 causes the freightanim to drop in tenders
        public string Cab3DShapeFileName; // 3DCab view shape file name
        public string InteriorShapeFileName; // passenger view shape file name
        public string MainSoundFileName;
        public string InteriorSoundFileName;
        public string Cab3DSoundFileName;
        public float ExternalSoundPassThruPercent = -1;
        public float WheelRadiusM = 1;          // provide some defaults in case it's missing from the wag
        protected float StaticFrictionFactorN;    // factor to multiply friction by to determine static or starting friction - will vary depending upon whether roller or friction bearing
        float FrictionLowSpeedN; // Davis low speed value 0 - 5 mph
        float FrictionBelowMergeSpeedN; // Davis low speed value for defined speed
        public float Friction0N;        // static friction
        protected float Friction5N;               // Friction at 5mph
        public float StandstillFrictionN;
        public float MergeSpeedFrictionN;
        public float MergeSpeedMpS;
        public float DavisAN;           // davis equation constant
        public float DavisBNSpM;        // davis equation constant for speed
        public float DavisCNSSpMM;      // davis equation constant for speed squared
        public float DavisDragConstant; // Drag coefficient for wagon
        public float WagonFrontalAreaM2; // Frontal area of wagon
        public float TrailLocoResistanceFactor; // Factor to reduce base and wind resistance if locomotive is not leading - based upon original Davis drag coefficients


#19 User is offline   Csantucci 

  • Member, Board of Directors
  • Group: Posts: Elite Member
  • Posts: 7,460
  • Joined: 31-December 11
  • Gender:Male
  • Country:

Posted 18 January 2020 - 10:13 AM

Sorry, but I don't follow you. What do you want that the mentioned if clause does?

#20 User is offline   NickonWheels 

  • Conductor
  • Group: Posts: Active Member
  • Posts: 327
  • Joined: 05-December 19
  • Gender:Male
  • Simulator:ORTS
  • Country:

Posted 18 January 2020 - 10:19 AM

Quote

What do you want that the mentioned if clause does?


It´s supposed that ORTS goes back to the MSTS friction section if neither of ORTSDavis_A, ORTSDavis_B, ORTSDavis_C, ORTSBearingType, ORTSStandstillFriction or ORTSMergeSpeed is used in the wagon section.

#21 User is offline   Csantucci 

  • Member, Board of Directors
  • Group: Posts: Elite Member
  • Posts: 7,460
  • Joined: 31-December 11
  • Gender:Male
  • Country:

Posted 18 January 2020 - 10:28 AM

Then I assume you have to modify the clause as I am suggesting.

#22 User is offline   NickonWheels 

  • Conductor
  • Group: Posts: Active Member
  • Posts: 327
  • Joined: 05-December 19
  • Gender:Male
  • Simulator:ORTS
  • Country:

Posted 18 January 2020 - 10:33 AM

Quote

Then I assume you have to modify the clause as I am suggesting.


Yes, I just fixed this line. Another 'if' clause is maybe causing the code extention not to work.
if (IsDavisFriction == true) // test to see if OR thinks that Davis Values have been entered in WG file.
            {
                if (DavisAN == 0 || DavisBNSpM == 0 || DavisCNSSpMM == 0 && StandstillFrictionN >= 0 && MergeSpeedMpS >= 0) // If Davis parameters are not defined in WAG file, then set falg to use default friction values
                    IsDavisFriction = false; // set to false - indicating that Davis friction is not used
            }
            if (IsORTSFriction == true) // test to see if OR thinks that Davis Values have been entered in WAG file.
            {
                if (DavisAN > 0 || DavisBNSpM > 0 || DavisCNSSpMM > 0 && StandstillFrictionN > 0 && MergeSpeedMpS > 0) // If Davis parameters are not defined in WAG file, then set falg to use default friction values
                    IsORTSFriction = true;
                else IsORTSFriction = false; // set to false - indicating that Davis friction is not used


#23 User is offline   Csantucci 

  • Member, Board of Directors
  • Group: Posts: Elite Member
  • Posts: 7,460
  • Joined: 31-December 11
  • Gender:Male
  • Country:

Posted 18 January 2020 - 11:32 AM

This is different from your file above. The line
            if (IsORTSFriction == true) // test to see if OR thinks that Davis Values have been entered in WAG file.

is of no use.
Remember also that VS computes first the && and then the ||, so I don't know if your long if clauses do what you desire. I suggest you to use the debugger to check how your changes behave.

#24 User is offline   NickonWheels 

  • Conductor
  • Group: Posts: Active Member
  • Posts: 327
  • Joined: 05-December 19
  • Gender:Male
  • Simulator:ORTS
  • Country:

Posted 19 January 2020 - 01:54 AM

I just deleted this particular line...
if (IsDavisFriction == true) // test to see if OR thinks that Davis Values have been entered in WG file.
            {
                if (DavisAN == 0 || DavisBNSpM == 0 || DavisCNSSpMM == 0 && StandstillFrictionN >= 0 && MergeSpeedMpS >= 0) // If Davis parameters are not defined in WAG file, then set falg to use default friction values
                    IsDavisFriction = false; // set to false - indicating that Davis friction is not used
            }
            if (IsORTSFriction == true) // test to see if OR thinks that Davis Values have been entered in WAG file.
            {
                if (DavisAN > 0 || DavisBNSpM > 0 || DavisCNSSpMM > 0 && StandstillFrictionN > 0 && MergeSpeedMpS > 0) // If Davis parameters are not defined in WAG file, then set falg to use default friction values
                    IsORTSFriction = true;
                else IsORTSFriction = false; // set to false - indicating that Davis friction is not used
                    // Davis formulas only apply above merge speed, so different treatment required for low speed
                    if (AbsSpeedMpS > MpS.FromMpH(MergeSpeedMpS))     // if speed above merge speed then turn off low speed calculations
                        IsBelowMergeSpeed = false;
                    if (AbsSpeedMpS == 0.0)
                        IsBelowMergeSpeed = true;

                    if (IsBelowMergeSpeed)
                    {

                        // Dtermine the starting friction factor based upon the type of bearing

                        float StartFrictionLowLoadN = StandstillFrictionN;  // Starting friction

                        // Determine the starting resistance due to wheel bearing temperature
                        // Note reference values in lbf and US tons - converted to metric values as appropriate
                        // At -10 DegC it will be equal to the snowing value, as the temperature increases to 25 DegC, it will move towards the summer value
                        // Assume a linear relationship between the two sets of points above and plot a straight line relationship.
                        const float LowGrad = -0.15f;
                        float LowIntersect = 7.15f * (StandstillFrictionN / DavisAN);
                        float HighIntersect = 18.5f * (StandstillFrictionN / DavisAN);

                        if (WheelBearingTemperatureDegC < -10)
                        {
                            // Set to snowing (frozen value)
                            StartFrictionLowLoadN = N.FromLbf(8f * (StandstillFrictionN / DavisAN));  // Starting friction for a car with standard roller bearings, snowing
                        }
                        else if (WheelBearingTemperatureDegC > 25)
                        {
                            // Set to normal temperature value
                            StartFrictionLowLoadN = N.FromLbf(2.5f * (StandstillFrictionN / DavisAN) * (StandstillFrictionN / DavisAN));  // Starting friction for a 10 ton(US) car with standard roller bearings, not snowing
                        }
                        else
                        {
                            // Set to variable value as bearing heats and cools
                            StartFrictionLowLoadN = N.FromLbf(LowGrad * WheelBearingTemperatureDegC + LowIntersect);
                        }

                        // Determine the running resistance due to wheel bearing temperature
                        float WheelBearingTemperatureResistanceFactor = 0;

                        // Assume the running resistance is impacted by wheel bearing temperature, ie gets higher as tmperature decreasses. This will only impact the A parameter as it is related to
                        // bearing. Assume that resisnce will increase by 30% as temperature drops below 0 DegC.
                        // At -10 DegC it will be equal to the snowing value, as the temperature increases to 25 DegC, it will move towards the summer value
                        // Assume a linear relationship between the two sets of points above and plot a straight line relationship.
                        const float RunGrad = -0.0085714285714286f;
                        const float RunIntersect = 1.2142857142857f;

                        if (WheelBearingTemperatureDegC < -10)
                        {
                            // Set to snowing (frozen value)
                            WheelBearingTemperatureResistanceFactor = 1.3f;
                        }
                        else if (WheelBearingTemperatureDegC > 25)
                        {
                            // Set to normal temperature value
                            WheelBearingTemperatureResistanceFactor = 1.0f;
                        }
                        else
                        {
                            // Set to variable value as bearing heats and cools
                            WheelBearingTemperatureResistanceFactor = RunGrad * WheelBearingTemperatureDegC + RunIntersect;
                        }
                        // If hot box has been initiated, then increase friction on the wagon significantly
                        if (HotBoxActivated && ActivityElapsedDurationS > HotBoxStartTimeS)
                        {
                            WheelBearingTemperatureResistanceFactor = 2.0f;
                            StaticFrictionFactorN *= 2.0f;
                        }
                        // Calculation of resistance @ low speeds
                        // Wind resistance is not included at low speeds, as it does not have a significant enough impact
                        MergeSpeedFrictionN = DavisAN * WheelBearingTemperatureResistanceFactor + MpS.FromMpH(MergeSpeedMpS) * (DavisBNSpM + MpS.FromMpH(MergeSpeedMpS) * DavisCNSSpMM); // Calculate friction @ merge speed
                        Friction0N = StandstillFrictionN * StaticFrictionFactorN; // Static friction is journal or roller bearing friction x weight factor based upon US tons as this matches reference value
                        FrictionLowSpeedN = ((1.0f - (AbsSpeedMpS / MpS.FromMpH(MergeSpeedMpS))) * (Friction0N - MergeSpeedFrictionN)) + MergeSpeedFrictionN; // Calculate friction below merge speed - decreases linearly with speed
                        FrictionForceN = FrictionLowSpeedN; // At low speed use this value
                    }
                    else
                    {
                        // Determine the running resistance due to wheel bearing temperature
                        float WheelBearingTemperatureResistanceFactor = 0;

                        // Assume the running resistance is impacted by wheel bearing temperature, ie gets higher as tmperature decreasses. This will only impact the A parameter as it is related to
                        // bearing. Assume that resisnce will increase by 30% as temperature drops below 0 DegC.
                        // At -10 DegC it will be equal to the snowing value, as the temperature increases to 25 DegC, it will move towards the summer value
                        // Assume a linear relationship between the two sets of points above and plot a straight line relationship.
                        const float RunGrad = -0.0085714285714286f;
                        const float RunIntersect = 1.2142857142857f;

                        if (WheelBearingTemperatureDegC < -10)
                        {
                            // Set to snowing (frozen value)
                            WheelBearingTemperatureResistanceFactor = 1.3f;
                        }
                        else if (WheelBearingTemperatureDegC > 25)
                        {
                            // Set to normal temperature value
                            WheelBearingTemperatureResistanceFactor = 1.0f;
                        }
                        else
                        {
                            // Set to variable value as bearing heats and cools
                            WheelBearingTemperatureResistanceFactor = RunGrad * WheelBearingTemperatureDegC + RunIntersect;

                        }

                        // If hot box has been initiated, then increase friction on the wagon significantly
                        if (HotBoxActivated && ActivityElapsedDurationS > HotBoxStartTimeS)
                        {
                            WheelBearingTemperatureResistanceFactor = 2.0f;
                        }

                        FrictionForceN = DavisAN * WheelBearingTemperatureResistanceFactor + AbsSpeedMpS * (DavisBNSpM + AbsSpeedMpS * DavisCNSSpMM); // for normal speed operation

                        // if this car is a locomotive, but not the lead one then recalculate the resistance with lower value as drag will not be as high on trailing locomotives
                        // Only the drag (C) factor changes if a trailing locomotive, so only running resistance, and not starting resistance needs to be corrected
                        if (WagonType == WagonTypes.Engine && Train.LeadLocomotive != this)
                        {
                            FrictionForceN = DavisAN * WheelBearingTemperatureResistanceFactor + AbsSpeedMpS * (DavisBNSpM + AbsSpeedMpS * (TrailLocoResistanceFactor * DavisCNSSpMM));
                        }

                        // Test to identify whether a tender is attached to the leading engine, if not then the resistance should also be derated as for the locomotive
                        bool IsLeadTender = false;
                        if (WagonType == WagonTypes.Tender)
                        {
                            bool PrevCarLead = false;
                            foreach (var car in Train.Cars)
                            {
                                // If this car is a tender and the previous car is the lead locomotive then set the flag so that resistance will be reduced
                                if (car == this && PrevCarLead)
                                {
                                    IsLeadTender = true;
                                    break;  // If the tender has been identified then break out of the loop, otherwise keep going until whole train is done.
                                }
                                // Identify whether car is a lead locomotive or not. This is kept for when the next iteration (next car) is checked.
                                if (Train.LeadLocomotive == car)
                                {
                                    PrevCarLead = true;
                                }
                                else
                                {
                                    PrevCarLead = false;
                                }

                            }

                            // If tender is coupled to a trailing locomotive then reduce resistance
                            if (!IsLeadTender)
                            {
                                FrictionForceN = DavisAN * WheelBearingTemperatureResistanceFactor + AbsSpeedMpS * (DavisBNSpM + AbsSpeedMpS * (TrailLocoResistanceFactor * DavisCNSSpMM));
                            }

                        }
                    }


The arrangement of || and && symbols seemingly have to be that way as otherwise the doings of the older friction calculation got messed up in some clumsy way (as told cars have no friction at all then).

The problem though is still that the code addition seemingly not getting used. From observing my rebuilt ES44 the standstill frction value is higher than of the units using ORTSBearingType, maybe because ORTS defaults to friction bearings if ORTSBearingType is not found in the wagon section. The code though does mean that if ORTSStandstillFriction and ORTSMergeSpeed both have a value higher than 0 (which basicly means these lines must be present in the wagon section) ORTS should use the added code section. Judging from the beginning of this code snippet I can´t really understnd why ORTS still takes the older calculation although the two new lines are present with the modified engine, which of course lacks ORTSBearingType and as a consequence should not use the older code.

#25 User is offline   NickonWheels 

  • Conductor
  • Group: Posts: Active Member
  • Posts: 327
  • Joined: 05-December 19
  • Gender:Male
  • Simulator:ORTS
  • Country:

Posted 20 January 2020 - 09:00 AM

I changed the first few lines over and over again to see if anything could fix this...
if (IsDavisFriction == true) // test to see if OR thinks that Davis Values have been entered in WG file.
            {
                if (DavisAN == 0 || DavisBNSpM == 0 || DavisCNSSpMM == 0 && StandstillFrictionN >= 0 && MergeSpeedMpS >= 0) // If Davis parameters are not defined in WAG file, then set falg to use default friction values
                    IsDavisFriction = false; // set to false - indicating that Davis friction is not used
            }
            if (IsORTSFriction == true) // test to see if OR thinks that Davis Values have been entered in WG file.
            {
                if (DavisAN == 0 || DavisBNSpM == 0 || DavisCNSSpMM == 0 && StandstillFrictionN == 0 && MergeSpeedMpS == 0) // If Davis parameters are not defined in WAG file, then set falg to use default friction values
                    IsORTSFriction = false; // set to false - indicating that Davis friction is not used
            }
            if (IsORTSFriction) // test to see if OR thinks that Davis Values have been entered in WAG file.
            {
                    // Davis formulas only apply above merge speed, so different treatment required for low speed
                    if (AbsSpeedMpS > MpS.FromMpH(MergeSpeedMpS))     // if speed above merge speed then turn off low speed calculations
                        IsBelowMergeSpeed = false;
                    if (AbsSpeedMpS == 0.0)
                        IsBelowMergeSpeed = true;


Honestly I think there is still some influence from ORTSBearingType though this line is NOT used in this part of the code. I´m nearly throwing the towel as obviously nothing can change this for the better. It more and more looks like whether VS or ORTS has a bug regarding how to read the code; I don´t really think this is the case...

As the older parts work with AND without ORTSBearingType, where ORTS just defaults to friction bearings and exactly this is what I get with my modified ES44, not what the engine should have according to this code and the lines in the wagon section.
 ORTSDavis_A ( 2670.353756 )
 ORTSDavis_B ( 18.59957 )
 ORTSDavis_C ( 1.607582 )
 ORTSStandstillFriction ( 2803.871443 )
 ORTSMergeSpeed ( 1.674476 )


As you can read here the value of the third engine is basicly what ORTS calculates with the older code section, guessing it has friction bearings as ORTSBearingType is not present in the wagon section. This value should be below 1000lbf according to the ORTSStandstillFriction value.

  • 5 Pages +
  • 1
  • 2
  • 3
  • Last »
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users