Main Content

Tune Parameters and Monitor Data in Model Running on Android Devices

Signal Monitoring and Parameter Tuning

You can use Monitor and Tune feature to tune parameters of a model running on your Android® device and monitor the effects of different parameter values in real time. Monitor and Tune feature 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:

  1. On the Hardware tab of the Simulink® model, in the Mode section, select Run on board and then click Monitor & Tune.

  2. (Optional) Place sink blocks in your model and connect them to signals.

  3. (Optional) On the Hardware tab of the Simulink model, in the Mode section, select Run on board and then click Monitor & Tune.

  4. (Optional) Observe signals from Android device using Display or Scope blocks on your host computer.

  5. Change and apply parameter values in the model on your host computer.

  6. Find the optimal parameter values by adjusting and observing the results.

  7. Save the new parameter values, click Stop to stop the model, and save the model.

Monitor and Tune Your Simulink Model

  1. Verify that you can run your Simulink model on the Android device, as described in Run Model on Android Devices.

  2. Verify that the Android device is connected to a Wi-Fi® network, and to the USB port on the Host computer.

  3. Set the Stop time parameter, located in the Simulation tab of the toolstrip.

    The default value is 10.0 seconds. To run the model for an indefinite period, enter inf.

  4. (Optional) To log data from the model while it is running on the Android device:

    • Right-click the signal line and select Log Selected Signals.

    • Connect a To File or To Workspace block to a signal in the model.

  5. (Optional) To display data from the model while it is running on the Android device, connect a Display, Floating Scope, or Scope block to a signal in the model.

  6. If it is locked, unlock the screen on the Android device.

    Unlocking the screen enables the 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.

  7. To start the simulink, on the Simulation tab, 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 a Wi-Fi connection to exchange data with the host computer.

  8. 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 Monitor and Tune

To stop signal monitoring and parameter tuning, on the Hardware tab of the toolstrip, click Stop.

If the Stop time parameter is set to a specific number of seconds, the Simulink model stops running after the time elapses.

Related Topics