Tune Parameters and Monitor Data in Model Running on Apple iOS Devices
Using External Mode
You can use external mode to tune parameters of a model running on your Apple iOS device and monitor the effects of different parameter values in real time. External mode helps you:
Find the optimal values for performance. This process is called parameter tuning.
Accelerate parameter tuning because you do not have to rerun the model each time you change parameters.
Develop and validate your model using the actual data and hardware for which it is designed.
This workflow lists the tasks required to tune parameters with external mode:
In the model on your host computer, enable external mode.
(Optional) Place Sink blocks in your model and connect them to signals.
Run the model on the Apple iOS device in external mode.
(Optional) Observe signals from Apple iOS device using Display or Scope blocks on your host computer.
Change and apply parameter values in the model on your host computer.
Find the optimal parameter values by adjusting the values and observing the results.
Save the new parameter values, disable external mode, and save the model.
Run Your Simulink Model in External Mode
Verify that you can run your Simulink® model on the Apple iOS device, as described in Run Model on Apple iOS Devices.
Verify that the Apple iOS device is connected to a wireless network, and to the USB port on the Host computer. Use the advanced settings to verify the IP address of the device is correct.
On the Simulink model toolbar, set Simulation mode to
External
.Set the Simulation stop time parameter, located to the left of Simulation mode.
The default value is
10.0
seconds. To run the model for an indefinite period, enterinf
.(Optional) To log data from the model while it is running on the Apple iOS device:
Select Simulation > Output > Configure Data Logging. Then, select the signal to log. In the Simulink editor, right-click the signal line and select Properties > Log signal data.
Connect a To File or To Workspace block to a signal in the model.
(Optional) To display data from the model while it is running on the Apple iOS device, connect a Display, Floating Scope, or Scope block to a signal in the model.
If it is locked, unlock the screen on the Apple iOS device.
Unlocking the screen enables the app to be deployed to the device and device to send sensor data back to the host computer. Otherwise, with the screen locked, the host computer receives zeros instead of real sensor data.
Click the Run button.
If your model does not contain a sink block, the Message Viewer displays a warning that “No data has been selected for uploading.” You can disregard this warning or add a sink block to the model.
After several minutes, Simulink starts running your model on the device.
External mode uses the wireless network connection to exchange data with the host computer.
In the model on your host computer, change parameter values.
Observe the corresponding changes in the model running on the hardware.
Any Simulink sink blocks in your model receive data from the hardware and display it on your host computer.
Note
External mode increases the processing burden of the model running on the device. If the software reports an overrun, disable external mode.
Stop External Mode
To stop the model that is running in external mode, click the Stop button on the model toolbar.
If the Simulation stop time parameter is set to a specific number of seconds, external mode stops when that time elapses.
When you are finished using external mode, set Simulation
mode back to Normal
.