Elvas Tower: Negative direction Traction/Braking - Elvas Tower

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

Negative direction Traction/Braking Needle works only in 1 direction Rate Topic: -----

#1 User is offline   Stijn D.C. 

  • Engineer
  • Group: Status: Contributing Member
  • Posts: 516
  • Joined: 20-August 16
  • Gender:Male
  • Simulator:Open Rails
  • Country:

Posted 15 March 2020 - 08:22 AM

Hello,

How i can let work Traction/braking needle like AMMETER?

AMMETER works in 2 direction when u use -XXX XXX scalerange (example -600 600)

But for a other train with negative and positive scalerange in KiloNewtons (-120 120)

The needle works for braking to right area too :-(

ORTS code for this is:

                case CABViewControlTypes.TRACTION_BRAKING:
                    {
                        var direction = 0; // Forwards
                        if (cvc is CVCGauge && ((CVCGauge)cvc).Orientation == 0)
                            direction = ((CVCGauge)cvc).Direction;
                        data = 0.0f;
                        if (FilteredMotiveForceN != 0)
                            data = this.FilteredMotiveForceN;
                        else
                            data = this.LocomotiveAxle.AxleForceN;
                        if (DynamicBrakePercent > 0)
                        {
                            data = DynamicBrakeForceN;
                        }
                        data = Math.Abs(data);
                        switch (cvc.Units)
                        {
                            case CABViewControlUnits.AMPS:
                                if (MaxCurrentA == 0)
                                    MaxCurrentA = (float)cvc.MaxValue;
                                if (DynamicBrakeMaxCurrentA == 0)
                                    DynamicBrakeMaxCurrentA = (float)cvc.MinValue;
                                if (ThrottlePercent > 0)
                                {
                                    data = (data / MaxForceN) * MaxCurrentA;
                                 }
                                if (DynamicBrakePercent > 0)
                                {
                                    data = (DynamicBrakeForceN / MaxDynamicBrakeForceN) * DynamicBrakeMaxCurrentA;
                                }
                                data = Math.Abs(data);
                                break;
                    
                            case CABViewControlUnits.NEWTONS:
                                break;
                    
                            case CABViewControlUnits.KILO_NEWTONS:
                                data = data / 1000.0f;
                                break;
                    
                            case CABViewControlUnits.KILO_LBS:
                                data = data / 4448.22162f;
                                break;
                        }                   
                        if (direction == 1 && !(cvc is CVCGauge))
                            data = -data;
                        break;
                    }




Have someone idea what there must be change in code that this needle works like it must be.


In advance thanks,

Stijn

Page 1 of 1
  • 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