For this example how to use blockrates, classes and variables and a combination of them, we take a look at the following plan (see pic below):
As you see we have two trains, lok1 with adress 1 and lok2 with adress 2.
We have two startblocks called start1 and start2, they lead over switches to the blocks called up1 and up2 or to the blocks called down1 and down2.
The direction is only to the right.
So when we start now the automatic and start all trains, the change is 50:50 weather a train goes to the upper road (via block up1) or to the down road (via block down1).
(If both blocks up1 and down1 are free and not occupied by another train or closed).
And now we want to change this change with blockrates.
We go now in the properties of block up1 and change the random rate to 8 (see pic below):
We do the same with the block down1, but here we set the random rate to 2!
When we start now over again, we will see, that a train in average choose in 8 of 10 cases the upper road and in 2 of 10 cases the down road!
But now we want more.
The goal is now, that train lok1 always take the upper road (via block up1), but train lok2 shall use in average in 8 cases up1 and in 2 cases down1.
So how we can reach this goal? → With classes!
We go in the train database and set for lok1 under properties-details the class 'lok1' (see pic below):
We do now the same for lok2, but lok2 get the class 'lok2'!
Now we set for block up1 the class: lok1,lok2 (under properties-permissions - see pic below):
For the block down1 we set the class only to lok2!
lok1 can now only choose the upper road (via block up1), because this is the only block, where the class lok1 is allowed!
lok2 will choose in average of 8 cases block up1 and in 2 cases block down1, because both blocks have the class lok2 and the blockrates are 8 to 2!
lok1 has as you see in the picture above the class 'lok1'
To change this we need a new action (In this example we want to set the lok class to xy and xyz):
Then we can call this action. The action will be done by every lok if we set no conditions in the conditions tab.
The result is, that the lok has now the new classes xy and xyz:
To change the block class, do it the same way: