JModelica.org comes with a graphical user interface (GUI) for displaying simulation and / or optimization results. The GUI supports result files generated by JModelica.org and Dymola (both binary and textual formats).
The GUI is located in the module
(pyjmi/pyfmi).common.plotting.plot_gui and can be started by Windows users by selecting the shortcut located in the start-menu under JModelica.org. The GUI can
also be started by typing the following commands in a Python shell:
from pyjmi.common.plotting import plot_gui #or pyfmi.common.plotting import plot_gui plot_gui.startGUI()
Note that the GUI requires the Python package wxPython.
An overview of the GUI is shown in Figure 9.1. As can be seen, the plot figures are located to the right and can contain multiple figures in various configurations. The left is dedicated to show the loaded result file(s) and its(theirs) variables together with options for filtering time-varying variables and parameters/constants.
Loading a result file is done using the
File menu selection
Open which opens a file dialog where either textual (.txt) results or binary (.mat) results can be chosen. The result is then
loaded into a tree structure which enables a user to easily browse between components in a model, see Figure 9.2 . Multiple results can be loaded either simultaneously or separately by using the
File menu option
Displaying trajectories is done by simply checking the box associated with the variable of interest, see Figure 9.2. Removing a trajectory follows the same principle.
A result can also be removed from the tree view by selecting an item in the tree and by pressing the delete key.
The GUI allows a range of options related to how the trajectories are displayed such as line width, color and draw style.
Information about a plot can in addition be defined by setting titles and labels. Options related to the figure can be found
Edit menu as well as adding more plot figures.
Axis/Labels, options such as defining titles and labels in both X and Y direction can be found together with axis options.
Lines/Legends, options for specifying specific line labels and line styles can be found, see Figure 9.6. The top drop-down list contains all variables related to the highlighted figure and the following input fields down to
Legend are related to the chosen variable. The changes take effect after the button
OK have been pressed. For changing multiple lines in the same session, the
Apply button should be used.
Additional figures can be added from the
Add Plot command in the
Edit menu. In Figure 9.7 an additional figure have been added.
The figures can be positioned by choosing a figure tab and moving it to one of the borders of the GUI. In Figure 9.8 "Plot 1" have been dragged to the left side of the figure and a highlighted area has emerged which shows where "Plot 1" will be positioned. In Figure 9.9 the result is shown.
If we are to add more figures, an increasingly complex figure layout can be created as is shown in Figure 9.10 where figures also have been dragged to other figure headers.
Options for interacting with a figure and changing the display can be found under the View menu. The options are to show/hide a grid, either to use the mouse to move the plot or to use the mouse for zooming and finally to resize the plot to fit the selected variables.
Moving a figure with the
move option is performed by simply pressing the left mouse button and while still holding down the button, dragging the plot to
the area of interest. A zoom operation is performed in a similar fashion.
In Figure 9.12 an example showing how the GUI can be used to plot four different plots with different labels. Some of the lines have also been modified in width and in line style. A grid is also shown.