Jump to content

Set a Max Speed

Richard T

Recommended Posts

I would like to add a Maximum Speed to an engine.

I was intending to set up an event instruction so if the Engine gets a new speed command, it will check it, and if the command is greater than the max, then it will set the speed at max.

I can set up the instructions but I can’t find a way to trigger the event when the engine receives a new speed command.

There seems to be an example on Wiki – event management (basic) –, I can translate the page to English, but it doesn’t translate the example.

Could someone help me please?

Also, is there an event management (advanced) page?  Some years ago, I wrote a program in VB to control things, but I can’t remember how I did it. I must have had some more detailed information about the game to have done it. Does anyone know where I could find more detailed programming info for V7 as I would like to do a bit more in this area?

Link to comment
Share on other sites

vor 6 Stunden schrieb Richard T:

I can’t find a way to trigger the event when the engine receives a new speed command.

Hello Richard,
a new speed command isn't a trigger as such, which is why you cannot respond to it.

When the issuing of a new target speed is an action inside your EV, you may of course use that same EV entry to first compare the new target speed with the max value stored in the engine's variables. From the way you describe this, I'm sure you know this.

I assume you want to activate the speed limiter when the speed is changed by external means (user input, rocrail etc.)?

In that case, you'll either have to set up a loop which regularly monitors all engine's target speed. 

Or maybe place a few stop contacts at strategic locations and set their deceleration value to the engine's max value.

The latter would be more in line with the studio's general philosophy.

Kind regards

Link to comment
Share on other sites

I've had this exact same problem.

My solution, though inelegant, works.

I have a number of events, all of which do the same thing. One is triggered when a train enters a track contact, one when it reaches the centre, one when it leaves, one when it enters a track length one when it leaves a track length. All of them do basically what Goetz said: check the vehicle's speed against a variable "Max Speed"on the vehicle, if it is greater they set it back to the maximum speed.

The problem is that at V7 signals have auto-accelerate on them. This is good because it saves a lot of code to stop and start trains when signals change, but while the train is passing that signal, it still tries to set the speed to the signal's "accelerate to" speed - even once the signal has gone red, which is weird! The only way I have found to limit a loco's speed at V7 is to literally check it everywhere and set it back down. Having a low acceleration on the slower trains means they generally don't get too much above their max before something notices.

If having maximum speeds on locos is important, you would be better off using V6, where the loco must be stored at the signal by an EV, and started by an EV when the signal changes, this EV can access the loco's max speed variable and set the speed as required.

Hopefully V8 will take account of this and allow different trains to have different maximum speeds

Link to comment
Share on other sites

vor 29 Minuten schrieb simonjackson1964:

it still tries to set the speed to the signal's "accelerate to" speed

No matter what people event, there's always some who manage to shoot themselves in the foot with it. Haha

How about setting the acceleration at signals to a low value, say a shunting speed of 25 km/h?
And let your automatic take care of superseeding this value, in accordance with the individual Vmax?

Link to comment
Share on other sites

Because it means that an express train will slow to an unrealistic crawl when passing a clear signal?


.... Wait...

Set the "accelerate to" to the lowest speed,  but don't set the decelerate to unless that is the track limit!

Then have a contact right after the signal that sets the train's new speed!

@Goetz Thanks, you've made my day.

(Major edit to layout coming up)

Edited by simonjackson1964
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Create New...