
h2. Model Visualization


h3. Usage of AMALTHEA Model Visualization

The AMALTHEA Visualization can be opened via
*  __Window &rarr; Show View &rarr; Other... &rarr; APP4MC &rarr; APP4MC Visualizations__, 
*  or via right click on an element and selecting __Open APP4MC Visualization__.
Via the context menu it is also possible to open multiple visualization views.
  
On selecting a model element, the view will render a corresponding visualization. If multiple visualizations are available, the first one will be selected by default, unless the user has selected another visualization before.

The visualization view has 3 buttons in the toolbar:

# **Visualization dropdown**<br/>The dropdown contains all available visualizations for the current active selection. A click on the image will reload the visualization.
# **Pin visualization**<br/>The selection handling will be disabled so the visualization gets not updated on model selection changes.
# **Select model element**<br/>Selects the current visualized model element in the model editor. Useful for example if a visualization is pinned and the selection in the model editor changed.

!../pictures/visualization-view.png!


h3. Standard Visualizations

APP4MC comes with a set of default model visualizations to show the options and possibilities the visualization framework provides.


h4. Hardware Model

* +HW Model Block Diagram+<br/><br/>This visualization is intended to provide an overview of the described and used hardware within the system.<br/><br/>It uses PlantUML and SVG for rendering. Therefore a Graphviz dot.exe needs to be configured via __Window - Preferences - PlantUML - Path to the dot executable of Graphviz__ in order to get the result shown.<br/><br/>!../pictures/hwmodel_hwblockdiagram.png!


h4. Software Model

* +SWModel Statistics Visualization+<br/><br/>This is a simple visualization that shows some statistics on the selected Software Model. It is also a simple example to show how to implement a visualization with JavaFX and some animations.<br/><br/>!../pictures/swmodel_statistics.png!<br/><br/>

* +Shared Runnable Label Dependencies+<br/><br/>This visualization paints all __Runnables__ and the read/write dependencies on __Labels__ in a Software Model.<br/>Via the buttons on the left edge you can __Zoom in (+) / Zoom out (-) / Filter (F)__ the currently visible __Runnables__.<br/><br/>!../pictures/swmodel_label_dependencies.png!

notextile. <ul>
    <li>
        <p>
            <u>Runnable Data Dependencies</u>
            <br />
            <br />
            The purpose of this small - but
            hopefully useful - visualization is to lay out a graph of the
            <i>Runnables</i>
            in a software model based on there data dependencies.
            This means, two runnables are connected by a directed edge if the first
            runnable writes a
            <i>Label</i>
            that is read by the second one.
            Furthermore, some parts of the control flow are expressed by edges. The
            tool colors the graph in order to make it easier for the user to follow
            individual edges.
        </p>
        <p>
            For the visualization to work properly, the path to Graphviz DOT has
            to be set up in the PlantUML preferences. You can access them via
            <i>Window &gt; Preferences...</i>
            and then opening the PlantUML tab.
        </p>
        <p>The buttons in the top row are used to configure the
            visualization.
        </p>
        <ul>
            <li>
                <i>Horizontal Layout:</i>
                Toggle between horizontal
                (left to right) and vertical (top to bottom) layout of the
                graph.
            </li>
            <li>
                <i>Show Labels:</i>
                Show read and written labels of the
                runnables.
            </li>
            <li>
                <i>Show R/W Dependencies:</i>
                Show read/write data
                dependencies between runnables. This is independent from the labels
                being shown.
            </li>
            <li>
                <i>Show Control Flow:</i>
                Show stimuli, inter-process
                triggers, and OS events. Also show the sequence of runnables within a
                task.
            </li>
            <li>
                <i>Show Tasks:</i>
                Group runnables by tasks.
            </li>
            <li>
                <i>Export:</i>
                Export the visualization as an image, or
                as Graphiz DOT. Supported image formats are PDF, SVG, and
                PNG. Output in other formats can be generated by exporting in DOT
                format and running Graphviz manually.
            </li>
            <li>
                <i>+ / -:</i>
                Zoom in/out.
            </li>
        </ul>
        <p>
            For performance reasons, the visualization has been limited to models
            containing at most 200 runnables. This limitation does not apply to
            the
            export of the graph in
            DOT
            format.
        </p>
        <p>
            <img src="../pictures/datadependency_screenshot.png" />
        </p>
        <p>The table below summarizes which elements are visualized. The
            following elements are considered:
        </p>
        <ul>
            <li>Within a <i>Runnable</i>: <i>LabelAccess</i></li>
            <li>Within a <i>Task</i>:
                    <i>Group</i>, <i>RunnableCall</i>,
                    <i>InterProcessTrigger</i>,
                    <i>WaitEvent</i>,
                    <i>SetEvent</i>
            </li>
        </ul>
        <p>
            Other activity items (e.g. <i>ProbabilitySwitch</i>) are simply
            ignored. Using them may lead to incomplete results.
        </p>
        <table class="classic">
            <tr>
                <td>Runnables</td>
                <td align="center">
                    <img src="../pictures/datadependency_runnable.png" alt="image" />
                </td>
            </tr>
            <tr>
                <td>Stimuli</td>
                <td align="center">
                    <img src="../pictures/datadependency_stimulus.png" />
                </td>
            </tr>
            <tr>
                <td>Tasks</td>
                <td align="center">
                    <img src="../pictures/datadependency_task.png" />
                </td>
            </tr>
            <tr class="odd">
                <td>Data dependencies</td>
                <td align="center">
                    <img src="../pictures/datadependency_rwdependency.png" />
                    <br />
                    (colored edges)
                </td>
            </tr>
            <tr>
                <td>Runnable sequence in tasks</td>
                <td align="center">
                    <img src="../pictures/datadependency_sequence.png" />
                </td>
            </tr>
            <tr>
                <td>Inter-process stimuli, OS events</td>
                <td align="center">
                    <img src="../pictures/datadependency_sync.png" />
                </td>
            </tr>
        </table>
    </li>
</ul>

h4. Runnable

* +LabelAccess View+<br/><br/>A simple visualization of a __Runnable__ and its __Label__ read/write access. On the left side the __Labels__ are rendered that are accessed for a read operation. On the right side the __Labels__ are rendered that are accessed for a write operation.<br/><br/>!../pictures/runnable_labelaccess.png!<br/><br/>

* +Shared Runnable Label Dependencies+<br/><br/>Visualization of all selected __Runnables__ and their relationships based on __Labels__. This visualization is an example to verify how to implement a visualization on multi-selection.<br/>Via the buttons on the left edge you can __Zoom in (+) / Zoom out (-) / Filter (F)__ the currently visible __Runnables__.<br/><br/>!../pictures/runnable_sharedlabels.png!<br/><br/>

* +Runnable Label Dependencies+<br/><br/>This visualization shows the current selected __Runnable__ and the __Runnables__ that have a direct dependency via __Labels__. On the left side the __Runnables__ are rendered that +write+ to __Labels__ that are read by the selected __Runnable__. On the right side the __Runnables__ are rendered that +read+ from __Labels__ that were modified by the selected __Runnable__.<br/>Via the buttons on the left edge you can __Zoom in (+) / Zoom out (-)__ the currently visible __Runnables__.<br/><br/>!(scale)../pictures/runnable_labeldependencies.png!


h4. Deviation

* +Probability Density Diagram+<br/><br/>This visualization provides probability density diagrams for all subclasses of<br/> - IContinuousValueDeviation<br/> - IDiscreteValueDeviation<br/> - ITimeDeviation<br/><br/>Markers (vertical lines) are shown for lower bound, upper bound and average.<br/><br/>Changed values in the Properties view lead to an update of the diagram.<br/><br/>!../pictures/deviation_boundaries.png! !../pictures/deviation_statistics.png! !../pictures/deviation_histogram.png! !../pictures/deviation_gauss.png! !../pictures/deviation_beta.png! !../pictures/deviation_weibull.png!

h4. Mapping

* +Scheduler Mapping Table+<br/><br/>This visualization shows a (hierarchical) table of schedulers, processing units and processes.<br/><br/>!../pictures/mapping_schedulers.png!

