Elvas Tower: Cruise control - Elvas Tower

Jump to content

Posting Rules

All new threads will be started by members of the Open Rails team, Staff, and/or Admins. Existing threads started in other forums may get moved here when it makes sense to do so.

Once a thread is started any member may post replies to it.
  • 25 Pages +
  • « First
  • 17
  • 18
  • 19
  • 20
  • 21
  • Last »
  • You cannot start a new topic
  • You cannot reply to this topic

Cruise control Rate Topic: -----

#181 User is offline   Csantucci 

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

Posted 19 November 2022 - 12:03 PM

ORNYMG 134 has now ModeSwitchAllowedWithThrottleNotAtZero (default false) instead of DisableManualSwitchToAutoWhenThrottleNotAtZero and DisableManualSwitchToManualWhenSetForceNotAtZero.
The manual has been updated and can be found (in html version) here http://interazioni-e...wYear_MG_Manual (search for Cruise Control chapter). The new parameter can be used both when throttle commands selected speed and when throttle commands max force, and both when there is a simple throttle or when there is a combined control.

Changes have been inserted also in the official OR versions, but the related Unstable release hasn't yet appeared.

Blueprint approval is still not there.

#182 User is offline   Csantucci 

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

Posted 23 November 2022 - 12:12 PM

The Cruise Control blueprint has now been approved (thanks, James) and the PR has now been approved (thanks, César), so I could merge the PR into the master branch, which means that starting from Saturday the feature should be present also in the official Testing release (in addition to ORNYMG).
I want to credit again Jindrich, which is the initial author of this feature. Most part of the code and logic is his creation.

#183 User is offline   Batuka 

  • Apprentice
  • Group: Status: Dispatcher
  • Posts: 14
  • Joined: 22-August 18
  • Gender:Male
  • Simulator:MSTS
  • Country:

Posted 24 November 2022 - 07:26 AM

I have a few questions about the Multi Position Controller.

  • Is it possible to control the Force Selector with a Multi Position controller?
  • Why is a unique value not received from the Cabview controller for each position type?:

Position Type	Cabview animation frame
ThrottleIncrease	0
DynamicBrakeDecrease	0
TrainBrakeDecrease	0
DynamicBrakeHold	0
ThrottleIncreaseOrDynamicBrakeDecreaseFast	0
ThrottleIncreaseOrDynamicBrakeDecrease	0
DynamicBrakeIncreaseOrThrottleDecreaseFast	0
DynamicBrakeIncreaseOrThrottleDecrease	0
KeepCurrent	0
Drive	1
ThrottleHold	1
Neutral	2
DynamicBrakeIncrease	3
TrainBrakeIncrease	4
DynamicBrakeIncreaseFast	5
EmergencyBrake	5
ThrottleIncreaseFast	6
ThrottleDecrease	7
ThrottleDecreaseFast	8
SelectedSpeedIncrease	9
SelectedSpeedDecrease	10
SelectSpeedZero	11


Among these, there are completely opposite ones, which are recived the same value. For example: ThrottleIncreaseOrDynamicBrakeDecrease and DynamicBrakeIncreaseOrThrottleDecrease

#184 User is offline   Csantucci 

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

Posted 24 November 2022 - 08:13 AM

1. No. Why do you need it? To manage the force, if you don't want to use the throttle for it, you can use the control ORTS_SELECTED_SPEED_MAXIMUM_ACCELERATION, which may be displayed as a lever.
2. In fact it is as you are writing, and I think this should be changed to provide different values for every position type. However this must be done carefully to avoid malfunctions in already published locomotives. I have always used only Position Types SelectedSpeedIncrease, Neutral, SelectedSpeedDecrease and SelectSpeedZero. It would be interesting to know what Position Types other people have used.

A comment by Jindrich about point 2. would also be welcome.

#185 User is offline   Aldarion 

  • Engineer
  • PipPipPipPipPip
  • Group: ET Owner
  • Posts: 629
  • Joined: 11-February 13
  • Gender:Male
  • Location:Lisbon, Portugal
  • Simulator:Open Rails
  • Country:

Posted 07 January 2023 - 12:49 PM

Hi.
I'm having some trouble implementing cruise control on an electric locomotive.

I'm trying to implement a 2 lever system:

1- Throtlle and dynamic brake combined lever. When CC is on this lever acts as force selector
2- CC lever acting as a proportional speed selector.

So far this is what I have in my eng file:
	ORTSCruiseControl (
		MaxForceSteps 								( 10 ) comment (** Usually will be 100 meaning 100%, but some locos have limited force steps **)
		SpeedSelectorStepTimeSeconds 						( 0.5 ) comment (** how fast the selected speed lever adds speed, 0.3 is one step in 0.3 seconds **)
		DynamicBrakeMaxForceAtSelectorStep 					( 50 ) comment (** the brake will reach 100% at this step, the lower step the max brake percent will be also lower **)
		NominalSpeedStep 								( 5 ) comment (** when pressing Shift+A or Shift+D how many speed units should the selected speed change **)
		StartReducingSpeedDelta 						( 0.5 ) (** the lower number, the sooner the regulator will decrease power **)
		StartReducingSpeedDeltaDownwards 					( 1.0 ) (** the lower number, the sooner the regulator will decrease power when dynamically braking**)
		ForceRegulatorAutoWhenNonZeroForceSelected 			( True ) comment (** When a non zero speed is selected, the regulator is set to auto **)
		ForceRegulatorAutoWhenNonZeroSpeedSelectedAndThrottleAtZero ( True ) comment (** Self explaining **)
		MaxForceKeepSelectedStepWhenManualModeSet 			( True ) comment (** Self explaining **)
		ForceResetRequiredAfterBraking 					( True ) comment (** After manual braking, to apply again force, the force must first be manually reset to zero **)
		ResetForceAfterAnyBraking 						( True )
		DynamicBrakeIsSelectedForceDependant 				( True ) comment (** If true dynamic brake force applied depends from the position of the force selector, else always the maximum dynamic brake force is applied **)
		ThrottleFullRangeIncreaseTimeSeconds 				( 4 ) comment (** time in seconds needed for the regulator to reach 0-100% of power **)
		ThrottleFullRangeDecreaseTimeSeconds 				( 4 ) comment (** time in seconds needed for the regulator to reach 100-0% of power **)
		DynamicBrakeFullRangeIncreaseTimeSeconds 				( 2 ) comment ( ** same as above, but for dynamic braking ** )
		DynamicBrakeFullRangeDecreaseTimeSeconds				( 2 ) comment ( ** same as above, but for dynamic braking ** )
		DefaultForceStep								( 0 ) comment (** When OR is started, this will be the selected force step, usually set at 0 **)
		DisableCruiseControlOnThrottleAndZeroForceAndZeroSpeed 	( True ) Comment (** enables manual if moving throttle or combined control when selected force and selected speed are at zero **)
		DynamicBrakeCommandHasPriorityOverCruiseControl 		( True ) comment (** When cruise control is in Auto, manually activating the dynamic brake has priority **)
		HasIndependentThrottleDynamicBrakeLever				( True ) comment (** added now ** The cabview is equipped with a combined Throttle-Dynamic brake lever independent from the CC controls **)
		DoComputeNumberOfAxles 							( True ) comment (** Number of train axles automatically computed at game start **)
		UseThrottleAsForceSelector 						( True ) comment (** if ControllerCruiseControlLogic is set to None, throttle when in Auto mode will change the maximum CC Force **)

		ForceResetIncludeDynamicBrake 					( True )
		Options 									( "RegulatorManual, RegulatorAuto, SelectorOn, StartFromZero, EngageForceOnNonZeroSpeed" )
	)


This is on my CVF:
		Lever (
			Type ( ORTS_SELECTED_SPEED_SELECTOR LEVER )
			Position ( 520 338 49 88 )
			Graphic ( 4700power.ace )
			Style ( NOT_SPRUNG )
			MouseControl ( 1 )
			NumFrames ( 10 5 2 )
			NumPositions ( 0 )
			NumValues ( 0 )
			Orientation ( 1 )
			DirIncrease ( 1 )
			ScaleRange ( 0 220 )
			Units ( KM_PER_HOUR )
		)	
		CombinedControl (
			Type ( CP_HANDLE COMBINED_CONTROL )
			Position ( 334 376 59 114 )
			Graphic ( 5600_combined.ace )
			Style ( NONE )
			MouseControl ( 1 )
			NumFrames ( 18 9 2 )
			NumPositions ( 18 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 )
			NumValues ( 18 0 0.059 0.118 0.176 0.235 0.294 0.353 0.412 0.471 0.529 0.588 0.647 0.706 0.765 0.824 0.882 0.941 1 )
			Orientation ( 1 )
			DirIncrease ( 1 )
		)


It appears to work, but when the locomotive starts moving, in a few seconds the simulation crashes.

I'm attaching the log file. I thank anyone that can give me a few hints on this, and if there is any cab control to create an indicator for CC being active, or even a button to activate an make CC available.

Attached File(s)



#186 User is offline   pschlik 

  • Conductor
  • Group: Status: Active Member
  • Posts: 331
  • Joined: 04-March 15
  • Gender:Male
  • Simulator:OpenRails - Unstable
  • Country:

Posted 10 May 2023 - 09:59 PM

Sorry to revive the thread after a few months, but I wanted to share some thoughts after implementing the cruise control system used by GE Genesis locomotives.

For context, the Genesis locomotives have a simple cruise control that will hold the current speed when activated using power limited to the throttle setting, with no use of braking at all and no buttons to directly change the speed setting. The only operator controls are MFD buttons to turn cruise on and off. Also, the throttle needs to be above idle to enable the system-which is interesting. Quite a few systems require 0 throttle to enable/disable but this is the inverse.

https://i.imgur.com/77XK3ge.png

  • I would really like a way to explicitly disable the use of dynamic braking. I know I can set the "DynamicBrakeFullRangeIncreaseTimeSeconds" to a very large number, which does prevent dynamic brake force from appearing, but it does not actually prevent the dynamic brakes from setting up. This causes interesting problems (eg: If I set the cruise mode from automatic to manual with the throttle open while the cruise system was trying to use dynamic braking, the resulting state is a broken setup where the throttle is open and the dynamic brakes are set to 0% at the same time! This weird state prevents throttle increases; reducing the throttle to idle is required to set the dynamic brakes to off, then normal control is restored. Maybe when cruise control is set to manual mode it should disable dynamic brakes instead of leaving them set to 0%?). There is an option to explicitly enable/disable the use of train brakes, so why not for dynamic brakes?
  • I need a way to make use of the train brake set the control mode back to manual. This is a behavior of the real genesis locomotives which I was unable to replicate, as the only triggers for disabling cruise control automatically are DisableCruiseControlOnThrottleAndZeroSpeed and DisableCruiseControlOnThrottleAndZeroForce. Using the train brake does disable CC tractive effort, but it doesn't actually set things back to manual.
  • Activating cruise control while in motion with throttle applied was resulting in my tractive force instantly dropping to 0 (I guess the system initializes to 0 force, even when the selected throttle isn't 0), which is jarring. It should start at the current power output and gradually reduce the throttle.
  • On the real locomotive, turning on cruise control while it is already on will re-select the current speed as the cruise speed (useful if speed increased or decreased from the setpoint due to a hill), but that cannot be done in OR.


Cruise parameters for reference:
	ORTSCruiseControl (
		MaxForceSteps ( 8 )	Comment ( Throttle controls cruise control force, and the throttle has 8 notches. )
		SpeedIsMPH ( True )
		NominalSpeedStep ( 0 )	Comment ( This system does not allow manual speed setting. Speed is set based on current speed at activation time. )
		SpeedSelectorStepTimeSeconds ( 1e9 )	Comment ( This will also prevent manual adjustments of speed setting. )
		UseThrottleAsForceSelector ( True )	Comment ( The throttle sets the maximum power the cruise control will use. )
		UseThrottleInCombinedControl ( True )	Comment ( Required for locomotives which have a combined throttle and dynamic brake. )
		ModeSwitchAllowedWithThrottleNotAtZero ( True )	Comment ( This system allows, and requires, throttle to be applied to activate. )
		ThrottleNeutralPosition ( True )	Comment ( Setting zero throttle disables this cruise control system entirely. )
		StartReducingSpeedDelta ( 0.1 )	Comment ( Set quite low to make acceleration more conservative. Should avoid overshoots. )
		Options ( "RegulatorManual, RegulatorAuto, EngageForceOnNonZeroSpeed" )
		ThrottleFullRangeIncreaseTimeSeconds ( 10 )
		ThrottleFullRangeDecreaseTimeSeconds ( 10 )
		DynamicBrakeFullRangeIncreaseTimeSeconds ( 1e9 )	Comment ( Force dynamic brake to take effectively infinite time to ramp up, preventing dynamics from being used. )
		DynamicBrakeFullRangeDecreaseTimeSeconds ( 1 ) 
		DisableCruiseControlOnThrottleAndZeroSpeed ( True )	Comment ( Resets cruise when train departs after a stop. )
		DisableCruiseControlOnThrottleAndZeroForce ( True )	Comment ( Forces cruise to disable when throttling up from idle, as real system is disabled by idle throttle. )
		DoComputeNumberOfAxles ( True )	Comment ( No manual entering of axle information. )
	)


#187 User is offline   Laci1959 

  • Foreman Of Engines
  • Group: Status: Contributing Member
  • Posts: 944
  • Joined: 01-March 15
  • Gender:Male
  • Simulator:Alföld
  • Country:

Posted 11 May 2023 - 12:37 AM

Quote

For context, the Genesis locomotives have a simple cruise control that will hold the current speed


Hello.

I did something similar. It accelerates to the set speed and holds it.
He can't brake.
Below is the complete code. The last line is the point.

	ORTSCruiseControl (
		MaxForceSteps ( 1 )
		SpeedSelectorStepTimeSeconds ( 0.5 )
		NominalSpeedStep ( 20 )
		Options ( "RegulatorManual, RegulatorAuto, SelectorOn, StartFromZero, EngageForceOnNonZeroSpeed" )
		StartReducingSpeedDelta ( 0.5 )
		ForceRegulatorAutoWhenNonZeroSpeedSelected ( True )
		ForceRegulatorAutoWhenNonZeroSpeedSelectedAndThrottleAtZero ( True )
		MaxForceKeepSelectedStepWhenManualModeSet ( True )
		ThrottleFullRangeIncreaseTimeSeconds ( 4 )
		ThrottleFullRangeDecreaseTimeSeconds ( 4 )
		MaxPowerThreshold ( 5.5 )

		UseThrottleAsSpeedSelector ( False )
		UseThrottleAsForceSelector ( True )
		UseThrottleInCombinedControl ( True )
		ControllerCruiseControlLogic ( None )

		HasProportionalSpeedSelector ( True )
		SpeedSelectorIsDiscrete ( True )
		ModeSwitchAllowedWithThrottleNotAtZero  ( True )

		TrainBrakeMinPercentValue ( 0 )		Comment ( This is the minimum train brake percentage used by CC. 0 means no braking. )
	)


Sincerely, Laci1959.

#188 User is offline   Laci1959 

  • Foreman Of Engines
  • Group: Status: Contributing Member
  • Posts: 944
  • Joined: 01-March 15
  • Gender:Male
  • Simulator:Alföld
  • Country:

Posted 11 May 2023 - 12:46 AM

Quote

It would be interesting to know what Position Types other people have used.


Hello.

Vehicles used in Hungary do not have this. There is only the lever for setting the speed and an on/off switch. FLIRT, KISS motor trains have only the lever for setting the speed. Fixed in zero position. You have to lift it a little and move it forward. With this, CC is already turned on. CC is switched off in the zero position of the lever.
Out of curiosity, I omitted the Multi Position controller and it works.

Sincerely, Laci1959.

#189 User is offline   pschlik 

  • Conductor
  • Group: Status: Active Member
  • Posts: 331
  • Joined: 04-March 15
  • Gender:Male
  • Simulator:OpenRails - Unstable
  • Country:

Posted 11 May 2023 - 05:58 PM

While looking through the code, I noticed an undocumented parameter "TrainBrakeCommandHasPriorityOverCruiseControl", thinking this may be helpful for my continued investigation I tried using it, but I noticed no effect regardless of its setting. Whether this one is set to true or false, applying the train brakes will kill cruise control. It seems like the intended behavior is that setting it to false would mean applying the train brakes does not change the applied force in cruise control, but instead, it behaves as if it is true always.

If I had to guess, it seems something in the if statement on line 508 of CruiseControl.cs may be mistakenly triggering CCThrottleOrDynBrakePercent = 0 even if TrainBrakePriority is false. Taking a close look, we have a statement that says "If (the brake pipe pressure is more than 1 psi below the max system pressure, or (the EP wire is commanding a brake application and the train brake has priority)) and the cruise control isn't using the train brake, then...". See the mistake? Due to order of operations, the train brake priority is anded with the EP wire, THEN that result is or'd with the brake pipe check. Thus, if the brake is applied, regardless of the train brake priority or EP wire, the cruise control will be set to 0.
                else if ((Locomotive.TrainBrakeController.MaxPressurePSI - Locomotive.BrakeSystem.BrakeLine1PressurePSI > 1 ||
                    Locomotive.Train.BrakeLine4 > 0 && TrainBrakePriority) && !CCIsUsingTrainBrake)
                {
                    reducingForce = true;
                    timeFromEngineMoved = 0;
                    if (CCThrottleOrDynBrakePercent > 0)
                        CCThrottleOrDynBrakePercent = 0;                }


I believe the fix to this would be a simple case of moving parenthesis to change that if statement to this. In this case, no matter what anything else evaluates to, if train brake priority is false then the statement won't run and the cruise control won't reset, thus fixing the problem. I'd like to try fixing that but I'm not exactly set up to compile OpenRails, and I don't have the time to set that up right now.
                else if ((Locomotive.TrainBrakeController.MaxPressurePSI - Locomotive.BrakeSystem.BrakeLine1PressurePSI > 1 ||
                    Locomotive.Train.BrakeLine4 > 0 ) && TrainBrakePriority && !CCIsUsingTrainBrake)
                {
                    reducingForce = true;
                    timeFromEngineMoved = 0;
                    if (CCThrottleOrDynBrakePercent > 0)
                        CCThrottleOrDynBrakePercent = 0;                }


Regardless, this does not give me the result I wanted for the Genesis locomotive, where applying the train brakes reverts the cruise control to manual mode. But I feel like there are quite a few systems out there where you should be able to apply the train brakes without cruise control suddenly setting the dynamic brake to 0.

#190 User is offline   cesarbl 

  • Conductor
  • Group: Status: Active Member
  • Posts: 395
  • Joined: 30-March 20
  • Gender:Male
  • Simulator:Open Rails
  • Country:

Posted 11 May 2023 - 10:51 PM

Known bug. I was hoping to fix it together with additional features to Cruise Control in the future (I'm busy with other areas), but since you are reporting it I've uploaded the fix. I came up to the same conclusion about the parenthesis when I detected the bug some time ago, so this is what I did.

  • 25 Pages +
  • « First
  • 17
  • 18
  • 19
  • 20
  • 21
  • 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