*As Featured on NI.com
Original Authors: Alisdair McClymont, Cambridge University Eco Racing
Edited by Cyth Systems
Using remote data analysis and telemetry to reliably monitor and control the electrical systems of a solar-powered car.
Using NI CompactRIO hardware as the in-car embedded controller to interface with the vehicle controller area network (CAN) bus, to implement the vehicle control algorithm programmed in NI LabVIEW software, and to send and receive data via telemetry radio.
Cambridge University Eco Racing (CUER), a student team from the university’s engineering department, designs, builds and races solar-powered cars. Our goal is to win the World Solar Challenge, the world’s premier race for solar vehicles. This 3,000 km race across Australia pushes efficiency and reliability to their limits. CUER first entered the race in 2009 with our car called Endeavor, which averaged more than 70 kmph and achieved a top speed of 121 kmph. However, we finished 14th due to reliability problems. This encouraged us to seek an alternative solution built with National Instruments products.
Solar Car Electrical Systems
The key electrical components of a solar car are simple – a battery, solar array modules, and a motor. A battery management system (BMS) monitors the state of each battery cell. The motor connects to the high-voltage bus through a high-efficiency three-phase inverter (motor controller), and each solar array module connects to the high-voltage bus through a high-efficiency switch-mode converter known as a maximum power point tracker (MPPT). Each of these devices has a CAN interface and outputs information, such as current, voltage, speed, temperature, and error, about the relevant electrical devices.
The motor controller actively controls the vehicle. It can limit both the current drawn from the high-voltage bus and the motor speed. Therefore, the motor controller requires a “desired velocity” and an “allowed current” via CAN. This message is sent by an on-vehicle processor, which monitors the driver inputs and the states of the other electrical systems and decides the values to send to the motor controller. Initially, we used a student-made device to perform this task. Although functional, the device was not reliable and, critically, failed during the 2009 race in Australia. We decided that a more reliable solution was essential for future success.
Vehicle Control Using CompactRIO
National Instruments, a key sponsor of CUER, provided CompactRIO products for use on solar cars. We used a 2-port, high-speed CAN module to connect to the CAN bus so the cRIO could receive information from the motor controller, BMS, MPPTs and driver inputs. We wrote a LabVIEW program to process this information in real-time and to send control messages to the motor controller and condensed information to the driver display.
We used the NI-CAN driver to quickly and easily create a database of all the CAN messages sent out by each device on the network. The program then called on the CAN Frame to Channel Conversion Library to decode and encode messages. This offered a quick, reliable way to process the information on the CAN bus.
We wrote the control program in LabVIEW using an object-oriented structure for easier modularization, maintenance, and understanding of the code. We created a class for each device on the bus, including functions to decode and encode messages for that device.
We used a state chart to determine the nature of the messages sent to the motor controller. The modes of the car include: “normal” driving mode where the driver’s accelerator controls the current drawn by the motor controller, and “cruise control” mode where the vehicle maintains a constant speed (we use this mode for almost all of the race), and “reversing” or “braking” mode where the motor controller uses regenerative braking to minimize the energy lost. Using LabVIEW state charts, we can easily define the actions carried out in each mode and the requirements to transition between states. Most importantly, it is a reliable way to implement vehicle control. The last thing the team wants is for a driver’s actions to result in a burnt-out motor.
A distinct advantage of using LabVIEW is the ease of running several processing loops in parallel. For example, one loop can send control messages to the motor controller at a constant rate and the system immediately processes CAN messages whenever they are received.
A reliable telemetry system between the car and the chase vehicle, which follows the car throughout the race, is essential. The driver sees a limited display inside the car, so team members in the chase vehicle must monitor in-depth data and look for any faults or suboptimal performance.
CompactRIO gave us a simple solution for implementing this system. We connected a telemetry radio to the serial port on the cRIO module and the control program simply sends packaged data via the serial port. A second telemetry radio in the chase vehicle receives this data and it’s processed, again using LabVIEW, on a laptop. The system presents this data so that operators can quickly detect errors or other significant changes in the vehicle state.
We also use the telemetry system to send the optimum cruise control speed to the solar car. We calculate the optimum speed using a complex optimization algorithm in LabVIEW, which integrates directly with the weather instruments on board the chase vehicle.
To date, using CompactRIO and LabVIEW for vehicle control and telemetry has proven 100 percent reliable. This means we can concentrate on improving the efficiency of the other systems on the car, such as modifying the algorithms run by the MPPTs and the battery voltage. Thanks to National Instruments, we look forward to a much-improved performance in the World Solar Challenge.
Alisdair McClymont, Cambridge University Eco Racing
Edited by Cyth Systems