Table of Contents
Set Model Log File Dialog
QUARC supports a model logging feature for keeping track of information about every run of the model. The model log can record when the model was started and stopped, whether errors occur, and user-defined messages defined using the Log Message block. The model log file name is associated with the active configuration of the model, and as such is a configuration parameter rather than a block parameter.
QUARC also supports the ability to copy the model at the beginning of each run to a unique location. Hence, all the information required to replicate the experiment can be stored for later reference.
This page describes the Set Model Log File dialog, which is used to configure the current log file for the model and the location in which to store a copy of the model, or "model copy". Both the log file and model copy may also be configured via the MEX-file arguments. A default log file and model copy may be defined for all models, rather than an individual model configuration via the QUARC Preferences dialog.
The Set Model Log File Dialog is opened from the Current log file name parameter of a Log Message block.
menu item or from the button beside the
Selecting this menu item causes the Set Model Log File dialog to open for the active configuration of the current model. This dialog is illustrated below:
There are two fields: one which defines the log file name and one which indicates the name of a file to which to copy the model. UNC filenames may be used. If a default log file name or default model copy have been defined in the QUARC Preferences dialog then their values will appear here also. Editing the log file name or the Copy of model field, however, will not change the default values - it will only change the values for the current model. Clearing either field so that it is empty, or setting the field to a value equal to the default value, will cause the model to use the default value for the current model configuration. The button may be used to reset the fields to the current defaults. To disable model logging, leave the fields empty and ensure that default logging is not enabled in the QUARC Preferences dialog.
A powerful feature of the both the log file name and model copy file name is that format specifiers may be employed in the file names. The format specifiers may be used, for example, to include the date and time as part of the filename so that a new file is created each time a model is run, using the current date and time. The model name can also be including automatically as part of the filename, making it easy to set the default values. The full list of format specifiers available are enumerated in the table below:
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. %(HOME) |
%{expr} |
the value of a MATLAB expression e.g. %{x + 1} |
%{date} |
the current date. This specifier is actually just an example of the %{expr} format specifier. See the date
function.
MATLAB Command Line Click to copy the following command line to the clipboard. Then paste it in the MATLAB Command Window: doc date |
%{time} |
the current time. This specifier is actually just an example of the %{expr} format specifier. See the time function. |
%{instance(3)} |
a 3-digit instance count. This specifier is actually just an example of the %{expr} format specifier. See the instance function. |
A suitable model log file name is %{date}/%m_%{time}.log
, which creates a log file name using the model name and
the date and time at which the model is run. The arrow next to the Log file name field may be used
to append a format specifier to the log file name as a convenience. It also permits the file name to be chosen by browsing
for the file when the item is selected.
Similarly, a suitable model copy file name is %{date}/%m_%{time}.mdl
, which creates a copy of the model using the model name and
the date and time at which the model is run. The arrow next to the Copy of model field may be used
to append a format specifier to the file name as a convenience. It also permits the file name to be chosen by browsing
for the file when the item is selected.
Once new values have been entered, click
to save the changes. The new values will be saved in the active configuration of the model as part of the MEX-file arguments. If the value of either field matches the default set in the QUARC Preferences dialog then the corresponding entry in the MEX-file arguments will be left blank so that the default is used.To exit the dialog without saving the changes, click on the
button.
Copyright ©2024 Quanser Inc. This page was generated 2024-10-17. Submit feedback to Quanser about this page.
Link to this page.