Elvas Tower: Sequence of parameters in .eng and .wag files - Elvas Tower

Jump to content

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

Sequence of parameters in .eng and .wag files Rate Topic: -----

#1 User is offline   Genma Saotome 

  • Owner Emeritus and Admin
  • PipPipPipPipPipPipPipPipPipPipPipPipPip
  • Group: ET Admin
  • Posts: 15,362
  • Joined: 11-January 04
  • Gender:Male
  • Location:United States
  • Simulator:Open Rails
  • Country:

Posted 14 March 2015 - 05:31 PM

Does Open Rails require a specific ordering of parameters in .eng and .wag files?

For example, if I change the ordering of lines and put Mass() after WheelRadius() instead of before it, will OR accept that as ok?

If not, why not?
If ok, does that apply to all parameter ordering or only some -- and if some, which ones?

I ask because the natural grouping of attributes in include files does not always correspond to the "traditional" ordering. For instance if you want to have an include file for a generic 50 ton car you'd put into it all of the weight related parameters, such as Mass(), Friction(), both BrakeForces(), and both DerailForces(). No matter where you place the include file some of those parameters are not going to be where KUJU thought they should go.

#2 User is offline   cr-stagg 

  • Foreman Of Engines
  • Group: Status: Contributing Member
  • Posts: 909
  • Joined: 16-May 05
  • Gender:Male
  • Simulator:OR
  • Country:

Posted 14 March 2015 - 06:23 PM

A bit of explanation on Dave's question. I was using some of his ENGs with Include statements to see how they affected ConBuilder. Then I made a consist with one and tried to use it in Open Rails. The pull down to select the locomotive to run listed Dave's engine as "<Load error H10-44_MILW_660>". After numerous experiments I noticed that if the Include statement files were read in the order they were in the ENG file they would not be in the order that the parameters are listed in the DOC files that come with MSTS. Rectifying that but still using Include statements throughout the ENG file I found that when I opened OR the ENG was properly listed in the pulldown selection list. So I started a run with that loco. A Fatal Error was reported before loading finished. The error message cited the ENG file. Reading the Log file I found this error:

Engine type missing
at ORTS.RollingStock.Load(Simulator simulator, String wagFilePath, Boolean initialize) in e:\Documents\Coding\Jenkins\jobs\Open
Rails\workspace\Source\RunActivity\RollingStock\- RollingStock.cs:line 61

Line 61 is the Wagon line in the Engine Section. The next line is normally a Type line as in:
Type ( Diesel )
So I moved the Type ( Diesel ) line from the INC file and placed it in the ENG file at line 62.
Restarted OR and the Engine worked correctly.

So it appears that at least some of the parameters must be in the sequence as outlined in the MSTS DOC files and that the Type line within the Wagon Section of the Engine Section must remain in the ENG file.

#3 User is offline   Genma Saotome 

  • Owner Emeritus and Admin
  • PipPipPipPipPipPipPipPipPipPipPipPipPip
  • Group: ET Admin
  • Posts: 15,362
  • Joined: 11-January 04
  • Gender:Male
  • Location:United States
  • Simulator:Open Rails
  • Country:

Posted 14 March 2015 - 07:25 PM

Thanks for the details Charles!

#4 User is online   James Ross 

  • Open Rails Developer
  • Group: Status: Elite Member
  • Posts: 5,492
  • Joined: 30-June 10
  • Gender:Not Telling
  • Simulator:Open Rails
  • Country:

Posted 15 March 2015 - 04:00 AM

 Genma Saotome, on 14 March 2015 - 05:31 PM, said:

Does Open Rails require a specific ordering of parameters in .eng and .wag files?

The engine/wagon parsing in OR works by scanning the whole file and dealing with each item as they turns up, which seems to always be storing it in a field. That means that the order of the items is irrelevant. There may be a very small number of cases where one thing depends on another... but I cannot find any such examples, so it seems better to assume no ordering is needed until proven otherwise.

However, I suspect there are issues with include; looking at the errors from Charles and at the code, I am getting a feeling that the STFReader.TokenProcessor method of parsing SIMIS files does not support includes, or doesn't support them correctly.

  • The menu loads the engine using STFReader.TokenProcessor and expects the Engine block to start with a "name".
  • Loading the rolling stock in the game also uses STFReader.TokenProcessor and expects the same Engine block starting with a "name" and somewhere inside it a Type block with a "type".
  • The actual (main) parsing of engine and wagon files uses a STFReader.Tree loop and has no requirements on ordering.

So my guess is that you need the Engine block, with its "name" first and a Type("type") in the actual engine file; everything else can be in an include, in any order. But this is only based on reading the code so there might be other conditions I've missed.

#5 User is offline   cr-stagg 

  • Foreman Of Engines
  • Group: Status: Contributing Member
  • Posts: 909
  • Joined: 16-May 05
  • Gender:Male
  • Simulator:OR
  • Country:

Posted 16 March 2015 - 06:21 AM

On the subject of INC files. Does OR require that INC files be in Unicode format? Should programs that test Trainset files test INCs for Unicode as they do other files?

#6 User is online   James Ross 

  • Open Rails Developer
  • Group: Status: Elite Member
  • Posts: 5,492
  • Joined: 30-June 10
  • Gender:Not Telling
  • Simulator:Open Rails
  • Country:

Posted 16 March 2015 - 11:18 AM

 cr-stagg, on 16 March 2015 - 06:21 AM, said:

On the subject of INC files. Does OR require that INC files be in Unicode format? Should programs that test Trainset files test INCs for Unicode as they do other files?

The included files are read-in in exactly the same way normal SIMIS files are: using .NET's stream format BOM-detection (because, it turns out, not all SIMIS files are UTF16). This will detect UTF16-LE (what MSTS normally uses), UTF16-BE (which nobody uses :) ) and UTF-8 (common outside MSTS files).

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