July 24, 2008

PID Controller and Built in Filter Design


We have designed a PID control loop simulator using Matlab and Simulink. Below is the PID control loop graphically designed using Simulink (Matlab and Simulink are excellent software design tools developed by The MathWorks Inc). The PID controller we have implemented is of type C. For more info about different types of PID controller please visit http://bestune.50megs.com/typeABC.htm.


The PID controller contains a built in digital filter. It receives 8 inputs:

x(1): Filtered PV, which will be further filtered in the built in digital filter.
x(2): Setpoint.
x(3): The proportional gain Kp.
x(4): The integral gain Ki.
x(5): The derivative gain Kd.
x(6): Time.
x(7): If it is 1, then use PID control action, otherwise use manual CO value.
x(8): Manual CO value.

The PID controller plus a built in digital filter is designed as a Matlab function "pid1.m", as shown below.

function u=pid(x)

global Tpid Tf t0 t1 tf k

global sp ek uk uk_1 yk yk_1 vk vk_1


t=x(6); % Read time

if t==0

k=0;

Tpid=1; % PID loop update time

t0=0;

t1=0;

uk=x(8); % Initial CO value

yk=x(1); % Initial PV value

sp=x(2); % Initial setpoint

ek=sp-yk;

Tf=0.1; % Filter time constant

tf=200; % Simulation stop time

else % Filtering yk

T0=t-t0;

yk=yk*Tf/(Tf+T0)+x(1)*T0/(Tf+T0);

t0=t;

end

if t-t1>=Tpid | x(2)~=sp %Every Tpid sec calculate the new CO value

sp=x(2);

T=t-t1;

if T>0.0001 %Avoid division by T=0

if x(7)==1 & k>=3 % Then use PID control

Kp=x(3);

Ki=x(4);

Kd=x(5);

ek=sp-yk;

vk=(yk-yk_1)/T;

ak=(vk-vk_1)/T;

Du=(Ki*ek-Kp*vk-Kd*ak)*T;

uk=uk_1+Du;

else

if k>=1 vk=(yk-yk_1)/T; end

if k>=2 ak=(vk-vk_1)/T; end

uk=x(8); % Use manual uk value x(8)

k=k+1;

end

end

if uk>5 uk=5;end % uk must be <= upper limit

if uk<-5 uk=-5;end % uk must be >= lower limit



% Show the control results and update t1, yk_1, vk_1, uk_1

fprintf('time=%5.2f setpoint=%5.2f pv=%5.2f co=%5.2f\n',t,x(2),yk,uk)

t1=t;yk_1=yk;vk_1=vk;uk_1=uk;

end

% End of the PID controller

u=uk;


The filter part is scaned at a very high frequency (i.e., every T0 seconds the filter will be executed once and T0 is very small). The PID controller is executed every Tpid=1 seconds.

Please note that the filter design and PID controller design are separated. When you tune this PID controller, the filter should be considered as a part of the process. So strictly speaking each time when you make changes to the filter, you should re-tune your PID parameters.

July 05, 2008

Fault Tree Analysis in 6 Steps

Often misunderstood, FTA requires nothing more complex than paper, pencil, and an understanding of the service at hand, writes ITSM Watch columnist Hank Marquis of itSM Solutions.

If you are IT Infrastructure Library (ITIL) certified you have no doubt heard of fault tree analysis, or FTA, as a means to improve availability. FTA requires no special software and can help you discover the root causes of a failure or detect where potential failures may occur.
It sounds complicated, but it’s actually fairly easy to use. Reactively, FTA starts with a top-level event, like a service outage, which you evaluate to determine the root cause. Proactively, FTA begins with an event you do not want to occur, like a server failure, and then helps you understand how to prevent the event from occurring.

In either case, you use the fault tree diagram to identify countermeasures to eliminate the causes of the failure. FTA does this through structured analysis of contributing faults and their cause that lead (or has led) to its occurrence.

FTA requires nothing more complex than paper, pencil, and an understanding of the service at hand. You will need accurate CI (configuration items) contextual information in order to get the most value from FTA. The following 6 simple steps can help you resolve tough design issues or problems quickly and easily.

1. Select a top level event for analysis. Try to be specific, for example, “Email server down for more than 4 hours.” Sources of top level events include: Problem/Known Error Records; service outage analysis; potential failures from brainstorming; and “what-if” scenarios based on service level agreements, etc.

2. Identify faults that could lead to the top level event. Continuing the above example, some possible faults leading to an outage lasting more than four hours might be “loss of power”, another might be “hardware failure.” List all the faults under the top level event in boxes and connect the fault boxes to the top level event box by drawing lines.

3. For each fault, list as many causes as possible in boxes below the related fault. Continuing the example above, in the case of “loss of power," some causes might be “electrical outage,” “power supply failure,” and so on. Connect the boxes to the appropriate fault box.

4. Draw a diagram of the “fault tree." Two logic operators – and and or, also known as logic gates – are used to represent the sequencing of faults and causes.

For example, “Email server down for more than 4 hours” could be caused by “loss of power” or “hardware fault." Another might be “loss of building power” and “battery backup exhausted.”

Update faults and causes by grouping logically related items using and or or between faults and events; and faults and causes. Re-draw the lines from top level event to logic gates to faults to logic gates to causes.

5. Continue identifying causes for each fault until you reach a root cause (reactive FTA), or one that you can do something about (proactive FTA). For example, the root cause of “power supply failure” might be “filter clogged;" the root cause of “battery backup exhausted” might be “battery backup too small."

6. Consider countermeasures. A root cause is one you can do something about; so now you need to think of the countermeasures you might apply to each root cause. List countermeasures for each root cause in a box under the root cause. For example, for “filter clogged” a countermeasure might be “clean filter monthly.” Link the countermeasure to the root cause by drawing a line.

FTA is useful alone on paper and as a group exercise on a media board. When your diagram is complete, you have a fault tree. Fault trees show how an event can occur and what you can about it from a design or change perspective. For Problems, you also have a possible root cause and a solution.

FTA is actually pretty simple, but don’t let its simplicity fool you. If you want to get fancy, you can play with probability statistics to try and get even more precise – determining the “chance” that a fault or cause could occur. Applying probabilities derived from CI metrics like mean time to repair and mean time between can produce some very precise calculations.

Even if you don’t get fancy with FTA you will have taken a powerful step toward preventing problems in the first place, or resolving tough problems. Often just the act of creating a fault tree as a group generates excellent ideas and possible solutions where before there were none.

FTA can be used by technical observation post (TOP) teams, problem managers, availability manager, and even IT service continuity management teams with a minimum of training. The graphical nature of FTA makes it easy to understand and easy to maintain in the face of changes.

July 04, 2008

Analytic Hierarchy Process


The Analytic Hierarchy Process (AHP) is a decision making technique developed by Thomas Saaty. He claimed AHP allows for the rational evaluation of pros and cons concerning different alternative solutions to a multi-goal problem.

AHP is based on a series pairwise comparions and then those comparisons are checked for internal consistency. The procedure can be summarized as:

1. Decision makers are asked their preferences of attributes of alternatives. For example, if the alternatives are comparing potential real-estate purchases, the investors might say they prefer location over price and price over timing.
2. Then they would be asked if the location of alternative "A" is preferred to that of "B", which has the preferred timing, and so on.
3. This creates a matrix which is evaluated by using eigenvalues to check the consistency of the responses. This produces a "consistency coefficient" where a value of "1" means all preferences are internally consistent. This value would be lower, however, if decision makers said X is preferred to Y, Y to Z but Z is preferred to X (such a position is internally inconsistent).

It is this last step that that causes many users to believe that AHP is theoretically well founded.

Criticisms

AHP has had many challenges to its theoretical and practical shortcomings from those who have a more thurough grounding in all the decision sciences. Some have maintained that AHP assigns arbitrary or ordinal measures to the pairwise comparisons. Proponents maintain that while this is true of the 'verbal' mode of AHP, it has been demonstrated that in situations where there is adequate variety and redundancy, accurate ratio scale priorities can be derived from such judgments.

Proponents claim that it could be used by Aircraft engineers to evaluate alternative wing designs and actuaries can use it to evaluate risks. However, in those fields specific models already exist that make AHP unnecessary and innacurate. AHP, for example, cannot compute the value of a premium in the way that an actuary does. Such methods have to use specific mathematical theorems unique to that field.

AHP, like many systems based on pairwise comparisons, can produce "rank reversal" outcomes. That is a situation where the order of preference is, for example, A, B, C then D. But if C is eliminated for other reasons, the order of A and B could be reversed so that the resulting priority is then B, A, then D. It has been proven that any pairwise comparison system will still have rank-reversal solutions even when the pair preferences are consistent Proponents argue that rank reversal may still be desirable but this is also controversial. Given the example, this would be the position that if C were elliminated, the preference of A over B should be switched.

Another strong theoretical problem of AHP was found by Perez, et. al. This has to do with what they identify as an "indiferent criterion" flaw. Indiferent criterion requires that once A, B, C and D are ranked according to criteria, say, W, X, Y, adding another criterion for which A, B, C, and D are equal, should have no bearing on the ranks. Yet, Perez et al prove that such an outcome is possible. Note that this flaw, too, is a shortcoming of any pairwise comparison process, not just AHP. But AHP's consistency-checking methods offer no guarantee such flaws cannot occur, since there are solution sets with these flaws even when preferences are consistent.

Many alternatives to AHP are economically viable, especially for larger, riskier decision. Methods from decision theory and various economic modeling methods can be applied. A scoring method that has a superior track record of improving decisions was developed by Egon Brunswik in the 1950's. Other methods such as Applied Information Economics quantify risk, cost and value in economically meaningful terms even where AHP considers them to be "immeasurable".

We can use Criterium Decision Plus for calculation in this AHP method

PID Controller Design



PID Controller Design and PID Auto-Tuning Tool Evaluation

PID Controller and Built in Filter Design
We will design a PID control loop simulator using Matlab and Simulink. Below is the PID control loop graphically designed using Simulink (Matlab and Simulink are excellent software design tools developed by The MathWorks Inc). The PID controller we will implement is of type C. Click here For more info about different types of PID controller.

June 03, 2008

PID simulation on Matlab

Matlab simulation can be used for modeling control system simulation through Simulink. Industrial plant needs control simulation to obtain PID parameter before it is applied to real plant control system. You can download source code for Simulink Matlab simulation on link below. This simulation is simulating 3 element control on High Pressure Steam Drum on one of Combined Cycle Indonesia's Power Plant.