Showing posts with label Control Systems. Show all posts
Showing posts with label Control Systems. Show all posts

Sunday, May 5, 2013

The Motor Controller


Before we looked why electric vehicles are important, the architecture of an electric vehicle and started looking at the components of the electric powertrain. Last time we saw the battery management controller and its functions. Today we will glance over the motor controller.

Similar to the BMS (Battery management system) which manages the interaction of the battery with various other components of the powertrain, the motor controller manages the interaction of the motor with the battery and rest of the vehicle. In most of the electric vehicles the motor used is 3ph AC induction motor. You should be studying this in your ES2 (Electric sciences 2) course in second year. AC motor is used because it has many advantages, the most important being high efficiency and low maintenance. Now this being a “3ph-AC” motor, it requires 3ph AC current whereas the battery outputs DC current. Hence there is a need of an “Inverter” in between the battery and the motor which converts DC current into AC current and the role of the motor controller is to control the functionality of this inverter.

The control action
The most important function of the motor controller is the 3ph AC current generation. Without going into detail mathematics, I would say that this is achieved by transforming the  current vector by a series of transformations, controlling their magnitudes by tuned controller gains and feeding them to the IGBTs of the inverter to convert them in 3ph-AC. 

So to be more specific the motor controller does the following things
  1. It measures the fed back current and the speed (RPM) of the motor via appropriate sensors. 
  2. It takes in these values and applies a few transformations transform these quantities into quantities that are easy to control. The controller uses Clarke and Park transformations.
  3. The PI (proportional-Integral) controller compares these values with the ideal values which are generated from the pedal position. (More the pedal is pressed, more velocity/ power is requested and hence more magnitude of AC current is needed). 
  4. This controller outputs corresponding voltages that would be required to generate appropriate PWMs for the 3 phases. 
  5. These voltages are then passed in a SVPWM (Space vector PWM) algorithm coded inside this controller which gives out the 3 ph PWM signals, which are in turn fed to the IGBTs with the DC current from the battery to generate the correct 3ph AC currents. This current is then fed to the motor windings to generate torque.

Hence the motor controller is a closed loop controller which ensures the correct 3ph currents are generated to achieve the requested torque and power levels.

If you guys want to go deeper into the design of motor controller you should be aware of the following things
  1. Clarke/ Park transformations
  2. Feedback controller design (PI, LQR)
  3. Space Vector PWM techniques
  4. Inverter (IGBT) Electronics
  5. Field Weakening algorithms etc.

I will try to give you brief information on these to give you a head start for the intereseted. Tons of information is available on motor control techniques online. This is a very well developed area and it should not be difficult to find research papers on this. I think Texas A&M university in the US has a good research lab on motor controls.

Saturday, April 20, 2013

The Battery Management System Design


I will try to glance upon the different important controllers of the electric powertrain system. Let's start with the battery controller a.k.a battery management system.

The brain of a pure electric vehicle is its battery management system. I will briefly go over the responsibilities of this controller in this article so as to give you an idea of what all this battery management system (or BMS) constitutes of. This could prove as a background in case you dive into this field in future.

As described in my previous article the battery constitutes of cells in parallel and series. There could be thousands of cells in a car battery which together produce hundreds of volts and a significant amount of current. Critical parameters of each cell are its voltage, current and temperature. Any one of these if goes out of control, can lead to a thermal runaway which can lead to an explosion. The entire battery is kept in control by its battery management system. The BMS is responsible for variety of function some of which are mentioned below.

State of Charge Estimation:
The BMS is responsible for estimating the charge remaining in the battery and hence the range. Hence the more effective the BMS estimates the range (taking into account factors like terrain, temperature, weather etc) lesser will be the range anxiety of the customer! There are various techniques used to calculate the state of charge in a battery (like coulomb counting etc)

Temperature/ Voltage/ Current Sensors:
It is very critical to measure voltages, currents and temperatures of all these cells. How these three quantities are measured depends on each manufacturer of the battery pack. Usually there is one current sensor measuring the current that the battery consumes or delivers. There are multiple voltage and temperature sensors at various locations to measure these cell variables at throughout the battery. All these are inputs to the battery management system (BMS) and the control logic in the BMS makes sure that these stay in bounds.

Battery Cooling Circuit:
It is also critical to sufficiently cool the battery. In an electric vehicle, batteries are generally cooled by separate pumps or via the radiator. The inlet and outlet temperatures are measured by two thermistors and are fed to the BMS which in turn controls the cooling fluid.

Contactors:
Contactors are nothing but switches that connect the battery to the motor/inverter or charger. Battery contains high voltage all the time. But when a car is not being driven, it’s not necessary to supply this voltage and hence current to the inverter. When a person puts the car into a state where he wants to drive it or charge it (where either the battery outputs or consumes current), these switches close and the loop (battery-charger or battery-motor) is complete. BMS decides when to close the contactors and let the battery drive or charge the car

Safety Monitoring:
BMS is also responsible for keeping the battery in safe condition. In any unsafe condition the BMS will not close the contactors and hence the high voltage will remain contained in the battery itself. Unsafe conditions can include any of the following
  1. Over heating of the battery, over/under voltage and over current conditions: BMS open the contactors and isolates the battery from the car if any of the voltage/current/temperature sensors report the above mentioned conditions. 
  2. Over charging: BMS stops charging if it detects an over charged cell. Overcharging can significantly reduce the battery health and lifespan. 
  3. Unequal charging of the cells: BMS throws appropriate alerts if different cells are charging at different rates. It is also responsible for discharging/ bleeding the over charged cells (if any) and maintain the charge of all the cells to same level. 
  4. Over discharging of cells: Over discharging cells also create problems for battery health. BMS prevents that. 
  5. Grounding/ Isolation problems: BMS always keeps checking if the battery is properly isolated from the vehicle of not. In case of a short/ thermal runaway BMS makes sure that the damage is contained in the battery and does not propagate into the car. In case of a crash (head on collision) the BMS has provisions to cut the current supply from the inverter and isolate the battery.
For each bullet mentioned above, BMS has its own state machine and probably one person dedicated for its design in the industry! 


So what’s there for you guys here: Mechanical engineers play a crucial role in conceptualizing and modeling the BMS. EE, E/I engineers are generally responsible for designing a PCB that functions as a BMS controller while software engineers write the firmware that does the control. Hence it’s a super interdisciplinary board in an electric car.

I will finish with an interesting video clip explaining the BMS in short. Hope you like it :)

  

Friday, April 12, 2013

The Electric Vehicle Architecture


Hey Guys,
Last time we looked at the fall and rise of electric vehicles. I realized that there is a decent interest amongst the student community to learn more about electric vehicles. I am also very glad that there are groups in BITS-Pilani Goa campus working on electric car prototypes and I am sure other campuses would also be making such contribution. I strongly believe that such experience in college will definitely benefit students who are interested in pursuing career/ higher studies in this domain or even in fields like power electronics/ motor controls and firmware for automotive powertrain systems.

For the people out there who are not really up to speed but are super interested and would like to get into this, today I would like to give a brief architectural overview of electric vehicles. The major difference between gasoline and electric vehicles is that there is no internal combustion engine in electric vehicles. This is replaced by an electric motor (AC or DC) and this motor is charged by a battery on the car. So, as gasoline engine cars require petrol or diesel as a fuel, these cars need charge or current. People who know the complexity of an engine would instantly realize the simplicity of electric car.

As you can see in the figure below the electric car consists of 4 major components.


A Battery: A battery is the heart of the car. This is the energy storage device (analogous to fuel tank in normal car). This stores DC voltage when it’s charged. The voltage levels are generally in 100s of volts (~400V). This battery has certain number of cells in series and parallel. The number of cells in series and parallel is decided on how much voltage (~range) and how much current (~power) you want in your car respectively.

A Charger: (not shown in the figure) It is used to charge the battery up to the desired voltage. This takes in AC voltage from the wall, rectifies it and then charges the battery. The charger is rated at certain KW which determines how much current it can consume which in turn dictates how much time you will need to charge the battery. You will study the concepts used in charging in ES1.

A Motor: Usually a 3ph AC induction motor is used in electric cars (due to efficiency/ reliability reasons).It takes in 3ph AC current and produces torque due to magnetic induction across the stator and rotor. The shaft of the motor is connected to the halfshaft of the car through a reduction gear box. You guys generally study these in ES2.

An Inverter: Inverter is a power electronics device that is needed in between a battery and the motor to convert the DC current that the battery produces to AC current that the motor consumes. It has IGBTs as switches which switch at high frequencies like 10KHz while converting DC to AC.

Having said this there are a couple peculiarities of electric vehicles:

Regenerative Braking: When you apply brakes you are essentially applying negative torque to the motor to speed it down. That means the motor consumes negative current which you can visualize as a current going from motor to battery through the inverter. This results in charging the battery. This phenomenon makes electric vehicles very attractive in the sense that you can recharge the battery using the energy spent in braking.

Max torque at zero speed: If you see the motor torque speed characteristic as shown below you will realize that we can extract maximum torque from the motor even at zero speeds. This means that we will not need a gear box to shift to the right gear to attain right amount of torque from the motor at various speeds (as we require in an engine). Hence you can achieve high amounts of accelerations/ power from the vehicle from dead stop positions.



Below is a very interesting link of a drag race between BMW M5 (known for its acceleration) and Tesla ModelS (electric sedan company that I work for :)). See how Tesla gets a head start due to full torque at zero speed!!


Thursday, March 14, 2013

Friendship With State Space

Last post we saw how to represent any system in a block diagram and barely touched upon mathematical representation of it called state space. Today I will try to make you believe how simple it is to convert any system into state space representation and give a few “Engineering Secrets” to you.

Best way is to go through an example and then generalize it. Let’s recall Newton (He has tortured us many times before! :-/). So (simplified) Newton’s second law is can be represented by 

Where “m” is the mass of the body, “a” is its acceleration and “F” is the force applied on it. We all have used this equation a million times before. We use this equation to answer the question “What force “F” is required to maintain/attain acceleration “a” of a mass “m”??) Now let’s try to convert this to the form I mentioned in the last post, which is

To do this we need values for “A”, “B” and “C”. Looking at this we can easily answer the question that we need an input “u” to maintain/ attain a state ([X]) ̇ where X is a vector of all the states of the system. So relating this to the answer mentioned above: We have Force (F) as an Input (u) and acceleration as an output (y)!! We can also represent the above equation as 


Engineering Secret 1!: “Generally the number of states in a state space representation is equal to the highest derivative in the differential equation of the system”

Hence in above equation (d^2 x)/(dt^2 ) suggests the highest derivative is second order. Hence the number of states (length of X vector) is 2!!

Engineering Secret 2!: List all the states X1…Xn. To guess the states, let the first state X1 be the original variable itself, in this case “x”. Let the second state, X2, be the derivative of first state, the third be the derivative of second state and so on!
So now we get 

Now computing LHS of the state space equation which is given by the matrix below is super easy!


We have all the ingredients! 
So,

Engineering Secret 3! How do you know the dimensions of A and B???
Well.. we know LHS is 2*1 and is 2*1 hence if A is m*n then 2*1 = (m*n)X(2*1). So n should be equal to 2 (for a valid matrix multiplication) and m should be 2 for valid dimensionality.  Thus A is 2*2. Similarly if LHS is 2*1 and u is 1*1 then 2*1 = (m*p)X(1*1). Hence p = 1 and m =2. So B is 2*1 matrix.

Dimensions of C depend on dimensions of “y”. That means if you  are going to measure both the states the Y is 2X1 and hence C will be 2X2. If you are measuring only X1 (displacement) then C will be 1X2.


Engineering Secret 4!: To rearrange this into state space format  write the skeleton first (according to the dimensions you derived from the above trick!) and then fill in the values for A and B using matrix multiplication rules

And then filling in the values we get


Hence to Summarize:
  1. Determine highest order in the system equation (given to you by physics!). Your number of  states is equal to the highest order of derivative. 
  2. Let first state be the variable itself, second be its derivative, third be second’s derivative and so on.. Calculate values for all states. 
  3. Calculate LHS by taking first derivative of each state. And write all equations. 
  4. Derive the dimensions of A, B  and C matrices
  5. Write the SS skeleton and then fill in the numbers according to the equation coefficients you got from step3!



 So.. how does that feel? I will try to go over a more real life example in next post so that you may get more familiar to this. 



Saturday, March 9, 2013

The Basics of Controls and State Space Behavior



Hey Guys.. I will try to share some tools that I learnt during the course of my Masters and in the industry. In my last post I mentioned a few things related to controls that you will learn during your 3rd or 4th year. Today I will discuss a few things that are important and always needed in industry. These may or may not be covered in the class and hence I felt I could share these.

In this field you will be given a task of modeling a particular system and then designing a controller for it which will help you attain desired behavior. If you consider a black box model your entire work could be represented by the block diagram shown below. Let’s discuss the parts of this which will result as a perfect segway into state space (the most important tool to design systems).

Block Diagram

  1. The block “A” is called the plant. This is defined by the laws of physics and is the guy that we  have to control. E.g. This could be a car going uphill at constant speed, a tap filling water in a tank, a line follower robot, a hydro electric power plant etc. All you need to remember is.. the behavior of this plant is defined by physical laws and is constant. You don’t have any control over its definition.
  2. The block “B” is your controller. You design this so that you can control “A” as you want. E.g You will have a flexibility to design a controller “B” that will maintain the speed of your car going uphill at 50Km/Hr or maintain the robot on the black line all the time. 
  3. The block “C” is your output that you can measure or observe and then use it in your controller. E.g It can be the speed of the car or velocity of the line follower. 
  4. The signal “u” is the control. This is the signal that is generated from your controller which is fed to the plant to control it as you want. 
  5. And finally, this controller will be responsible to control a particular “state” of your system. Your system can have many states. One of these many states is your “output” that you observe/ measure with the help of block “C”.

So, the ingredients of the any damn system are: the Plant (A), the Controller (B),the control input (u), the state (x) and the output that you measure (y). And mathematically, any damn system can be represented as


Believe me, with this representation, it becomes super easy to analyze the system compared to writing huge differential equations by drawing free  body diagrams as we all learn in Math 3 and Physics! This representation is called state space and next time we will  see how we generate this state space from any given damn system.

State Space should be your friend and  you should be comfortable in playing with it!

Sunday, March 3, 2013

A Blend of Theory and Practice: A Control Systems Example


My last article states the importance of having a blend of theory and practical exposure in your engineering education. I would like to give you an example of how actually you can go about developing it.

We all have control systems as one of the compulsory courses that we need to pass before we get an engineering degree.  It’s a very important course.  Be it any system in any field, you will, at some point, have to control it to achieve certain objectives. The course that we study during our undergrad spans the following aspects of control systems
  1. What is a system and representing a system in a block diagram.
  2. Mathematical representations of any system by transfer functions and state space (If your professor does not teach state space, go ahead and learn it by yourself. It’s super important in industry). You lean about deriving transfer functions on paper. 
  3. Time and frequency response of that system. Comparison of such responses with higher order systems (You learn big mathematical formulae and derivations to represent different parameters like settling time, overshoot, gain frequency, phase margin etc etc). 
  4. Root Locus, Bode plots, Nyquist plots. You learn all the rules and learn how to sketch these on a graph paper by following the rules.
  5. PID Controller design: You learn about the structure of PID controller and if there is sufficient time in the semester you will learn how to implement it on paper.

So, after giving your final exam, you are proficient in drawing block diagrams, root loci, bode plots on paper, deriving settling time, overshoot numbers given a particular system, changing a system from transfer function form to state space form etc.

This is important to understand the math behind controls. Is it sufficient for the industry?  What else should you do??

  1. Software Implementation: You can do each and every thing mentioned above in MATLAB. When you learn a certain concept, say root locus, in the class, try to plot the same locus using MATLAB. Try to plot a step response and see if it matches to what you sketched in the class. Analyze the system properties (settling time, overshoot etc) by interactively moving the poles and zeros and see the effect. You will have derived relations between the system properties and pole positions in the class. Try to replicate them in MATLAB. 
  2. Take a transfer function change it into state space and vice versa using MATLAB. Design a PID controller and see how the system properties are affected when you change the proportional, integral and derivative gains. 
  3. Get comfortable in plotting and analyzing root loci and bode plots using SISOTOOL in MATLAB.

This skill set with develop an understanding of quickly analyzing the system and coming up with a set of controllers that will satisfy your requirements on settling time, overshoot, steady state errors etc.

Hardware Implementation: If more interested you can also use micro controllers to actually see your controller in action on say a DC motor. Implement DC motor speed control. It’s a classic example to try out and is explained in every single control’s book.

Why I am telling this?
In industry no one will ask you to derive expressions, or ask you a proof of how you did what you did. They will want to see results, see your controllers in action. And 99% of the time it’s about designing a PID controller and tweaking the three gains to achieve the system performance.
All you will do ità Model the system in MATLAB, design a PID controller, tweak the gains and check for a) stability, b) system properties (settling time, overshot etc) and c) tracking (steady state error) and d) robustness. So be sure before you call it a day for control systems, you are comfortable in the above mentioned aspects of the system and controller.

To sum up: Be sure to go one step ahead than a textbook oriented course and get familiar with MATLAB tools (tf(), ss(), pid(), rlocus(), sisotool(), bode() etc commands) to be able to use MATLAB to do what you would otherwise spend time on doing by hand. This one subject will then open arenas like controls, mechatronics, robotics, instrumentation, modeling & development and much more which you can focus if you go for higher studies.

Good Books you can refer for the basics:
Feedback Control Systems by Franklin Powell


Hope these links help you.

(If you are interested in controls/ mechatronics I have designed few projects that I can share with you. Let me know via email at bits2world@gmail.com and I will email them to you)