WOLFRAM SYSTEMMODELER TUTORIAL

Model CenterIntroduction

Introduction | Class Browser | Class Window | Graphical Views | Modelica Text View | Component Browser | Variable Views | Reliability View | Messages View | Kernel Command View | Documentation Center | Functional Mock-up Interface | Keyboard Shortcuts | Kernel Commands

By default, Model Center starts with four windows (see following figure): (A) the Class Browser; (B) a class window; (C) the Component Browser; and (D) a window with parameter and variable views and the Messages view.

1.gif

An overview of Model Center.

Tooltips

Tooltips are the small rectangles with help messages that pop up while keeping the mouse cursor still over an item, for example, a button on the toolbar or a connection in the Diagram View.

In some views, such as the Diagram View, the tooltips can be disabled. To turn tooltips on or off for a certain view, open the Options dialog box by choosing Tools Options. The tooltip settings are located in the Model Center General view and are automatically saved when closing the dialog box and restored the next time Model Center is started.

In most dialog boxes, you can get help with any item in the dialog box by clicking the question mark icon in the title bar and then clicking the item, or right-clicking on an area or item and choosing What's This? from the popup menu.

Showing a tooltip for the Version section of the Class Properties dialog.

Customizing the Windows

All Model Center windows, except the class window and the Documentation Center window, can be dragged and dropped within the main window or outside it as floating windows.

The window locations and sizes are saved when the application is closed and restored when the application is opened the next time. To reset all windows to the default configuration, choose View Reset Window Layout.

Window layouts are described in greater detail in the section Window Layout Management.

Version and License Details

The version of Model Center can be found by choosing About SystemModeler from the Help menu.

3.gif

The About SystemModeler dialog box.

The dialog will also show the name of the licensee and the activation key. There is also a System Information button, which will show detailed information about SystemModeler in a new dialog. This information is intended for sending to Wolfram technical support if technical issues arise.

Document Interface

The default configuration of Model Center is to use a tabbed document interface (TDI), where classes can be viewed and edited in a tabbed environment. If you prefer to use a multiple document interface (MDI), where classes are viewed and edited in windows, you can switch to MDI in the Options dialog box. Open the Options dialog box by choosing Tools Options. The document interface settings are located in the Model Center General view.

One of the main benefits of TDI is the overview of open classes that it provides. The tabbed environment also makes it easier to switch back and forth between classes. What it does not allow is to view multiple classes side by side. This can only be accomplished by switching to the MDI, which gives you control over the size and position of the windows.

Default Units

The default units used in Model Center can be changed in the Options dialog box. Open the Options dialog box by choosing Options from the Tools menu. The default units setting is located in the General view.

Loading Classes

At any time you can load one or more Modelica files (*.mo, *.moe) in Model Center by choosing File Open. Alternatively, you can drop Modelica files anywhere on the Model Center window. Recently used files are available in the File Recent Files menu. Click one of the menu items to load the specified file. The number of items available in the Recent Files menu can be specified in the General view of the Options dialog box, accessible from the Tools menu.

As soon as Model Center is finished reading the contents of the files, the loaded classes will appear in the Class Browser.

Any attempts to redefine existing classes when loading a file will be detected and you will be given a chance to abort the operation. If you choose to proceed, the existing classes will be replaced with the class definitions in the file.

4.gif

The Load and replace warning dialog box.

Refreshing Classes

In some rare cases, it may be necessary to force a refresh of a class in Model Center. When refreshing a class, the class definition is refetched from the SystemModeler kernel and all elements of the class, including child classes, are updated in Model Center.

To refresh a class, right-click its name in the Class Browser and choose Refresh from the popup menu, or if the class is open, right-click an empty area in a graphical view and choose Refresh from the menu.

Validating Classes

Click the Validate Class button on the toolbar to validate the class of the active class window. You may also right-click any class in the Class Browser and choose Validate from the menu. Note that it is not possible to validate read-only classes.

5.gif

The Validate Class button on the Tools toolbar.

All syntactic and many semantic errors in the class will be detected and reported. Note that the semantic check cannot be performed if the class has syntax errors. A report of the semantic check is shown in the Messages view of the window at the bottom of Model Center.

If the semantic check is successfully completed, the total number of equations and variables, as well as the number of non-trivial equations of the class, will be listed at the end of the report.

6.gif

The validation report of the MyFilter model.

Simulating Classes

Classes are simulated using Simulation Center. To start a simulation of the class in the active class window, click the Simulate Class button on the Tools toolbar. This will build and simulate the class in Simulation Center.

7.gif

The Simulation Class button on the Tools toolbar.

By clicking the arrow next to the Simulate Class button, it is possible to set experiment settings such as start and stop time for the class. This is described in greater detail in the section on editing class properties.

Simulation Center can also be started or brought into focus without creating an experiment by clicking the Simulation Center button on the Applications toolbar.

8.gif

The Simulation Center button on the Applications toolbar.

For more information on simulation, please see the chapter on Simulation Center.

Publishing Classes

Using the publisher tool, it is possible to generate documentation for Modelica classes that can be viewed in any web browser. The generated documentation is standalone and does not require SystemModeler.

When publishing a class, pages with information about the class, such as parameters, variables, constants, and components are automatically generated. The publisher extracts information from the class in order to create these pages, so the more details you provide in the form of component descriptions, documentation annotations, and so on, the more information will be available in the generated documentation.

The publisher also generates an interactive graphical representation of the Diagram View of each published class. In order to visualize the graphics in a web browser, the web browser needs to have the Microsoft Silverlight plugin installed.

To publish a class, open the class and choose Publish Class from the File menu. This will open a dialog box that will let you configure the publisher.

9.gif

The publisher configuration dialog box.

The different sections of the dialog box are described in detail below.

  • Publishing Root Directory: the directory in which all generated files and folders are saved.
  • Target Folder: select an existing folder to update a previously published class.
  • Publish Referenced Classes: select classes to publish along with the main class to enable hierarchical browsing of the published class.
  • Post-processing Options: specifies the post-processing options.
  • Show published class in web browser: shows the published class in the default web browser.
  • Create ZIP archive: archives all generated files and folders of the published class in a single ZIP file.

The published version of the class Modelica.Electrical.Analog.Examples.DifferenceAmplifier can be seen in the screenshot at the end of this section.

As seen in the figure, the view of a published class is divided into four sections. In the top-right section, the Diagram View of the class is found. This view is also interactive. Click a component to select it and view related information in the bottom-right section. When no component is selected, information about the published class is shown in the bottom-right section. If the class of a component was published along with the main class, it is possible to view the component class by double-clicking the component. In the top-left corner of the Diagram View, you will also find a control panel that is used to pan and zoom the Diagram View. The control panel becomes visible when the mouse cursor is within its area. Finally, the top-left view is a tree view of all referenced classes that were published along with the published class.

The bottom-left section controls what information is shown about the published class or any selected component of the class. For information on how to publish simulation results, see the section on publishing plots.

10.gif

Modelica.Electrical.Analog.Examples.DifferenceAmplifier published.

Updating a Previously Published Class

If you have made changes to a class that you already have published, you may update the published result by changing the target folder in the dialog box to the folder containing the previously published class. The folders presented in the drop-down box are the folders found in the specified publishing root directory.

11.gif

Updating a previously published class.

When updating a previously published class, any published simulation results will remain intact and accessible from the updated version of the published class.

Limitations

Due to technical reasons, there are a few limitations that should be taken into consideration when publishing classes.

  • Text items: the font name and font style attributes of text items are not supported.
  • Rectangle items: the border style attribute of rectangle items is not supported.
  • Ellipse items: the begin and end angle attributes of ellipse items are not supported.
  • Filled shapes: the tiled fill patterns (Horizontal, Vertical, Cross, Forward, Backward, and Cross diagonal) are not supported.

Importing and Exporting Functional Mock-up Units (FMUs)

In SystemModeler it is possible to export and import FMUs. An FMU implements a C interface defined by the Functional Mock-up Interface (FMI), which is an open and tool-independent standard for exchange of models between tools. SystemModeler supports FMI 1.0 for Model Exchange export and import.

Undoing Mistakes

In the event of a mistake, you can undo the most recent actions performed. Choose Edit Undo to undo the very last undoable action you performed. If you later decide you did not want to undo a certain action, choose Edit Redo. Please note that it is not possible to undo all actions. The Undo and Redo operations can also be reached from the Standard toolbar.

12.gif

The Undo and Redo buttons on the Standard toolbar.

Setting the Number of Undo Levels

The maximum number of consecutive actions you can undo is by default 100. This number can be changed to any number between 0 and 999. Open the Options dialog box by choosing Tools Options. The setting is available in the Model Center General view and is automatically saved when closing the dialog box and restored the next time Model Center is started.

Installing Modelica Libraries from Library Archives

A library archive is the preferred form of distributing Modelica libraries for SystemModeler. It allows Modelica libraries to be distributed as a single file and provides the means to automate the installation and configuration of Modelica libraries in SystemModeler.

Modelica libraries for SystemModeler are available in the Wolfram library store. The library store carries both free and commercial libraries and is reachable by clicking the Download Libraries button at the bottom of the Class Browser in Model Center. The library store is an online store and requires a web browser and an internet connection.

The Download Libraries button at the bottom of the Class Browser in Model Center.

Installing Library Archives

SystemModeler library archive files are associated with Model Center and can be opened either by choosing Open from the File menu or by dropping the files anywhere on Model Center.

When opening a library archive file, the Library Archive Installer is launched and the contents of the library archive is presented. A single library archive can contain multiple libraries. To start the library installation process, click the Install Libraries button.

Installing the BioChem library using the Library Archive Installer in Model Center.

Once the installation process is finished, the libraries will automatically be loaded and configured to load at startup of SystemModeler. If any of the libraries in the library archive are commercial libraries that require activation, an activation dialog will be shown when they are loaded. See Activating Modelica Libraries for more information on the activation process.

During the configuration step, libraries are configured to load at startup of SystemModeler. This could lead to a library conflict if another library with the same Modelica name is also configured to load at startup. In this case, a dialog will appear that will let you resolve the conflicts. See Resolving Library Conflicts for details on library conflicts and how to resolve them.

Library conflicts when installing libraries from a SystemModeler library archive.

Activating Modelica Libraries

Commercial libraries need to be activated before they can be used in SystemModeler. The activation process is initiated when the library is loaded. To activate a library, you need the activation key that you received when you purchased the library.

The SystemModeler library activation dialog box.

Managing Modelica Libraries

It is possible to customize the set of libraries for use with SystemModeler in the Modelica library manager. The Modelica library manager is available in the Options dialog box and is accessible from both Model Center and Simulation Center. Open the Options dialog box by choosing Options from the Tools menu and go to the Global Modelica Libraries section. In Model Center it is also possible to reach the library manager by clicking the Modelica Library Manager button at the bottom of the Class Browser.

17.gif

The Modelica Library Manager button at the bottom of the Class Browser in Model Center.

You will find that the right-hand side of the dialog box lists all Modelica libraries currently configured for use with SystemModeler. The settings are automatically saved when clicking the Apply button or closing the Options dialog and restored the next time SystemModeler is started.

The Modelica Libraries view of the Options dialog box.

In the library manager, Modelica Libraries are divided up into bundled libraries, installed libraries, and custom path libraries. Libraries are listed in a tree view, where libraries that come with SystemModeler are listed under the Bundled Libraries branch of the tree. These libraries cannot be uninstalled or removed. If you were to download and install libraries from the SystemModeler Library Store, these libraries will be listed under an Installed Libraries branch (only visible if at least one library is installed). Custom path libraries are libraries that can be located anywhere on your computer and that can be added to the library manager by adding their location as a library path. These libraries appear under a branch named after the actual location of the library path.

Some libraries, such as the Modelica Standard Library, consist of a collection of libraries. To view all the libraries that are part of such a library, expand the branch of the tree representing the library.

Loading Libraries from the Library Manager

When accessing the library manager from Model Center it is possible to load any library listed in the library manager by right-clicking the item representing the library and choosing Load Library from the popup menu. As soon as Model Center is finished reading the contents of the library files, the loaded library will appear in the Class Browser. If the library is already loaded, it is reloaded from the file and the current loaded version of the library is replaced. Any unsaved changes of the currently loaded version of the library are lost.

Specifying Libraries to Load at Startup

A library whose checkbox is checked is automatically loaded at startup of SystemModeler. By default, the Modelica standard library, the SystemModeler IntroductoryExamples, and the SystemModeler MathematicaExamples are configured to load at startup.

Whenever a new library is specified to load at startup, a dependency analysis and conflict analysis are performed. Any additional libraries required by the specified library are automatically selected to load at startup as well. To avoid a situation where conflicting libraries are loaded at startup, any conflicting libraries are automatically unchecked. If this happens a dialog will be shown with information on the libraries that were unchecked.

At any time, a library's dependencies on other libraries can be shown in the form of a tooltip. To activate the tooltip, move the mouse cursor on top of a library item and hold it still for a couple of seconds.

Showing the dependencies of the Modelica library in the library manager.

Changing the Logical Group for a Library

Each library in the library manager is associated with a logical group. This setting controls which section of the Class Browser the library appears in when loaded. To change the associated group for a library, click the corresponding drop-down box and choose a different group.

Changing the group association for a library.

Adding Custom Libraries

To add your own libraries or models, click the Add Library Path button and select the path containing your files. Once added, any Modelica libraries found within the path appear under a new branch of the tree and are loaded at startup. The folder search depth when adding a path is two levels, i.e. libraries located more than two folders down the folder hierarchy of the added path are not picked up.

As a convenience, all libraries discovered in custom library paths are automatically checked to load at startup. This may lead to library conflicts; see Resolving Library Conflicts.

Removing Custom Libraries

Libraries or models added using the Add Library Path button can be removed from the library manager by selecting the custom library path and clicking the Remove Library Path button. When removing a custom path, no files are deleted; the libraries are only removed from the library manager.

Uninstalling Libraries

Libraries that have been installed from a SystemModeler Library Archive can be uninstalled by selecting the item representing the library archive and clicking Uninstall Library Archive. All libraries part of the library archive will be uninstalled and the files of the libraries will be permanently deleted from the computer. This operation is not undoable; a warning will be issued before the uninstallation is performed.

Resolving Library Conflicts

In some situations, such as when adding a custom library path or installing libraries from a SystemModeler Library Archive, a library conflict may arise. A library conflict is when two or more libraries with the same Modelica name are specified to load at startup, for instance two different versions of the same library. A library conflict is shown in the form of a warning triangle icon next to the libraries in conflict.

To obtain information on exactly what other libraries are in conflict with a given library, place the mouse cursor on the library item and hold it still for a couple of seconds; a tooltip will appear. Resolve the conflict by unchecking all but one of the conflicting libraries.

Resolving a library conflict in the library manager.

Setting the Screen Resolution

To make the size of graphic objects on screen match their actual specified size, you need to set the screen resolution in the Options dialog box. Choose Options from the Tools menu and edit the Screen resolution (DPI) box in the Display view of the Graphical Class Views options.

For instance, the screen resolution (in dots per inches) for a monitor measuring 19 inches diagonally, and with a resolution of 1280x1024 pixels, equals

This leaves us with a screen resolution of approximately 86 dpi.

The setting is automatically saved when closing the dialog and restored the next time Model Center is started.

Introduction | Class Browser | Class Window | Graphical Views | Modelica Text View | Component Browser | Variable Views | Reliability View | Messages View | Kernel Command View | Documentation Center | Functional Mock-up Interface | Keyboard Shortcuts | Kernel Commands