Page tree

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Using the Visualization

The railway visualization is created for the KIELER Simulation Visualization (KiVis). When running a simulation of the environment or controller, the visualization will present the current state of the system by positioning trains and changing colors and other graphical attributes of elements in the image. Furthermore it is possible to interact with the visualization.

Interactions

The following presents the possible interactions.

  • Power and unpower all tracks using the corresponding buttons
  • Power and unpower tracks by clicking the corresponding track
  • Toggle state of points via click
  • Toggle state of lamps via click
  • Toggle state of contacts via click

There are 3 states in which tracks can be powered using the visualization

  • When the track is unpowered, the track will be powered to move in travel direction (120)
  • When the track is clicked again, the power is changed to be against the main travel direction (-120)

...

  • The third click will unpower the track (0).

Animations

The following presents how variable values are visualized.

  • Trains are positioned on the tracks they are standing on
    • The environment visualization moves trains to the correct path and position on that path using the values of train_track, train_branch and train_pos.
    • The controller visualization moves trains to the middle of the track they are standing on, based on the value of the position array
  • Colors show the track speeds
    • red, yellow and pink are used for power in the main travel direction
    • red: 100..120, yellow: 80..100, pink: 1..80
    • blue, purple and green are used for power against the main travel direction
    • blue: -100..-120, purple: -80..-100, green: -1..-80
    • a speed value of 0 will show the normal track as it is in the SVG file
    • this animation is created by changing the stroke size and color of the paths on the track
  • Colors show the state of points and lamps
    • points that are STRAIGHT are visualized with a white background
    • points that are BRANCHED are visualized with a green background
    • lamps that are OFF have a transparent background
    • lamps that are ON have a yellow background
  • Colors show the state of contacts
    • contacts that are ON have a big green stroke added to them (big enough to be visible even if a train is shown above that contact)
    • contacts that are OFF are shown as in the SVG image
  • The fill color of signals is transparent, if that signal is off and visible if it is on
  • A sonic beam is visible around the bell if the bell is ON
  • Error labels are shown for each train as well as each wagon
  • An additional error label is shown if a collision occurs

The SVG File

An SVG file has been created, in which the elements that are animated have a unique Id. The Model Railway Track Layout svg has been choosen for this task, because it shows a more detailed view of the railway, in contrast to the Model Railway Track Scheme.

The KiVis File Templates


Another file required for the visualization is a kivis file. It defines how the SVG elements are animated to represent the running simulation. For the railway, this file is rather complex and thus created from Freemarker templates.

The following explains the structure of the Freemarker template files that generate the kivis files.

...

There are dedicated visualizations for the environment SCChart and controller SCChart. Both reference the same base templates, that provide animations and interactions for common railway elements, e.g., points and contacts. Further the same constant definition file is used by the templates.

This results in the following template files for the visualization:

FileDescriptionReferences
EnvironmentVisualization.ftl

The top level template for the environment visualization.

Has animations for the trains, based on their exact position from the environment (track, branch, pos).
Furthermore, errors detected by the environment are shown via animations.

BasicVisualization.ftl
ControllerVisualization.ftl

The top level template for the controller visualization.

Has animations for the trains, based on the track position, that is assumed by the controller.

BasicVisualization.ftl
BasicVisualization

Has animations and interactions that can be used by both, the environment and controller.
This includes animations and interactions for the bell, crossing lights, crossing gates, lamps, points, signals, contacts.

Furthermore the power of the tracks is animated and can be changed with a click on the corresponding track.

Constants.ftl

Util.ftl

Constants.ftl

Defines railway constants, mostely taken from the wagon.sctx

Furthermore the file contains classification of the tracks, to calculate with these.

For instance, there are lists with all tracks, only with tracks that have branches, or which branches belong to which tracks.


Util.ftlUtil
constants
macros and functions


To Be Continued...

In the next episode of "Visualization Documentation":

  • Constant details
  • Basic visualization details
    • Trains are hidden when not in use
  • Controller visualization details
  • Environment visualization details