Computer package development: Applications to engineering education

9 downloads 8568 Views 118KB Size Report
Computer Package. Development: Applications to Engineering Education. SALAH A. ALMAJDOUB, ISA S. QAMBER. Department of Electrical and Electronics ...
Computer Package Development: Applications to Engineering Education SALAH A. ALMAJDOUB, ISA S. QAMBER Department of Electrical and Electronics Engineering, University of Bahrain, P. O. Box 33831, Isa Town, Bahrain Received 22 October 1999; accepted 2 January 2001

ABSTRACT: A well developed program that uses ¯ow graph theory to calculate the steady

state probabilities is presented in this paper. Two examples are tested, and their results are successfully obtained. The ®rst model is a seven state model and represents two transmitters fed from a common power supply unit. The second model is an eight-state model which represents three electric generators supplying part of State of Bahrain electrical network. The high accuracy and the time saving advantages show that the proposed method gives excellent agreement with the results obtained by the Runge-Kutta method. ß 2001 John Wiley & Sons, Inc. Comput Appl Eng Educ 9: 20±25, 2001

Keywords:

¯ow graph; state diagram; reliability; graph theory

INTRODUCTION Engineers often mathematically model ideas related to new designs before investing large sums of money on actual hardware. In the conceptual stage, particularly during the synthesis of a new system, it is desirable to obtain an understanding of how the various elements of the system will perform. In putting systems together, designers lay them out in a manner to obtain an idea of the overall operation of the system to see how much equipment will be involved. This way many potential mistakes can be eliminated from the beginning and an improved system design can be obtained. By developing and using models that simulate behavior of the system over a proposed lifetime, the designer can identify design de®ciencies and attempts to remove or reduce them.

Correspondence to I. S. Qamber. ß 2001 John Wiley & Sons, Inc.

20

In 1736, L. Euler [1] published the ®rst paper in graph theory in which he dealt with a problem occurring in Kognigsberg, Germany. This is the socalled Kognigsberg bridge problem. Since then graph theory found its way to many other ®elds and became one of the well known methods in modeling many real life problems. However, only in the last few years, graph theory has been introduced to the area of reliability. In reference [2], the authors describe a general purpose graphical approach for obtaining steady-state availability and frequency expressions from a ¯ow graph based on Markov model. This method incorporates the use of self-loops, the number of sources and the number of sinks for every graph node into the Markov model. Although somewhat complicated, this method represents a successful attempt to use graph theory for the calculation of steady state probabilities. Qamber [3] demonstrated the use of graph theory to ®nd the steady state behavior of multi-state systems described by Markov models. He developed a method

COMPUTER PACKAGE DEVELOPMENT

that uses the graph theory to calculate the steady-state probabilities of a system. Qamber's method is faster and easier than non-graph-theory-based methods. Moreover, Qamber's method eliminates the use of self-loops and sinks in the Markov model. This resulted in a simpler model than the one in [2] while maintaining the same level of accuracy. Qamber and Fakhro [4] compared the ¯ow-graph method [3] to the Laplace Transforms. They determined the steady-state probabilities for three-state model using Laplace Transforms and the developed ¯ow-graph method. The accuracy obtained in both cases was almost the same. Unfortunately, all the above work uses manual methods to calculate the steady state probabilities using graph theory. Note that it is impractical to use manual methods for systems with seven or more states. This situation demands the development of an algorithm that automates the process of calculating the steady state probabilities to handle larger systems.

ALGORITHMS This section presents the algorithm that calculates the steady state probabilities. This algorithm is dependent on two other supporting algorithms presented afterwards.

Steady State Probabilities Algorithm The algorithm used to ®nd the steady-state probabilities is based on the work in [3]. However, the present format facilitates the automation of this algorithm. The input to the algorithm is the  matrix, where  is known as the modi®ed transition rate matrix and can be arranged in the following form: 2 3 11 12 . . . 1n 6 21 22 . . . 2n 7 6 7 ˆ6 . .. 7 .. .. 4 .. . 5 . . n1 n2 . . . nn Note that diagonal elements ii , i ˆ 1; . . . ; n are all zero in the above matrix [3]. 1. Form the matrix A where A is initially set to the transpose of  A ˆ T 2. Calculate the diagonal elements of A aii ˆ ÿ1 

n X jˆ1

aij for all i ˆ 1; . . . ; n

21

i.e., each diagonal element equals the negative of the sum of elements residing in the same column. 3. Set all the elements of the ®rst row of A to 1 to replace the ®rst equation for pi with n X

pi ˆ 1

iˆ1

where pi is the probability of the ith state. 4. Calculate the G matrix by dividing every row in A by minus one times the diagonal element. Then, set all the diagonal elements of G to zero.  gij ˆ

aij ÿaii

0

if i 6ˆ j for all if i ˆ j

i ˆ 1; . . . ; n and j ˆ 1; . . . ; n where G is the matrix representation of the signal ¯ow graph. G is called the gain matrix since gij equals the gain of the directed edge connecting node i to node j. 5. Find all cyclic paths in the signal ¯ow graph (see section ``Cyclic Paths Search''). 6. Calculate the gain for every cyclic path. The gain of a cyclic path equals the product of the gains of all the edges in the path. For example, the gain of path (1,2,3,1) is g…1;2;3;1† ˆ g12  g23  g31 7. Find sets of nontouching cyclic paths C2, C3, . . . Ci ˆ fci1 ; ci2 ; . . .g where cij is the jth set of i nontouching cyclic paths (see section ``Nontouching Cyclic Paths Search''). For example, C2 is the set of every two nontouching cyclic paths. C2 ˆ fc21 ; c22 ; . . .g 8. De®ne lij to be the product of gains of cyclic paths in cij. Also de®ne Li to be the sum of lij, j ˆ 1; 2; . . . : For example, L2 is the sum of the products of any two nontouching closed loops. X lij Li ˆ j

9. Calculate   ˆ 1 ÿ L1 ‡ L2 ÿ L3 ‡ . . . where L1 is the sum of the gains of all the cyclic loops in the signal ¯ow graph.

22

ALMAJDOUB AND QAMBER

10. Find all cyclic paths that do not include the source node. The source node can be assumed to be node 1 without loss of generality. 11. Calculate p1 p1 ˆ

1 …1 ÿ Q† 

where Q is the sum of gains of cyclic paths that do not include the source node. 12. Reduce the n by n system to (nÿ1) by (nÿ1) A0  p0 ˆ b0 where A0 is formed of matrix A by deleting the ®rst column and the ®rst row. p0 includes all the unknown pi 's except p1. b0 is formed by multiplying ÿp1 times the ®rst column of A. The following equation shows the contents of A0 , p0 , and b0. 2 3 2 3 2 3 ÿp1 :a2;1 a22 a23 . . . a2n p2 6 a32 a33 . . . a3n 7 6 P3 7 6 ÿp1 :a3;1 7 6 7 6 7 6 7 6 .. 7 .. 7  6 .. 7 ˆ 6 .. .. .. 4 . 5 . 5 4 . 5 4 . . . an2

an3

. . . ann

Pn

ÿp1 :an;1

13. Use matrix inversion to ®nd p0 , hence, p2,. . ., pn.

4. Remove all the original paths from T and insert all the extended versions. Note that unextended paths are removed from T without any replacement. 5. Examine all paths in T and move any cyclic path in T to C where C is the set of all cyclic paths in the signal ¯ow graph. 6. Repeat steps 3±5 (n ÿ 2) times i.e., a total of (n ÿ 1) times. However if T is empty, quit since there is no path that can be a candidate for extension. By the end of the above algorithm, C includes all the cyclic paths in the signal ¯ow graph. Steps 1 and 3 ensures the uniqueness of cyclic paths, e.g., paths (1,2,3, 1) and (2,3,1,2) are actually the same path and will appear only once as (1,2,3,1).

Nontouching Cyclic Paths Search This section explains the algorithm used to ®nd all the sets of non touching cyclic paths needed to calculate  in step 9, section ``Steady State Probabilities Algorithm.'' The algorithm depends on a set, R, which includes all the nontouching pairs of cyclic paths. 1. Examine the set of cyclic paths C and ®nd all the pairs of nontouching cyclic paths. L2 is the set of all nontouching cyclic paths pairs. …a; b† 2 L2 for all a 2 C; b 2 C and a and b have no common nodes

Cyclic Paths Search This section presents the algorithm used to ®nd all the cyclic paths in the signal ¯ow graph as represented by matrix G. 1. Find all the potential starting edges for all the cyclic paths. To ensure the uniqueness of cyclic paths, all cyclic paths must start with an edge that connects node i to a higher node i ‡ j, j > 0. These edges correspond to the nonzero upper diagonal elements in G. 2. De®ne T to be the set of all paths represented by nonzero upper diagonal elements in G. T includes path (i, j) if gij 6ˆ 0 for all i ˆ 1; . . . ; n ÿ 1 and j ˆ i ‡ 1; . . . ; n. 3. Extend every path in T by ®nding all the available extensions. For example path (i, j) can form paths (i, j, k) for all gik 6ˆ 0, k ˆ 1; . . . ; n. To ensure the uniqueness of cyclic paths, two other conditions are imposed on k. The ®rst condition is that k must be a higher node that the starting node i. ki The second condition is that k can not be an already included node in the path. However, k can be equal to i, the starting node, in which case the cyclic path is complete.

2. Set i ˆ 2. 3. Extend every element in Li using the elements of L2 . For example the set of two nontouching cyclic paths (a, b) in L2 can be extended to (a, b, c) if (a, c) and (b, c) both exist in L2. Also the set of three nontouching cyclic paths (a, b, c) in L3 can be extended to (a, b, c, d) if (a, d), (b, d) , and (c, d) all exist in L2. 4. Set Li‡1 to all the extended elements of Li. 5. If Li‡1 is empty quit, else, set i ˆ i ‡ 1 then go back to Step 3.

EXAMPLES Four models are tested in this study, where only two of them are presented in this paper. The presented models are the seven-state model and the eight-state model. For these two models, the results are obtained and discussed. Results are also obtained for the two smaller models introduced in [3].

Seven-State Model As the ®rst example consider the seven-state model. This model is taken from a paper by Barlow and

COMPUTER PACKAGE DEVELOPMENT

23

Figure 1 A three unit system.

Hunter [5]. The system consists of two transmitters, A and B, and a power supply C. The two transmitters are run from the same power supply C. If one of two transmitters fails, the other can perform the system task satisfactorily but with a decrease in expected time. The system block diagram and the estimated repair and failure times of each unit are presented in Figure 1. The system is considered as being in one of seven possible states; these are as follows: S1: All three units are working properly S2: Both B and C are working properly, but A fails S3: Both A and B are working properly, but C fails S4: Both A and C are working properly, but B fails S5: B is working properly, but A and C are failed S6: C is working properly, but A and B are failed S7: A is working properly, but B and C are failed The four states S3, S5, S6, and S7 represent the system failures when the system is shutdown, requiring repair. In the case of power supply unit failures, the system will fail as a whole. Similarly, if both transmitters fail, the system serves no purpose and operation discontinues until the system is repaired. For the above two reasons, the state represented by failures of all three units can be ignored. The state-space diagram is given in Figure 2 and the system differential equations are written as follows:

Figure 2 State diagram for the seven-state model.

dP5 …t†=dt ˆ 0:005P2 …t† ÿ 0:2P5 …t† dP6 …t†=dt ˆ 0:02P2 …t† ‡ 0:02P4 …t† ÿ P6 …t† dP7 …t†=dt ˆ 0:005P4 …t† ÿ 0:2P7 …t†

Eight-State Model Considering an eight-state model which represents three generators supplying part of Bahrain's electrical network [6]. These generators are part of one of Bahrain power stations. The generators are combined as one model, which become as an eight-state model. The system state-space diagram is shown in Figure 3 where the values of 's are omitted for simplicity. The system differential equations are as follows. dP1 …t†=dt ˆ ÿ0:0010504P1 …t† ‡ 1:8518519P2 …t† ‡ 0:1428061P3 …t† ‡ 0:0013441P5 …t† dP2 …t†=dt ˆ 0:0002283P1 …t† ÿ 1:582674P2 …t† ‡ 0:1428061P4 …t† ‡ 0:0013441P6 …t† dP3 …t†=dt ˆ 0:0005726P1 …t† ÿ 0:1432839P3 …t† ‡ 1:8518519P4 …t† ‡ 0:0013441P7 …t† dP4 …t†=dt ˆ 0:0005726P2 …t† ‡ 0:0002283P3 …t† ÿ 1:9949075P4 …t† ‡ 0:0013441P8 …t† dP5 …t†=dt ˆ 0:0002495P1 …t† ÿ 0:002145P5 …t†

dP1 …t†=dt ˆ ÿ0:0283P1 …t† ‡ 0:5P2 …t† ‡ 0:2P3 …t† ‡ 0:5P4 …t†

‡ 1:8518519P6 …t† ‡ 0:1428061P7 …t† dP6 …t†=dt ˆ 0:0002495P2 …t† ‡ 0:0002283P5 …t†

dP2 …t†=dt ˆ 0:0133P1 …t† ÿ 0:525P2 …t† ‡ 0:2P5 …t† ‡ 0:5P6 …t†

ÿ 1:8537686P6 …t† ‡ 0:1428061P8 …t†

dP3 …t†=dt ˆ 0:005P1 …t† ÿ 0:2P3 …t†

dP7 …t†=dt ˆ 0:002495P3 …t† ‡ 0:0005726P5 …t† ÿ 0:1450016P7 …t† ‡ 1:8518519P8 …t†

dP4 …t†=dt ˆ 0:01P1 …t† ÿ 0:525P4 …t† ‡ 0:5P6 …t† ‡ 0:2P7 …t†

dP8 …t†=dt ˆ 0:002495P4 …t† ‡ 0:0005726P6 …t† ‡ 0:0002283P7 …t† ÿ 1:9960021P8 …t†

24

ALMAJDOUB AND QAMBER Table 2 Results Comparison for the Eight-State Model State Probability Runge-Kutta Present Method P1 P2 P3 P4 P5 P6 P7 P8

0.84016757 0.00010344 0.00337112 0.00000042 0.15566574 0.00001917 0.0006246 0.00000008

% Error

0.83899798 0.139209134 0.00010343 0.00966744 0.00336407 0.20912931 0.00000041 2.380952381 0.1557399 ÿ0.047640541 0.0000192 ÿ0.156494523 0.00062446 0.022414345 0.00000008 0.0

Table 3 CPU Time Number of Nodes Figure 3 State diagram for the eight-state model.

RESULTS AND DISCUSSION The algorithm discussed in the section ``Algorithms'' were implemented using MATLAB as a computer package called FGRAPH. The results for applying FGRAPH to the seven-state and the eight-state models is summarized in Tables 1 and 2, respectively. These tables also compare the results of the current method to the Runge-Kutta method. The percentage error is given in the last column of Tables 1 and 2, where it shows that a maximum of 1.6393% is reached for the seven-state model and 2.3809% for the eight-state model. Clearly, the newly developed tool, FGRAPH, provides high accuracy in addition to the ef®ciency of calculation. Table 3 shows the CPU time needed for the calculation of steady state probabilities, pis. Table 3 also shows that the CPU time grows exponentially

Table 1 Model State Probability P1 P2 P3 P4 P5 P6 P7

4 5 7 8

Number of Cyclic Paths 7 9 15 134

CPU time (s) 0.55 0.66 1.76 1202.20

with the increase in the number cyclic paths in the signal ¯ow graph. Note that in previous work [3, 4], the calculation of the steady state probabilities is done manually. However, Table 3 reveals that a manual approach is impractical if the number of states is seven or more. Clearly, the development of a computer package to automate the calculation of steady-state probabilities is a must. The CPU time in Table 3 is obtained by running FGRAPH on a 66MHz Pentium PC.

CONCLUSION This paper presents a computer package that automates the calculation of the steady-state probabilities for any model described by Markov system. Earlier manual methods are simply impractical when the state

Results Comparison for the Seven-State

Runge-Kutta Present Method 0.93141 0.02466 0.02323 0.01875 0.00061 0.00087 0.00047

0.93091 0.02464 0.02327 0.01874 0.00062 0.00087 0.00047

% Error 0.05368205 0.081103 ÿ0.1721911 0.05333333 ÿ1.6393443 0.0 0.0

Figure 4 CPU time versus the number of cyclic paths.

COMPUTER PACKAGE DEVELOPMENT

graph has seven or more nodes. Two examples are investigated and results are carried out. Their results illustrate the high accuracy and ef®ciency of the developed package. This package is enormous, especially for undergraduate engineering students and trainee engineers or technicians.

APPENDIX:  MATRICES The  matrix for the seven-state model is given below. 3 0 0:0133 0:005 0:01 0 0 0 6 0:5 0 0 0 0:005 0:02 0 7 7 6 6 0:2 0 0 0 0 0 0 7 7 6  ˆ6 0 0 0 0 0:02 0:0057 7 6 0:5 6 0 0:2 0 0 0 0 0 7 7 6 4 0 0:5 0 0:5 0 0 0 5 0 0 0 0:2 0 0 0 2

25

REFERENCES [1] F. Harary, Graph Theory and Theoretical Physics, Academic Press, London, 1967. [2] S. Kumar and R. Billinton, ``Graph theory concepts in frequency and availability analysis,'' IEEE Trans. Reliability, 34(4) (1985), 290±294. [3] I. S. Qamber, ``Flow graph development method,'' Microelectronics and Reliability, 33(9) (1993), 1387± 1395. [4] I. S. Qamber and S. Q. Fakhro, ``Comparison of threestate probability under both Laplace transforms and ¯ow-graph methods, when applied to four TVA models,'' Microelectronics and Reliability, 34(3) (1994), 463±473. [5] R. E. Barlow and L. C. Hunter, ``System Ef®ciency and Reliability,'' Proc. IRE National Convention, 7(6) (1959), 104±109. [6] Y. M. Al-Buti, ``Following Kronecker technique in building an overall electric system,'' Senior Project, University of Bahrain, 1996.

While the following is the  matrix for the eight-state model. 2

0 6 1:8518519 6 6 6 0:1428061 6 6 0 6 ˆ6 6 0:0013441 6 6 0 6 6 4 0 0

0:0002283 0

0:0005726 0

0 0:0005726

0:0002495 0

0 0:0002495

0 0

0 0:1428061

0 1:8518519

0:0002283 0

0 0

0 0

0:0002495 0

0

0

0

0

0:0013441 0

0 0:0013441

0 0

1:8518519 0:1428061

0

0

0:0013441

0

0:0002283 0:0005726 0 0

0 0

0:1428061 1:8518519

0 0

3

7 7 7 7 0 7 0:0002495 7 7 7 7 0 7 0:0005726 7 7 7 0:0002283 5 0

BIOGRAPHIES Salah A. Almajdoub is an assistant professor at the Department of Electrical and Electronics Engineering at the University of Bahrain. He obtained his BSc and MSc from King Fahd University of Petroleum and Minerals, Saudia Arabia, in 1985 and 1988, respectively. In 1996 he obtained his PhD from Virginia Tech. His research interests include computer algorithms, parallel processing, CAD tools for hardware design, and Internet architecture. He is a board member of Bahrain Information Technology Society and a member of the IEEE computer society.

Isa S. Qamber was born in Al-Muharraq, Bahrain, on July 7, 1959. He received the BSc degree in electrical engineering from King Saud University, Saudi Arabia, in 1982; PGD in 1983; and MSc degree in 1984 both from UMIST, UK; and the PhD degree in reliability engineering from the University of Bradford, UK, in 1988. In 1988 he joined the Department of Electrical Engineering, College of Engineering, University of Bahrain, as an assistant professor. Currently, he is an associate professor in the Department of Electrical and Electronics Engineering. Dr. Qamber is a member of the CIGRE, the Bahrain Society of Engineers, and the IEEE PES Society. His research interests include studying the reliability of power systems and plants, the applications of CAD tools to high power engineering, and control of power systems.