Graphical Controls for XCP External Mode Simulations - MATLAB & Simulink (original) (raw)
You can control an XCP external mode simulation through:
- The Hardware tab on the Simulink® Editor toolbar. To display the Hardware tab, from theApps tab on the Simulink toolstrip, click Run on Custom Hardware.
- The External Mode Control Panel. To open this dialog box, on theHardware 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 Action | Hardware Tab | External Mode Control Panel |
---|---|---|
Build target application. | > ![]() |
N/A |
Run application on target hardware. | > ![]() |
N/A |
Connect Simulink to a waiting or running target application. | > ![]() |
Connect |
Start real-time execution of generated code in the target environment. | > ![]() |
Start Real-Time Code |
Disconnect Simulink from the target environment, but do not stop real-time execution of code. | > ![]() |
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 ![]() ![]() |
Batch download andDownload |
XCP External Mode Control Panel
The External Mode Control Panel provides these controls for XCP external mode simulations.
Section | Control | Description |
---|---|---|
Connection and triggering | Connect | Connect Simulink to a waiting or running target application.When Simulink is connected to the target application,Connect changes toDisconnect. |
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 toArm Trigger. | |
Floating scope | Enable data uploading | Selecting the check box arms the trigger for uploading target application data to Floating Scope blocks. |
Duration | Not supported. | |
Parameter tuning | Batch download | To tune a batch of block parameters: In the External Mode Control Panel, select Batch download.In the Simulink Editor, modify the required block parameters.When you modify parameters, the External Mode Control Panel displays this message next toDownload:Parameter changes pending... Simulink stores the modified parameters locally.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. | |
Configuration | Signal & 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.
Section | Control | Description |
---|---|---|
Signal selection | Select 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 theSelect 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. TheTrigger column displays the letter T. If the signal is already selected, clicking this button deselects the signal.If the configuration parameterPurelyIntegerCode is set to 'on', the trigger signal must be a non-complex, int32 scalar.If the configuration parameterPurelyIntegerCode 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 theSignal selection view and then click this button. | |
Trigger options | Source | 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, ifDuration 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: Stores data samples in a buffer.Sends samples from multiple time steps in a packet.The Duration value, saydurationFieldValue, determines the number of samples sent in a packet:numOfSamplesSent = durationFieldValue/nwheren = (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 ismanual, data uploading begins immediately.If the trigger Source issignal, 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 signal | Direction | To enable the uploading of data from the target application when the trigger signal crosses the threshold value (specified byLevel), 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 whenMode value is normal. Default is 0. |