Elvas Tower: Suggestion: new "include" parameter - Elvas Tower

Jump to content

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

Suggestion: new "include" parameter Rate Topic: -----

#11 User is online   Weter 

  • Member, Board of Directors
  • PipPipPipPipPipPipPipPipPipPip
  • Group: ET Admin
  • Posts: 6,957
  • Joined: 01-June 20
  • Gender:Not Telling
  • Simulator:ORTS
  • Country:

Posted 03 November 2022 - 10:27 PM

Hello, Luca.
I confirm that (it was seen in Rudolph Richrer's ENG manual): "second" blocks are taken in account, as like they either "overwrite" previous ones, or as like program "reads" file from its end, so takes the first block, it encounters, but ignores all subsequent ones with the same "Name ()"

But my original question was caused by my being surprised, seeing new for me method: the first string (or second, if the first is blanc) of include file in example contained "call" of superseding "original" rolling-stock file; then contained include block itself.
As I thought before, only "calling" of include-files from original ones are used, all this become very interesting for me to learn.
Exactly this technique I've called "reversible" include command usage in my question.

#12 User is offline   lucstef 

  • Apprentice
  • Group: Status: Active Member
  • Posts: 29
  • Joined: 22-August 14
  • Simulator:OR-MSTS
  • Country:

Posted 04 November 2022 - 04:13 AM

View PostWeter, on 03 November 2022 - 10:27 PM, said:

Hello, Luca.
I confirm that (it was seen in Rudolph Richrer's ENG manual): "second" blocks are taken in account, as like they either "overwrite" previous ones,


That ^^^


Quote

But my original question was caused by my being surprised, seeing new for me method: the first string (or second, if the first is blanc) of include file in example contained "call" of superseding "original" rolling-stock file; then contained include block itself.
As I thought before, only "calling" of include-files from original ones are used, all this become very interesting for me to learn.
Exactly this technique I've called "reversible" include command usage in my question.


Oh I see what you were saying; more than "reversible", I'd call it "recursive" and I'm still not sure it's the right term :)

For what I understand, the include(file2) statement in file1 takes the file2's text and places it inside file1 at the exact position of the statement.

That means, include ( "..//WVOGrain.wag" ) grabs all the text inside WVOGrain.wag and builds the first part of the new .wag file (that is now a full .wag config file, including the SIMISA first line of the original), then include ( "..\\..\\Common.inc\\Wagons\\Std_Wag_Brakes.inc" ) adds instructions from STD_Wag_Brake.inc inside the wagon section, and being after the the first include() these will be at the end of this section.

(The first empty line is required, or the include() statement wouldn't work.)

It's like programming with subroutines, that are then called by a base program one after another or based on specific tests; only, here we're working with text files and the result is a new text file.

Later from home I'll post the original .wag, the .inc and will show you the resulting file; I'll even post an example from an .eng file where there are additions to two sections (wagon and engine), it's not hard to understand and (to me) very simple and straightforward.



Luca

#13 User is offline   lucstef 

  • Apprentice
  • Group: Status: Active Member
  • Posts: 29
  • Joined: 22-August 14
  • Simulator:OR-MSTS
  • Country:

Posted 04 November 2022 - 09:49 AM

(This is not for Weter or other experts, it's just to show how I understand how the include() statement works)

Let's start with the original WVOGrain.wag:
SIMISA@@@@@@@@@@JINX0D0t______

Wagon ( WVOGrain
	comment( WVO Covered hopper, hi-hip version)
	comment( Physics by Chris Lee)
	Type ( Freight )
	WagonShape ( WVOGrain.s )
	Size ( 3.243m 4.728m 17.503m)
	comment( 23.776t empty, 106.747t full )
	Mass ( 73.78t )
	WheelRadius ( 36in/2 )
	InertiaTensor ( Box (3m 3.6m 13.5m) )
	Coupling (
		Type ( Automatic )
		Spring (
			Stiffness ( 1e6N/m 5e6N/m )
			Damping ( 1e6N/m 1e6N/m )
			Break ( 5.1e8N 5.1e8N )
			r0 ( 20cm 30cm )
		)
		comment( CouplingHasRigidConnection () )
		Velocity ( 0.1m/s )
	)
	Buffers (
		Spring (
			Stiffness ( 1e6N/m 5e6N/m )
			Damping ( 1e6N/m/s 1e6N/m/s )
			r0 ( 0m 1e9 )
		)
		Centre ( 0.5 )
		Radius ( 1 )
		Angle ( 0.5deg )
	)
			
	Adheasion ( 0.2 0.4 2 0 )
	DerailRailHeight ( 4cm )
	DerailRailForce ( 2.5N/kg*23t )
	DerailBufferForce ( 400kN )
	NumWheels (	8 )
	Friction (
		871N/m/s		0		1mph		3.26N/m/s		1.8
		5.1N/rad/s		1		-1rad/s		0		1
	)
	Lights	(	2
				
		Light	(
			comment( Rear red light flashing dim )
			Type		( 0 )
			Conditions	(
				Headlight ( 2 )
				Unit ( 3 )
			)
			FadeIn	( 0.5 )
			FadeOut	( 0.5 )
			Cycle		( 0 )
			States	(	2
				State	(
					Duration ( 0.35 )
					LightColour ( 80ff0000 )
					Position ( 0.0 1.2 -8.955 )
					Azimuth ( -180 -180 -180 )
					Transition ( 0 )
					Radius ( 1.0 )
				)
				State	(
					Duration ( 0.35 )
					LightColour ( 00000000 )
					Position ( 0.0 1.2 -8.955 )
					Azimuth ( -180 -180 -180 )
					Transition ( 0 )
					Radius ( 1.0 )
				)
			)
		)
		Light	(
			comment( Rear red light flashing bright )
			Type		( 0 )
			Conditions	(
				Headlight ( 3 )
				Unit ( 3 )
			)
			FadeIn	( 0.5 )
			FadeOut	( 0.5 )
			Cycle		( 0 )
			States	(	2
				State	(
					Duration ( 0.35 )
					LightColour ( 80ff0000 )
					Position ( 0.0 1.2 -8.955 )
					Azimuth ( -180 -180 -180 )
					Transition ( 0 )
					Radius ( 1.0 )
				)
				State	(
					Duration ( 0.35 )
					LightColour ( 00000000 )
					Position ( 0.0 1.2 -8.955 )
					Azimuth ( -180 -180 -180 )
					Transition ( 0 )
					Radius ( 1.0 )
				)
			)
		)
	)

	BrakeEquipmentType( "Handbrake, Triple_valve, Auxilary_reservoir, Emergency_brake_reservoir" )    <----- THIS SECTION HAS SOME SORT OF ISSUE THAT I'M NOT GOING TO CHECK,
	BrakeSystemType( "Air_single_pipe" )                                                              <----- IN OPENRAILS THE BRAKES AREN'T RECOGNIZED
	MaxBrakeForce( 22.13kN )                                                                            !
                                     
	MaxHandbrakeForce( 22.13kN )                                                                        !
	NumberOfHandbrakeLeverSteps( 100 )
                                                                                                            !
	EmergencyBrakeResMaxPressure( 110 )
	TripleValveRatio( 2.5 )                                                                             !
	MaxReleaseRate( 2.27 )
	MaxApplicationRate( 1.717 )                                                                         !
	MaxAuxilaryChargingRate( 1 )
	EmergencyResCapacity( 2.604 )
	EmergencyResChargingRate( 1 )                                                                       !
	BrakeCylinderPressureForMaxBrakeBrakeForce( 64 )                                                 <-----------------------------------------------------------------------

  	Sound (	"GenFreightWag1.sms" )
)


I then made a new brake system section and typed it in a STD_Wag_Brake.inc:

	BrakeEquipmentType ( "Handbrake, Triple_valve, Auxilary_reservoir, Emergency_brake_reservoir" )
	BrakeSystemType( "Air_single_pipe" )
	MaxBrakeForce( 78kN )
	MaxHandbrakeForce ( 57.2kN )
	NumberOfHandbrakeLeverSteps( 100 )
	EmergencyBrakeResMaxPressure( 110 )
	TripleValveRatio( 2.5 )
	EmergencyResVolumeMultiplier ( 1.461 )
	MaxReleaseRate( 22.2 )
	MaxApplicationRate( 13.9 )
	MaxAuxilaryChargingRate( 20 )
	EmergencyResCapacity( 2.025ft^3 )
	EmergencyResChargingRate( 20 )
	BrakePipeVolume ( 0.307ft^3 )
	BrakeCylinderPressureForMaxBrakeBrakeForce( 90 )

(Yes, I know, same everything apart from the tweaked values but still.....)

At this point, I made an Openrails folder inside the WVOGrain folder, where I placed a text file with the following text called WVOGrain.wag (the well known include method, with my comments):
                                                                           <----- REQUIRED EMPTY LINE
include ( "..\\WVOGrain.wag" )                                             <----- CALLS THE ORIGINAL WAG FILE
Wagon (                                                                    <----- THIS MEANS: INSERT THE NEXT LINES IN THE WAGON SECTION
	include ( "..\\..\\Common.inc\\Wagons\\Std_Wag_Brakes.inc" )       <----- CALLS THE .INC FILE WITH THE NEW PARAMETERS
)                                                                          <----- CLOSE THE WAGON SECTION


To note: this trick is in the manual, where it explains how to add instructions to remove the trees on rails in a route without touching the original .trk definition file.

The final result, if it would be visible, would be that:
SIMISA@@@@@@@@@@JINX0D0t______                                                              <---- START OF THE ORIGINAL WVOGRAIN.WAG

Wagon ( WVOGrain
        comment( WVO Covered hopper, hi-hip version)
        comment( Physics by Chris Lee)
        Type ( Freight )
        WagonShape ( WVOGrain.s )
        Size ( 3.243m 4.728m 17.503m)
        comment( 23.776t empty, 106.747t full )
        Mass ( 73.78t )
        WheelRadius ( 36in/2 )
        InertiaTensor ( Box (3m 3.6m 13.5m) )
        Coupling (
                Type ( Automatic )
                Spring (
                        Stiffness ( 1e6N/m 5e6N/m )
                        Damping ( 1e6N/m 1e6N/m )
                        Break ( 5.1e8N 5.1e8N )
                        r0 ( 20cm 30cm )
                )
                comment( CouplingHasRigidConnection () )
                Velocity ( 0.1m/s )
        )
        Buffers (
                Spring (
                        Stiffness ( 1e6N/m 5e6N/m )
                        Damping ( 1e6N/m/s 1e6N/m/s )
                        r0 ( 0m 1e9 )
                )
                Centre ( 0.5 )
                Radius ( 1 )
                Angle ( 0.5deg )
        )
                        
        Adheasion ( 0.2 0.4 2 0 )
        DerailRailHeight ( 4cm )
        DerailRailForce ( 2.5N/kg*23t )
        DerailBufferForce ( 400kN )
        NumWheels (     8 )
        Friction (
                871N/m/s                0               1mph            3.26N/m/s               1.8
                5.1N/rad/s              1               -1rad/s         0               1
        )
        Lights  (       2
                                
                Light   (
                        comment( Rear red light flashing dim )
                        Type            ( 0 )
                        Conditions      (
                                Headlight ( 2 )
                                Unit ( 3 )
                        )
                        FadeIn  ( 0.5 )
                        FadeOut ( 0.5 )
                        Cycle           ( 0 )
                        States  (       2
                                State   (
                                        Duration ( 0.35 )
                                        LightColour ( 80ff0000 )
                                        Position ( 0.0 1.2 -8.955 )
                                        Azimuth ( -180 -180 -180 )
                                        Transition ( 0 )
                                        Radius ( 1.0 )
                                )
                                State   (
                                        Duration ( 0.35 )
                                        LightColour ( 00000000 )
                                        Position ( 0.0 1.2 -8.955 )
                                        Azimuth ( -180 -180 -180 )
                                        Transition ( 0 )
                                        Radius ( 1.0 )
                                )
                        )
                )
                Light   (
                        comment( Rear red light flashing bright )
                        Type            ( 0 )
                        Conditions      (
                                Headlight ( 3 )
                                Unit ( 3 )
                        )
                        FadeIn  ( 0.5 )
                        FadeOut ( 0.5 )
                        Cycle           ( 0 )
                        States  (       2
                                State   (
                                        Duration ( 0.35 )
                                        LightColour ( 80ff0000 )
                                        Position ( 0.0 1.2 -8.955 )
                                        Azimuth ( -180 -180 -180 )
                                        Transition ( 0 )
                                        Radius ( 1.0 )
                                )
                                State   (
                                        Duration ( 0.35 )
                                        LightColour ( 00000000 )
                                        Position ( 0.0 1.2 -8.955 )
                                        Azimuth ( -180 -180 -180 )
                                        Transition ( 0 )
                                        Radius ( 1.0 )
                                )
                        )
                )
        )

        BrakeEquipmentType( "Handbrake, Triple_valve, Auxilary_reservoir, Emergency_brake_reservoir" )
        BrakeSystemType( "Air_single_pipe" )                                                          
        MaxBrakeForce( 22.13kN )                                                                            
                                     
        MaxHandbrakeForce( 22.13kN )                                                                        
        NumberOfHandbrakeLeverSteps( 100 )
                                                                                                            
        EmergencyBrakeResMaxPressure( 110 )
        TripleValveRatio( 2.5 )                                                                             
        MaxReleaseRate( 2.27 )
        MaxApplicationRate( 1.717 )                                                                         
        MaxAuxilaryChargingRate( 1 )
        EmergencyResCapacity( 2.604 )
        EmergencyResChargingRate( 1 )                                                                       
        BrakeCylinderPressureForMaxBrakeBrakeForce( 64 )                                          

        Sound ( "GenFreightWag1.sms" )

        BrakeEquipmentType ( "Handbrake, Triple_valve, Auxilary_reservoir, Emergency_brake_reservoir" )   <---- THIS IS THE ADDED SNIPPET FROM THE .INC
        BrakeSystemType( "Air_single_pipe" )
        MaxBrakeForce( 78kN )
        MaxHandbrakeForce ( 57.2kN )
        NumberOfHandbrakeLeverSteps( 100 )
        EmergencyBrakeResMaxPressure( 110 )
        TripleValveRatio( 2.5 )
        EmergencyResVolumeMultiplier ( 1.461 )
        MaxReleaseRate( 22.2 )
        MaxApplicationRate( 13.9 )
        MaxAuxilaryChargingRate( 20 )
        EmergencyResCapacity( 2.025ft^3 )
        EmergencyResChargingRate( 20 )
        BrakePipeVolume ( 0.307ft^3 )
        BrakeCylinderPressureForMaxBrakeBrakeForce( 90 )                                                 <---- ...TO HERE
)                                                                                              <----- END OF ORIGINAL FILE


That's it!!!

Oh, you can add parameters in different sections too, look at this commented example where I added new values in an .eng file:

include ( "..\\WVOSD402.eng" )                                                             <---- CALL THE ORIGINAL DEFINITIONS
Wagon (                                                                                    <---- ADD LINES TO THE WAGON SECTION
	include ( "..\\..\\Common.inc\\Locomotives\\Brakes\\Std_Loco_Brakes.inc" )
	MaxBrakeForce( 200kN )
)                                                                                          <---- END THE WAGON SECTION
Engine (                                                                                   <---- ADD LINES TO THE ENGINE SECTION
	include ( "..\\..\\Common.inc\\Locomotives\\Std_Loco_Eng.inc" )
)                                                                                          <---- END THE ENGINE SECTION


If you're working on a copy of the original file not using the first include, then you won't need the wagon() and/or engine() statements, because the new code will be placed right at the spot where the new parameter's include() is.


I hope this explanation is clear enough to understand the include() statement, and it's useful to ay least one of you :)
(I'm almost sure it's somewhere in the manual too, but I couldn't find it).


Luca

#14 User is online   Genma Saotome 

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

Posted 04 November 2022 - 12:03 PM

Luca, if you continue with this approach you should get to a point where the second file can become the actual .wag file. Go back to my post (number 7 in this thread) and look at the .wag file I posted and think about it.

#15 User is offline   lucstef 

  • Apprentice
  • Group: Status: Active Member
  • Posts: 29
  • Joined: 22-August 14
  • Simulator:OR-MSTS
  • Country:

Posted 04 November 2022 - 02:19 PM

Genma, I must admit I can't understand this last post.
Aren't the resulting files in Openrails folders just MSTS structured .wag and .eng files with added ORTS parameters?

One thing I didn't mention: I wanted to keep the original files (all 4000+ of them!) untouched to be used by MSTS if needed, although I'm on the way to abandon it entirely if not for the activity editor.
AS a plus, I can tweak the parameters if I find them too hard or easy, and that would reflect on all the rolling stock at once.


Luca

#16 User is online   Genma Saotome 

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

Posted 04 November 2022 - 05:32 PM

View Postlucstef, on 04 November 2022 - 02:19 PM, said:

Genma, I must admit I can't understand this last post.
Aren't the resulting files in Openrails folders just MSTS structured .wag and .eng files with added ORTS parameters?


As you continue to develop .inc files for various functions you'll be adding the Include statement to the file you have in your Open Rails folder. As you continue down that path you'll probably wind up with a file that looks a lot like what I posted in post #7. Then you add a name and sound and you have a complete .wag which you can elevate to the regular folder, replacing the .wag that was there and emptying the open rails folder in the process.


View Postlucstef, on 04 November 2022 - 02:19 PM, said:

One thing I didn't mention: I wanted to keep the original files (all 4000+ of them!) untouched to be used by MSTS if needed, although I'm on the way to abandon it entirely if not for the activity editor.
AS a plus, I can tweak the parameters if I find them too hard or easy, and that would reflect on all the rolling stock at once.

Ok. I had a similar though tho it wasn't about being able to go back to MSTS but to go back to the original .wag or .eng file. I moved a copy of all of the folders in \trainset into a new folder I called Library and for the most part left them as-is. Eventially I made a second library, one for MSTS an the other for pure OR. You see, I didn't want to use the Open Rails folder... I felt it was a kludge solution that was likely going to leave me with a lot of redundant files and I was very focused on eliminating redundancy. You have so many files I rather doubt you will wind up doing much like what I did but perhaps some of the things I'm writing about might give you something to think about any maybe try. For example my comment about you ending up with a pure OR .wag file in you Open Rails folder. Just keep doing what you've been doing... that file will start to look more and more like the example I posted. When it does AND you find yourself only using OR, what good is the original .wag?

Anyway, this is all meant as food for thought and you already have plenty on your plate. Keep at it!

#17 User is online   Weter 

  • Member, Board of Directors
  • PipPipPipPipPipPipPipPipPipPip
  • Group: ET Admin
  • Posts: 6,957
  • Joined: 01-June 20
  • Gender:Not Telling
  • Simulator:ORTS
  • Country:

Posted 04 November 2022 - 09:14 PM

Hello, Luca.
Thanks for explanation.
(Long time I didn't touched that - so have fragmental amnesia)
Well, I've seen as well somewhere in Manual, that given by Your example include method will replace whole blocks of original file: that means, doing that way, one can prepare the whole block, rather specific lines.

#18 User is offline   lucstef 

  • Apprentice
  • Group: Status: Active Member
  • Posts: 29
  • Joined: 22-August 14
  • Simulator:OR-MSTS
  • Country:

Posted 05 November 2022 - 01:27 AM

View PostWeter, on 04 November 2022 - 09:14 PM, said:

Hello, Luca.
Thanks for explanation.


I'm happy to be of help :)


View PostGenma Saotome, on 04 November 2022 - 05:32 PM, said:

As you continue to develop .inc files for various functions you'll be adding the Include statement to the file you have in your Open Rails folder.


Yes Dave (Genma), I see your point, but this time I only had one section to correct, everything else was good already, and I still can't understand why can't the original brake parameters be recognized by OR, maybe the too low values.
I understand it may be a cheating method as well, with switchers powered by an AC6000 engine... :D

The trainset was already backed up, so I have a base for MSTS and maybe all this work was for nothing; still, I'm sure I had much less work that way than opening every single wag and eng and replacing the bad parts (copy, scroll, select and paste...eyes and hands are not what they used to be :) ).

I'm going to rebuild the MSTS installation for backup purpose, I'll move differently with incremental backups now, one pure MSTS, another tweaked for ORTS etc. working on the original files...
All this in the name of knowledge, I like to experiment with different roads.

Aaaaahh, the joy of virtual railroads and the happiness to install an activity without the need to hunt for missing rolling stock... :D too bad there are none active right now :(



Luca

#19 User is offline   Csantucci 

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

Posted 05 November 2022 - 03:28 AM

Luca,
I also felt the inconvenience that you describe in the first post. So, I checked the OR code and noticed that, merely adding two lines of code, your desire can be fulfilled. i attach here a patch for ORNYMG 133: inserting the 2 patch files in ORNYMG, following feature is present: if the include line is as follows:
include ( ../##SameName## )

OR will replace ##SameName## with the name of the file where tthe line is present.
Attached File  Orts_Parsers.Msts.zip (63.46K)
Number of downloads: 78

Luca, if you can check the patch and if it works, I'll include it in next ORNYMG version and generate also a PR for the official OR versions.

#20 User is offline   lucstef 

  • Apprentice
  • Group: Status: Active Member
  • Posts: 29
  • Joined: 22-August 14
  • Simulator:OR-MSTS
  • Country:

Posted 05 November 2022 - 10:20 AM

Thanks Carlo, it appears to work.
In the F5 advanced HUD I can see the values from my own .inc files, both for engines and wagons, and the train does what I expect i.e. a 6000HP engine (just for fun on a SW1500) gives the expected pull and the brakeforce raises to my values.

If you trust my 10 minutes test...it's a go :)
Thanks again.


Luca

  • 3 Pages +
  • 1
  • 2
  • 3
  • 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