This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English version of the page.

Note: This page has been translated by MathWorks. Click here to see
To view all translated materials including this page, select Country from the country navigator on the bottom of this page.

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:

  1. In the model on your host computer, enable external mode.

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

  3. Run the model on the Apple iOS device in external mode.

  4. (Optional) Observe signals from Apple iOS 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 the values and observing the results.

  7. Save the new parameter values, disable external mode, and save the model.

Run Your Simulink Model in External Mode

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

  2. 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.

  3. On the Simulink model toolbar, set Simulation mode to External.

  4. 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, enter inf.

  5. (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.

  6. (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.

  7. 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.

  8. 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.

  9. 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.