QUARC Basics for Scripts Command Line Tools navigation bar

Table of Contents > QUARC > User's Guide

Using Windows Explorer to Manage Models and Scripts

When the real-time code for a Simulink model or MATLAB script is generated using QUARC, a "QUARC executable" is created in MATLAB's current directory. For example, when building a model called "mymodel" for the QUARC Target for Windows, an executable file called "mymodel.rt-win64" is created. Likewise, then building a script called "myscript" for the QUARC Target for Windows, an executable file called "myscript.rt-win64" is created. Each target type has its own unique extension. For instance, the QUARC Target for Linux uses the ".rt-linux_{target}" extension for its real-time code. While downloading and running this executable on the QUARC target is usually done through the Simulink interface or MATLAB command-line, QUARC also allows these QUARC executables to be manipulated directly from Windows Explorer. This section describes the various ways of managing and interacting with real-time code on the target machine through Windows Explorer.

It should be noted that these executables do not require MATLAB, Simulink or any other third party compilers to be installed on the target machine. The only component required for proper operation of these executables is QUARC. You do not need QUARC's Simulink Development Environment component to run the executables on the target or to use the Windows Explorer interface. Bear in mind, however, that without MATLAB and Simulink and QUARC's Simulink Development Environment, modifications cannot be made to the real-time code embedded in the QUARC executables.

To use Windows Explorer to manage real-time code, simply browse to the folder containing the QUARC executable in Windows Explorer and then right-click on the QUARC executable file itself. The context menu that opens is shown in the figure below.

Depending on your operating system settings and other software installed on your computer, you may see other options appearing in the menu depicted above. However only QUARC-related options are shown in this figure.

The menu items may be grouped into two general categories: items that use the default target and items that allow the target and other options to be specified. The Run, Console, Stop, Run at boot, Do not run at boot and Upload MAT file menu items use the default target. For convenience, these menu items will be referred to as the preconfigured menu items.

The Run on target, Console for target, Stop on target, Run at boot on target, Do not run at boot on target and Upload MAT file from target menu items allow the target and other options to be specified. These menu items will be referred to as the configurable menu items.

The first time any one of the menu items is ever selected for a given type of QUARC executable, a configuration window opens that allows the options for that target type to be specified. This window is the same one that opens whenever one of the configurable menu items is chosen, such as the Run on target menu item. A sample configuration window is depicted below.

There are two primary fields: the Target URI and the Model arguments. The target URI identifies the target machine and the protocol used to communicate with it. The model arguments are passed to the QUARC executable when it is loaded on the target. Not all menu items load a model on the target, so the Model arguments parameter may be disabled for some menu items. For details on the format and purpose of a target URI, refer to Communicating with the Target. For information about valid model arguments and their functionality please refer to the MEX-File Arguments reference section.

If the box next to "Use these parameters as defaults for this target type" is checked then the target URI and model arguments will be stored as the default values for the next time a QUARC executable menu item is selected. This checkbox may be used to establish the initial defaults or to change the current default options. The defaults are stored separately for each target type. Hence, QUARC executables for the QUARC Windows target maintain a different set of default options than the other QUARC Linux targets. However, the options are not unique to each executable. All executables for the QUARC Windows target share the same default options. Also note that these options are only used by Windows Explorer. The default target URI that may be configured in the QUARC Preferences dialog in a Simulink diagram is unrelated.

If the box next to "Use these parameters as defaults for this target type" is not checked or the target URI is left blank, then the default options will not be changed. If no default options have yet been established, then this configuration window will open again regardless of which QUARC executable menu item is selected, until default options are stored.

Once the defaults have been set for a target type, choosing any of the preconfigured menu items will result in the command being performed immediately, without opening the configuration window. The default settings that were established will be used. To change the defaults, use one of the configurable menu items.

The different menu items and their functionality are described below.

Preconfigured Menu Items

Run

This preconfigured menu item can be used to download and run the generated real-time code on a QUARC target. As mentioned above, a separate executable file is created for each target type for which code is built. As a result, if you build code for the QUARC Windows target, the executable file that is created may only be run on a QUARC Windows target. The same principle applies to other target types, such as the Linux targets. Be aware that this option does download the code to the target each time it is selected. Doing so ensures that the correct code is always run on the target.

Note: As an alternative to right-clicking on the executable and selecting Run, you can simply double-click on the file, since Run is the default action for QUARC executables.

Console

This preconfigured menu item can be used to open a QUARC Console to monitor the model's standard input and output when it runs on a QUARC target. Please note that the console you open using the executable file menu is model-specific. It only displays the standard I/O of the QUARC executable that was selected. If you are running multiple models at the same time and would like to monitor their standard I/O you must open a separate console for every model you are running using each model's executable file menu. It is possible to monitor all the models running on a specific target with a single QUARC Console. In order to do so, select Start/All Programs/Quanser/QUARC/Console for Target from the Start menu of your Windows desktop. The window depicted below will open:

You must enter the URI of the target for which you want to monitor the models' standard I/O in the Target URI field of this window. Once you enter the target URI and click on Console, a QUARC Console window will open in which you will be able to monitor the standard I/O of all the models running on the target you specified when filling in the Target URI field.

It is important to remember when using the Console menu item that the QUARC Console you open for a particular QUARC executable uses the default target URI to communicate with the target. If you would like to specify the target URI manually when opening a console, use the Console for target... menu item of the executable file menu.

Stop

You can use this preconfigured menu item to stop a model running on a QUARC target. The Stop menu item uses the default target URI to communicate with the target. If you would like to specify the target URI manually or if you are running the same executable on multiple targets and want to stop a particular one, you can use the configurable Stop on target ... menu item to explicitly specify which model you would like to stop.

Run at boot

This preconfigured menu item may be used to configure a QUARC executable to run on a QUARC target at boot. This option uses the default target URI to identify the target. If you would like to specify the target URI manually, you can use the Run at boot on target... option. Please keep in mind that once a model has been configured to run at boot using this option, it will keep this setting and run every time the target boots. The Do not run at boot option must be used to disable this setting.

Do not run at boot

If you have previously configured a model to run on a QUARC target at boot, you can use this preconfigured menu item to prevent the model from running at boot. Please note that if you select this menu item for an executable which has not been configured to run at boot, an error will be displayed similar to the one shown below.

Upload MAT file

When using MAT-file logging, the log file is generated on the target. If the target is a remote machine then this MAT-file must be uploaded from the target to the host in order to load the results into Matlab. This menu item uses the name of the executable and the current directory for the model specified in the -d option of the Model arguments parameter in the configuration window for this menu item (this window only opens the first time you choose this menu item) to locate the MAT-file and upload it to the current Matlab directory on the host for analysis. The model does not need to be compiled with external mode for this option to work so it provides a convenient method of getting the MAT-file for any model and avoids the need to use ftp or another file transfer tool to get the MAT-file from the target.

Configurable Menu Items

Run on target...

This configurable menu item can be used to download and run the generated code on a QUARC target while specifying the target URI and model arguments manually. The configuration window depicted below is opened when this menu item is selected:

Depending on your previous settings, the Target URI and Model arguments fields may already be filled in, contrary to what is shown in the figure above. You can enter your choice of target URI and model arguments in their respective fields. If you do not wish to use the new settings as the defaults for the preconfigured menu items, then be sure that the box next to the "Use these parameters as defaults for this target type" is not checked. To change the default settings, check this box.

Console for target...

This configurable menu item may be used to open a QUARC Console to monitor the executable model's standard I/O. The window shown below is opened when this menu item is selected in order to allow the target URI to be specified.

Depending on your previous settings, the Target URI field may already contain the default target URI established for this target type. You can specify a new target URI for the target for which you want to monitor the model's standard I/O by changing the contents of the Target URI field. If you do not wish to use the new settings as the defaults for the preconfigured menu items, then be sure that the box next to the "Use these parameters as defaults for this target type" is not checked. To change the default settings, check this box.

Stop on target...

You can use this configurable menu item to stop a model running on a QUARC target. The window shown below is opened when this menu item is selected in order to allow the target URI to be specified. This item is particularly useful when you are running the same executable on multiple targets and would like to stop the model on a specific target.

Depending on your previous settings, the Target URI field may already contain the default target URI established for this target type. You can specify a new target URI for the target for which you want to stop the model by changing the contents of the Target URI field. If you do not wish to use the new settings as the defaults for the preconfigured menu items, then be sure that the box next to the "Use these parameters as defaults for this target type" is not checked. To change the default settings, check this box.

Run at boot on target...

This configurable menu item can be used to register a QUARC executable file to run on a QUARC target when the target boots. The Run at boot on target... option lets you specify the target on which you would like your executable to run by entering an associated target URI. You can also specify the model arguments that will be passed to the model when it is run using this function. The window shown below is opened when you select this menu item from the executable file menu.

Depending on your previous settings, the Target URI field may already contain the default target URI established for this target type. You can specify a new target URI for the target for which you want to configure the model to run at boot by changing the contents of the Target URI field. Likewise, the Model arguments field may contain the default model arguments. The model arguments may also be changed. If you do not wish to use the new settings as the defaults for the preconfigured menu items, then be sure that the box next to the "Use these parameters as defaults for this target type" is not checked. To change the default settings, check this box. Once you click on the At boot button, the executable is downloaded to the target you have specified and will be automatically run the next time this target boots.

Please keep in mind that once a model has been configured to run at boot using this option, it will keep this setting and run every time the target boots. The Do not run at boot on target... option must be used to disable this setting.

Do not run at boot on target...

If you have previously configured a model to run on a QUARC target at boot time, you can use this option to disable the model from running at boot. The Do not run at boot on target... option lets you specify the target for which you do not want your executable to run at boot by entering an associated target URI. The configuration window depicted below is opened when you select this menu item from the executable file menu.

Depending on your previous settings, the Target URI field may already contain the default target URI established for this target type. You can specify a new target URI for the target for which you want to unregister the model to run at boot by changing the contents of the Target URI field. If you do not wish to use the new settings as the defaults for the preconfigured menu items, then be sure that the box next to the "Use these parameters as defaults for this target type" is not checked. To change the default settings, check this box.

Upload MAT file from target...

When using MAT-file logging, the log file is generated on the target. If the target is a remote machine then this MAT-file must be uploaded from the target to the host in order to load the results into Matlab. You can use this menu item to upload a model's MAT-file from the target machine. It uses the name of the executable and the current directory for the model specified in the -d option of the Model arguments parameter in the configuration window for this menu item to locate the MAT-file and upload it to the current Matlab directory on the host for analysis. The configuration window depicted below is opened when you select this menu item from the executable file menu.

Depending on your previous settings, the Target URI field may already contain the default target URI established for this target type. You can specify a new target URI for the target from which you want to upload a model's MAT-file by changing the contents of the Target URI field. If you do not wish to use the new settings as the defaults for the preconfigured menu items, then be sure that the box next to the "Use these parameters as defaults for this target type" is not checked. To change the default settings, check this box. The model does not need to be compiled with external mode for this menu item to work so it provides a convenient method of getting the MAT-file for any model and avoids the need to use ftp or another file transfer tool to get the MAT-file from the target.

 

navigation bar