The Simulink® Real-Time™ software includes a web server that allows you to interact with your real-time application through a web browser running on a development computer.
Note: In R2017a, the web interface to the target application will cease to function. Use Simulink Real-Time Explorer instead.
You access the web browser through an Ethernet connection using the Simulink Real-Time web server.
If your development computer and target computer are connected with a network cable, you can connect the real-time application on the target computer to a web browser on the development computer.
The TCP/IP stack on the Simulink Real-Time kernel supports only one simultaneous connection, because its main objective is real-time applications. This connection is shared between the MATLAB® interface and the web browser. This shared connection means that only one browser or the MATLAB interface can connect at one time. Close the other connections to the target computer. For example, if you are currently connected to the target computer through Simulink Real-Time Explorer, right-click that target computer icon and select Disconnect or click the Disconnect button on the toolbar.
In the Command Window, type
The MATLAB interface is disconnected from the target computer, and the connection is reset for connecting to another client. If you do not use this command immediately before opening the web interface, your browser might not be able to connect to the target computer.
Open a web browser. In the address box, enter the IP address and port number you entered in Simulink Real-Time Explorer. For example, if the target computer IP address is 192.168.0.10 and the port is 22222, type:
The browser loads the Simulink Real-Time web interface frame and panes.
The Main pane is divided into four parts, one below the other. The four parts are System Status, Simulink Real-Time Properties, Navigation, and WWW Properties.
After you connect a web browser to the target computer, you can use the Main pane to control the real-time application:
In the left frame, click the Refresh button.
System status information in the top cell is uploaded from the target computer. If the right frame is either the Signals List pane or the Screen Shot pane, updating the left frame also updates the right frame.
Click the Start Execution button.
The real-time application begins running on the target computer, the Status line is changed from Stopped to Running, and the Start Execution button text changes to Stop Execution.
Update the execution time and average task execution time (TET). Click the Refresh button. To stop the real-time application, click the Stop Execution button.
Enter new values
in the StopTime and SampleTime boxes, then click the Apply button. You can enter
the StopTime box for an infinite
The new property values are downloaded to the real-time application. Note that the SampleTime box is visible only when the real-time application is stopped. You cannot change the sample time while a real-time application is running. (See Alternative Configuration and Control Methods for limitations on changing sample times.)
After entering values, the screen looks like this:
The WWW Properties cell in the left frame contains fields that control the display on the web interface itself, and not the real-time application. There are two fields: maximum signal width to display and refresh interval.
In the Maximum
Signal Width box enter
only scalar signals),
2 (show scalar and vector
signals less than or equal to 2 wide), or
signals with a width less than or equal to
Signals with a width greater than the value you enter are not displayed on the Signals pane.
In the Refresh Interval box, enter a value greater than 10. For example, enter 20.
The signal pane updates automatically every 20 seconds. Entering
not automatically refresh the pane.
Sometimes, both the frames try to update simultaneously, or
the auto refresh starts before the previous load has finished. This
problem can happen with slow network connections. In this case, increase
the refresh interval or manually refresh the browser (set the Refresh Interval =
This can also happen when you are trying to update a parameter or property at the same time that the pane is automatically refreshing.
Sometimes, when a race condition occurs, the browser becomes confused about the format, and you might have to refresh it. This should not happen often.
The Signals pane is a list of the signals in your model.
After you connect a web browser to the target computer you can use the Signals pane to view signal data:
In the left frame, click the Signals button.
The Signals pane is loaded in the right frame with a list of signals and the current values.
On the Signals pane in the right frame, click the Refresh button.
The Signals pane is updated with the current values. Vector/matrix signals are expanded and indexed in the same column-major format that the MATLAB interface uses. This can be changed by the Maximum Signal Width value you enter in the left frame.
In the left frame, click the Screen Shot button.
The Screen Shot pane is loaded and a copy of the current target computer screen is displayed. The screen shot uses the portable network graphics (PNG) file format.
The web browser interface allows you to visualize data using a user interface.
After you connect a web browser to the target computer, you can use the scopes page to add, remove, and control scopes on the target computer:
In the left frame, click the Scopes button. The browser loads the Scopes List pane into the right frame.
Click the Add Scope button.
A target scope is created and displayed on the target computer. The Scopes pane displays a list of the scopes present. You can add a scope, remove existing scopes, and configure the scopes from this page.
To create a host scope, use the drop-down list next to the Add
Scope button to select
This item is set to
Target by default.
Click the Edit button.
From the scope editing pane, you can configure and control the scope.
Click the Add Signals button. The browser displays an Add New Signals list.
Select the check boxes next to the signal names, and then click Apply. A Remove Existing Signals list is added above the Add New Signals list.
You do not have to stop a scope to change scope parameters. If the scope is running, the web interface stops the scope automatically and then restarts it when the changes are made. It does not restart the scope if the state was originally stopped.
The Get Data button becomes available under these circumstances:
The host scope is stopped (Scope State is
The host scope finishes one cycle of acquisition (Scope
State is set to
If you click the Get Data button, the scope data is retrieved in comma-separated value (CSV) format. The signals in the scope are spread across columns. Each row corresponds to one sample of acquisition. The first column corresponds to the time each sample was acquired.
If Scope State is set to
the scope was stopped before it completed a full cycle of acquisition.
The number of rows in the CSV data still correspond to a full cycle.
The last few rows (for which data was not acquired) are set to
When you stop the model execution, you see another section of
the web browser interface where you can download logging data. This
data is in comma-separated value (CSV) format. The MATLAB interface
reads CSV format using the
Most spreadsheet programs can read CSV format files.
You see this section of the web browser interface only if you have enabled data logging. Buttons become available only for those logs (states, output, and TET) that are enabled. If time logging is enabled, the first column of the CSV file is the time at which data (states, output, and TET values) was acquired. If time logging is not enabled, only the data is in the CSV file, without time information.
You plot the outputs and states of your real-time application to observe the behavior of your model with different input signal values and parameter settings.
To do data logging, first carry out the following setup.
Click Simulation > Model Configuration Parameters.
To allow Simulink to log signals, in the Data Import/Export pane, verify that the Signal logging check box is selected. This check box is selected by default.
To plot the task execution time, in the Simulink Real-Time Options pane, verify that the Log Task Execution Time check box is selected. This check box is selected by default.
In the Simulink Real-Time Options pane of the Configuration Parameters dialog box, set Signal logging buffer size in doubles to a value large enough to accommodate the number of signals you are logging.
Task Execution Time (TET) measures how long it takes the kernel to run for one base-rate time step. For a multirate model, use the profiler to find out what the execution time is for each rate.
The Parameters pane displays the tunable parameters in your model. Row and column indices for vector/matrix parameters are also shown.
After you connect a web browser to the target computer, use the Parameters page to change parameters in your real-time application while it is running.
In the left frame, click Parameters. The browser loads the Parameter List pane into the right frame.
If the parameter is a scalar parameter, the current parameter value is shown in a box that you can edit.
If the parameter is a vector or matrix, click the Edit button to view the vector or matrix. You can edit the parameter in this pane.
In the Value box, enter a new parameter value, and then click the Apply button.
The new parameter values are uploaded to the real-time application.
The web browser interface allows you to set access levels to the real-time application. The different levels limit access to the real-time application. The highest level, 0, is the default level and allows full access. The lowest level, 4, only allows signal monitoring and tracing with your real-time application.
In Simulink Editor, click Simulation > Model Configuration Parameters.
The Configuration Parameters dialog box for the model is displayed.
Click the Code Generation node.
The code generation pane opens.
In the Target
selection section, access levels are set in the System target file box. For example, to set
the access level to
If you do not specify
the highest access level (
0) is set.
The various fields disappear, depending on the access level. For example, if your access level does not allow you access to the parameters, you do not see the button for parameters.
There are various access levels for monitoring, which allow different levels of hiding. The proposed setup is described below. Each level builds on the previous one, so only the incremental hiding of each successive level is described.
Level 0 — Full access to the panes and functions.
Level 1 — Cannot change the sample and stop times. Cannot change parameters, but can view parameters.
Level 2 — Cannot start and stop execution of the real-time application or log data.
Level 3 — Cannot view parameters. Cannot add new scopes, but can edit existing scopes.
Level 4 — Cannot edit existing scopes on the Scopes pane. Cannot add or remove signals on the Scopes pane. Cannot view the Signals pane and the Parameters pane, and cannot get scope data.