The MATLAB View provides quick access to the local MATLAB application inside RT-LAB. From here, users can make modifications to the offline model with MATLAB.
By default, the MATLAB View is included in the Edition perspective. To add it to the current perspective, click Window > Show view > Other... > RT-LAB > MATLAB View
Note: Because there is no MATLAB environment on the real-time operating system, any changes to the Simulink model require recompilation to affect the real-time simulator.
Console View
The Console View is a generic view that may contain different Console types. A Console basically displays formatted text. Some Consoles enable user input, for example, the Interactive Python Console.
By default, the RT-Lab Workbench includes three different Consoles:
- An Interactive Python Console for Python development:
- A Target Console that displays output from target nodes when executing remote commands:
- A Log Console that provides internal debug information. This Console can only be used if the Advanced User Capabilities preference page is enabled:
Several Console Views may be opened at the same time in the workbench, but they all share the same list of Consoles.
To add a Console View to the current perspective, click Window > Show view > Other... > RT-LAB > Console or use the Open Console button of an existing Console View.
This is useful when you want to display several Consoles side-by-side, for example, to compare two command outputs.
Toolbar
Command | Name | Description | Availability |
---|---|---|---|
Clear Console | Clears the current | Toolbar and Context | |
Scroll Lock | Toggles the Scroll Lock | Toolbar | |
Pin Console | Pins the current console | Toolbar | |
Display Selected | Opens a listing of current | Toolbar | |
Open Console | Opens a new console of | Toolbar |
Most Console types provide the following additional commands:
Command | Name | Description | Availability |
---|---|---|---|
Close Console | Closes the current console | Toolbar | |
Save Console session | Saves the current content of the Console to a file | Toolbar |
The Interactive Python Console is shown in the Console View. This Console is provided by the PyDev plugin, available at http://pydev.org
To open a new Interactive Python Console, you can use the main application toolbar:
...or the corresponding menu: Tools > Python > Open Console.
A dialog is displayed to choose among available console types:
Repeat these operations to open several Consoles in the same View. These Consoles may be of different types. Use the toolbar to switch between opened Consoles.
Once started, the Interactive Python Console is able to launch Python scripts and to execute Python commands. This is particularly useful when working with RT-Lab projects since RT-Lab provides a complete Python module. This module, named RtlabApi, allows you to control any part of a simulator, from configuration to execution. All available functions are described in the Python API Reference Guide.
In order to use this module, users must import it with the following command:
>>> import Rt LabApi
However, by default, when opening an Interactive Python Console, some modules are automatically imported, including the RT-Lab API. The RT-Lab API is also given the alias ‘r’. Use the PyDev preference page to edit these initial commands (see Configuration).
Using the RT-Lab API through the Interactive Python Console is a good way to test some commands that would be later integrated to a Python script and thus create a full automated sequence.
Here is an example of what the Interactive Python Console can do:
Command | Name | Description | Availability |
---|---|---|---|
Terminate | Closes the current console | Toolbar | |
Save | Saves current content to a file | Toolbar | |
Clear Console | Clears the current console | Toolbar and Context menu | |
Pin Console | Pins the current console to remain on top of all other consoles in the current Console View | Toolbar | |
Display Selected Console | Opens a listing of current consoles and allows you to select which one you would like to see | Toolbar | |
Open Console | Opens a new console of the selected type | Toolbar |
Shortcuts
SHORTCUT | ACTION |
---|---|
Ctrl + Space | Code completion. |
PageUp | Displays history in a dialog. |
Up/Down Arrows | Cycles through history. |
Esc | Clears current line. |
Ctrl + f | Opens the search dialog. |
Configuration
Enabling the Advanced User Capabilities preference page allows you to configure the Interactive Python Console.
Go to Window > Preferences > PyDev > Interactive Console:
You can also change the current Python version and settings in Window > Preferences > PyDev > Interpreter - Python.
References
PyDev web site: http://pydev.org/
Target Console
The Target Console is shown in the Console View. It is a simple Shell interface that looks similar to a Terminal View:
The Target Console automatically opens when you execute a command or launch a Python script on a Target from its context Menu.
If the Advanced Capabilities preference page is enabled, you can open a new Target Console from the Console View Menu. A dialog is displayed to select the Target to connect to this new Console:
Toolbar
Command | Name | Description | Availability |
---|---|---|---|
Terminate | Closes the current | Toolbar | |
Clear Console | Clears the current | Toolbar and Context | |
Scroll Lock | Toggles the Scroll Lock | Toolbar | |
Pin Console | Pins the current console | Toolbar | |
Display Selected | Opens a listing of current | Toolbar | |
Open Console | Opens a new console of | Toolbar |
Log Console
The Log Console is shown in the Console View. It displays internal debug messages and needs the Advanced Capabilities preference page to be used.
The Log Console can be opened using the Open Console command of the Console View.
Toolbar
Command | Name | Description | Availability |
---|---|---|---|
Terminate | Closes the current | Toolbar | |
Save | Saves current content to | Toolbar | |
Clear Console | Clears the current | Toolbar and Content menu | |
Scroll Lock | Toggles the Scroll Lock | Toolbar | |
Pin Console | Pins the current console | Toolbar | |
Display Selected | Opens a listing of current | Toolbar | |
Open Console | Opens a new console of | Toolbar |
The Variables Table View displays one or more sets of RT-LAB variables, such as Signals and Parameters, in a tabbed notebook:
By default, the Variables Table View is included in the Edition perspective. To add it to the current perspective, click Window > Show view > Other... > RT-LAB > Variables Table.
Working Sets
Variables Working Sets are intended to represent logical groups of RT-LAB variables, for example, the main parameters of a controller. This allows you to focus on a particular set of variables without having to search for them within an entire model.
Several Variables Table Views can be used to display different working sets. The same working set can also be shared between several Variables Tables.
Selecting Working Sets
When a new Variables Table View is created, it opens a default working set. This working set is fully functional but will not be saved when RT-LAB is closed. To have a working set restored the next time RT-LAB is opened, you must create a working set with a unique name.
The easiest way to do so is to click on the New Working Set button. Enter a name and click OK to create a new working set containing all the variables currently displayed in the Variables Table View.
This working set is then automatically opened in the Variables Table and its name appears at the top of the table.
This method can also be used to merge several workings sets into a new one: select the working sets you want to merge (see below) then create a new working set. Duplicates will automatically be removed.
To select which working sets should be shown in a Variable Table, click on the Select Working Sets button to open the following dialog:
This dialog allows you to create, edit and delete variables working sets.
Note: Variables working sets are common to the entire workbench, which allows them to be used in the Project Explorer like other types of Working Sets:
Editing Working Sets
In the Select Working Sets dialog, clicking the Edit... button opens a new dialog that can be used to choose the variables that will be part of the selected working set:
An easier way of adding elements to a working set is to open it in a Variables Table and to drag and drop variables from the Project Explorer, the Search View or another Variables Table View.
You can also drag a block, a subsystem or even a model to add all the contained variables to the working set.
If the Variables Table displays several working sets, the variables will be added to each of them.
It is also possible to right-click on a variable or a block (or a combination of them) in the Project Explorer or the Search View and then click on Add to Working Sets:
This opens the Select Working Set dialog described above.
To remove a variable from a working set, right-click it in the Variables Table and click Remove, or press the Delete key.
Lost Elements
If a variable is not available, it is displayed with a red-cross icon as below:
This happens, for example, when the project is closed, when the model is removed from the project, or when the model has been recompiled and the variable does not exist anymore.
Then you can either remove the variables from the working set or fix the problem. If a variable becomes available again, the Variable Table will automatically be updated.
Editing Values
When a model is running, the values of the variables are automatically updated every few seconds. You can also change the value of editable variables such as parameters.
- By default, the Variables Table View is in Auto-apply mode. This means that as soon as you change a value and hit Enter, the value is sent to the model.
- If you want to send several values at the same time (so that all the variables are updated during the same calculation step), toggle the Auto-apply button.
- Then if you modify a value and hit Enter, the value will be displayed with an asterisk indicating a non-applied change.
- The new value will not be sent to the model until you press the Apply button or you toggle the Apply button again. If you press the Discard button, all pending changes will be canceled.
Note: Pending changes are shared between views which means that only one pending change is allowed per variable at any time.
To edit the value of a vector or a matrix, you have to use the Variable Viewer: double-click on the variable or right-click on it and select Show In > Variable Viewer.
Table Customization
You can sort variables by name, path, type or any property by clicking on the corresponding column header. Columns can be resized and moved by drag and drop.
The Variables Table also provides Filter and Search functionalities at the bottom of the view.
For advanced customization, open the View Menu and select Customize Table to open the following dialog:
Toolbar: View Menu
Command | Name | Description |
---|---|---|
Discard | Discards current changes. | |
Apply | Applies current changes. | |
Auto-apply | Toggles auto-apply mode. | |
Select Working Sets | Selects the working sets to be displayed in this view. | |
New Working Set | Saves current variables to a new working set. | |
New View | Opens a new Variables Table view. |
Command | Description |
---|---|
Customize Table | Opens the configuration dialog. |
Show In... | Displays the selected variable in another view. |
Copy | Copies the selected lines to the clipboard. |
Remove | Removes the selected variables from the current Working Sets |
Select All | Selects all the variables currently displayed in the view. |
Refresh | Updates the table content. |
Probe Control Panel
The Probe Control panel enables you to specify the acquisition parameters for each acquisition group. The signals from a given group share the same characteristics, such as: size of the data frames being sent, expressed either as a number of samples per signal, or in units of time
- decimation factor
- sampling mode (repetitive or not) and re-arming delay
- blocking mode in case acquisition or transmission is interrupted
- a write-to-file option, that enables simulation data to be saved as a .mat file on the target nodes.
The Probe Control Panel can be launch using the Tools > Probe Control menu or using the toolbar button. Note that the panel is only available when a model is selected in the Project Explorer view.
Connect | Connects to a simulation model which acquisition parameters are to be changed. It displays the Active Models panel, if there are simulations running, to enable you to select the model from a list of running models. |
---|---|
Disconnect | Disconnects from the model we are currently connected to. |
Group # | These tabs enable you to select which acquisition group parameters are to be changed. |
More information | Opens the group info panel on which additional information about the acquisition group is displayed. |
Data acquisition triggering | Sets dynamically a trigger on the acquisition group. Data will be acquired only when the specified signal is triggered. The trigger is defined using the fields Trig signal name, Trig by value, Offset, Trig by signal and Condition. If a block OpTrigger is present in the model when activating the dynamic acquisition, the triggering will be set to the value of parameters provided via the Probe Control. When deactivating the dynamic triggering, the block OpTrigger will regain the triggering control once again. |
Trig signal name | Sets the name of the signal to be triggered. |
Trig by value | Specifies the value that must be reached by the trigger signal to trigger acquisition. |
Trig by signal | Specifies a triggering signal instead of a constant value. |
Offset | If this parameter is a positive value, it is used to set the number of steps (cycles) to wait before starting the acquisition system, once the trigger condition is met. The default value is 0, which means start as soon as the trigger condition is met. The trigger offset can also be a negative value n. In this case, the n samples which correspond to the simulation results of the n steps before the trigger condition happened will be acquired (up to the number of samples per signals). The range value for the offset is [-FrameSize ; +FrameSize]. See Number of samples per signal and Duration definitions hereafter for the definition of the frame length. |
Condition | Condition to be satisfied so that the acquisition system is triggered. The different conditions are:
|
Write-to-file | Saves acquisition group signals on the target node's hard drive rather than sending them to the Windows NT Console on the host computer. Signals are saved in MATFILE version 4, using the name supplied in the FileName field. Before write-to-file is enabled for the first time, the FileName and Variable Name fields are empty. The FileName and Variable Name fields may contain valid names even if the group is not set to write-to-file. This is because this panel uses the filename set for the group from the ProbeControl panel. Disabling the write-to-file option from the ProbeControl panel does not clear these fields. As more than one subsystem may be running on the same target node, RT-LAB adds the group number, the subsystem name, and the subsystem id to the filename specified by the user on the Probe Control panel. This is a simple way to avoid file name collisions on target. |
FileName | Name of the file in which acquisition signals are to be saved when the Write-to-file option is checked. |
Variable Name | Name of the variable to be associated with the signals saved in FileName. |
Repetitive sampling | Enables you to choose repetitive (automated) sampling or non-repetitive (manual control) sampling. If you choose non-repetitive, the Re-arm button enables you to manually re-arm data acquisition. |
Rearming delay | This is the acquisition delay between the end of one frame and the beginning of the next. This parameter is used only for repetitive sampling. |
Decimation factor | Lets you skip acquisition during some calculation steps. When this parameter is set to a number n, a sample is acquired at every n-th calculation step. |
Number of samples per signal | Defines the frame length of the signals for a group according to the number of samples for each signal. These signals are received and saved in a buffer, ready for transmission to the Console via the Ethernet link (or other communication devices). For example: if n is the number of samples per signal of a group with m signals, the buffer’s size value of m x n, and the signal frame has a length value of n corresponding to n cycles (calculation steps) up to the maximum number of samples. In other words, this guarantees that there is no data loss for n simulation steps. The default value = max (1, 200 / model / timestep / decimation / 1000). |
Max number of samples per signal | Defines the maximum number of samples that can be acquired for a specified acquisition group of the current model. Setting this value prior to simulation ensures that no dynamic memory allocation (a process that can degrade real-time performance and stability) takes place during the simulation. This maximum is the total number for all the signals in the group. For example, when acquiring 4 signals for an acquisition group, you can specify the number of samples per signal up to the number set here. |
Duration | Defines the length of time (in milliseconds) during which acquisition of signals is performed; this parameter provides another possibility for defining the frame length and is linked to the decimation factor and the number of samples per signal using this formula: Duration = (Decimation factor) x (Number of samples per signal) x (Basic calculation step). |
Sampling, Pause | Enables you to interrupt a signal acquisition and transmission without affecting the model, which continues to run. This parameter is used with repetitive sampling. |
Sampling, Continue | Enables you to resume data acquisition after a pause. This parameter is used with repetitive sampling. |
Sampling, Rearm | Enables you to manually rearm the acquisition system. This parameter is used with non-repetitive sampling. |
Sampling, Apply to all | Applies the current sampling options to all acquisition groups. |
Console blocks on group | This multiple-choice function (Groups 1 to n, or without blocking) enables you to stop signal display devices from the scope blocks (Simulink scopes, LabVIEW panels, etc.) when data acquisition is not available. But because all Simulink windows are frozen in blocking mode, a Do not block option is added to avoid completely freezing Simulink. In this mode, and when an acquisition is stopped, the value displayed is the one chosen by the Output value when no data available parameter. |
Output value when no data available | When the Do not block option is selected, this parameter enables you to choose an output value in the absence of data (zero or the last output value). |
Set group control | Enables multiple users to connect to the same model and control acquisition parameters. This function enables each user to select just the acquisition group(s) for which they would like to control parameters; users who subsequently connect to the same model can select among the remaining acquisition groups. |
Modifications, Apply | Used to validate modifications to panel parameters. |
Modifications, Apply to all | Applies modifications to all acquisition groups. |
Modifications, Cancel | Enables you to cancel the modifications to panel parameters. |
Default | Sets all acquisition control parameters to their default values. Note: Please note that the Number of Samples per Signal and Duration is set by default to values that allow simulations at 200 ms or 5Hz. |
More information | Opens the group info panel where you can find additional information on about the acquisition group. |
Signals | Opens the dynamic signals panel to enable you to add signals to an acquisition group. |
Close | Closes the ProbeControl panel. If one of the parameters on the panel is modified without being validated with the Apply button, closing the panel does not validate the modification made to that parameter. |
Group Control Panel
For a model with more than one acquisition group, the GroupControl Panel is displayed when the ProbeControl panel is opened.
To open the probeControl panel, select the model and assure you that it is built. Then, open the panel from the Tools > Probe Control menu. The probeControl is automatically connected to this model. In all other cases, you are required to click on Connect to choose a model from a list of running simulations. The ProbePanel is then said to be standalone. In this configuration, it receives some important notifications from the target nodes such as System Paused, System Reset, System Error, etc.
Group Information Panel
The Group info panel displays additional information about the configuration and settings of an acquisition group.
Subsystem Name | Name of target subsystems. |
---|---|
Logical Id | Logical Id of the corresponding subsystem: assigned by RT-LAB. |
Nb Signals | Number of signals that the corresponding subsystem sends to the group. |
Target Node | Name of the target node to which the corresponding subsystem is assigned. |
File Name | Name of the file saved by the corresponding subsystem on the target when writing to file. |
Variable name | Name of the variable associated with the file if write-to-file is enabled. |
Dynamic Signals Panel
The Dynamic Signals panel is the graphical interface to manage dynamic signals. The dynamic signals are the signals available inside the model. A signal is the port’s outputs of a block. Only double-type signals could be added to an acquisition group in order to be displayed.
In order to have access to all the signals inside them the model, the option Reuse storage signals should be set to off in the Simulation parameters of the Simulink model.
Current model systems and signal set | Signals tree containing three groups of signals:
|
---|---|
Dynamic signals list | List of dynamic signals added to the current acquisition group. |
Add | Adds the selected dynamic signal in the tree to the current acquisition group. |
Signal value | Get: Gets value of the selected signal in the tree Set: Sets value of a control signal Max number of dynamic signals: Maximum number of signals that could be added to the acquisition group while the simulation is running. |
Remove | Removes a signal from the dynamic signals list. |
Remove All | Removes all the signals from the dynamic signals list. |
Save | Saves the current list. |
Load | Loads a saved list. |
Signal Selection Panel
The Signal Selection panel is the graphical interface to select signals while setting dynamic triggering. The dynamic signals are the signals available inside the model. A signal is the port’s outputs of a block.