Jump to content

Recommended Posts

I have just recently purchased version 4. I love it, I also (perversely) love the frustration of trying to work out how to make it do what I want...! But now I think it's time to give up struggling and ask!

I'm sure this must be really easy to do because it is a basic function of automatic train control. I have managed to make the train entering the block turn the signal red, and the train leaving the block turn it green. I can get the train to stop at the red signal, And get it to start again when the signal changes to green, but the moment the train enters the block and turns the signal red, it stops again.

I'm sure there must be an easy way to do this... The way I have found seems awfully complicated!

Share this post


Link to post
Share on other sites

Hi simon!

I assume the signal to be within the block.
So I got two questions:

vor 2 Stunden schrieb simonjackson1964:

the train leaving the block turn it green

isn't the signal already green, if you leave the block? How did you pass it else? And why switch it to green, if you switch it back to red when a trains reenters the block? Okay, that seems not to be the problem.
 

vor 2 Stunden schrieb simonjackson1964:

but the moment the train enters the block and turns the signal red, it stops again.

I assume it stops immediately and not at the signal. Assure to set the speed of the train to zero when the event happens, that the trains enters the track right before the signal with the condition is red. You may also add (in a second event) setting it to zero if the signal becomes red, with the condition that the train is at this track. Checkout the available samples before you're goin' cray :)

greetings
  Andy

Share this post


Link to post
Share on other sites

I found a solution, actually! It works now.

To summarise what I said originally: I had two trains and two signals (With the layout under development, I wanted to get one signal block working before investing the time in all the others). Signal 1 is the starter for Bock 1 and Signal 2 is the starter for block 2. Train A is in block 1 (having been driven past Signal 1 manually). Train B is in the fiddle-yard (Call it Block 0). Signal 2 is green and has no control on it yet... Train B drives out of the fiddle-yard and stops (correctly) at signal 1. Train A is continuing forward and passes signal 2 (having no effect because 2 is not yet "wired up"). As the tail of Train A passes signal 2, it triggers a "vehicle leaving" event which turns signal 1 green, allowing train B into block 1. But the moment Train B hits the track section that triggers the event to change the signal to red, which in turn triggers the event to stop the train on the preceding track section, the train stops, because the loco is still partly on that section!

The solution I came up with is so obvious I deserve a slap for not thinking of it sooner: I put a length of track between the length that stops the train and the length that changes the signal, long enough for the longest locomotive to fit on! *FACEPALM!* That way the loco is clear of the stop section before it hits the trigger section!

If there were more guides and instructions in English, this would be a much more universal product... The entire world speaks some English, but only a small part speaks German. I was unaware that there are any available samples, because I don't understand most of the threads in this forum!

-------------------------------

I do have a related question, though. At present on my layout, when a signal goes green because the preceding train has left the block, the train stopped at the signal speeds up to a set speed determined by the event that starts it going. Is there a way of telling the loco to always speed to a unique value, so for example a freight train might get up to 100kph, where an express passenger train might get up to 200kph (And get realistically stuck behind the freight...) without the need to create a starter event for each loco at each signal?

If there isn't, I'll just have to get my coding hands out of the drawer I keep them in and bite the bullet!

Edited by simonjackson1964

Share this post


Link to post
Share on other sites

Hi simon!

If you look close to the trains parameters, there's a symbol in the top row leading to 'object variables'. This is a field of variables to be defined local to the object. You may spent here a variable called (i.e.) standardspeed and set it (i.e.) to 100. Instead of setting a fix value for the trains speed when the signal turns green, you can now give the value mytrain.standardspeed, or even better, use _Trigger1 (or maybe 2), read the instructions for that special one.

Another possibility: grab the invisible (read-only!) objectvariable mytrain._TargetSpeed and save it to another variable before setting the speed to zero.
Don't forget the $-character before the variable's name to pick the real value and not the variable's name (strings and values are treated pretty same here).

vor 8 Stunden schrieb simonjackson1964:

If there were more guides and instructions in English, this would be a much more universal product.

That's hopefully just a question of time. In the english section of the forum you may have to wait sometimes a bit to get a response - but someone will care! So far, everyone from everywhere is needed for further development. Best wishes for your project.

Andy

Share this post


Link to post
Share on other sites

Hi Andy

On 23/06/2018 at 10:37 AM, Andy said:

If you look close to the trains parameters, there's a symbol in the top row leading to 'object variables'.

Sorry, I'm not sure what I'm looking for? I have found the "Event Wizard" button has a list of active variables in it, which helped me debug my semi-automatic fiddle-yard...

I'm wondering if there is a "behind the scenes" coding tool, that shows the actual event code the wizard creates? I've not found it yet if there is!

Share this post


Link to post
Share on other sites

Hello simon,
not the event wizard, try the trains menu, look here:

 

objectvariables.jpg

Share this post


Link to post
Share on other sites

Ah, right, got that. So I create a variable in there, called "Speed" and give it a value 135. (for example)

Then, I have an event, for when the signal is toggled to green, that has the action "Set Vehicle speed"  to "$my_train.Speed". That works for the locomotive called "my_train". What about the other 7 trains I have running? (Not usually all at once but sometimes, just to slow things down a bit... Basically I have two 5-track fiddle-yards, one at each end of a double-track - technically it's just a squashed single track loop! Track 1 is automated and just pushes each train back out as it comes in. Tracks 2-5 are manually controlled with some serious interlocking on the control switches (learned the hard way).)

The track lengths and signals all have user variables too.The problem is, not how to get the speed I want into the locomotive, it's how to get the value out of the specific locomotive and save it.

I think it might actually just be easier to create a "Set Vehicle Speed" action for each loco, at each signal. Unless there is a way I can somehow save the loco name when it stops at the signal?

Share this post


Link to post
Share on other sites

Hi simon,
just check my sample. It's a pretty simple one. You will find an object variable "dir" for the train - this could be important for more complex situations, don't underestimate it.
There are two non-object-variables for the block. block1_speed and block1_filled. 2nd one is for later expansions only, but the first one is used. In this sample I leave the block with the incoming speed (which could be negative!!!). The train gets slowed down to a speed that ensures that it can stop at the signal. You could also use your favorite speed (trains local speed as mentioned in posts before). As you can see, this block is independent from a specific train name. (just click > to start the sample).

greets

  Andy

 

blocksample.mbp

Share this post


Link to post
Share on other sites

Hi Andy.

Thanks, that seems to be exactly what I was looking for!

Now to try it out with 8 different locos hauling 8 different trains on my 12 block layout....... Ugh. If it works (and I've no reason to think it won't), I will have to re-edit most of the train control events.

I also realised why I was having trouble with "Head & Tail" (or "Push-me-pull-you") railcars, thanks to your example. The one at the back is going backwards... Allowing for negative speed values will help with this (Needs a bit of tweaking to give the rear loco its initial -ve speed, but do-able), but also with the very likely idea that a diesel drives forward into a siding, has the wagons uncoupled and shunted into a different siding  to be filled/emptied, then the diesel attaches to the other end of the train and hauls it back out in the opposite direction - In prototype, the driver just gets in the cab at the other end of the loco. In the model, the loco is now going backwards! (I checked to make sure my locos were facing forwards before adding them to the layout).

Thanks for all your help. When I've got the layout how I want it, I'll publish it and let you have a play! ;)

(Oh, please don't go away though... I will probably need more help when I start trying to get the goods yard working! That's on hold until the main-line does what I want. And I'm not happy with yard track formation yet - one of the best things about this program is the ability to rip up the track and re-lay it all, without having to buy new track!)

Simon

Share this post


Link to post
Share on other sites
vor einer Stunde schrieb simonjackson1964:

Oh, please don't go away though

I'll stay until they kick me for spamming :D

p.s.: if you reorganize tracks, place those tracks aside that have a meaning for events. you can modify their length or alignment, but the connection to the logic should be kept.

Edited by Andy

Share this post


Link to post
Share on other sites

I already realised that! (The hard way!)

Fortunately the goods yard has no "wiring" yet. (I call it wiring, because that's what it would be on a physical model railway - half a tonne of "spaghetti" dangling off the bottom of the baseboard!)

One thing I do like is that if you change the name of an object, that change is cascaded through the entire event file. Otherwise it would be a nightmare changing every single occurrence!

Share this post


Link to post
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

×