User Tools

Site Tools


critsec-en

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

critsec-en [2018/11/12 08:56] (current)
Line 1: Line 1:
 +====== Critical Sections ======
 +[[english|Content]] -> [[english#​automatic mode|Automatic Mode]] ​
 +  * **Critical Sections ​ ** 
 +   
  
 +// \\ // \\
 +
 +----
 +With Critical Sections you can prevent deadlocks by grouping Blocks so they are all reserved by one train at the same time
 +----
 +
 + \\
 +
 +A Critical Section prevents two locomotives from blocking each other when trying to enter a single main line from opposite ends.  When two locomotives want to travel down the same main line in opposite directions, one must wait until the other one has come through the line and passed it.
 +
 +===== Setup =====
 +
 +Blocks **b3** and **b4** are setup as a **Block Group** with the **Critical Section** flag set (__[[blockgroups-en|See Content > Objects > Block Groups]]__) to prevent a dead lock.  **b3** and **b4** are the main line that must be shared by locomotives running in opposite directions. ​ At least one end of the main line must have a turnout to provide a passing track, this example has turnouts at both ends.
 +
 + \\
 +
 +**Notes** \\
 +Also b3 and b4 do not have the __[[block-gen-en#​wait|wait]]__ flag set.\\
 + \\
 +
 +===== Flow of locking and unlocking =====
 +
 +| Initial positions of the two loco'​s. |
 +| {{critsec-test-1.png}} |\\
 + \\
 +| After starting both loco's in auto mode only one can reserve the block group b3b4. In this case Loc1 did win. |
 +|{{critsec-test-2.png}}|\\
 + \\
 +| Block b1 is unlocked at the **in** event of block b3. |
 +| {{critsec-test-3.png}} |\\
 + \\
 +| Block b5 is reserved at the **enter** event of block b4. |
 +| {{critsec-test-4.png}} |\\
 + \\
 +| Block b3 is unlocked at the **in** event of block b4. But block b3 cannot be locked by another train because b4 is still locked. |
 +| {{critsec-test-5.png}} |\\
 + \\
 +| Now Loc1 has come in to block b5 and frees up block 4 which makes it possible for other trains to lock the block group b3b4. |
 +| {{critsec-test-6.png}} |\\
 + \\
 +| Loc2 can now travel to the other side by locking b3 and b4. |
 +| {{critsec-test-7.png}} |\\
 + \\
 +
 +===== Files =====
 +{{critsec-test.xml}}\\
 + \\
 +Use the **Virtual** or **DDX** library to simulate the events by mouse clicks.
critsec-en.txt ยท Last modified: 2018/11/12 08:56 (external edit)