• Keine Ergebnisse gefunden

CityMoS Frontend is a software which was self-implemented as part of this work. It is an interactive visualization tool that allows participating in and controlling of federation executions in a coupled environment using HLA. It may either be used as a standalone

visualization of static offline data or as a live interactive visualization of dynamically exchanged data between joined federates by participating in a federation execution. The design goal of CityMoS Frontend evolved, first being merely a supporting tool for visually inspecting data used as input for or generated as output by CityMoS Power in 2D. It later emerged as a 3D visualization of complex moving scenes and was ultimately extended by supporting HLA not only passively consuming data to be visualized but also actively producing data.

From a simulation perspective the contribution of CityMoS Frontend may be low. This tool, however, facilitates work with the CityMoS platform by allowing to visualize and influence the interactions between CityMoS Traffic and CityMoS Power and thereby provide insights into federation executions at runtime. This is especially important to attract new users which in principal enables a rapid adaption of the entire CityMoS platform.

CityMoS Frontend is implemented in Processing, an open source programming language and integrated development environment [133]. Processing was developed as a cross-platform environment for programming within the context of visual design and visual arts at the MIT Media Lab in 2001. Processing is based on Java and is, besides its new graphics and utility API, fully compatible with it. It supports both 2D and 3D visualization and uses the open graphics library [134] to interact with the system’sgraphics processing unit to achieve hardware accelerated rendering.

The various functionality provided by CityMoS Frontend supports simple and complex visualization of graph-related data and allows for user interactions with either the standalone visualization or the joined federates in a federation execution. Its main functionality is described in Section 3.5.1 followed by an architectural overview in which the sequence of interactions is explained in Section 3.5.2. The data format used for input and output data is discussed in Section 3.5.3. Examples for the visual output generated by CityMoS Frontend are provided in the context of applying the platform to the case of Singapore in Chapter 4.

3.5.1 Main Functionality

CityMoS Frontend comprises various functionality for visualizing data, especially graph-related data, and supporting the user in visually interacting with simulations coupled via HLA at runtime. The following list provides an overview on CityMoS Frontend’s main functionality:

Execution mode

CityMoS Frontend implements HLA functionality which allows it to join federation executions and act as a regular federate. As such it can register, delete, update, and reflect object instances as well as send and receive interactions. It therefore acts not only as a sink visualizing received data but also as a source being able to influence the federation execution by sending data. A standalone execution mode only visualizing offline data from a file system without joining any federation execution is also available.

Visualization

Graph-based data, in this context nodes and edges, can be visualized both in 2D and 3D allowing to switch the way of presentation at runtime. Data is thereby drawn on multiple layers whose visibility can be toggled to visualize only parts of the data being of

interest to the user. Currently, layers for power system, road and railway transportation system, and general purpose graph-based data as well as layers for showing a background and general visualization parameters are supported. The layer for power system data is further distinguished into the different voltage levels, the layer for road and railway transportation system as well as general data is split up each into a layer for nodes and edges. The visualization is not restricted to the screen resolution. Instead, the resolution can be arbitrarily changed. It is only limited by the used graphics and processing hardware. This is especially important when reducing the resolution to improve performance or increasing the resolution for rendering images or videos in a higher than the native resolution. Rendered images may not only be directly visualized but also saved to the file system for later processing.

User interactivity

CityMoS Frontend implements user interaction possibilities for both execution modes visualizing offline and online data coming from the file system or from other joined federates, respectively. Direct interactions with the visualized data set is restricted to inserting and deleting nodes or edges as well as selecting them and showing or modifying their attributes. Modifications to the initial data set coming from the user or other joined federates can be saved to the file system. Visualization parameters, e.g., resolution, layer visibility and their elevation when drawing in 3D, as well as color and size of drawn nodes and edges can be modified at runtime over the maingraphical user interface. With simple mouse movements the user may also change the camera view settings by moving along the two or three axes in 2D or 3D mode, respectively. This includes zooming in and out functionality. The user may also pixel-based compare two rendered images to conclude on the degree of equality of the underlying data sets. This especially comes in handy when spotting the differences of two different scenes that are not obviously visible at first glance.

3.5.2 Interactions

In Figure 3.6, the interaction sequence is shown for the execution mode in which CityMoS Fron-tend acts as a joined federate in a federation execution. The sequence is as follows:

1. At the beginning, the user passes program arguments to the main classMainFrontend. Those arguments contain various parameters for rendering images, illustrating nodes and edges, composing the different layers, settings regarding the usage of CityMoS Frontend in a coupled environment using HLA, and other configuration parameters related to logging as well as input and output file handling.

2. Within MainFrontend a new Visualization object is created. Its purpose is to visualize data, handle user interactions, and manage interactions within the federation execution.

3. For interactions with other joined federates, an RTI object is created serving as an interface for calling functions offered by and providing callback functions from the RTI. Available services are defined in the interface specification of HLA as described

[User wished to change the settings]

[User wished to insert nodes and/or edges]

[User interaction]

reflectedObjectInstances / receivedInteractions timeAdvanceGranted [User wished to delete nodes and/or edges]

modifyNodesEdges() [User wished to modify nodes and/or edges]

opt

Figure 3.6: Interactions in CityMoS Frontend.

in Section 3.2.2. In case of the standalone execution mode the RTI object does neither forward any calls to nor receive any messages from the RTI.

4. TheRTI object is initialized as described in the Initialization phase in Section 3.2.5.

5. In case there is offline data available it is initialized and registered to the federation execution.

6. A continuous loop is running until the simulation exit condition, e.g., the simulation end time or an exception, is reached. The loop consists of the followings steps:

a) The user may interact with the Visualization object at the beginning of each time step. Possible interactions are described in Section 3.5.1 and include modifications to program settings and to the visualized data such as inserting, deleting, or updating nodes or edges.

b) The Visualization object executes the desired user interaction and, in case of a modification of the visualized data, additionally delegates it to the RTI object to inform other joined federates of the modification.

c) The actual visualization is performed by calling thedrawFrame() method of the

Visualization object. If the user indicated to save the rendered images the save-Frame()method is additionally being called.

d) In case the federate is paused the time advancing functionality is disabled resulting in rendering the exact same frame at the next iteration of the loop. This allows the user to interact multiple times with the federate at the same time period. In the usual case where the federate is not paused the time advances and data modified by other joined federates is being reflected as described in Section 3.2.5.

7. TheRTIobject is finalized as described in the Finalization phase in Section 3.2.5 and the control flow is first given back to the MainFrontendclass and then to the user.

3.5.3 Data Format

As a tool interacting with and visualizing data of other federates, CityMoS Frontend does not define its own data format. Instead, the XML and CSV format used by each individual federate is supported. CityMoS Frontend as a live interactive visualization tool allows the user to interact with the input data, either being offline or dynamically exchanged between joined federates. Regardless of the execution model, visualized data can be output to the file system including any modifications applied by the users of other joined federates. The data format equals the one used by the respective federate. Output files comply with their matching XSD, if existing, and are therefore valid. Semantic constraints are not validated but assumed to already have been checked by each particular federate.