Main Content

Test Downshift Points of a Transmission Controller

This example demonstrates how to test a transmission shift logic controller using test sequences and test assessments.

The Model and Controller

This example uses the TransmissionDownshiftTestSequence model, which is a simplified drivetrain system arranged in a controller-plant configuration. The objective is to unit test the downshift behavior of the transmission controller.

The Test

The controller should downshift between gear ratios in response to a increasing throttle application. The test inputs hold vehicle speed constant while ramping the throttle. The Test Assessment block includes requirements-based assessments of the controller performance.

Open the Test Harness

Click the badge on the subsystem shift_controller and open the test harness controller_harness. The test harness contains a Test Sequence block and a Test Assessment block connected to the controller subsystem.

The Test Sequence

Double-click the Test Sequence block to open the Test Sequence Editor.

The test sequence ramps speed to 75 to initialize the controller in fourth gear. Throttle is then ramped at constant speed until a gear change. Subsequent initialization and downshifts execute. After the change to first gear, the test sequence stops.

Test Assessments for the Controller

This example tests the following conditions:

  • Speed value shall be greater than or equal to 0.

  • Gear value shall be greater than 0.

  • Throttle value shall be between 0 and 100.

  • The shift controller shall keep the vehicle speed below specified maximums in each of the first three gears.

Open the Test Assessment block. The assert statements correspond to the first three conditions. If the controller violates an assertion, the simulation fails.

assert(speed >= 0, 'speed must be >= 0');
assert(throttle >= 0, 'throttle must be >= 0 and <= 100');
assert(throttle <= 100, 'throttle must be >= 0 and <= 100');
assert(gear > 0,'gear must be > 0');

The last condition is checked by three verify statements corresponding to the maximum speeds in gears 3, 2, and 1:

  • Vehicle speed shall not exceed 90 in gear 3.

  • Vehicle speed shall not exceed 50 in gear 2.

  • Vehicle speed shall not exceed 30 in gear 1.

A When decomposition sequence contains the verify statements. In the When decomposition sequence, signal conditions determine the active step. A step includes a condition preceded by the when operator. The last step Else covers undefined conditions and does not use a when statement. For more information on When decomposition, see "Transition Types" in Test Sequence Basics.

OverSpeed3 when gear==3
verify(speed <= 90,'Engine overspeed in gear 3')
OverSpeed2 when gear==2
verify(speed <= 50,'Engine overspeed in gear 2')
OverSpeed1 when gear==1
verify(speed <= 30,'Engine overspeed in gear 1')

Testing the Controller

Simulating the test harness demonstrates the progressive throttle ramp at each test step and the corresponding downshifts. The controller passes all of the assessments in the Test Assessment block.

View the Results

Click the Simulation Data Inspector button in the test harness toolstrip to view the results. You can compare the speed signal to the verify statement outputs.