Elvas Tower: About the gearbox diesel locomotives - Elvas Tower

Jump to content

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

About the gearbox diesel locomotives Rate Topic: -----

#1 User is offline   disc 

  • Foreman Of Engines
  • Group: Private - Open Rails Developer
  • Posts: 818
  • Joined: 07-October 12
  • Gender:Male
  • Simulator:OpenRails
  • Country:

Posted 06 July 2015 - 01:31 PM

I've just tried to make an MSTS gearboxed mechanical DMU more realistic, with the new ORTS parameters, so i've added these which i've copied from manual, but of course i've changed the values.

	ORTSDieselEngines ( 1
		Diesel (
			IdleRPM ( 250 )
			MaxRPM ( 2150 )
			StartingRPM ( 200 )
			StartingConfirmRPM ( 300 )
			ChangeUpRPMpS ( 150 )
			ChangeDownRPMpS ( 150 )
			RateOfChangeUpRPMpSS ( 20 )
			RateOfChangeDownRPMpSS ( 20 )
			MaximalPower ( 141kW )
			IdleExhaust ( 5 )
			MaxExhaust ( 50 )
			ExhaustDynamics ( 10 )
			ExhaustColor ( 00 fe )
			ExhaustTransientColor ( 00 00 00 00 )
			DieselPowerTab (
				0  0 
				250  2000
				2150  141000
			) 
			DieselConsumptionTab (
				0  0
				250  10
				2150  245
			) 
			ThrottleRPMTab (
				0  250
				100  2150
			)
		)
	)

If i add this inside Engine () (the manual isn't so clear about in which block should be added, then i get a warning Warning: Diesel engine model has some errors - loading MSTS format in C:\Gamez\MSTS\trains\trainset\acthu_motor\openrails\acthu_bzmot-237.eng:line 35 which is the line of the closing bracket of ORTSDieselEngines, but nothing more. The game loads, but i get instant crash and exception if i move the throttle, and the error message indicates ORTS.GearBox.get_MotiveForceN().

If i move ORTSDieselEngines out from Engine () block, i don't get the error message, nor the crash, but i can't say that these parameters are used, mostly because i don't see any way to see the engine RPM in game.

So what's the problem?

#2 User is offline   captain_bazza 

  • Chairman, Board of Directors
  • PipPipPipPipPipPipPipPipPipPipPip
  • Group: ET Admin
  • Posts: 13,927
  • Joined: 21-February 06
  • Gender:Male
  • Location:Way, way, way, South
  • Simulator:MSTS & OR
  • Country:

Posted 06 July 2015 - 04:04 PM

Do a check in ConText editor of the ENG, use the open bracket util (plug-in) to see if there's a missing close bracket at the end of the ENG.

Not done an ORTS comp ENG, but msg bkts are poss cause. CB.

#3 User is offline   Lindsayts 

  • Superintendant
  • Group: Status: Elite Member
  • Posts: 1,849
  • Joined: 25-November 11
  • Gender:Male
  • Country:

Posted 06 July 2015 - 10:25 PM

Engine RPM appears in the Shift F5 display under locomotive information (I think thats its name.

Check the OR log to see if it has any errors from this section.

Its a ______________REAL_______________ ____________________REAL____________________ __________________REAL________________ good idea when editing any of MSTS/OR's config files to use an editor that displays brace nesting as a matter of course as particularly in ENG files, its easy to get the braces out of step. I do not use Windows so I can not give any recomendations for this I use vim a unix editor that automaticlly shows brace nesting (amongst a lot of other helpfull things).

Note in the section shown its another good idea to line matching braces vertcially see below

        ORTSDieselEngines ( 1
                                Diesel (
                                        IdleRPM ( 250 )
                                        MaxRPM ( 2150 )
                                        StartingRPM ( 200 )
                                        StartingConfirmRPM ( 300 )
                                        ChangeUpRPMpS ( 150 )
                                        ChangeDownRPMpS ( 150 )
                                        RateOfChangeUpRPMpSS ( 20 )
                                        RateOfChangeDownRPMpSS ( 20 )
                                        MaximalPower ( 141kW )
                                        IdleExhaust ( 5 )
                                        MaxExhaust ( 50 )
                                        ExhaustDynamics ( 10 )
                                        ExhaustColor ( 00 fe )
                                        ExhaustTransientColor ( 00 00 00 00 )
                                        DieselPowerTab  (
                                                        0  0
                                                        250  2000
                                                        2150  141000
                                                        )
                                        DieselConsumptionTab    (
                                                                0  0
                                                                250  10
                                                                2150  245
                                                                )
                                        ThrottleRPMTab (
                                                        0  250
                                                        100  2150
                                                        )
                                        )
                        )
 



This makes it trivially easy to see MOST matching braces. Note this layout is one of the 2 standard ways of writng matching braces when doing programs.

Lindsay

#4 User is offline   disc 

  • Foreman Of Engines
  • Group: Private - Open Rails Developer
  • Posts: 818
  • Joined: 07-October 12
  • Gender:Male
  • Simulator:OpenRails
  • Country:

Posted 07 July 2015 - 02:54 AM

I've checked the braces, and i'm using notepad++ which shows the closing ones. And i wouldn't open this topic, if that would be the problem.

I've tried everything, including copy-paste from the manual. Now either the manual is wrong, or the feature is bugged. Probably the latter, as the log writes that the game fall back to msts parameters, but still the orts parameters make it crash.

This warning is so TS20xx style :lol2: makes no sense, and gives 0 information

With other locomotives it doesn't crash the game, but the warning is shown.

#5 User is offline   sim-al2 

  • Hostler
  • Group: Status: Active Member
  • Posts: 76
  • Joined: 23-February 12
  • Gender:Male
  • Simulator:Open Rails
  • Country:

Posted 07 July 2015 - 05:01 AM

View Postdisc, on 07 July 2015 - 02:54 AM, said:


With other locomotives it doesn't crash the game, but the warning is shown.


Hi disc, I've had this same problem with the ORTS Engine parameters. If I use this include block:
SIMISA@@@@@@@@@@JINX0D0t______
include ( ../m41-2175.eng )
Wagon (

)
Engine (
  ORTSDieselEngines ( 1
Diesel (
IdleRPM ( 650 )
MaxRPM ( 1515 )
StartingRPM ( 400 )
StartingConfirmRPM ( 670 )
ChangeUpRPMpS ( 40 )
ChangeDownRPMpS ( 70 )
RateOfChangeUpRPMpSS ( 5 )
RateOfChangeDownRPMpSS ( 5 )


)
)
)


All I get is an error message similar to yours:
Warning: Diesel engine model has some errors - loading MSTS format in C:\Games\Microsoft Games\Train Simulator\trains\trainset\MAV_M41_VMW\openrails\M41-2175.eng:line 19


If I include the ORTS code block in the main .eng file, the rpm drops to zero and using the "Y" key to restart the engine causes the player train to disappear with the NaN errors showing.

#6 User is offline   copperpen 

  • Executive Vice President
  • Group: Status: Elite Member
  • Posts: 3,139
  • Joined: 08-August 05
  • Gender:Male
  • Simulator:MSTS & OR
  • Country:

Posted 07 July 2015 - 10:40 AM

Not looked at this before, so I decided to copy the block from the manual into an eng file. No matter where I place it in the eng file I get the same warning in the log file along with a game crash with

Error: System.IO.FileLoadException: F:\Open Rails - Testing\trains\trainset\Class37\37261_Large_logo_vac.eng ---> System.ArgumentOutOfRangeException: Index was out of range. Must be non-negative and less than the size of the collection.
Parameter name: index at the head of the error listing in the log. ( attached )

If I place the parameters after the close of file bracket nothing happens. I have the normal single engine and OR is happy. The manual is unclear as to exactly where these parameters are to be placed, but the expected EOF warning is puzzling because all brackets match exactly.

Attached File(s)



#7 User is offline   disc 

  • Foreman Of Engines
  • Group: Private - Open Rails Developer
  • Posts: 818
  • Joined: 07-October 12
  • Gender:Male
  • Simulator:OpenRails
  • Country:

Posted 30 August 2015 - 12:33 PM

I've looked at the code, and ORTSDieselEngines should be placed in Engine() there are also some duplicate parameters: ortsdieselcooling and ORTSEngines(Diesel(Cooling))) is the same.
That warning is sent by the STF reader, which means it's caused by a syntax error, and not by wrong numbers.
Perhaps who made that part (DieselEngine.cs) should take a look at it. I'll try to find out what happens in debug mode too.

PS: i can't find out anything, i can't start the game in debug mode with VS.

#8 User is online   Csantucci 

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

Posted 30 August 2015 - 11:28 PM

Always good if someone is able to inspect the OR code.
To start the game in debug mode, make a previous standard OR run and take care of following lines in logfile:
Argument   = -start
Argument   = -explorer
Argument   = D:\Programmi\Microsoft Games\Train Simulator\ROUTES\USA1\PATHS\aftstrmtrafficplayer.pat
Argument   = D:\Programmi\Microsoft Games\Train Simulator\TRAINS\CONSISTS\1d950chm.con
Argument   = 12:00
Argument   = 1
Argument   = 0

(They look different in activity mode).
Then double-click on ORTS.sln (located in subfolder SOURCE). VS should start and load the OR project. In Solution Explorer look for Runactivity and double-click on Properties.
Select Debug on the left-hand side list, and copy all above arguments in "Command line arguments", each enclosed in double quotes and separated by a space, as shown below:
"-start" "-explorer" "D:\Programmi\Microsoft Games\Train Simulator\ROUTES\USA1\PATHS\aftstrmtrafficplayer.pat" "D:\Programmi\Microsoft Games\Train Simulator\TRAINS\CONSISTS\1d950chm.con" "12:00" "1" "0"

Now you can start the debug by clicking Debug - Start Debugging on the drop-down menu.

#9 User is offline   disc 

  • Foreman Of Engines
  • Group: Private - Open Rails Developer
  • Posts: 818
  • Joined: 07-October 12
  • Gender:Male
  • Simulator:OpenRails
  • Country:

Posted 31 August 2015 - 02:55 AM

So what i've found in DieselEngine.cs:

There is an enum:

        public enum SettingsFlags
        {
            IdleRPM              = 0x0001,
            MaxRPM               = 0x0002,
            StartingRPM          = 0x0004,
            StartingConfirmRPM   = 0x0008,
            ChangeUpRPMpS        = 0x0010,
            ChangeDownRPMpS      = 0x0020,
            RateOfChangeUpRPMpSS = 0x0040,
            RateOfChangeDownRPMpSS = 0x0080,
            MaximalPowerW        = 0x0100,
            IdleExhaust          = 0x0200,
            MaxExhaust           = 0x0400,
            ExhaustDynamics      = 0x0800,
            ExhaustColor         = 0x1000,
            ExhaustTransientColor = 0x2000,
            DieselPowerTab       = 0x4000,
            DieselConsumptionTab = 0x8000,
            ThrottleRPMTab       = 0x10000,
            DieselTorqueTab      = 0x20000,
            MinOilPressure       = 0x40000,
            MaxOilPressure       = 0x80000,
            MaxTemperature       = 0x100000,
            Cooling              = 0x200000,
            TempTimeConstant     = 0x400000,
            OptTemperature       = 0x800000,
            IdleTemperature      = 0x1000000
        }


When the eng is loaded, then each parameter does something with this initlevel ( don't know what, i've usually check parameters with a simple boolean if i writing a code in java.)

...
 case "idlerpm":         IdleRPM = stf.ReadFloatBlock(STFReader.UNITS.Power, 0); initLevel |= SettingsFlags.IdleRPM; break;
                    case "maxrpm":          MaxRPM = stf.ReadFloatBlock(STFReader.UNITS.None, 0);initLevel |= SettingsFlags.MaxRPM; break;
                    case "startingrpm": StartingRPM = stf.ReadFloatBlock(STFReader.UNITS.None, 0); initLevel |= SettingsFlags.StartingRPM; break;
...



This thing checks for all of the settings, however i don't know why, because every setting has a default. And of course the initLevel never equals with the result of that long code( initlevel should be around 400000, but the code gives back ~3 million), so makes the code fall back to MSTS diesel settings:
        public bool IsInitialized
        {
            get
            {
                if (initLevel == (SettingsFlags.IdleRPM | SettingsFlags.MaxRPM | SettingsFlags.StartingRPM | SettingsFlags.StartingConfirmRPM | SettingsFlags.ChangeUpRPMpS | SettingsFlags.ChangeDownRPMpS
                    | SettingsFlags.RateOfChangeUpRPMpSS | SettingsFlags.RateOfChangeDownRPMpSS | SettingsFlags.MaximalPowerW | SettingsFlags.IdleExhaust | SettingsFlags.MaxExhaust
                    | SettingsFlags.ExhaustDynamics | SettingsFlags.ExhaustTransientColor | SettingsFlags.DieselPowerTab | SettingsFlags.DieselConsumptionTab | SettingsFlags.ThrottleRPMTab
                    | SettingsFlags.DieselTorqueTab | SettingsFlags.MinOilPressure | SettingsFlags.MaxOilPressure | SettingsFlags.MaxTemperature | SettingsFlags.Cooling
                    | SettingsFlags.TempTimeConstant | SettingsFlags.OptTemperature | SettingsFlags.IdleTemperature))

                    return true;
                else
                    return false;
            }
        }



Now i've just changed the return false; in the else branch, to return true; to see what happens. And it works(with gearless diesel), just like as it written in the advanced ORTSDieselEngines, however the exhaust is a bit strange, but i just copied that from manual.
So it seems this IsInitialized method is wrong, but i don't know how it can be fixed. The problem is probably caused by that this code expects all of these settings set by eng parameters, even if there are defaults for all.

Another smaller problem, is this: case "cooling": EngineCooling = (Cooling)stf.ReadInt((int)Cooling.Proportional); initLevel |= SettingsFlags.Cooling; break ;
This cooling parameter is not mentioned in the manual (along with some other parameters, that are in the code), but it's also an Enum: NoCooling = 0, Mechanical = 1, Hysteresis = 2, Proportional = 3

I've tried to write in simple numbers to eng Cooling ( 3 ) for example, i've also tried Cooling ( Proportional ) but none of these are accepted, always writes "cannot parse constant number".

#10 User is online   Csantucci 

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

Posted 31 August 2015 - 12:45 PM

Hi disc,
I see your points.
Re the bigger point, it would of course be ideal if the author of the code (I believe it is Matej Pacha) explained us what he meant with initlevel; if no reply comes, we could consider changing the IsInitialized method, that in fact at a first glance does not seem to make sense.
Re the smaller point, I think the problem is only that an stf.ReadInt instead of an stf.ReadIntBlock is called. You could try to change that and see if then the parameter is accepted (it must be a numeric one).

  • 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