RT Box Coder Options

The Target page contains code generation options which are specific to the PLECS RT Box.

General

Analog input voltage range

The allowed voltage range for analog input signals. The specified range is discretized with a resolution of 16 bit. For best results the smallest matching range should be selected.

Analog output voltage range

The voltage range for analog output signals. The specified range is discretized with a resolution of 16 bit. For best results the smallest matching range should be selected.

Nanostep D-Sub output range

(RT Box 4 only) This option specifies whether the Nanstep outputs on the D-Sub connector are unipolar or bipolar. The voltage range for the bipolar setting is -2 V to 2 V if the outputs are unterminated, -1 V to 1 V if correctly terminated to ground with 100 \(\Omega\). For the unipolar setting, the voltage output range is 0 V to 4 V if the outputs are unterminated, 0 V to 2 V if correctly terminated to ground with 100 \(\Omega\).

Digital output voltage level

The voltage level for all digital outputs of the RT Box. Possible values are 3.3 V and 5 V.

Analog input sampling / Sampling delay

The delay (in seconds) between the start of the simulation step and the sampling of the analog inputs for the next simulation step. If a sampling delay of 0 is specified, sampling for the next simulation step is done at the beginning of the current simulation step (corresponding to the maximum latency). To sample the analog inputs as late as possible, select Minimize latency. Minimum latency is usually desirable unless sampling must be synchronized to, for example, the peaks of the PWM carrier. Alternatively, the Analog In block allows to configure individual software or hardware triggers.

Overrun limit

The maximum number of consecutive overruns that may occur before the simulation is aborted. Increasing this parameter allows the simulation to continue in certain conditions where the calculation time exceeds the model step size for a short period of time, e.g. when sending the first trigger command in external mode.

Simulation mode

When set to HIL, the default value, the RT Box behaves as discussed in chapter Principle of Operation: The outputs of the RT Box are updated at the start of the next simulation step. In rapid control prototyping applications, this can lead to undesirable latency. When switching to RCP, the outputs of the RT Box are updated immediately after the calculation for the simulation step is completed (at the expense of less time available for the calculation). RCP mode cannot be used when multitasking is enabled.

Note

The Simulation mode parameter is deprecated. The RCP mode will be removed in a future version of the TSP.

Enable external mode

This setting adds code to use the external mode on the RT Box. Code size and memory consumption are slightly increased when the external mode is enabled.

Enable XCP

XCP is the Universal Measurement and Calibration Protocol published by the Association for Standardisation of Automation and Measuring Systems (www.asam.net). RT Box 2, 3 and 4 support the XCP protocol version 1.5 over a UDP network connection. The RT Box acts as an XCP slave device. It can be accessed on UDP port 5555.

When enabled, all signals to scopes, XY plots and display blocks are available as DAQ measurements. All tuneable parameters can be modified using STIM packets. An A2L file is generated in the output directory of the code generation process for import into an XCP master (e.g. CANape from Vector Informatik GmbH).

XCP slave identity

This options specifies how the RT Box is identified in the generated A2L file. When set to Use target device, the name of the box is taken from the Target device input field. When set to Specify host name or Specify IP address, the host name or IP address of the RT Box can be explicitly specified. For use with CANape it seems to be necessary to specify the IP address explicitly.

Interconnect

These options allow to synchronize multiple connected RT Boxes. Please also read section Time and Startup Synchronization.

Primary box for startup/clock

Specifies on which SFP port the primary RT Box is connected. For the top level primary box or for standalone boxes this option must be set to Self.

Synchronize startup with SFP x

Enables startup synchronization on the given SFP port. Primary boxes must enable startup synchronization on all ports to which a secondary box is connected. Secondary boxes must enable startup synchronization on the port to which the primary box is connected.

Use clock from primary box

Enables simulation time step synchronization. The SFP port to which the primary RT Box is connected must be specified in option Primary box for startup/clock. No settings are necessary on the primary RT Box.

CAN

These options allow to set up the CAN interfaces of the RT Box.

Enable CANx

Enables or disables a CAN interface. If a CAN interface is enabled and configured to use digital IO pins, these pins cannot be used for other purposes (e.g. PWM generation or PWM capturing).

Baud rate

The baud rate that is used on the connected CAN bus. All devices on a CAN bus must be configured to use the same baud rate.

TX/RX pin

Specifies which IOs to use for CAN communication. Each CAN channel requires one input and one output pin. Select ‘Internal CAN interface’ for the in-built CAN interface on the back of some RT Box models (see section CAN). This option is only available with RT Box 1. RT Box 2, 3 and 4 always use the internal CAN interface.

CANx error recovery delay [ms]

If too many errors occur on the CAN bus, the CAN bus switches to a bus-off state. If this parameter is set to a non-zero value, automatic recovery is activated. The value specifies the time in milliseconds after which the recovery should be started. A value of 0 disables automatic recovery.