Hardware in the Loop
Increasingly complex systems now need to be developed in ever shorter periods of time. In this process, it is vitally important that any errors are detected and corrected in the early phases of development. One approach is to use Hardware in the Loop (HiL) test rigs. HiL allows an existing control unit to be tested within a model of its subsequent environment. This makes it possible to carry out an analysis of the device at an early stage.
 
ref_hil_01   The vehicle electrical system:a guarantee for voltage stability and functional reliability
The main requirement to be met by a vehicle’s onboard electrical system is that it provides a stable voltage and performs all the functions required. This includes the ability to start the vehicle and to provide a reliable source of power to the electrical components of safety-relevant systems as well as to those relating to comfort, for example. In order to ensure that these requirements are fulfilled, modern vehicle electrical systems are equipped with energy management functionalities. Depending on the level of standard equipment in the vehicle, the functions provided by an energy management system range from simply stabilising the onboard voltage by raising the alternator’s no-load voltage to predicting the battery’s ability to start the vehicle at a future point in time by means of a predictive diagnosis of the battery’s condition and state of charge. Therefore, the primary task of the energy management control unit is to determine the battery’s performance capacity at any one time and to prioritise the electrical components accordingly.

HiL test rig project: testing the control unit functions of the energy management control unit
The task facing the engineers in the Automotive Electronics department at the Technikum Ehningen was to develop and build an HiL test rig that is able to automatically test the control unit functions of an onboard energy management control unit in accordance with a given test specification. The emphasis was on reducing testing time and ensuring the repeatability of the tests, while maintaining constant test conditions. In the tests, the control unit is subjected to various stimuli via the CAN bus, such as voltage, current, temperature and the simulation of the residual bus. The reactions of the control unit are formulated as CAN messages and are recorded on the computer using CANape and CANoe, where they are compared with the specifications. This comparison and the values expected are used to decide whether the control unit is functioning correctly. Once the hardware and software have been tested and put into operation, trials are performed and the results are documented.
  ref_hil_02
The heart of the test stand the central junction box: high-current power unit with contactors and inductive current measurement.

The test rig concept: interaction between hardware and software
The test specifications for the control unit were provided by the customer. On the basis of these specifications, the project began by developing a concept for the hardware and software. The hardware components were then put together and dimensioned in accordance with the special test speci- fications. The software test used two commercial tools from Vector: CANoe for the residual bus simulation and to record the CAN messages and CANape to record the control unit parameters. Communication between CANoe and CANape was achieved via a gateway programmed in Visual Basic through a Microsoft COM interface. From the test specifications, the individual testing steps were compiled in process chains and programmed and executed in LabView with the aid of a process control programme. In this context, the process control specifies the set values, determines the physical measured values and provides the documentation of the results. It consists of a large number of reusable individual modules so-called functional blocks that represent recurring test procedures. For example, they include plotting voltage curves over time, setting the voltage and current, waiting for results, controlling CANoe via the CAN bus or filing the data. Information on the process sequence is provided by the process chain.

ref_hil_03
1 Signal distribution 2 Screenshot of the graphical user interface 3 Measuring cabinets for the HiL test rig.

DThe entire residual bus behaviour for the test object is simulated using CANoe. The sending and receiving of messages to and from the control unit is controlled by a measurement node programmed in CAPL (residual bus simulation). This allows the requirements of the test specification on the CAN communication with the control unit (residual bus parameters, value specification, read out of values using CANape and the diagnosis function) to be represented. In implementing this concept, the electronics engineers worked in close cooperation with their colleagues from the testing department, who contributed their experience in designing test rigs and programming LabView. Bertrandt engineers from Ingolstadt also supported the CAPL programming.

Developing and building the test rig: the junction box as the central hardware element Following the joint concept development in the Bertrandt Engineering Network, the test rig was built in Ehningen. It consists of two measuring cabinets, a climate chamber and two laptop computers. The first measuring cabinet houses an industrial PC, data acquisition cards from National Instruments and mains adapters with fixed voltages, as well as further programmable mains adapters (0-45 V, 0-70 A). The second measuring cabinet contains a high current constant for currents of up to 1,000 A and appropriately sized contactors for reversing the polarity of the voltage as well as the corresponding inductive high-current measurement unit. A bitserial interface (BSS) provides information on the alternator current derived from the CAN bus data.

The BSS module forms the interface between the CAN bus and the serial line to the control unit. The hardware component CANstress is used to apply a physical disturbance to the CAN. A diagnosis tester is used to flash the control unit. The junction box is the central hardware element of the control unit test rig and connects all the hardware components with one another. All voltage and current sources come together at this point and can be distributed to the control unit accordingly in a targeted manner. Various currents and voltages as well as the temperature of the control unit are measured as output data. Furthermore, the various systems, such as the test routine control programme, the residual bus simulation and the diagnosis tester, are linked together.

Trials: control unit testing on the HiL test rig
Before the actual test is performed on the control unit, system integration has to be carried out. The purpose of this integration is to test how the various software modules interact with each other and with the hardware. The test rig is then ready to start the test.
 
ref_hil_04
System representation of the HiL test rig.
 
Testing usually takes place at a room temperature of +25 °C. The test specifications provided by the control unit developers are divided up into different test case groups, which place different emphasis on the various hardware, software and diagnosis functionalities. The test case groups are in turn divided into test cases and these are subdivided into single testing steps. These testing steps are executed on the HiL test rig largely without manual intervention. The execution of a single test routine can take five minutes or several days, and for some special testing steps waiting periods of up to eleven hours are necessary in order to check the occurrence of specific events.

Many of the testing steps are then repeated at temperatures of 40 °C and +70 °C. For this purpose, the control unit is placed in a climate chamber. The automatically generated results are then plausibility checked and entered into the corresponding test specification to simplify evaluation.

Conclusion
The HiL test rig developed in cooperation with various company branches allows Bertrandt to carry out tests on energy management control units for vehicle electrical systems. Depending on the test case group in question, measurement can achieve a degree of automation of up to 100 %. Manual intervention is necessary only in certain cases, for example for flashing the control unit. The scope of testing can be extended at the customer’s request by adapting the CAPL programmes and by programming additional LabView modules.