Elvas Tower: Diesel Locomotives with Two Engines - Elvas Tower

Jump to content

  • 2 Pages +
  • 1
  • 2
  • You cannot start a new topic
  • You cannot reply to this topic

Diesel Locomotives with Two Engines Rate Topic: -----

#11 User is offline   QJ-6811 

  • Conductor
  • Group: Status: Active Member
  • Posts: 385
  • Joined: 27-December 15
  • Gender:Male
  • Simulator:MSTS / Open Rails
  • Country:

Posted 28 April 2020 - 12:37 AM

Another thing, a bit "off topic", but in relation to Shift-Y and Ctr-Y.

Maybe noticed that "Y" also works with diesels. Originally "Y" for steam locomotives is for "Water scoop up / down", but the Key-Y with its discrete triggers 38 and 39 is also very useful for diesels.
After all, the combination "Shift-Y" / "Ctr-Y" / "Y" is nice, everything concerns diesel start-up or shut-down!

As an example I use the "Y" for sounds at "a cold start", as is often the case when a diesel engine is preheated. (usually heating the cooling water to 40 ° C) Then start the diesel (Shift-Y).
IOW, you have variations, first / cold start "Y" and then "Shift-Y" or just warm start with "Shift-Y".

Also other possibilities, I also use the "Y" as a trigger for "first start-up" (or when changing cab) to enable control of "the control of dachboard lights" or "switching on train influence" in the cabin. (or anything you can think of creatively with this ......)

Summarized:
Nothing needs to be changed in OR (it already works after all), but I hope no one later considers that "water scoop at diesels" is incorrect and removed this .........

#12 User is offline   FloBarr 

  • Apprentice
  • Group: Status: Dispatcher
  • Posts: 24
  • Joined: 13-May 20
  • Gender:Male
  • Simulator:OpenRails
  • Country:

Posted 16 May 2020 - 01:25 AM

Hi all,

I've read this topic carrefully, and, with french engines, found several issues that can be easily corrected:
-Stopping an engine on a multi prime mover locomotive doesn't change the available power and force. It can be solved by modifying the UpdateMotiveForce function from MSTSLocomotive.cs by:

            
        protected virtual void UpdateMotiveForce(float elapsedClockSeconds, float t, float AbsSpeedMpS, float AbsWheelSpeedMpS)
        {
            // Method to set force and power info
            // An alternative method in the steam locomotive will override this and input force and power info for it.
            if (PowerOn && Direction != Direction.N)
            {
                //** MON BAZAR: pondération de la puissance développée en fonction du nombre de moteurs en marche   **//
                //** Some vars used to calculate the total power usable for the loco                                **//
                float wRatioMoteur = 1;
                float wTotalPower=0;
                float wRunningPower=0;

                if (this is MSTSDieselLocomotive)
                {
                    //** Listing every engines for the Loco **//
                    foreach (var DieselEngine in (this as MSTSDieselLocomotive).DieselEngines)
                    {
                        //** Taking only running engines  **//
                        if (DieselEngine.EngineStatus== DieselEngine.Status.Running)
                        {
                            wRunningPower+=DieselEngine.OutputPowerW;
                        }
                        wTotalPower+= DieselEngine.OutputPowerW;
                    }
                    wRatioMoteur = wRunningPower / wTotalPower;
                }

                if (TractiveForceCurves == null)
                {
                    float maxForceN = MaxForceN * t * (1 - PowerReduction)*wRatioMoteur;
                    float maxPowerW = MaxPowerW * t * t * (1 - PowerReduction) * wRatioMoteur;

                    if (maxForceN * AbsWheelSpeedMpS > maxPowerW)
                        maxForceN = maxPowerW / AbsWheelSpeedMpS;
                    //if (AbsSpeedMpS > MaxSpeedMpS)
                    //    maxForceN = 0;
                    if (AbsSpeedMpS > MaxSpeedMpS - 0.05f)
                        maxForceN = 20 * (MaxSpeedMpS - AbsSpeedMpS) * maxForceN;
                    if (AbsSpeedMpS > (MaxSpeedMpS))
                        maxForceN = 0;
                    MotiveForceN = maxForceN;
                }
                else
                {
                    MotiveForceN = TractiveForceCurves.Get(t, AbsWheelSpeedMpS) * (1 - PowerReduction) * wRatioMoteur;
                    if (MotiveForceN < 0 && !TractiveForceCurves.AcceptsNegativeValues())
                        MotiveForceN = 0;
                }
                TractiveForceN = MotiveForceN;
            }
            else
                TractiveForceN = 0f;

            if (MaxForceN > 0 && MaxContinuousForceN > 0 && PowerReduction < 1)
            {
                MotiveForceN *= 1 - (MaxForceN - MaxContinuousForceN) / (MaxForceN * MaxContinuousForceN) * AverageForceN * (1 - PowerReduction);
                float w = (ContinuousForceTimeFactor - elapsedClockSeconds) / ContinuousForceTimeFactor;
                if (w < 0)
                    w = 0;
                AverageForceN = w * AverageForceN + (1 - w) * MotiveForceN;
            }
        }

(Sorry, some words or explanation are in french, was initialy for my use...)

This modification make me introduce a second one, in cab. It would bu usefull to have a RPM dial for the Helpers Locomotives in cab. It can be added by the following codes in enumeration of control types in MSTSLocomotive.cs:
    public enum CABViewControlTypes
    {
        NONE,
        SPEEDOMETER,
        MAIN_RES,
  <SNAP...>
        ORTS_MIRRORS,
        RPM_HELPER,
 
        // Further CabViewControlTypes must be added above this line, to avoid their malfunction in 3DCabs
        EXTERNALWIPERS,
        LEFTDOOR,
        RIGHTDOOR,
        MIRRORS
    }


and in GetDataOf in MSTSLocomotive.cs
        public virtual float GetDataOf(CabViewControl cvc)
        {
            float data = 0;
            switch (cvc.ControlType)
            {

<SNAP ...>
                //** Getting the RPM for Helpers
                case CABViewControlTypes.RPM_HELPER:
                    {
                        foreach (var car in Train.Cars)
                        {
                            // Testing each car in the train which is not the player loco: if a RPM is found, it's used for display
                            var dieselLoco = car as MSTSDieselLocomotive;
                            if (dieselLoco != null && dieselLoco.AcceptMUSignals)
                            {
                                if (car != Simulator.PlayerLocomotive)
                                {
                                    
                                    data = dieselLoco.DieselEngines[0].RealRPM;
                                    break;
                                }
                            }
                        }
                        break;
                    }
                default:
                    {
                        data = 0;
                        break;
                    }
            }
            return data;
        }


If interrested, a more complete code modification for multi engine is possible (and written), and could be posted (or sent), allowing to manage engines by series. This possibility was used on Turboliners, and style exist on DMU.

Flo

#13 User is offline   steamer_ctn 

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

Posted 16 May 2020 - 02:34 PM

View PostFloBarr, on 16 May 2020 - 01:25 AM, said:

-Stopping an engine on a multi prime mover locomotive doesn't change the available power and force. It can be solved by modifying the UpdateMotiveForce function from MSTSLocomotive.cs by:
............................

If interrested, a more complete code modification for multi engine is possible (and written), and could be posted (or sent), allowing to manage engines by series. This possibility was used on Turboliners, and style exist on DMU.

Thanks for sharing this.

What OR version was the code developed in?

The code that you have suggested for MSTSLocomotive.cs should actually be placed in MSTSDieselLocomotive.cs as there is a method in there that overwrites the UpdateMotiveForce method in MSTSLocomotive.cs.

I agree with the concept that you have suggested for "turning" the prime movers on/off. There was a similar concept in the code that appears to have been inadvertently removed, and since I am working in this area at the moment, I am happy to add some appropriate code to correct it.

In regard to the Helper RPM meter, I am happy to add it as well, provided that a few people indicate that it would be a useful addition.

You can send me the code modification for the multi engine if you wish and I will have a look at it.

Thanks

#14 User is offline   FloBarr 

  • Apprentice
  • Group: Status: Dispatcher
  • Posts: 24
  • Joined: 13-May 20
  • Gender:Male
  • Simulator:OpenRails
  • Country:

Posted 16 May 2020 - 11:55 PM

Hello,

Thanks for the reply!

I work on a 1.3.1 version, so my code may not be up to date... How can I send you code modification easily than in topic? I presume a better way il possible!

Flo

#15 User is offline   steamer_ctn 

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

Posted 17 May 2020 - 12:26 AM

View PostFloBarr, on 16 May 2020 - 11:55 PM, said:

I work on a 1.3.1 version, so my code may not be up to date... How can I send you code modification easily than in topic? I presume a better way il possible!

Sadly it will be out of date.

Send me a PM.

Thanks

  • 2 Pages +
  • 1
  • 2
  • 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