Page tree

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: added date for Excursion to Miniatur Wunderland

...

Code Block
13.5. Presentation    
27.5. Station-Station Controller + C-Interface
17.6. Integrationstesting
24.6. Defined testcases with stopflag
01.7. Schedules for trains are working

cw 34 Final presentation
cw 3528.08 Excursion to Miniatur Wunderland

...

The main idea is, that we have a universal model of the track segments. From these single track segments, track sections, that connect train stations are modeled and from those track sections, all final schedules for the trains should be build. On each track segment, there should be at most one train: In order to drive over a track, a train must request this track, and afterwards it must free it again (details below). If two trains request the same track section, the priority, which is derived from the train number, decides, which train gets the track section. A train must request all tracks until the next possibility to stop an wait and wait in order to avoid collisions. If the train does not get all track segments, it must free them again in order to avoid deadlocks or delays of other trains. Deadlocks might occur at the exits of all train stations, and additionally, if one train with a low priority exits the Kicking-Horse-path while another train with a higher priority sends an entry-request. It remains to be seen, if additional deadlocks occur. Deadlocks can be resolved by using a superior Mutex-Controller. 

...

Code Block
linenumberstrue
scchart Default_Pass {
  bool perm_next_Segment;
  initial state Fooprev
  --> Gleissegment with 'contact(Segment,0)';
  state Gleissegment {
    entry / 'req(next_Segment)';
    entry / 'setSignal(prevSegment, red)';
  
  initalinitial state Entry
    --> Continue with 'contact(Segment,0)' & perm_next_Segment
 
   --> Slowdown with 'contact(Segment,0)';
  
  state Slowdown {
      entry / 'setSpeed(Segment,SLOW)';
    }
    --> Waiting with 'contact(Segment,1)'
    --> Continue with perm_next_Segment;
    
  state Waiting {
      entry / 'setSpeed(Segment,BRAKE)';
    }
    --> Continue with perm_next_Segment;
  
  state Continue {
      entry / 'setSignal(Segment,green)';
      entry / 'setSpeed(Segment,full)';
      entry / 'setSpeed(nextSegment,full)';
      entry / 'setSignal(nextSegment, red)';
    }
    --> leave immediate;
    final state leave;
    region:
    initial state Entry
    --> cleanup with 'contact(Segment, 0)';
    state cleanup {
      entry / 'free(prevSegment)';
      entry / 'setSpeed(prevSegment,OFF)';
    }
    --> leavedone immediate;
    final state done;
  }
  >-> next with 'contact(nextSegment, 0)';
 final state leavenext;
}

Behaviour modeled in an SCChart (without deadlock prevention):

...

The C-Interface wraps some general functions, in order to prevent long and ugly host-code statements within the SCCharts. It especially hides the railway pointer. In addition, the C-Interface provides a persistent environment during a macro step. To bring in some randomness, the time, which a train has to wait in a station, is controlled by the C-Interface. Therefore, trains have to notify the interface about their arrival and their departure. 

Controller C Interface

 

Test cases: 

Our Implementation should pass the following simple tests: 

...