QUARC Tab Error Codes navigation bar

Table of Contents > QUARC > User's Guide

QUARC Preferences Dialog

Essential elements of QUARC's communication with the real-time code running on a target are the model URI, which governs communication with the real-time code for a model and the target URI, which designates the parameters for communicating with the QUARC Target Manager service on the target. The default model URI to be used for models and the default URI for targets may both be specified using the convenient QUARC Preferences dialog. The default target type for new models may also be configured via this simple user interface.

The QUARC Preferences dialog is opened by choosing the QUARC/Preferences... menu item of the model window as shown below.

QUARC Menu

The dialog has five panes: Model, Target, Target Type, Logging and Build. In the Model pane, a different default model URI may be configured for each supported target type. The Target pane may be used to set the default target URI for each supported communication protocol. The Target Type pane is where you select the default target type and compiler for new models. The Logging pane allows automatic logging to be enabled for models. Finally, the Build pane may be used to configure default options for building code. Unless specified explicitly in a model, QUARC uses these default settings to run the model on the target machine. For information on URIs in general, please refer to the Universal Resource Identifiers reference page. For information on model and target URIs, refer to the Communicating with the Target section. For details on default model and target URIs, please refer to the Using Default URIs section in the QUARC documentation.

The following list may be used to jump to the appropriate sections discussing the options that may be set with each pane of the QUARC Preferences dialog, including how to set the defaults for the model URI, the target URI, target type, logging and build options respectively:

Model

You can set the default model URI for each target type in the Model pane. The model URI is used for communication between the Simulink model on the host PC and the real-time code running on the target machine. Examples of this kind of communication would be streaming data to the MATLAB workspace from the real-time code or tuning parameters within the real-time code using the Simulink model. For more information on the model URI, please refer to the Real-Time Code - the Model URI section of the QUARC documentation. The illustration below depicts the Model pane.

QUARC Preferences Dialog Model pane

There are two fields in this pane as shown in the figure: Target type and Default model URI. The Target type dropdown list is used to select a target type supported by QUARC. Once a target type is chosen, specify the default model URI for the chosen target type in the Default model URI field. For instance, if you want to use TCP/IP as your communication protocol for the Windows target, select windows in the Target type list and then set the Default model URI to tcpip://mytargetbox:port where "mytargetbox" is the hostname or IP address of the target system and "port" is the port number you wish to use for the TCP/IP protocol. TCP/IP port 17001 is typically used as a default port for the TCP/IP protocol, so the default model URI might be tcpip://mytargetbox:17001.

Each target type has its own default model URI. Hence, selecting a new target type from the list will cause a different model URI to be displayed in the Default model URI field. Changing the contents of the Default model URI field will then modify the default model URI for the newly selected target type. The default model URI for the previously selected target type is still remembered by QUARC and can be seen by switching back to the original target type in the dropdown list. Refer to the Default Model URI reference page for more details on the default model URI.

The Default URI button may be used to reset the default model URI field back to the factory default for the currently selected target type. The default model URI for the Windows target, for instance, is shmem://%m:1. The "shmem" scheme stands for the shared memory protocol. The host name of "%m" is a format specifier which is replaced with the model name and "1" is the port number used. The default model URI for the linux_x86 target, on the other hand, is tcpip://linux-dev:17001, which indicates that the TCP/IP protocol will be used to communicate with a target that has a hostname of "linux-dev". The model will listen on TCP/IP port "17001" for a connection from the Simulink model window.

The scope update rate compensation options reflect a workaround Quanser has implemented for a bug in MATLAB R2022a in which Scope performance is very choppy when there are two or more Scopes active. The workaround forces the Scopes (and other display blocks) to update more frequently. The update rate is tunable between 1 Hz and 20 Hz in the Scope update rate field. If the Enable scope update rate compensation option is not checked then no compensation is performed.

Once the default model URIs and other options are set, click on Apply to save the changes or on OK to both save the new default model URIs entered and close the dialog.

Target

You can set the default target URI for each communication protocol in the Target pane. The target URI is used for communication between the host PC and the QUARC Target Manager service running on the target. Examples of using this kind of communication are downloading real-time code to the target and opening the QUARC console. For more information on the target URI, please refer to the QUARC Target Manager - the Target URI section in the QUARC documentation. The figure below shows the Target pane.

QUARC Preferences Dialog Target pane

There are two fields in this pane, as shown in the figure: Protocol and Default target URI. To enter the default target URI for a particular communication protocol, first select the protocol in the Protocol drop down list. This list contains all the protocols suitable for communications with the target. Once a protocol is chosen, then enter the new default target URI in the Default target URI field. There are of variety of format specifiers that may be used in the default target URI. For example, "%m" which is replaced with the model name, "%h" which is substituted for the hostname from the model URI, "%p" which identifies the port number from the model URI and "%o" for the options from the model URI. These last two format specifiers are not usually used while the first two are very useful for the case where you do not want to explicitly specify the model name or hostname. Notice that the default target URI is generally a template whose components are derived from the model URI. This scheme allows the target URI to be derived automatically from the model URI so that only the model URI needs to be specified in order to communicate with a target.

Each protocol has its own default target URI. Hence, selecting a new protocol from the list will cause a different target URI to be displayed in the Default target URI field. Changing the contents of the Default target URI field will then modify the default target URI for the newly selected protocol. The default target URI for the previously selected protocol is still remembered by QUARC and can be seen by switching back to the original protocol in the dropdown list. Refer to the Default Target URI reference page for more details on the default target URI.

Once the default target URIs are configured, click on Apply to save the changes or click on OK to both record the new default target URIs and close the dialog.

Target Type

You can set the default target type to be used by QUARC in the Target Type pane. New models created will be configured automatically to use this target type. This pane is illustrated below:

QUARC Preferences Dialog Target Type pane

There are two fields in this pane: Default target type and Default compiler. The Default target type field is a drop down list containing a list of all the target types that are supported by QUARC, such as win64. You may want to set the default target type to the one you use most often.

The Default compiler field is a drop down list containing a list of the compilers supported by the target type selected in the Default target type field. Most targets only support a single compiler, but the linux_overo, linux_rt_armv7 and linux_verdex targets allow different compilers to be selected. The windows and win64 targets support different compilers if more than one suitable compiler is installed. For these targets, changing the compiler from the QUARC Preferences dialog will run mex -setup to reconfigure the default compiler when OK or Apply is pressed.

After changing the default target type or compiler, click on Apply to save the new target type or click on OK to save the target type and compiler and to close the dialog. Now if you open a new model and check the Configuration Parameters, you will notice that the system target file and other options are configured for the new target type. For information on how to open the Configuration Parameters dialog, please refer to the Configuring a Model section in the QUARC documentation.

Logging

QUARC's model logging feature records information about each run of a model in a human-readable log file. This log can be useful for maintaining records about repeated runs of a model, including details such as the date and time the model was run, when block parameters were changed, as well as user-defined messages created using the Log Message block.

QUARC allows logging to be performed automatically for all models. Such automatic logging is enabled via the Logging pane depicated below:

QUARC Preferences dialog Logging pane

In the Default log file field, enter the name of the file name to use for logs. Since this file name will be used for all models, QUARC provides the ability to use special format specifiers to tailor the file name to each model automatically. For example, use the %m format specifier to insert the name of the model into the log file name. Other convenient format specifiers are %{date} and %{time}, which insert the date and time at which the model is started. Hence, a new log file can be created each time a model is run that is automatically marked with the date and time, so that a complete history of your work can be recorded. The log file name may include directories. Directories that do not exist will be created when the log is produced.

A typical log file name is:

%{date}/%m_%{time}.log

which produces a log filename such as "2010-07-16\mymodel_11_57_03.log" each time the model is run. Hence, the model name, date and time are embedded in the filename automatically. Valid format specifiers are:

Format Specifier

Description

%d

the current Matlab directory in quotes e.g. "C:\Documents and Settings\myname\My Documents\MATLAB"

%D

the current Matlab directory using short filenames (PC) or escaped spaces (UNIX) e.g. "C:\Docume~1\myname\MyDocu~1\MATLAB" (requires Simulink Coder)

%m

the model name e.g. mymodel

%q

replaced with a double quote (since MATLAB does not accept double quote characters)

%t

the target type for the given model or configuration set (e.g. win64)

%(var)

the value of environment variable 'var' (on the host!) e.g. %(PATH)

%{expr}

the value of a MATLAB expression e.g. %{x + 1}, %{date}, %{time} or %{instance(3)}

The model name format specifier, %m is clearly useful for the log file name because it indicates the model with which the log is associated. Likewise, the target type format specifier, %t, is useful for generating a log file name that includes the type of the target.

The environment variable specifier is convenient for accessing the user's home directory, for example, by using the format specifier %(HOME).

The ability to substitute a MATLAB expression is also useful in many instances. For example, the date and/or time may be embedded in the filename of the log. Some particularly useful expressions are:

Expression

Description

%{date}

the current date. See date.

%{time}

the current time. See time.

%{datestr(now,format)}

the date or time in a particular format. See datestr for valid formats.

%{instance(3)}

an instance count, incremented every time the substitution is performed. See instance.

The log file name is coerced after substitutions to be a valid filename. For example, the colon in the time string returned by %{time} is replaced with underscores, since colons are not valid in a filename except after the drive letter.

Hint The use of underscores instead of spaces or hyphens in the filename portion of the path is recommended, especially if the model copy logging feature is also used. The names of directories are not so restricted. QUARC will attempt to coerce invalid filenames into the proper format.

Hint To disable automatic model logging, simply leave the Default log file field empty. In this case, a log is not generated for models unless the MEX-file arguments for the model explicitly contain an entry for a log file.

In the Default model copy field, enter the name of the file name to which to copy the model at the start of each run. Since this file name will be used for all models, QUARC provides the ability to use special format specifiers to tailor the file name to each model automatically. The same format specifiers that may be used with the Default log file parameter may be used here. Hence, a new copy of the model can be created each time a model is run that is automatically marked with the date and time, so that a complete history of your work can be recorded. The model copy name may include directories. Directories that do not exist will be created when the model is copied.

Warning

Spaces and hyphens are not allowed in the filename portion of the path because the filename must represent a valid Simulink model name. The use of underscores instead is recommended. The names of directories are not so restricted. QUARC will attempt to coerce invalid filenames into the proper format.

A typical model copy name is:

%{date}/%m_%{time}.mdl

which produces a copy of the model such as "2010-07-16\mymodel_11_57_03.mdl" each time the model is run. Hence, the model name, date and time are embedded in the filename automatically. See the full list of format specifiers above.

Hint To disable automatic model copying, simply leave the Default model copy field empty. In this case, a log is not generated for models unless the MEX-file arguments for the model explicitly contain an entry for a model copy.

When a model has been modified without being saved, and that model is started with model copying enabled, QUARC will request that the model be saved first, before it performs the copy. The Save model, without prompting, if model modified option causes QUARC to automatically save the model before performing the copy so that QUARC does not prompt you to save the model. Use this option with caution because you may not want the model saved automatically each time you run the model.

After changing the logging options, click on Apply to save the new values or click on OK to both save the changes and close the dialog. A log file and/or copy of the model will now be generated whenever a model is run.

Warning Note that log information is appended to the log and does not overwrite the log. The copy of the model, on the other hand, will overwrite any extant file.

Build Options

Whenever QUARC builds a model, it usually brings the Simulink Diagnostic Viewer to the foreground so that the progress of the build may be viewed. However, if screen space is limited it may be better to leave the Simulink Diagnostic Viewer in the background. Fortunately, QUARC allows you to change this behavior using the Build pane. This pane is illustrated below:

QUARC Preferences Dialog Build pane

There is only one field in this pane: the Show Diagnostic Viewer when building models checkbox. Check this option to have the Simulink Diagnostic Viewer brought to the foreground when building models. To leave the Diagnostic Viewer in the background, uncheck this option.

After changing this setting, click on Apply to save the new setting or click on OK to both save the settings and close the dialog.

For versions of MATLAB prior to R2014a, this option affects the MATLAB Command Window instead, since build messages were displayed in the MATLAB Command Window in those versions of MATLAB.

Restoring the Factory Defaults

To the right of the Apply button is a button called Defaults. Clicking this button causes all of the settings to revert to the factory defaults for QUARC. This feature can be useful if you have entered incorrect values and need to restore meaningful settings.

 

navigation bar