Elvas Tower: Headlights: multi purpose code! - Elvas Tower

Jump to content

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

Headlights: multi purpose code! New code to get headlight running in lhf and shf both Rate Topic: -----

#1 User is offline   backontrack 

  • Apprentice
  • Group: Status: Switchman
  • Posts: 5
  • Joined: 14-March 19
  • Gender:Male
  • Simulator:Open Rails
  • Country:

Posted 17 March 2019 - 03:13 AM

This is my first post here after my introduction post on hash house. I apologize if my english is not very clear since i'm from India.

I have found after quite a time of testing(if it has not been done before) the method of running the locomotive lights in both directions without having to compromise the dim for rear. What I did is use this locomotive, Dash 9.

-First you have to create a reverse cabview file for the locomotive( no need to change anything in it just make a duplicate and rename it with _rv like dash9_rv.cvf).
-Now what i did is use the unit condition parameters given here by James Ross.
-When you press the ctrl+e open rails assumes that the locomotive is reversed, so this means that we can specify a whole new set of lights to run in reverse.
-I have used this code:
SIMISA@@@@@@@@@@JINX0D0t______

Wagon ( Dash9
	Type ( Engine )
	WagonShape ( dash9.s )	
	Size ( 3.594m 4.431m 22.1m ) 
	Comment ( 400,000 lbs ) 
	Mass ( 181.5t )
	WheelRadius ( 42in/2 )
	InertiaTensor ( Box ( 3.594m 4.431m 22.1m ) )
	Coupling (
		Type ( Automatic )
		Spring (
			Stiffness ( 1e6N/m 5e6N/m )
			Damping ( 1e7N/m/s 1e8N/m/s )
			Break ( 4e7N 4e7N )
			r0 ( 10cm 10cm )
		)
		Velocity ( 0.1m/s )
	)
	Adheasion ( 0.25 0.45 2 0 )
	DerailRailHeight ( 4cm )
	DerailRailForce ( 2.5*181.5t )
	DerailBufferForce ( 400kN )
	Friction (
		1932N/m/s	0	1mph		21.63N/m/s	1.8
		5.1N/rad/s	1	-1rad/s	0		1
	)
	AntiSlip ( 1 )

	BrakeEquipmentType( "Triple_valve, Auxilary_reservoir, Emergency_brake_reservoir" )
	BrakeSystemType( "Air_single_pipe" )

	MaxBrakeForce ( 181kN )
	EmergencyBrakeResMaxPressure( 110 )
	TripleValveRatio( 2.5 )
	MaxReleaseRate( 2.27 )
	MaxApplicationRate( 1.717 )
	MaxAuxilaryChargingRate( 1 )
	EmergencyResCapacity( 2.604 )
	EmergencyResChargingRate( 1 )
	BrakeCylinderPressureForMaxBrakeBrakeForce( 64 )

	IntakePoint ( 3.33 0.4 FuelDiesel )

	Lights (	14
            Light	(
			comment( Rear cone light Top reverse  )
			Type		( 1 )
			Conditions	(
					Headlight ( 1 )
					Unit ( 5 )
					)
			FadeIn	( 0.5 )
			FadeOut	( 0.5 )
			Cycle		( 0 )
			States	(	1
				State	(
					Duration ( 0.0 )
					LightColour ( FFFFFFCA )
					Position ( 0.0 4.15 -9.93 )
					Azimuth ( -180 -180 -180 )
					Transition ( 0 )
					Radius ( 1.0 )
					)
				)
			)
Light	(
			comment( Rear light Bottom bright reverse )
			Type		( 0 )
			Conditions	(
					Headlight ( 3 )
					Unit ( 5 )
					)
			FadeIn	( 0.5 )
			FadeOut	( 0.5 )
			Cycle		( 0 )
			States	(	1
				State	(
					Duration ( 0.0 )
					LightColour ( FFFFFFCA )
					Position ( 0.0 3.93 -9.91 )
					Azimuth ( -180 -180 -180 )
					Transition ( 0 )
					Radius ( 1.0 )
					)
				)
			)
 Light	(
			comment( Rear light Top bright reverse )
			Type		( 0 )
			Conditions	(
					Headlight ( 3 )
					Unit ( 5 )
					)
			FadeIn	( 0.5 )
			FadeOut	( 0.5 )
			Cycle		( 0 )
			States	(	1
				State	(
					Duration ( 0.0 )
					LightColour ( FFFFFFCA )
					Position ( 0.0 4.15 -9.93 )
					Azimuth ( -180 -180 -180 )
					Transition ( 0 )
					Radius ( 1.0 )
					)
				)
			)
Light	(
			comment( Sphere of Lights Bright)
			Type		( 1 )
			Conditions	(
					Headlight ( 3 )
					Unit ( 2 )
					)
			Cycle		( 0 )
			FadeIn	( 0.5 )
			FadeOut	( 0.5 )
			States	(	1
				State	(
					Duration ( 0.0 )
					LightColour ( FFFFFFCA )
					Position ( 0.0 3.0 7.0 )
					Transition ( 0 )
					Radius ( 300 )
					Angle ( 45.0 )
					)
				)
			)
		Light	(
			comment( Sphere of Lights dim)
			Type		( 1 )
			Conditions	(
					Headlight ( 2 )
					Unit ( 2 )
					)
			Cycle		( 0 )
			FadeIn	( 0.5 )
			FadeOut	( 0.5 )
			States	(	1
				State	(
					Duration ( 0.0 )
					LightColour ( FFFFFFCA )
					Position ( 0.0 3.0 7.0 )
					Transition ( 0 )
					Radius ( 300 )
					Angle ( 45.0 )
					)
				)
			)    
            Light	(
			comment( Head light Top dim )
			Type		( 0 )
			Conditions	(
					Headlight ( 2 )
					Unit ( 2 )
					)
			FadeIn	( 0.5 )
			FadeOut	( 0.5 )
			Cycle		( 0 )
			States	(	1
				State	(
					Duration ( 0.0 )
					LightColour ( FFFFFFCA )
					Position ( 0.0 3.39 10.14 )
					Transition ( 0 )
					Radius ( 1.0 )
					)
				)
			)
		Light	(
			comment( Head light Bottom dim )
			Type		( 0 )
			Conditions	(
					Headlight ( 2 )
					Unit ( 2 )
					)
			FadeIn	( 0.5 )
			FadeOut	( 0.5 )
			Cycle		( 0 )
			States	(	1
				State	(
					Duration ( 0.0 )
					LightColour ( FFFFFFCA )
					Position ( 0.0 3.17 10.12 )
					Transition ( 0 )
					Radius ( 1.0 )
					)
				)
			)
            Light	(
			comment( Head light Top bright )
			Type		( 0 )
			Conditions	(
					Headlight ( 3 )
					Unit ( 2 )
					)
			FadeIn	( 0.5 )
			FadeOut	( 0.5 )
			Cycle		( 0 )
			States	(	1
				State	(
					Duration ( 0.0 )
					LightColour ( FFFFFFCA )
					Position ( 0.0 3.39 10.14 )
					Transition ( 0 )
					Radius ( 1.0 )
					)
				)
			)
		Light	(
			comment( Head light Bottom bright )
			Type		( 0 )
			Conditions	(
					Headlight ( 3 )
					Unit ( 2 )
					)
			FadeIn	( 0.5 )
			FadeOut	( 0.5 )
			Cycle		( 0 )
			States	(	1
				State	(
					Duration ( 0.0 )
					LightColour ( FFFFFFCA )
					Position ( 0.0 3.17 10.12 )
					Transition ( 0 )
					Radius ( 1.0 )
					)
				)
			)		
		Light	(
			comment( Right ditch light )
			Type		( 0 )
			Conditions	(
					Headlight ( 3 )
					Unit ( 2 )
					)
			Cycle		( 0 )
			FadeIn	( 0.5 )
			FadeOut	( 0.5 )
			States	(	1
				State	(
					Duration ( 0.0 )
					LightColour ( FFFFFFCA )
					Position ( -0.85 1.89 10.79 )
					Transition ( 0 )
					Radius ( 1.0 )
					)
				)
			)
		Light	(
			comment( Left ditch light )
			Type		( 0 )
			Conditions	(
					Headlight ( 3 )
					Unit ( 2 )
					)
			Cycle		( 0 )
			FadeIn	( 0.5 )
			FadeOut	( 0.5 )
			States	(	1
				State	(
					Duration ( 0.0 )
					LightColour ( FFFFFFCA )
					Position ( 0.85 1.89 10.79 )
					Transition ( 0 )
					Radius ( 1.0 )
					)
				)
			)
Light	(
			comment( blink left ditch light )
			Type		( 0 )
			Conditions	(
				Headlight ( 2 )
				Unit ( 2 )
				)
			Cycle	( 0 )
			FadeIn	( 0.5 )
			FadeOut	( 0.5 )
			States	(	4
				State	(
					Duration ( 0.1 )
					LightColour ( 00000000 )
					Position ( 0.85 1.89 10.79 )
					Azimuth ( 0.0 -5.0 5.0 )
					Transition ( 1 )
					Radius ( 1 )
					)
				State	(
					Duration ( 0.6 )
					LightColour ( FFFFFFCA )
					Position ( 0.85 1.89 10.79 )
					Azimuth ( 0.0 -5.0 5.0 )
					Transition ( 1 )
					Radius ( 1 )
					)
				State	(
					Duration ( 0.6 )
					LightColour ( FFFFFFCA )
					Position ( 0.85 1.89 10.79 )
					Azimuth ( 0.0 -5.0 5.0 )
					Transition ( 1 )
					Radius ( 1 )
					)
				State	(
					Duration ( 0.1 )
					LightColour ( 00000000 )
					Position ( 0.85 1.89 10.79 )
					Azimuth ( 0.0 -5.0 5.0 )
					Transition ( 1 )
					Radius ( 1 )
					)
				)
			)
		Light	(
			comment( blink right ditch light )
			Type		( 0 )
			Conditions	(
				Headlight ( 2 )
				Unit ( 2 )
				)
			Cycle	( 0 )
			FadeIn	( 0.5 )
			FadeOut	( 0.5 )
			States	(	4
				State	(
					Duration ( 0.6 )
					LightColour ( FFFFFFCA )
					Position ( -0.85 1.89 10.79 )
					Azimuth ( 0.0 -5.0 5.0 )
					Transition ( 1 )
					Radius ( 1 )
					)
				State	(
					Duration ( 0.1 )
					LightColour ( 00000000 )
					Position ( -0.85 1.89 10.79 )
					Azimuth ( 0.0 -5.0 5.0 )
					Transition ( 1 )
					Radius ( 1 )
					)
				State	(
					Duration ( 0.1 )
					LightColour ( 00000000 )
					Position ( -0.85 1.89 10.79 )
					Transition ( 1 )
					Radius ( 1 )
					)
				State	(
					Duration ( 0.6 )
					LightColour ( FFFFFFCA )
					Position ( -0.85 1.89 10.79 )
					Azimuth ( 0.0 -5.0 5.0 )
					Transition ( 1 )
					Radius ( 1 )
					)
				)
			)
            Light	(
			comment( Rear light Top bright )
			Type		( 0 )
			Conditions	(
					Headlight ( 3 )
					Unit ( 3 )
					)
			FadeIn	( 0.5 )
			FadeOut	( 0.5 )
			Cycle		( 0 )
			States	(	1
				State	(
					Duration ( 0.0 )
					LightColour ( FFFFFFCA )
					Position ( 0.0 4.15 -9.93 )
					Azimuth ( -180 -180 -180 )
					Transition ( 0 )
					Radius ( 1.0 )
					)
				)
			)
		Light	(
			comment( Rear light Bottom bright )
			Type		( 0 )
			Conditions	(
					Headlight ( 3 )
					Unit ( 3 )
					)
			FadeIn	( 0.5 )
			FadeOut	( 0.5 )
			Cycle		( 0 )
			States	(	1
				State	(
					Duration ( 0.0 )
					LightColour ( FFFFFFCA )
					Position ( 0.0 3.93 -9.91 )
					Azimuth ( -180 -180 -180 )
					Transition ( 0 )
					Radius ( 1.0 )
					)
				)
			)		
	Comment ( AI Loco )
		Light	(
			comment( AI Head light Top bright )
			Type		( 0 )
			Conditions	(
					Service ( 2 )
					Unit ( 2 )
					Control ( 1 )
					)
			FadeIn	( 0.5 )
			FadeOut	( 0.5 )
			Cycle		( 0 )
			States	(	1
				State	(
					Duration ( 0.0 )
					LightColour ( FFFFFFCA )
					Position ( 0.0 3.39 10.14 )
					Transition ( 0 )
					Radius ( 1.0 )
					)
				)
			)
		Light	(
			comment( AI Head light Bottom bright )
			Type		( 0 )
			Conditions	(
					Service ( 2 )
					Unit ( 2 )
					Control ( 1 )
					)
			FadeIn	( 0.5 )
			FadeOut	( 0.5 )
			Cycle		( 0 )
			States	(	1
				State	(
					Duration ( 0.0 )
					LightColour ( FFFFFFCA )
					Position ( 0.0 3.17 10.12 )
					Transition ( 0 )
					Radius ( 1.0 )
					)
				)
			)		
		Light	(
			comment( AI Right ditch light )
			Type		( 0 )
			Conditions	(
					Service ( 2 )
					Unit ( 2 )
					Control ( 1 )
					)
			Cycle		( 0 )
			FadeIn	( 0.5 )
			FadeOut	( 0.5 )
			States	(	1
				State	(
					Duration ( 0.0 )
					LightColour ( FFFFFFCA )
					Position ( -0.85 1.89 10.79 )
					Transition ( 0 )
					Radius ( 1.2 )
					)
				)
			)
		Light	(
			comment( AI Left ditch light )
			Type		( 0 )
			Conditions	(
					Service ( 2 )
					Unit ( 2 )
					Control ( 1 )		
					)
			Cycle		( 0 )
			FadeIn	( 0.5 )
			FadeOut	( 0.5 )
			States	(	1
				State	(
					Duration ( 0.0 )
					LightColour ( FFFFFFCA )
					Position ( 0.85 1.89 10.79 )
					Transition ( 0 )
					Radius ( 1.2 )
					)
				)
			)
		)
	Sound (	"d9eng.sms" )
	)

Engine ( Dash9
	Effects
	(
		DieselSpecialEffects
		(
		Exhaust1
			(
                        0 4.72 -3.515
				0 1 0
				0.2
			)
		)
	)
	Wagon ( Dash9 )
	Type ( Diesel )
	MaxPower ( 3278kW ) Comment ( 4400 HP )
	MaxForce ( 685.9kN )
	MaxContinuousForce ( 488.7kN )
	MaxVelocity ( 71mph )
	MaxCurrent ( 1800A )
	WheelRadius ( 21in )
	Sanding ( 5mph )
	NumWheels ( 6 )
	MaxTemperature ( 120 )
	MaxOilPressure ( 90 )

	CabView ( dash9.cvf )
      HeadOut ( 1.67 3.79 6.995 )

	AirBrakesAirCompressorPowerRating( 4 )
	AirBrakesMainMinResAirPressure( 14.7 )
	AirBrakesMainMaxAirPressure( 140 )
	AirBrakesMainResVolume( 12 )
	AirBrakesAirCompressorWattage( 19000 )
	AirBrakesCompressorRestartPressure( 135 )
	AirBrakesAirUsedPerPoundsOfBrakePipePressure( 1.4 )
	AirBrakesHasLowPressureTest( 1 )
	AirBrakesIsCompressorElectricOrMechanical( 1 )

	EngineBrakesControllerMinPressureReduction( 6 )
	TrainBrakesControllerMinPressureReduction( 6 )
	EngineBrakesControllerHasProportionalBrake( 1 )
	EngineBrakesProportionalBrakeLag( 0.8 )
	EngineBrakesControllerMaxApplicationRate( 7 )
	TrainBrakesControllerMaxApplicationRate( 5.5 )
	EngineBrakesControllerMaxReleaseRate( 10 )
	TrainBrakesControllerMaxReleaseRate( 3.4 )
	EngineBrakesControllerEmergencyApplicationRate( 8 )
	TrainBrakesControllerEmergencyApplicationRate( 7 )
	EngineBrakesControllerMinSystemPressure( 15 )
	TrainBrakesControllerMinSystemPressure( 15 )
	EngineBrakesControllerMaxSystemPressure( 90 )
	TrainBrakesControllerMaxSystemPressure( 90 )
	EngineBrakesControllerEmergencyBrakeTimePenalty( 60 )
	TrainBrakesControllerEmergencyBrakeTimePenalty( 60 )
	EngineBrakesControllerFullServicePressureDrop( 26 )
	TrainBrakesControllerFullServicePressureDrop( 26 )
	EngineBrakesControllerDirectControlExponent( 1 )

	DynamicBrakesMinUsableSpeed( 3.5 )
	DynamicBrakesMaximumEffectiveSpeed( 71 )
	DynamicBrakesMaximumForce( 370kN )
	DynamicBrakesResistorCurrentLimit ( 952 )
	DynamicBrakesCutInSpeed( 5 )
	DynamicBrakesMaxAirBrakePressure ( 55 )
	DynamicBrakesFadingSpeed( 7 )
	DynamicBrakesDelayTimeBeforeEngaging ( 8 )
	DynamicBrakesMaximumSpeedForFadeOut ( 71 )
	DynamicBrakesEffectAtMaximumFadeOut( 0 )
	DynamicBrakesHigherSpeedCurveExponent( 10 )
	DynamicBrakesLowerSpeedCurveExponent( 0.9 )
	DynamicBrakesNumberOfControllerNotches( 1 )
      DynamicBrakeHasAutoBailOff ( 1 )

	BrakesEngineBrakeType( "Air_single_pipe"  )
	BrakesTrainBrakeType( "Air_single_pipe" )
      BrakesEngineControllers( "Independent, Train, Dynamic" )
	
	MaxDieselLevel ( 4700gal )
	DieselUsedPerHourAtMaxPower ( 178gal )
	DieselUsedPerHourAtIdle ( 2.8gal )
	DieselSmokeEffectInitialMagnitude( 0.8 )
	DieselSmokeEffectMaxMagnitude( 1.8 )
	DieselSmokeEffectInitialSmokeRate( 0.8 )
	DieselSmokeEffectMaxSmokeRate( 3.1 )
	DieselEngineIdleRPM( 200 )
	DieselEngineMaxRPM( 1025 )
	DieselEngineSpeedOfMaxTractiveEffort( 11.4mph )
	DieselEngineMaxRPMChangeRate( 25 )
	DoesHornTriggerBell( 1 )
	
	EmergencyStopMonitor(
    		MonitoringDeviceMonitorTimeLimit( 0 )
    		MonitoringDeviceAlarmTimeLimit( 0 )
    		MonitoringDevicePenaltyTimeLimit( 0 )
    		MonitoringDeviceCriticalLevel( 0 )
    		MonitoringDeviceResetLevel( 0 )
    		MonitoringDeviceAppliesFullBrake( 0 )
    		MonitoringDeviceAppliesEmergencyBrake( 1 )
    		MonitoringDeviceAppliesCutsPower( 1 )
    		MonitoringDeviceAppliesShutsDownEngine( 0 )
    		)
	OverspeedMonitor(
		MonitoringDeviceMonitorTimeLimit( 0 )
		MonitoringDeviceAlarmTimeLimit( 0 )
		MonitoringDevicePenaltyTimeLimit( 0 )
		MonitoringDeviceCriticalLevel( 79 )
		MonitoringDeviceResetLevel( 0.1 )
		MonitoringDeviceAppliesFullBrake( 0 )
		MonitoringDeviceAppliesEmergencyBrake( 1 )
		MonitoringDeviceAppliesCutsPower( 1 )
		MonitoringDeviceAppliesShutsDownEngine( 0 )
		MonitoringDeviceAlarmTimeBeforeOverSpeed( 5 )
		MonitoringDeviceDoesSuppressionReset( 0 )
		MonitoringDeviceTriggerOnOverspeed( 74 )
		MonitoringDeviceResetOnZeroSpeed( 1 )
		MonitoringDeviceResetOnResetButton( 0 )
		)
	EngineControllers (
            Throttle ( 0 1 0.125 0 
                NumNotches ( 9
                    Notch ( 0       0 Dummy )
                    Notch ( 0.125   0 Dummy )
                    Notch ( 0.25    0 Dummy )
                    Notch ( 0.375   0 Dummy )
                    Notch ( 0.5     0 Dummy )
                    Notch ( 0.625   0 Dummy )
                    Notch ( 0.75    0 Dummy )
                    Notch ( 0.875   0 Dummy )
                    Notch ( 1       0 Dummy )
                )
            )
            Brake_Engine ( 0 1 0.025 0 
                NumNotches ( 1
                    Notch( 0  	1 Dummy )
                )
            )
            Brake_Train ( 0 1 0.0125 0.5 
                NumNotches ( 5
                    Notch ( 0    	0 TrainBrakesControllerReleaseStart )
                    Notch ( 0.3  	1 TrainBrakesControllerGraduatedSelfLapLimitedHoldingStart )
                    Notch ( 0.85 	0 TrainBrakesControllerSuppressionStart )
                    Notch ( 0.9  	0 TrainBrakesControllerContinuousServiceStart )
                    Notch ( 0.95 	0 TrainBrakesControllerEmergencyStart )
                )
            )
            Brake_Dynamic ( 0 1 0.025 0 
                NumNotches ( 2
                    Notch ( 0      0 Dummy )
                    Notch ( 0.025  1 Dummy )
                 )
            )
		Combined_Control( 0 1 0.5 0.5 throttle dynamic )  
            DirControl ( -1 0 1 1 )
            BellToggle( 0 1 0 )
            Sanding ( 0 1 0 )
            Horn ( 0 1 0 )
            EmergencyStopToggle( 0 1 0 )
            Vigilance ( 0 1 0 )
            Headlights ( 0 0.25 1 0 )
            BailOffButton( 0 1 0 )
      )
 	Sound (	"d9cab.sms" )

 	Name ( "Dash 9" )
 	Description (
	"The C44-9W, a modern diesel-electric locomotive, most effective "+
	"pulling loads over long stretches at moderate speeds.\n\n"+
	"Locomotive type: Diesel-Electric\n\n"+
	"Power: 4,400 hp\n\n"+
	"Max. speed: 71 mph (115 km/h)\n\n"+
	"Gear ratio: 83:20\n\n"+
	"Power source: GE 7FDL16, Alternator GMG197\n\n"+
      "Traction motors: GE752AH\n\n"+
	"Road Numbers: 8100-8200, Total Delivered: 25)\n\n"+
	"Max. continuous tractive effort: 108,600 Lbs. (488.5 kN) @11.4mph\n\n"+
	"Wheel configuration: Twelve 42-inch (110 cm) diameter in C-C configuration (two sets of three "+
	"driven axles)\n\n"+
	"Height: 15 ft. 5 in. (4.70 m)\n\n"+
	"Width: 10 ft. 3 in. (3.12 m)\n\n"+
	"Length: 73 ft. 2 in. (22.25 m)\n\n"+
	"Weight: 200 U.S. tons (181.5 metric tons)"	
 	)
)


( i gave the whole code so anyone can easily copy paste it and test it themselves)

The first few lights that i have defined (with reverse in comment) are the ones that work when you press ctrl+e.

Now, these lights work fine as it is , i have not added the reverse light type(0) for dim but that's because this was just for testing.

However, there is one problem, when the locomotive is reversed, i have noticed that they don't follow the same parameters for headlight() that is why here the reverse cone of light has headlight(1) which means it will turn on when the light position is off but still it only works when headlight is 'dim or bright'which is the function of headlight(4). I tried to use headlight (3) so the cone of light comes on at "bright, but in the game it only came on at 'dim'(which theoretically is headlight(1)).

Sorry for the long post and once again sorry if my english sucked. I encourage you to test these yourself, and give your valuable suggestions since I'm a newbie to coding. If any OR devs are reading this then maybe we can try fixing the reverse light parameters to be uniform with the front ones.

I wanted to upload images but i'm not permitted. I hope this post will help you with your locomotive building in the future!

Cheers,
Aryan

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