Talk:Embedded Control Systems Design/Automotive

Untitled
This Application chapter discusses the embedded systems of modern automobiles, including trucks and busses. Most attention is given to the engine control unit, however several other vehicle parts and their embedded systems are also handled. To finish, a short case study of the airbag controle module of a Toyota Prius is given.

Overview of embedded systems in an automobile
'''This is the old automotive section, wich we though wasn't very enlightening, so we pretty much changed it all. If someone would feel the urge to adapt the automotive section again, inspiration could be found here. '''

Embedded systems in a car are situated in four major areas: the driving control system, the body control system, the driving information system and the in-vehicle LAN. The driving control system part will mainly focus on the engine control unit but also discusses electronic stability control and electric power steering. The body control system considers dashboard meters, control switches, power windows, intelligent keys, adaptive front lighting system, tire pressure monitoring, automatic wipers and central monitoring. The driving information system will review the car navigation system, wave radar and night vision. Finally a short word will be said about the in-vehicle LAN.

Engine control
Gasoline engines are based on the Otto cycle. Basically a mixture of fuel and air is ignited and part of the released energy is translated into mechanical energy to make the car move via the drive line. The power and pollutants which result from this process are greatly affected by how precisely the fuel/air mixture approached theoretical perfection and when the ignition event took place. To get clean air, fuel had to be precisely mixed in a "stoichiometric" 14.7:1 ratio. The mixture had to be ignited at a precise instant that varied with load, speed, and other factors (http://www.intel.com/design/auto/engback.htm).

The introduction of Electronic engine control units gave the required flexibility for a good metering of the fuel and a precise ignition timing on the whole range of the engine. They can also control other aspects of the internal combustion process such as variable valve timing.

The ECU was the first embedded system used in a standard automobile and remains the most important one. This section discusses some of the important aspects of such a controller and how they relate to the general theory of embedded control systems design.

Conditions for a good ECU
A good ECU must possess a number of qualities


 * The timing of the injections has to be as precise as possible, this implies real-time operation.
 * The ECU has to interface with a number of sensors which monitor the combustion process.
 * The ECU must be sufficiently powerful to process all the signals and control commands in a real-time matter.
 * The ECU must be sufficiently robust to maintain a long lifetime while being subject to the high temperatures, vibrations and electromagnetic noise generated by other components in the car.
 * The weight of the ECU and all of it’s related components has to be as low as possible.
 * The price of the system had to be as low as possible to be mounted on passenger cars.
 * The ECU must have a safe failure mode to avoid damaging the engine or causing an unsafe situation.
 * The ECU must be able to communicate with other components of the car
 * The ECU has to provide On Board Diagnosis interface

Structure of an ECU

 * Processor :

The heart of an ECU is of course it’s processor. Usually the processor is a microcontroller. These can be produced cheaply in large quantities. The fact that they are hard(er) to reprogram is not an issue since they are meant to run the same program throughout their entire lifetime. A typical processor in an ECU is at least a 16-bit processor working at 24Mhz. Usually an ECU also has some flash memory for data logging and a couple of K RAM to handle the parameters when computing. High Performance applications demands for ECUs are too high to be handled by a single microcontroller. More complex embedded CPUs are then often used. Sometimes multi-processor solutions are used, for example in the McLaren TAG-210 (http://www.mclarenelectronics.com/). An alternative is the use of smart sensors (http://electronics.howstuffworks.com/car-computer5.htm), which do part of the signal processing themselves and thus lessen the load on the main ECU processor.

Due to the repetitive character of the tasks, the ECU does not need an operating system. The software which is directly burnt on the memory is usually not made publicly available by the manufacturers.
 * Software :

The working principle of the software is as follows :

Volumetric Efficiency (VE) table which give the filling of the cylinder is set in function of the pressure in the manifold and the engine speed. Using the signals of the sensors (air temperature and pressure) and the VE table, the mass of air in the cylinder can be computed by the perfect gas law. The requested fuel quantity is computed as the product of the air mass with the air fuel ratio. Corrections are made in function of the temperature, throttle opening speed, atmospheric pressure, EGR,... The final fuel quantity is translated into an opening time of the injector or a Pulse Width (PW). The PW is translated to electric signal which is send to the injectors.

This part of the control system is a full feed forward regulation.

A closed loop regulation with Exhaust Gas Oxygen sensor (EGO) correction is added to the process. This regulation works only in normal working conditions (not idling or Wide Open Throttle). The ECU checks the value of the lambda sensor and adjust the fuel quantity.


 * Converters and buses :

The ECU controls amongst other things, the release of fuel in the combustion chamber (injection timing) and the actual ignition (ignition timing) The sensors and actuators usually use analog signals as input and output. A microprocessor, of course, operates using digital signals. This is why a ECU contains a large number of A/D and D/A converters. Smart sensors (http://electronics.howstuffworks.com/car-computer5.htm already do part of the signal processing themselves and can thus send digital signals instead of analog ones. These are less susceptible to electrical noise.  The (digital) communication between different parts of the ECU or between the ECU and the rest of the car usually happens according to the  CAN protocol.


 * Casing :

Because the ECU has to last a long time the microprocessor is usually shielded by a special box. This box protects the processor from harmful influences from the environment such as excessive heat, humidity, vibrations or electrical noise.

Sensors
An ECU needs to continuously monitor the combustion process. Therefore it uses a wide array of sensors. A non-exhaustive list of these is given bellow :


 * Manifold Absolute Pressure sensor : Piezoresistive sensor
 * Throttle Position Sensor (TPS) : rotational potentiometer
 * Crankshaft position sensor : electromagnetic sensor
 * Camshaft position sensor : electromagnetic sensor
 * Air temperature sensor : NTC thermistor
 * Coolant temperature sensor : NTC thermistor
 * EGO sensor : wide band warm oxygen sensor (aka Lambda sensor)

Most of the sensors output analogue signals varying between 0 and 5 V DC.

Actuators
Actuators are here the injectors. They work with a piezoelectric actuator or solenoid which opens the injector under 12V voltage. These are rated by the fuel flow they can deliver. This parameter is given in cc/Min @ full opening. The choice of injector is specific to each engine and it's application.

Once the requested fuel quantity is computed by the ECU, it can be easily converted in injector's opening time. This opening time theoretical equal to time that the injector must be feed with 12V or the pulse width. Deviations from the theory occurs due to the finite time needed to fully open the injector and the battery voltage variation. Those two facts must also be taken into account.

Injectors can be have low or high impedance. So in order to work with low impedance injectors, the current must limited. This can done by adding resistor or reducing the current electronically with a Pulse Width Modulation (PWM). If the injector is very quickly set alternatively to 12V and ground the total amount of current in the injector will decrease.

More Information:
Megasquirt ( MegaSquirt ) ( http://www.megasquirt.info/ ) is an open source ECU for educational purposes.

Howstuffworks http://electronics.howstuffworks.com/car-computer.htm has a good article explaining the basic construction and functions of an ECU.

Manufacturers:

 * Bosch
 * Magneti-Marelli
 * Siemens

Electronic stability control (ESC)
When dangerous driving conditions occur, for instance driving on a wet or slippy road or turning, electronic stability control helps the driver to master the car. Therefore the ESC uses systems like ABS and traction control. Traction control prevents the tires from slipping by controlling engine power and/or braking.

Electric power steering
Depending on the angle of the steering wheel and the exerted torque, the microcontroller of the electric power steering system determines how much power the assist motor must give.

Dashboard meters
Contrary to older cars where dashboard meters were all mechanically driven, the dasboard meters found in newer cars are all precisely driven by electric motors controlled by an instrumentation controller.

Control switches
On the dashboard and around the steering wheel, more and more switches (telephone, navigation system, car audio system…) tend to appear. In order to avoid having on wire per switch, manufacturers came up with the ‘LIN’ or ‘local interconnect network’.

Power windows
Almost all cars today get equipped with power windows. A control system is needed to give them an ‘auto shut down’ function, to avoid accidents with children.

Intelligent keys
All car keys today are able to automatically open the doors without having to manually insert the key into the door. Some keys even are able to start the engine. These functions ask for wireless command signals together with radio transmitters, receivers and antenna’s built into the door. Of course the signal must be coded to avoid burglary. This task is accomplished by a microcontroller chip.

Adaptive front lighting system
When making a turn by night on a badly illuminated road, a microcontroller turns one of the headlights according to the speed of the car and turning angle. This way the driver can see further.

Tire pressure monitoring
Tire pressure must be kept at the right level. Suboptimal pressure increases fuel consumption and tire wear. Therefore a microcontroller communicates wirelessly with sensors sensing the pressure in every tire. When tire pressure is too low, the driver can be alerted.

Automatic wipers
To make sure the driver needs not to worry about turning on or off the wiping system or decide how fast the wipers should go there and back, a microcontroller equipped with an optical system is used. A sensor detecting the reflection of LED light being irradiated on the windscreen detects whether or not rain is on the windscreen and how much.

Central monitoring
The central monitor or computer constantly informs the driver about the vehicle condition. Examples are the detection of a broken lamp, low battery voltage or the average fuel consumption.

Car navigation system
The navigation system has evolved from a simple electronic route map display to a multimedia console. Car manufacturers expect the navigation system to gradually become even more sophisticated, for instance by using 3D road maps instead of 2D.

Wave radar
The wave radar’s task consists of determining following distances and relative vehicle speeds. In an event of possible crash, it also must activate the brakes.

Night vision
When driving by night, people walking over the road may be difficult to see. The night vision consists of an infrared camera attached to the front of the car, sending images to a control system able to detect persons or moving objects. These can then be projected on the windscreen to warn the driver.

In vehicle LAN
The number of controllers and sensors in an automobile will keep growing. In order to reduce the complexity of communication and therefore the number of wires, an in-vehicle network was engineered, the most well-known being the CAN protocol.

= Case study: ACM of the Toyota Prius =

The Toyota Prius is a popular hybrid vehicle. Due to the use of a conventional internal combustion engine combined with electric motors it achieves very low fuel consumption. A complete teardown of the car is carried out at http://www.techonline.com/product/underthehood/199100168. In this section only the airbag control module (ACM) is shortly reviewed.

The airbag control module
Analog components form the critical front-end for the ACM, with accelerometers being the primary impact detection sensors. Two MEMS-based (http://en.wikipedia.org/wiki/MEMS) accelerometers are surface-mounted directly to the ACM board. The two MEMS components are placed orthogonal to one another, one in the Y-axis for front collision detection and the other oriented in the X axis and presumed to correspond to side-impact events. The MEMS element appears to be a micromachined strain gauge which then connects to a second chip below for signal processing and communication with the rest of the ACM electronics. A Renesas (http://www.renesas.com) 32-bit CPU (http://en.wikibooks.org/wiki/Embedded_Control_Systems_Design/Processors) with memory monitors the MEMS outputs and performs the algorithmic computations to determine the fire/no-fire threshold. Most memory for the processor is resident on the Renesas chip and no discrete memory devices other than a small serial EEPROM (http://en.wikipedia.org/wiki/EEPROM) are present.

= Drive By Wire =

Many of today’s production vehicles are loaded with high-tech features. This trend will continu the next years. Nowadays vehicle constructors even tend to replace several mechanical links by electrical actuators controlled by a CPU. The mechanical links get replaced by a wire, which is used to send the needed information from the CPU to the actuators. The CPU gets the needed information to control the actuators from several sensor placed on a wide variety of carparts. Drive-by-wire is a term which combines several new systems, that are explained below. For all this systems a set of input signals need to be processed to generate the needed output. The input signals are generated by sensors that measure the input variables that are needed to provide the necessary output. These signals are transferred trough a field bus to the central processing unit (CPU). The CPU makes calculations to generate an output. A software program needs to be loaded on the CPU. With the help of this software program, the CPU can perform operations on the input signals so that these input signals are transformed into the needed output. This output will then be sent to the actuators. The actuators transform the output signals to a physical output e.g. a braking pressure.

Brake-By-Wire
On most cars that are currently being sold, the brake pressure can’t be chosen independently on the four wheels. A Brake-by-wire system makes it possible to shorten the braking distance by monitoring the braking force of each wheel. It is also possible to integrate Electronic stability control (ESC) in this system. ESC monitors the stability of the vehicle and tries to stabilize when the vehicle tends to lose grip. This stabilisation happens by braking on a certain wheel. Another important feature of brake-by-wire is to provide a feedback to the user. The driver needs to feel a certain resistance force when he pushes the brake pedal.

Inputs:
 * Pedal inputs: The driver requests a certain braking force by pushing the brake pedal. The force and speed of pushing this pedal is important to calculate the needed braking force e.g. when a driver pushes the brake pedal very fast, he probably wants to make an emergency stop. In this case the maximum braking force should be applied as fast as possible.


 * Wheel speed: The braking distance can be reduced by measuring the wheel speed of the four different wheels. When one wheel turns slower than the others it means that this wheel is losing grip. The brake force on this wheel should be lowered.
 * Braking pressure: If the braking pressure is measured, it can be compared to the pressure that was calculated by the CPU. This makes it possible to make a feedback control loop for the pressure and to detect defects in the braking system.

Outputs:
 * Braking pressure: The braking pressure is the most important output. Since the driver wants the vehicle to stop, the braking pressure provides this deceleration.


 * Brake pedal feedback force: Another important output of the system is a force on the braking pedal that opposes the input force comming from the driver. This opposing force gives the driver information about how hard he is pushing the pedal, so that he can choose to push the pedal even harder or to push it less hard.

Between input and output all the input information should get processed to generate the appropriate output. This happens in the central processing unit (CPU). But first the input information should reach this CPU. This information transfer can happen by a remote I/O field bus This bus transfers information from the distributed sensors to a central processing unit. Then, the information of the CPU is sent to the actuators by another bus. The actuator transforms the output information to the requested braking force.



Steer-By-Wire
Steering: Nowadays both wheels or mechanically linked. The ideal turning angle of both wheels is only accomplished for one turning radius (this ideal angle is defined by the design of the mechanical link). For other turning radii, both wheels are not pointed exactly in the wanted direction. This generates a slip angle in both wheels, increasing the resistance of the car. This can be overcome when both wheels can turn independantly. This is possible with the steer-by-wire technology. Here the driver requests a certain steering angle by turning the steering wheel. This information is sent to a CPU, which calculates the steering angles of both weels independantly. The driver should also receive a feedback of the lateral forces on the vehicle so he can feel when he’s losing control over the vehicle.

Inputs:


 * Steering wheel input: The speed and force applied by the driver should be measured to calculate the appropriate steering angle


 * Lateral forces: The lateral forces on the vehicle are measured to provide the driver with information about the stability of the vehicle.

Outputs:


 * Steering angle: The driver steers to make a certain turn. The wheels of the vehicle should turn in order to make this turn. Ideally, both weels should drive on a circular path with the same center point. This implies that both wheels should turn under a different angle.


 * Steering wheel feedback: For reasons mentionned above, the driver should experience a certain resistance in the steering wheel.

Similar to brake-by-wire, an embedded control system should be implimented. The inputs mentionned above should be transferred (by field busses) to a CPU, which generates the needed outputs. This outputs then get transferred to actuators, so that the vehicle responds as requested by the driver.

= Electronic throttle control (ETC) =

The benefits of ETC are largely unnoticed by most drivers because the aim is to make the vehicle power-train characteristics seamlessly consistent irrespective of prevailing conditions, such as engine temperature, altitude, accessory loads etc. The ETC is also working 'behind the scenes' to dramatically improve the ease with which the driver can execute gear changes and deal with the dramatic torque changes associated with rapid accelerations and decelerations. ETC makes it much easier to integrate features to the vehicle such as cruise control, traction control, stability control and others that require torque management, since the throttle can be moved irrespective of the position of the driver's accelerator pedal. This makes ETC a very complicated system. Since information about engine temperature, atmospheric pressure, engine torque, cruise control etc. is needed to calculate the throttle valve position. The output of the system, however, is much simpler. Since the only output is the valve position, no feedback to the user is needed.

= Electronic valve control (EVC) =

An electronic valve control (EVC) system replaces the mechanical camshaft, controlling each valve with actuators for independent valve timing. The EVC system controls the opening and closing time and lift amount of each intake and exhaust valve with independent actuators on each valve. Changing from a mechanical camshaft driven valve into independently controlled actuator valves provides a huge amount of flexibility in engine control strategy. The electronic control system of the actuator can be integrated in the ECU of the direct injection system. The two systems are closely related to each and they need the same inputs.

More info: http://www.bmwworld.com/technology/valvetronic.htm

= AUTOSAR =

Many of today’s production vehicles are loaded with high-tech features. New vehicles containing as many as 80 electronic control units (ECUs). The majority of these ECUs must communicate which one another to realize the features. Developing a highly distributed, reliable, real-time electronic system is a complex challenge. Automotive control engineers try to tackle the growing complexity of their systems by adopting universal standards for the interface between software and hardware. This is where AUTOSAR (Automotive open systems architecture) comes in. An AUTOSAR-compliant runtime environment might be compared to personal computer operating systems, witch all hardware drivers and services conforming to the standard. All applications for unique functionality, such as powertrain controls, would be written to interface with this runtime environment without the developer having to write for specific electronic control unit. The AUTOSAR runtime environment will allow independence of software from hardware. AUTOSAR will force current automotive microcontroller suppliers to act like system developers since they must supply software drivers as well as the underlying hardware. To achieve the technical goals modularity, scalability, transferability and re-usebility of functions AUTOSAR will provide a common software infrastructure for automotive systems of all vehicle domains based on standardized interfaces for the different layers shown in the top right image.

Modularity of automotive software elements will enable tailoring of software according to the individual requirements of electronic control units and their tasks.
 * Modularity:

Scalability of functions will ensure the adaptability of common software modules to different vehicle platforms to prohibit proliferation of software with similar functionality.
 * Scalability:

Transferability of functions will optimize the use of resources available throughout a vehicle’s electronic architecture.
 * Transferability:

Re-usability of functions will help to improve product quality and reliability and to reinforce corporate brand image across product lines.
 * Re-usability:

More info at http://www.autosar.org/

= References: =

http://electronics.howstuffworks.com/car-computer.htm http://www.necel.com/en/solutions/applications/auto/auto_02.html http://www.carinstincts.com/CarPerformance/ecus.htm http://en.wikipedia.org/wiki/Engine_Control_Unit http://en.wikipedia.org/wiki/MegaSquirt http://www.intel.com/design/auto/index.htm http://www.mclarenelectronics.com/Products/All/Unit_Cont_TAG-210.asp http://www.techonline.com/product/underthehood/ http://www.openecu.org http://www.bmwworld.com/technology/valvetronic.htm http://www.autosar.org/