Pages

Tuesday, November 29, 2011

Cliche vs Creativity

Let's play a game. Help yourself to a piece of pen and paper, write down as many functions of a paper clip that you can figure out. It can be anything, let the imagination runs wild.


How many functions of paper clip that one can found out? Did you know average adult can find up to 30 functions while a child can have up to 100 function. Why is this so?

Also check out this interesting poll regarding artistic freedom in relation to age [link]. Majority chosen youth and teenagers than adult and elderly. It is clear that people are more creative when they were young.

Cliche

As people grow, they get more bounded by rules and regulations. As a result, human are bound to a cliche or pattern. For example in schools, higher institutes or working organizations.

Let's take the example of the paper clip. A small children might not know the function of a paper clip if one shows them the first time. As their imagination is wild, they can use that for almost anything. While for an adult, a paper clip is used just for clipping papers.

As adults grow, their thinking are getting more and more inside the box.

Creativity vs Innovation

Creativity and innovation sounds different from each other but they are quite connected in some way or another. Being creative is to do things differently, to think outside of the box, to think outside of a cliche. Being innovative means to implement an idea to generate new idea.

Tan Sri Lim Kok Wing mentioned that people and stressing on innovation but no one stresses on creativity [link]. This is quite true based on his article in the link. Why is that so? One thing, innovation drives the market. Consumer says it all. If there is no market, means any organization will not generate revenue.

Put for example, person A in Alpha Company, uses an idea to create a product to sell. That is called innovation. Putting it another way, that person can copy an idea from Beta Company and use it for their own. It is still called innovation.



But who are the ones to create those idea? This is where creativity comes into place. It takes less resources to generate an idea than to get a well established idea and use it. So to speak, innovation is more important to generate money than creativity.

Science , Technology and Engineering

As can be seen, creativity and innovation are closely related to science, technology and engineering. It takes a lot of creativity to explore in science. A good example is Einstein. 


According to Professor Brian Cox, science, especially curiosity led science is underfunded [link]. It is underfund because there is no direct profit from funding science. One might satisfy a curiosity of another by explore in science but it does not generate market for the consumers. This is why stress is given on an innovation led economy, not a creativity led economy.

But imagine, if there is not science, there will be not technology. Without technology, engineers could not come up with consumer products.

Tools for Creativity

Nevertheless, creativity is important in one way or another. But how creativity can be encouraged with all those rules and cliche? Edward de Bono, a renowned thinker comes up with a lot of tools to generate creative ideas, for example the Lateral Thinking [link]. In his book, he mentioned about creativity and how it was blocked by cliche in human mind.

Concluding Remark

Innovation seems to be more important than creativity because they generates more profit than creativity. But without creativity, innovations cannot comes into hand. One of the factor that stops people from being creative is the rules and cliche they are bounded to.

Saturday, November 26, 2011

Understanding the DC Motor Part IV

The final part of understanding motor control is regarding control the position of the permanent magnet direct current motor. But this is applicable to the speed or torque. This control method is called the cascade control and it is inspired by the Faulhaber motion control module.

Again, the motor model is from Roger Asenstrup. All the parameters are from the model.

Motor Position Control with Single Loop PID

A simple position feedback using the angle feedback from the motor. Kp = 1, Ki = 0, Kd = 0.


Figure 1. Position control with Kp = 1, Ki = 0, Kd = 0.



Figure 2. Result from Figure 1

As seen from Figure 2, the Proportional only control is good enough to control the motor position.

Dead Zone Problem

But this is when the nonlinearity kicks in. In Figure 3, a dead zone was added to approximate the Coulomb friction. The value of dead zone is -0.1 to 0.1 volts. 
Figure 3. P control (Kp = 1) with dead zone


Figure 4. Result from Figure 3

Figure 4 shows the result with the presence of dead zone. The motor position will not converge to desired value of position. One method to solve this is to use proportional and integral control (PI control).
Figure 5. PI control (Kp = 1, Ki = 3) with dead zone

After applying the PI control, the value will converge to the desired value slowly, shown in Figure 5.

Saturation Problem

Using PI control is not good for saturation problem. It will cause the error to integrate really quickly and causing a large overshoot.
Figure 6. PI control (Kp = 1, Ki = 3) with dead zone and saturation


Figure 7. Result of Figure 6.

As seen from Figure 7, the motor will overshoot due to integration of the saturation.

Cascaded PID Control

To solve the problem, a cascade controller was proposed. The position error will be fed into a PID with velocity feedback.
Figure 8. Position P Control (Kp = 5) cascade with Velocity P Control (Kp = 3)


Figure 9. Result of Figure 8

From Figure 9, seems that the performance of the motor position control has improved although the reaching time is slower. Even with presence of dead zone, and saturation, the control still be able to perform well.


Motor Driver Current Problem

There is another problem to address, which is the motor current. The current is needed to drive the torque of the motor. If the simulation in Figure 8 was modified (Figure 10) to include motor current plot, it can be seen in Figure 11 that the motor current can spike at more than 5 Ampere.

Figure 10. Modified to include motor current plot


Figure 11. Same result as Figure 9, zoomed

Triple Cascade Control

Another loop of PID was used to control the motor current. In this strategy, only integral control (I control) was used. In other word, the overall system is Proportional (Position) - Proportional (Velocity) - Integral Control (Current).

Figure 12. Position P Control (Kp = 5) cascade with Velocity P Control (Kp = 3) cascade with Current Integral Control (Ki = 1)


Figure 13. Result from Figure 12

After adding the current controller, the performance is quite similar to the controller without it, in Figure 9.

But notice the peak current was reduced from more than 5 A to 0.57 A.


Concluding Remark

This concludes the "Understanding the DC Motor" section. Although this is only simulation, application in the real motor is still far away. It includes the feedback sensor (like position, velocity and current) and the motor driver. Making the position control as a whole is not as easy as it seems. But if one do not understand the nature of motor, it is quite hard to start with.

Check out the full series

Part I
Part II
Part III
Part II, III - Interlude
Part IV

Understanding the DC Motor Part II, III - Interlude

The motor nonlinearities will be discussed in this part. Before jumping in, let's dive in to the concept of Liner Time Invariant or the LTI.

Linear Time Invariant
LTI concept is very important to understand linear control theory. Two basic characteristics of LTI is linear and time invariant.

Equation 1 - Linearity
Let:
y=f(x), then ay=f(ax).
Intepretation:
A function taking x and returning y, if multiplied with a constant, a in x, will give a product of a and y.

Equation 2 - Time
Let:
y(t) = g(x,t), then y(t-b) = g(x,t-b)
Intepretation:
A function y in time, t, of g in x and time, if the time is delayed by b, the output will give the same.

DC Motor Nonlinearities
A direct current motor is subject to at least two types of nonlininearities, namely the saturation and dead zone. Another type of nonlinearity is the performance due to the decay of the motor mechanism and carbon brush. This is a type variant system but usually was not taken into account due to slow decay.

Dead Zone
Let's say V = 10 volts applied to the motor. After steady state, the motor will turn with an angular velocity of 100 rpm. If V applied is 1 volts, the motor will turn with 100/10 = 10 rpm. But given V = 0.1 volts, the motor will not turn due to the dead zone. Example of cause of dead zone is Coulomb friction. Coulomb friction is hard to model and it changes with many variables.

Saturation
Let's put it again V = 10 volts yield 100 rpm, giving 20 volts will yield 200 rpm, but giving 30 volts might only produce 240 rpm. This might not be the nonlinearity in the motor but in the motor driver. It depends on the voltage supplied to the motor.

Decay
Let's say again, V = 10 volts yields 100 rpm, but after one year, V = 10 volts might yield only 95 rpm.

Concluding Remark
Nonlinearity is a pain in control system. This is why simulation and real application is so different.


Check out the full series

Part I
Part II
Part III
Part II, III - Interlude
Part IV

Tuesday, November 22, 2011

Understanding the DC Motor Part III

In this part, simulations for the permanent magnet DC motor will be shown. Several cases will be given to show the nature of the DC motor and how they act. Although simulation can give a good representation of the motor, the simulation will not be exactly like the real motor because of modelling error and unmodeled dynamics.

Modelling error and Unmodeled Dynamics

Quick fact about modelling error and unmodeled dynamics. Modelling error is when the parameters in the simulation is not exactly like the real motor for example motor resistance. Maybe one could measure the resistance but the value is prone to error due to measurements error. Secondly, the unmodeled dynamics. Although the model can be derived from first principle, surely there are some "things" that cannot be expected from the motor. Maybe there are some imperfection in the motor that causes the motor cannot turn correctly. This is when the order of the motor increases.

Simulation Model

Moving on, the simulation was done in simulink using a model by Roger Asenstrup.
Model in Simulink
The motor parameters used in this simulation is the original value in the motor model (except for the damping friction).

Resistance: 2.06 Ohm
Inductance: 0.238 mH
Back EMF Constant: 1/((406*2*pi)/60)
Torque Constant: 0.0235 Nm/A
Rotoe Inertia: 1.07e-6
Mechanical Damping: 12e-5 Nms/rad

Of course this value is not exactly the same for all motors. Each motors has their own parameters. Also to explain, the motor current, motor speed and motor position were plotted.

Simulation Cases

Three cases will be shown:
1) The normal situation for a motor
2) If there is not friction
3) If the load is very big (heavy)

Case 1: Normal situation
Case 1 plot

Case 1 plot (zoomed)
In a normal situation, a motor will work like so: The applied voltage will cause a surge in motor current. It will increase with a decay due to the motor inductance. As soon as the motor current causes the motor to rotate, the back EMF will reduce the current to the motor. In the end, the motor will move in a constant speed (as long as the applied voltage is constant). Note that there is a constant value in the motor current (This will be explain in the second case).

Case 2: Zero Friction
Case 2 plot

Case 2 plot (zoomed)
In the second case, the damping value in the simulation was reduced to zero. The applied voltage will cause the surge in motor current. After the motor current causes the motor to rotate, the back EMF will reduce the motor current to zero. Due to zero friction, the motor need not have any torque to keep it moving (Newton's First Law of Motion). In other words, in a motor with friction, the current is actually used to counter the friction.

Case 3: Heavy Load / Stalled
Case 3 plot
The value of damping is 12e-5 but the value of inertia is 1.07. In the case of stalled motor, the applied voltage will cause the motor current to surge, then the value will not reduce due to no back EMF present (The motor cannot move because it is stalled). This is when care should be taken to the motor driver design. If the driver cannot withstand high continuous current, the drive will burn.

Concluding Remarks

Now, we have known the motor nature, more or less but note that all this simulation was done in open loop configuration. Let's say 1 V will cause the motor to move in certain velocity, changing the motor load will change the velocity. In the next part, let's move into motor control using proportional, integral and derivative controller.

p/s: Please click on the pictures to enlarge.


Check out the full series

Part I
Part II
Part III
Part II, III - Interlude
Part IV

Thursday, November 17, 2011

Understanding the DC Motor Part II

This part is about understanding the derivation of the motor model. (Actually this is obtained from Control System Engineering Book by Nise, so credit to that fellow). Someone new to control theory might wonder what the heck is a model. Let's put that a model is used to calculate an output given an input. Like a simple function like y=f(x). The input is x and output is y. But in control model, it is more to dynamic model or model which involves ordinary differential equation. Let's proceed.

Modeling Electrical Characteristics

Electrical Schematic
Starting off with the electrical characteristics. From the motor schematics, we can draw the Kirchoff Voltage Law (KVL) line.

Equation 1
According to KVL, the total voltage in the line is zero.

Equation 2
Therefore, we can come up with Equation 2.
Equation 3
Taking the form of La Place in Equation 3 with all initial values zeroed. 
Equation 4
The equation then can be arrange in term of current (Equation 4),
Equation 5
Or in the form of transfer function (Equation 5).

Modeling Mechanical Characteristics

After the electrical part, let's move on to the mechanical part:
Mechanical Schematic
The schematic above shows the free body diagram.
Equation 6
Start off with Newton's law, where torque equals moment of inertia, angular acceleration
Equation 7
In Equation 7, there are three acting torque, (1) the torque from the motor, (2) the viscous friction from where the higher the speed of rotation the higher the friction force is, and (3) the Coulomb friction where the friction counters the movement. For simplicity, the Coulomb friction can be assumed constant or zero. 
Equation 8
Rearranging in terms of motor speed, omega.
Equation 9
Applying La Place transform with zero initial values.
Equation 10
Rearranging in terms of omega,
Equation 11
Or in terms of transfer function.
Equation 12
Equation 12 is an auxiliary equation, just for completeness, where speed is the derivation of motor position, theta
Equation 13
Applying La Place transform with zero initial value,
Equation 14
And arranging it in transfer function form.
Equation 15
Equation 15 and 16 are additional equations where they are need to "connect" the electrical and mechanical parts. Equation 15 connects the motor current to the torque produced.
Equation 16
Equation 16 is the back electromotive force produces with a certain motor speed.

The Complete Model

Arranging Equation 5, 11, 14, 15 and 16, we obtain the motor model like in the figure below.


From this figure, it can be seen that a motor have six unknown parameters, (1) motor resistance, (2) motor inductance, (3) load moment of inertia, (4) load viscous friction, (5) torque constant, Kt, and (6) speed constant, Ke. This is when the external torque, T1 is assumed zero.

In the next part, the simulation and interpretation will be shown, using some values for all these parameters. It is also interesting to know that there are topics in parameter estimation or system identification to identify the parameter values. Most probably this will not be covered here because it is quite extensive.


Check out the full series

Part I
Part II
Part III
Part II, III - Interlude
Part IV

Wednesday, November 16, 2011

Understanding the DC Motor Part I

It took me quite some time to understand the permanent magnet direct current motor or people like to just call it DC motor. In order to properly control a DC motor, they should understand the motor nature first before applying the control algorithm. The dangerous part is, a motor can get over current easily, not only spoiling the driver but the motor itself will get burned.

The figure below shows a typical DC motor. Amateur hobbyist like to apply the motor voltage directly to the motor and expect the performance of the motor to be the same every time. This is not the case. Applied voltage, Va, is not directly related to the motor speed, omega. In fact, the motor is a third order system with Type 1.

In layman term, third order means, in between the applied voltage and the angle, there are motor current and motor speed. Type 1 means, if the applied voltage is removed, the angle of rotation of the motor will not go back to the original position. To understand the nature or characteristics of the motor, read on.  
Typical motor. Photo credit: Cytron.com.my
First, we should understand the built up of the motor, or the motor schematic. Not exactly how a motor was constructed but rather, what can be used to represent a motor. The figure below (motor schematic) is a good representation of a DC motor.

Motor is built up of winding coil, therefore it is represented with the motor inductance, La. With long motor coil, there is expected to have resistance, Ra. Most important part of the motor is the back electromotive force, EMF. The concept of EMF is quite hard go grasp at the beginning but it is quite simple. Back EMF is actually "virtual". In other word, it cannot be measured directly. But the motor terminal can give a good estimate of the back EMF.

Another part of the DC motor is the mechanical part. The motor is always used to move a load, depicted as J and the load sure to have viscous friction and Coulomb friction, depicted with B and T1 respectively. Coulomb friction is sometimes represented with a constant value for simplicity. Which means, the torque will always go against the movement, either it is moving or in static. While the viscous friction appears only when the motor is moving, in fact, the faster the motor is moving, the higher the torque of the viscous friction is (approximated with a linear relationship).

After understanding this motor schematic, we should move on to the motor model. Model is the most important part to understand the motor. Using a model, one could predict how a motor react to certain applied voltage, either it is linear or in pulse width modulation form. 
Motor Schematic

I am not going to go too deep in the motor model derivation. To derive the motor model, two first principle rules are needed namely the Kirchoff Voltage Law and Newton's Law. It is also useful to use La Place transformation.

The Kirchoff Voltage Law can be used to derive the electrical characteristics while the Newton's Law can be used to derive the mechanical characteristics. Besides that, one should understand the the motor current is proportional with the motor produced torque and the back EMF is proportional with the motor speed. Using all this information, the motor can be put in the form depicted in picture below.
Motor Model (click to enlarge)

Perhaps in Part II, I will explain more about this motor model and how to derive it. Later on, I will discuss on a motor control method to properly control a motor.


Check out the full series

Part I
Part II
Part III
Part II, III - Interlude
Part IV