Main Content

Graphical Controls for XCP External Mode Simulations

You can control an XCP external mode simulation through:

  • The Hardware tab on the Simulink® Editor toolbar. To display the Hardware tab, from the Apps tab on the Simulink toolstrip, click Run on Custom Hardware.

  • The External Mode Control Panel. To open this dialog box, on the Hardware tab, in the Prepare section, click . Then, under Signal Monitoring & Tracing, click Control Panel.

Equivalent Controls on Hardware Tab and External Mode Control Panel

This table lists external mode actions that you can perform by using controls that are available in the Hardware tab and the External Mode Control Panel.

External Mode ActionHardware TabExternal Mode Control Panel

Build target application.

Run on Hardware > Build for Monitoring

N/A

Run application on target hardware.

Run on Hardware > Deploy

N/A

Connect Simulink to a waiting or running target application.

Run on Hardware > Connect

Connect

Start real-time execution of generated code in the target environment.

Run on Hardware > Start

Start Real-Time Code

Disconnect Simulink from the target environment, but do not stop real-time execution of code.

Run on Hardware > Disconnect

Disconnect

Stop target application execution and disconnect Simulink from the target environment.

If you want to reestablish the external mode connection after stopping the target application, you must perform the Deploy step.

In Run on Hardware section, Stop button .

Stop Real-Time Code

Tune batch of block parameters. You can modify values of tunable parameters in Simulink, and then update the parameters in the target application simultaneously. See Monitor Signal and Tune Parameter.

In Prepare section, Hold Updates and Update All Parameters buttons.

Batch download and Download

XCP External Mode Control Panel

The External Mode Control Panel provides these controls for XCP external mode simulations.

SectionControlDescription
Connection and triggeringConnect

Connect Simulink to a waiting or running target application.

When Simulink is connected to the target application, Connect changes to Disconnect.

Start Real-Time Code

Start real-time execution of generated code in the target environment.

When the generated code starts executing, the button changes to Stop Real-Time Code.

Arm Trigger

Arm the trigger that you specify through the External Signal & Triggering dialog box. If Simulink is not connected to the target application, the button appears dimmed.

If Simulink is connected to the target application and the trigger is armed, the button becomes Cancel Trigger.

Cancel Trigger

Disarm the trigger. Once the trigger is disarmed, the button changes to Arm Trigger.

Floating scopeEnable data uploading

Selecting the check box arms the trigger for uploading target application data to Floating Scope blocks.

Duration

Not supported.

Parameter tuningBatch download

To tune a batch of block parameters:

  1. In the External Mode Control Panel, select Batch download.

  2. In the Simulink Editor, modify the required block parameters.

  3. When you modify parameters, the External Mode Control Panel displays this message next to Download:

    Parameter changes pending... 
    Simulink stores the modified parameters locally.

  4. Click Download. Simulink downloads the batch of modified parameters to the target application.

Download

If the Batch download check box is not selected, the button appears dimmed.

ConfigurationSignal & Triggering

Open the External Signal & Triggering dialog box.

Data Archiving

XCP external mode simulations do not support this button, which appears dimmed.

XCP External Signal & Triggering Dialog Box

For an XCP external mode simulation, you can use the External Signal & Triggering dialog box to:

  • Specify the logged signals that you want to monitor.

  • Configure a trigger that starts the uploading of data from the target application.

The External Signal & Triggering dialog box provides these controls.

SectionControlDescription
Signal selectionSelect all

The Signal selection view lists top-model and referenced-model signals that are configured for logging. Simulink uploads a logged signal for monitoring only if the signal is selected in the Signal selection view. By default, this check box is selected, which enables monitoring of all logged signals.

Clear all

Deselect the signals that are selected for monitoring. If the Select all check box is selected, this button appears dimmed.

on, off

If you select a row, clicking on selects the corresponding signal for monitoring. The Selected column displays the letter X. Clicking off deselects the signal. If the Select all check box is selected, these radio buttons appear dimmed.

Trigger Signal

If you select a row, clicking this button sets the corresponding signal as the trigger for uploading target application data. The Trigger column displays the letter T. If the signal is already selected, clicking this button deselects the signal.

If the configuration parameter PurelyIntegerCode is set to 'on', the trigger signal must be a non-complex, int32 scalar.

If the configuration parameter PurelyIntegerCode is set to 'off', the trigger signal must be a non-complex, double scalar.

Go To Signal

To locate a signal in the model, select the corresponding row in the Signal selection view and then click this button.

Trigger optionsSource

Specify how the trigger is armed:

  • manual (default) — Arm the trigger by selecting the Arm when connecting to target check box or by clicking the Arm Trigger button on the External Mode Control Panel.

  • signal — Use specific characteristics of the trigger signal to start uploading data.

Mode

Specify trigger rearming after a trigger event is complete:

  • normal (default) — The external mode simulation rearms the trigger after each trigger event.

  • one-shot— The external mode simulation collects only one buffer of data for each time that you arm the trigger.

Duration

Specify the number of base rate steps for which the external mode simulation uploads data after a trigger event (default is 1000). For example, if Duration is set to 1000, and the base (fastest) rate of the model is one second:

  • For a signal sampled at the base rate, one second (1.0 Hz), the external mode simulation collects 1000 contiguous samples during a trigger event.

  • For a signal sampled at two seconds (0.5 Hz), the external mode simulation collects 500 samples during a trigger event.

If Send multiple contiguous samples in same packet is also selected, on the target hardware, the target application:

  1. Stores data samples in a buffer.

  2. Sends samples from multiple time steps in a packet.

The Duration value, say durationFieldValue, determines the number of samples sent in a packet:

numOfSamplesSent = durationFieldValue/n
where n = (base rate)/(sample rate)

When the sample rate is the base rate (n=1), numOfSamples is exactly durationFieldValue. For subrates (n=2, 3, …), numOfSamplesSent is rounded down to the nearest integer. The target application discards buffer samples that are not sent to Simulink.

Delay

Apply a delay to data collection, which is the time between a trigger event and the start of data collection expressed in base rate steps. You can specify a positive value or zero (default).

An XCP external mode simulation does not support a negative delay (pretriggering).

Arm when connecting to target

This check box is selected by default. Connecting Simulink to the target application arms the trigger.

  • If the trigger Source is manual, data uploading begins immediately.

  • If the trigger Source is signal, monitoring of the trigger signal begins immediately. Data uploading begins when the trigger signal satisfies trigger conditions (as defined in the Trigger signal section).

If you clear the check box, you can arm the trigger by clicking the Arm Trigger button on the External Mode Control Panel.

Send multiple contiguous samples in same packet

This check box is not selected by default.

If you select the check box, the XCP server uses the XCP DAQ packed mode for streaming signals to Simulink, which improves the ratio of useful data to control data in streamed signals.

The target application sends samples from multiple time steps in a packet. The Duration value determines the number of samples in the packet.

Trigger signalDirection

To enable the uploading of data from the target application when the trigger signal crosses the threshold value (specified by Level), specify the required direction of the signal:

  • rising (default) — Signal must be increasing in value.

  • falling — Signal must be decreasing in value.

  • either — Signal can be increasing or decreasing in value.

Level

Specify the threshold value that the signal must cross to start the uploading of target application data. Default is 0.

Hold-off

Specify, in base rate steps, the time between the termination of one trigger event and the rearming of the trigger. Applies only when Mode value is normal. Default is 0.

Related Topics