Beiträge von Zaphr


Abonniere unseren Kanal auf WhatsApp (klicke hier zum abonnieren).

    A virtual control value is, as the name says, a virtual thing. It is used for the F4 HUD and can be used to unbind a control like the TrainBrakeControl from the hardcoded simulation part of TS. When you put in the VirtualBrake in your BP, it then replaces the hardcoded train brake lever in the HUD and you can use the TrainBrakeControl as an direct input from script to control the brakes without having the user being able to move it by the HUD. This is possible for most of the HUD presented levers and values. The Ammeter can be replaced by the VirtualAmmeter and so the HUD would show the value that you write onto that virtual control instead of the hardcoded simulation ammeter value.


    Thats a basic description of the behavior. What you then do with this is a completely different story and much more complicated. If you want to have your own brake cotrol behavior, then you need to script it completeley. You can use the VirtualBrake as the users input, do something with the given input value and write the result onto the actual TrainBrakeControl. Same for the Regulator what can be replaced by the VirtualThrottle. And so on....

    Thanks! I had the function of VirtualBrake and TrainBrakeControl mixed up, but your explanation makes perfect sense. I will basically let the user set the VirtualBrake to a specific value and then have TrainBrakeControl match it but more slowly.

    The simulation script is basically not used at all since years. It's kinda useless. You cant do the same from the simultion script as you can from the engine script AND the simulation script is only running when you are sitting in that vehicle. Both sccripts cant communicate with each other (only with numbers over translating controllers in the engine BP what is also mostly useless and restricted).

    Thanks Maik, I guess that's why the AP locomotives only have one line of code or so in the simulation script (an update function).


    If I want to control the rate of application (how fast the brake lever percentage increases in the sim) and other stuff like implementing clasp brake phyiscs (different percentage of brake for different speeds), can this be done by controlling the TrainBrakeControl directly or do I need to use VirtualBrake? I'm still kind of unsure what the use of VirtualBrake, VirtualThrottle etc is for, but I see it used in the complex trains such as AP, vR, 3DZUG etc.

    I'll update this thread since I found the solutions to my questions. It seems like you can implement your functions in either the main script (like Armstrong Powerhouse does) or the simulation script.


    I'm trying to create more realistic brakes for my locomotive (more notches for example) but I'm unsure what the difference is between TrainBrakeControl and VirtualBrake. Is there a reason for using a VirtualBrake instead of only the TrainBrakeControl?

    I'm trying to modify a locomotives behavior but I'm still inexperienced in how the lua-scripts are used by Train Simulator.

    Many times a locomotive will have one main script such as "locomotive name script".lua and then in the Simulation folder there will also be a script. Are these divisions completely arbitrary or is there a general method of what will be controlled by the main script and what is controlled by the simulation-script?


    I presumed that the main script would call the engine script/simulation script but looking inside the main script I don't see any reference so maybe it is the simulation blueprint that calls it?

    Sorry if the question is too vague/general.


    EDIT: I had a look around in the main script and the engine script (latter located in Simulation folder) and that answered my first question. The engine blueprint calls the main script and the simulation-blueprint calls the engine script.


    Looking inside the main script I see very few references to TrainAirBrakeControl, actually the only reference/call is to set the train air brake to the initial application setting. I have some follow up questions instead:


    1. If I want to program the throttle to decrease according to the tractive effort curve rather than the default way of controlling this with the tractiveeffortvsspeed table. For example to also implement a delay and implement field weakening effects. Would this be programmed inside the script file inside the simulation folder or main script, or is it up to my choice?


    2. If I want to implement G-brake and P-brake slower application timings, is this something for the main script? I foresee that you could have a check for what the player sets the brake lever to and then call some function that slowly ups the virtual brake handle to this value.

    Thanks. I'll have to experiment with the track rules.

    Zaphr Yeah, it works exactly like that. It just multiplies braking force with coefficient meaning how much of braking force can be applied at this speed.

    Could I ask what curve you are using? I was implementing this on another addon but a lot of the brake shoe coefficient of friction vs speed curves are different.

    I think in Sweden the max cant is 160mm so MaxCantAngleDegree = 6.36 deg


    "Why would you use a yard trackrule for a 160 km/h main line or vice versa?"


    It was more to find out how the system worked. If you define a 160 km/h track rule, then the minimum radius should be the minimum radius that trains can travel, with max cant, right? So then Passenger and Freight type would have the same minimum radius I presume? (otherwise for example passenger will give less cant)

    Kal000px I think the possibility of wheelslip should decrease the higher speed you have.

    This is not 100% correct, adhesion is lower at high speeds so if the locomotive can develop the same tractive effort at a higher speed then the likelihood of getting a wheelslip is increased. The only reason why wheel slip happens less often at high speed is due to the locomotive power not being able to achieve full force.

    Sorry if this has been asked before but I'm interested in the clasp brake (block brake I think it's called in the manual) physics of the locomotive. Is this achieved by decrease the brake controller (in the sim I mean) with higher speed, according to a curve? If this is the case I think wagons have to be recalibrated with higher brake force to get the correct BrH.

    Thanks, both Prelli and Rschally!


    I just have three follow up questions (that I can think of right now at least):


    1. What does "curve to angle percent" mean in the track rules blueprint?


    2. Just to confirm a max vertical rail displacement of y mm would give a "Max cant angle degrees" of arctan(y/1435) for normal track gauge?


    3. If we go back to this answer:


    "Different values of maxspeed require different values for the superelevation.

    If you have a radius of 1000m with a maxspeed of 80 kmh you will probably want a noticeable but weak superelevation.

    If you have a radius of 1000m with a maxspeed of 160 kmh you will probably want a remarkeble and very heavy/strong superelevation.

    Therefore most route bulders use several trackrules for different maxspeeds."


    The railway you are trying to simulate probably has a maximum cant (I think in Europe around 150-160mm but maybe there are some exceptions). Usually there is also a maximum lateral acceleration allowed, which will depend on the cant, curve radius and speed.


    In Sweden they use the following equation: R >= 11.8 * v^2 / (cant + cant deficiency). Take the 160 km/h at 1000m radius, would you create the track rule so that you need to use yard-type for this or perhaps you have passenger minimum = yard minimum? Or yard can exceed comfortable acceleration?

    So there is no "danger" in creating a piece of track with one trackrule (f.e. vmax = 80) and then connect it to another piece of track with another trackrule (f.e vmax = 120)?

    Thanks for the info!


    If you don't mind, I have two other questions:


    1. I hear conflicting recommendations about using track rules, one is that you should only have one track rule per connected railway and one is that you "will not get far with only one track rule". My plan was to make my own track rule for the route so I can control stuff like superelevation/distance between tracks etc specific for the route I'm building (in Sweden). If you should have more than one track rule, what would be the reason for this?


    2. I like the look of the DBtracks but I can not find a download link, I've only seen them from Trainworks updates but they don't seem to come with the asset folder, simply just changed out tracks. Are these still available for download?

    I've sent you a PM. Thanks again for all the help!


    I have two follow up questions:


    1. Do most commercial routes use SRTM/DEM data or a different format or an entirely different process?


    2. I usually struggle with how to end a curve and transition to straight track when using easements and following the Google-maps overlay. This is because the straight track indicator is so short it is very difficult to see if it is slightly misaligned until you start laying the straight track. Usually I try to line up the straight purple indicator but then oftentimes have to split the curve at the end and retry until I get it "perfectly" aligned. Is there a better process than this?

    I'm currently designing a route in Sweden where I have used SRTM 30m data to get "better" topology. Unfortunately the starting station DEM data was slightly incorrect so I played my tracks about 5m higher than they are in real life. This would not be a problem if the whole route was raised 5m but I noticed later when I had built about 10km of track that only this station was wrong and so I needed to have higher gradient than in real life.


    1. I would like to move all of the track in the whole route 5 meters lower, is this possible? It seems like it would be possible in theory, just go over all track coordinates and subtract the Z-coordinate 5 meters (or vertical coordinate, seems like this is Y in TS2020).


    2. I have pretty good gradient data for my route like this: km xx.x-yy.y: 5 per mill up etc. Is there a better way to assign a piece of track a specific gradient (such as 0.005) instead of having to drag the gradient marker up (which is quite inaccurate and tedious)?


    3. When the gradient changes, has anyone found a good "gradient change per meter" that doesn't cause an unrealistic bump in the cab?


    I checked the Moselbahn and it seemed like a change from 0.0 to 4.0 per mill was done in sections of about 5m for every 0.5 per mil (so 0.0, 0.5, 1.0, 1.5, 2.0, etc each 5 meter). But I couldn't see any gradient markers, maybe this is deleted when you open up a route that you didn't make in the editor. But I wonder if the gradients were changed manually or with the "smooth gradient"-tool?


    4. I noticed that the "smooth gradient"-tool is kinda tricky/buggy. If I have for example 0.0 grade that changes to 8.0 per mill grade and I mark some track before and after the change in gradient sometimes after smoothing the grade goes up then down then up, rather than slowly going up. Is there a correct way to use the tool?

    Everything at maximum except view distance 1 step back from maximum.

    Weird. I had view distance at max when I tested it but scenery detail one step from maximum for some reason so unless view distance is more taxing I should have the less intensive settings. My GPU is slightly stronger so this would point toward it being a CPU issue, can TS2020 take advantage of all 8 cores?

    I was wondering if the Umgehungsbahn Mainz is something you have already started working on or if it is something you will start with when you are done with all the other fixes to the route you are planning? The reason for me asking is because if it is something you won't start with for a long time I could do it (or part of it at least) because I'd love to have that in the route to make realistic freight scenarios from Mainz-Bischofsheim Rbf.

    Maybe someone already said this:


    1. On the early morning winter scenario for Frankfurt Koblenz all light screens (ebula for example) and things that are lit up by headlights look pixelated, am I the only one that sees this?


    2. In the Frankfurt - Koblenz scenario (2nd one) I get 5fps with i7 7700K at 4.8Ghz and RTX 2070 Super : D although i have 2x2 Supersampling but it's the lowest I have ever seen, anyone else get very low fps?

    I think I know the reason, in Frankfurt Hbf there are like 30 AI BR423 placed everywhere and the FK BR423 are really badly optimized.

    1. BR406 Mg-brake seems to have wrong physics because it doesn't seem to increase brake force vs full brake (VB). Test stopping distance in VB from 160 km / h vs emergency (SB). Maybe the Mg-brake is only aesthetic?


    2. RSN freight wagons (actually all wagons) are empty, even the trains are called "loaded". Take a loaded train in timetable and check the briefing (divide by number of wagons).


    3. RSN passenger & freight wagons have incorrect braking physics (too strong brakes)


    4. Trains with clasp brakes (klotzbremse) such as RSN freight wagons and Sand Patch grade wagons don't work like in reality.


    Brake force vs speed should look something like this (x = speed (km / h), y = percentage of maximum brake force):

    {

    {x = 0, y = 1},

    {x = 10, y = 0.743},

    {x = 20, y = 0.600},

    {x = 30, y = 0.506},

    {x = 40, y = 0.451},

    {x = 50, y = 0.414},

    {x = 60, y = 0.394},

    {x = 100, y = 0.331},

    {x = 160, y = 0.286},

    }

    Or something similar to this (I took this from a curve I found in a study of block brakes), important thing is that it is * NOT * linear. In TSW2 it is linear = not realistic. It might seem like a small difference but it makes a huge difference for American freight trains when you are driving them down steep grades.


    EDIT: For those who are skeptical of how much the difference in shape of friction curves can affect the simulation. Let me give an example of how trains are driven in mountain grades (1.5% or steeper or there abouts, someone might have the exact definition, I can't remember it).


    In the USA they use "Tons per Operational Brake" (TOB) instead of BrH. It is defined as the train weight in tons divided by number of brake cylinders (usually one per car) so it basically is the average weight per car.

    On the 2.4% grade at Tehachapi Pass the engineer will usually apply around 8-14 pounds depending on the TOB, this will nearly hold the speed steady but the engineer then uses dynamic brakes to fully control the speed. Usually the amount of air brakes applied is enough to hold the speed at 50% dynamic brakes at around 20-30mph.


    Here is where the variable braking force with speed comes in: If the train has to stop, rather than applying more air the engineer simply increases the dynamic brakes to make the train decelerate, because the brakes are much more effective at low speed (due to the non-linear dependence) the train will stop even if the brakes were not enough to keep the speed constant at initial higher speed.


    When the train has to move again, rather than releasing the brakes (this is not good because of how North American freight train brakes work, you could end up with a runaway train since the brakes wont have had time to fully recharge when the train has accelerated to the line speed again) the engineer throttles up enough to accelerate the train, then goes into dynamic braking close to the line speed and holds it there as before.


    In TSW2 because of the unrealistic linear friction dependence, when you try to drive the train like this the train will never stop because the brake force hasn't increased enough at low speed to overcome the drop in brake force when the dynamic brakes fade away! This means that if you have to stop for a signal you have to increase the air brakes, but when you want to get moving again the brakes will be too strong back at line speed so you need to release them (no no) or use throttle going down hill! xD