International Journal of Advanced Computer Engineering and Communication Technology (IJACECT) ______

Fuzzy designing and scheduling of Automotive ECUs over Controller Area Network

1Anu Jose, 2Shinu M R , 3Divya P 1,2,3 Department of Computer Science Engineering, Amrita Vishwa Vidyapeetham, Bangalore Email: [email protected], [email protected], [email protected]

controllers for the engine and transmission system Abstract- The technological advancements of embedded system and electronics within the vehicle are being driven generally require 32 bit CPUs to process the real time by the challenge to make the vehicle safer, more energy algorithms. Other areas of the automotive industry, such efficient and networked. Implementation of Automotive as chassis and safety systems use both 16 bit and 32 bit tasks has become easier with various advancement in processors, depending on complexity of the control. The software and hardware design modules. These Automotive electronic content within the vehicle continues to grow tasks are implemented on a controller called ECU. Heart of and more systems become intelligent with the addition of any ECU is a Flash-based microcontroller which varies microcontroller based electronics. A normal vehicle from a System on Chip to Field Programmable Gate Array today contains an average of 25 to 35 microcontrollers (FPGA) which are used in different vehicle domains. with some luxury vehicles containing up to 70 Automotive tasks selected for this project are Windshield wiper control, Adaptive cruise control and Seat-belt microcontrollers per vehicle. Flash-based tightener. Windshield wiper control is designed using microcontrollers are continuing to replace switches, Fuzzy Logic method and adaptive cruise control using PI relays, and traditional mechanical functions with higher- controller. The tasks in the application program should be reliability components while eliminating the cost and checked whether they execute within their deadline. So, the weight of copper wire. Embedded controllers can drive need of Real-time scheduling comes into play in Automotive motors to operate power seats, mirrors, and windows. Embedded System. Driver-information processors display or announce navigation and traffic information along with vehicle Keywords: Fuzzy designing, Controller area network, diagnostics [1]. adaptive cruise control, ECU, Windshield Wiper control, PI controller. Networks are a recent addition to embedded systems which are the challenge of squeezing in the hardware and I. INTRODUCTION code for in-car networking. To satisfy the new emissions regulations of government, vehicle manufacturers and Every year, automobile manufacturers pack new the Society of Automotive Engineers (SAE) developed embedded system into vehicles. Small processors in the J1850, an automotive-network protocol. European deep recesses of the vehicle exchange and collect manufacturers support controller area network (CAN). information to optimize, control, and monitor many of The Controller Area Network (CAN) is a multi master the functions that a few years ago were totally serial . CAN protocol provide mechanical. The advancements of embedded system and advantages over other communication protocols. CAN electronics within the vehicle are being driven by the serial communication protocol offers a very good challenge to make the system more energy efficient, safer, price/performance ratio. CAN allow moving data with a and networked. Flash-based microcontrollers, from fast transmission speed (up to 1 Mbit/s) and can be used system on-chip (SOC) to Field Programmable Gate in real-time systems. CAN data is reliable and the error Array (FPGA), are the heart of embedded system design. detection is robust and sophisticated. Unlike a traditional network such as or USB, CAN does not send In 1968 for fuel injection, Volkswagen launched the first large blocks of data point-to-point from a node to embedded system in the automotive field. Historically, another node under a central master. In a CAN low-cost 8 bit and 16 bit microprocessors were the norm network short messages like RPM or temperature are in automotive controllers, and engineers written majority broadcast to the entire network, which allows for data of the code in assembly language. A successful consistency in each node of the entire system. automotive electronic design depends on careful selection of microprocessor. Modern power train ______ISSN (Print): 2278-5140, Volume -3, Issue -1, 2014 18 International Journal of Advanced Computer Engineering and Communication Technology (IJACECT) ______

II. LITERATURE SURVEY emptive scheduling requires control of the processor be given to the task of the highest priority at all time. In the Automotive electronics first began with the need for event that makes a higher priority task ready to run, the better controls for the engine. The first electronic part in current running task is immediately suspended and the an automobile was called an ECU which means “engine control of the processor is given to the higher priority control unit”. task [2].

2.1 Survey on different automotive domains 2.3 Survey on communication protocols

Automotive embedded systems are distributed systems With the increase of number and complex of automotive and according to different domains in the automotive electronic control system, it is impossible to use field, they can be classified as, traditional point-to-point links method for implementing information exchange between different ECU. This  Engine Electronics method will bring drawbacks such as the increase of  Transmission Electronics wiring length and weight, redundancy of signal cable,  Chassis Electronics difficulty of examine and repair, lack of electric device  Active Safety protect, impossibility of information sharing and  Driver assistance integration, and finally increase the hardness and  Passenger Comfort complexity of system integration. Passenger car control  Infotainment systems system is real-time networked control system which aims at passenger car as control object, applies in-vehicle Engine control unit, one of the most demanding network as information transmission channel, uses electronic parts of an automobile. Engine controls electronics integration and network integration as basis, demand one of the highest real time deadlines, as the information integration and control integration as core, engine system itself is very fast and complex part of the function integration as target, design integration as automobile. In a Diesel Engine, embedded systems development method. Supported by automotive include[1]: electronic control technology, in-vehicle network  Fuel injection rate technology, embedded control technology, sensor  Emission control, NOx control technology and intelligent control technology etc, it  Oxidation catalytic converter shares information and achieves correlative real-time  Turbocharger control control between ECU‟s and electric devices according to  Cooling system control special control functions.  Throttle control 2.3.1 Available communication protocols There are lots of sensors about 20 to50, which measure temperature, flow, pressure, engine speed, oxygen level Numerous communication protocols are available for and NOx level and more parameters at different points in automotive networking. They are listed below. an engine. All these sensor output signals are sent to the electronic control unit. The ECU output is connected to a. CAN (Controller Area Network) different actuator like throttle valve actuation, EGR valve actuation. CAN is a standard designed to allow microcontrollers and devices to communicate with each 2.2 Survey on available RTOS schedulers other within a vehicle without a host computer. Bit rates up to 1 Mbit/s are possible at network lengths below 40 The real time scheduler keeps record of the state of each m [4]. decreasing the bit rate supports long network task and selects from among them that are ready to distances. execute and allocates the CPU to one of them [8]. A real time scheduler helps to maximize CPU utilization among b. VAN () different tasks in a multi-tasking program and to minimize waiting time. There are two types of VAN is a vehicle bus developed by PSA Peugeot Citroen schedulers available: non-pre emptive and priority-based and Renault. It is a serial communication protocol pre emptive. Non-pre emptive scheduling or cooperative capable of speeds up to 125 Kbit/s. multitasking requires the tasks to cooperate with each other to explicitly give up control of the processor. When c. Flex Ray the task releases the control, the next impotent task that is already in ready state will be executed. A task that is Flex Ray is a general purpose high-speed protocol with newly entered with a higher priority than the others will safety-critical features. Flex ray is designed to be faster only get control of the processor when the current and more reliable than CAN, but is more expensive executing task gives up the control. Priority-based pre ______ISSN (Print): 2278-5140, Volume -3, Issue -1, 2014 19 International Journal of Advanced Computer Engineering and Communication Technology (IJACECT) ______d. LIN (Local Interconnect Network) actuators, that is, motor serve as output. Three automotive tasks were taken into consideration in this The LIN bus is an inexpensive serial communications project. These tasks have to be programmed such a way protocol, which effectively supports local application that sensor provide input to the controller to actuate the under controller area network (CAN). It is particularly actuator. One active safety task, one passenger comfort intended low cost applications. Bit rates vary within the task and one driver assistance task .All tasks are range of 1 Kbit/s to 20 Kbit/s. described below. e. MOST (Media Oriented Systems Transport) 3.2 Windshield Wiper control

MOST is a high-speed multimedia network technology In the past, automakers have tried to either eliminate the optimized by the automotive industry. MOST can be wipers or to control their speed automatically. Some of used outside or inside the car. the techniques for detecting the vibrations caused by the raindrops touching the windshield, applying some f. J1708 and J1587 coatings that prevents drops to form, or ultrasonically vibrating the windshield to break the drops so no need of This is a standard used for serial communications wiping. But these systems have problems and either between ECUs on a heavy duty vehicle and also between never made it to production. A new type of wiper system a computer and the vehicle. The standard defines a 2- is starting to appear on cars that actually do a good job wire 18 gauge wire cable that can run up to 130 feet (40 of detecting the amount of water on the windshield and m) and operates at 9600 bit/s. controlling the wipes [7].

Among these communication protocols, Controller Area a. Designing task using fuzzy logic Network was selected, it is a serial network established among microcontrollers. It uses only two wires.CAN is As the complexity of the system increases, it become half duplex, high speed communication system and is more difficult and impossible to make a precise well suited for high speed applications which supports statement about its behaviour, thus arriving at a point of short messages. CAN can theoretically link up to 2032 complexity. Fuzzy logic is the way to solve problems devices (assuming one node with one identifier) on a and analyse through a system which resembles human single network. Error confinement and error detection decisions, which can use appropriate data to find precise feature make it more reliable in noise critical information. The various steps used to create a fuzzy environment [3]. controlled machine are as follows [6].

III. SYSTEM DESIGN b. Fuzzification

3.1 Block diagram The first step in designing a fuzzy controller is to decide which state variables represent the system dynamic performance must be taken as the input signal to the controller. Fuzzy logic uses linguistic variables or fuzzy variables instead of numerical variables. The process of converting a crisp variable (real number) in to a fuzzy variable is called fuzziication.

c. Rule Evaluation

The rule base comprises knowledge of the application domain and the attendant control goals. It consists of a data “base” and a linguistic (fuzzy) control rule base. The fuzzy data base provides definitions that are used to define linguistic control rules or fuzzy rules and fuzzy data manipulation in an FLC[6]. The rule base characteristics the control goals and control policy o the Figure 1: Block diagram of system domain experts by means of a set of linguistic control rules with syntax. Block diagram consist of two ECU units, sensors, actuators and controller area network. 2 tasks are allotted d. Decision Making to ECU1, seat belt tighter and windshield wiper control. Adaptive cruise control is allotted to ECU2. For the Decision making logic infers a system of rules through three automotive tasks, sensors serve as input and the fuzzy operators namely 'AND' and 'OR' and ______ISSN (Print): 2278-5140, Volume -3, Issue -1, 2014 20 International Journal of Advanced Computer Engineering and Communication Technology (IJACECT) ______generates a single truth value which determines the The system allows to adapt the distance to the car in outcome of rules. It has the capability of simulating front without the driver’s intervention, and traffic flows human decision making based on fuzzy concepts and of better altogether because acceleration and breaking interring fuzzy control actions employing fuzzy maneuvers are automatically adjusted. implication and the rules of inference in fuzzy logic. e. Defuzzification

The reverse of fuzzification is known as defuzzification. The use of Fuzzy Logic Controller (FLC) produces required output in a linguistic variable (fuzzy number). The linguistic variables have to be transformed to crisp output. Centre of gravity method is the best defuzzification method and used for research purpose also. Defuzzification is the process of producing a quantifiable result in fuzzy logic.

Figure 2: Block diagram of adaptive cruise control

In Adaptive cruise mode variable being controlled is distance. Vehicle has to maintain a threshold distance between the neighboring vehicles. An Ultrasonic sensor is used to sense the distance from the adjacent vehicle. If the distance is greater than the threshold the throttle actuator is automatically adjusted to increase the speed, so that threshold distance can be achieved. Control loop using PI controller is given below.

Table 1: Rule set for wiper control using fuzzy logic 3.3 Seat belt tighter

This task is written without fuzzy logic since there will not be any fuzzy condition present. When both the sensor value is detected, microcontroller gives command to operate motor.

Figure 3: Block diagram of adaptive cruise control using PI controller

The input to the control loop is the distance. Control loop compares the actual distance and the threshold distance and generates an error signal which is fed in to PI-controller. PI controller controls the PWM input to motor so that motor speed can be controlled to achieve a constant threshold distance. Table 2 : Conditions for seat-belt tighter a. PI- controller 3.4 Adaptive cruise control using PI controller PI controller is representative of good design for such a Comfortable distance to the car ahead increases driving control system since it can reduce speed errors due to safety and ensures a better and relaxed driving disturbances (such as hills) to zero. In this strategy an experience. Adaptive cruise control using PI controller error e is formed by subtracting (electronically) the ensures that there is enough distance to the car ahead, actual speed Va from the desired speed Vd: even if it reduces it speed. With Adaptive Cruise Control, the conventional systems for speed control have e = Vd – Va been enhanced to a driver assistant with an added value. ______ISSN (Print): 2278-5140, Volume -3, Issue -1, 2014 21 International Journal of Advanced Computer Engineering and Communication Technology (IJACECT) ______

The controller then electronically generates the actuator signal by combining a term proportional to the error (KPe) and a term proportional to the integral of the error The actuator signal u is a combination of these two terms:

u = KPe + KI∫e dt

IV. SIMULATION RESULTS

Most of the automotive tasks are critical real-time applications which need careful processing. The tasks Figure 7: Surface view of windshield wiper taken for consideration are: Windshield wiper control, seatbelt tighter and adaptive cruise control. These tasks Development IDE – Keil IDE and Fuzzy tool box in have to be scheduled in real-time so that no task will MATLAB miss deadline. This is done by RMS algorithm. Controller Area Network protocol is used for Software Details – Embedded C communicating between the two controllers so that efficient scheduling can be done with knowledge of task Hardware Details – ARM 7 Based LPC 2129 execution in each controller. Keil IDE was used for Development Board, Passive Infrared Sensor, writing application tasks with CAN. Piezoelectric sensor, Phototransistor.

Figure 4: RMS Scheduling

Figure 8: Adaptive cruise control using Keil IDE

Figure 6: fuzzy controller for windshield wiper

Figure 9: CAN communication

______ISSN (Print): 2278-5140, Volume -3, Issue -1, 2014 22 International Journal of Advanced Computer Engineering and Communication Technology (IJACECT) ______

V. CONCLUSION Peric, “Modelling Controller Area Network Communication”, The 5th IEEE International Implementation of three automotive tasks (wiper control, Conference on Industrial Informatics, Vol. seat-belt tightener, power window control) upon two 1,pp.485-490, 23-27 June 2007. ARM7 based ECUs performed. Communication was enabled between the ECUs through CAN based protocol. [4] CAN specification version 2.0. Robert Bosch In the project work, a detailed study and implementation GmbH, Stuttgart, Germany, 1991. of intra-vehicular communication was performed which can be extended for inter vehicular and road-side [5] Amos Albert, Robert Bosch, “Comparison of communication. This will help in collecting more event-triggered and time- triggered concepts with information about the objects in the vicinity of the regard to distributed control systems”, vehicle. Proceedings of Embedded World Conference, pp235-252,17.–19.02, 2004. REFERENCES [6] “Representation of 3-D Mappings for Automotive [1] Goswami, D. ; Schneider, R. ; Masrur, Control Applications using Neural Networks and A. ; Lukasiewycz, M. ;Chakraborty, S. ; Voit, Fuzzy Logic”, H. Holzmann, Ch. Halfmann, R H. ; Annaswamy, A.” Isermann, IEEE Conference on Control Challenges in automotive cyber-physical systems Applications – Proceedings, pp.229-234, 1997. design” Proceedings 2012 International Conference on Embedded Computer Systems: [7] Sonali B. Madankar, “Intelligent Rain sensing Architectures, Modelling and Simulation. Smart Windshield wiper system”, International Journal of Advanced Research in Computer [2] J.A. Cook et al., “Control, Computing and Science and Electronics Engineering(2277 – Communications: Technologies for the Twenty- 9043),Volume 1, Issue 3, May 2012. First Century Model T,” Proc. IEEE, special issue on automotive power electronics and motor [8] Jean J Labrosse, “MicroC/OS II: The real-time drives, vol. 95, no. 2, 2007, pp. 334-355. kernel” CMP Books, Second edition, 2002.

[3] CAN specification version 2.0. Robert Bosch [9] Raj Kamal, “Embedded Systems – Architecture, GmbH, Stuttgart. M. Bago, S. Marijan, and N. Programming and Design”, Tata McGraw Hill, Second Edition, 2008.



______ISSN (Print): 2278-5140, Volume -3, Issue -1, 2014 23