UBC Theses and Dissertations

UBC Theses Logo

UBC Theses and Dissertations

Schematic capture interface and post-processing for the OVNI power system simulator Qi, Hao 2003

Your browser doesn't seem to have a PDF viewer, please download the PDF to view this item.

Item Metadata


831-ubc_2004-0104.pdf [ 5.37MB ]
JSON: 831-1.0065857.json
JSON-LD: 831-1.0065857-ld.json
RDF/XML (Pretty): 831-1.0065857-rdf.xml
RDF/JSON: 831-1.0065857-rdf.json
Turtle: 831-1.0065857-turtle.txt
N-Triples: 831-1.0065857-rdf-ntriples.txt
Original Record: 831-1.0065857-source.json
Full Text

Full Text

Schematic Capture Interface and Post-processing for the OVNI Power System Simulator by HaoQi B.A.Sc, The University of British Columbia, 1997 A THESIS SUBMITTED IN PARTIAL FULFILLMENT OF THE REQUIREMENTS FOR THE DEGREE OF MASTER OF APPLIED SCIENCE in THE FACULTY OF GRADUATE STUDIES (Department of Electrical & Computer Engineering) We accept this thesis as conforming to the required standard THE UNIVERSITY OF BRITISH COLUMBIA December 2003 © Hao Qi, 2003 Library Authorization In presenting this thesis in partial fulfillment of the requirements for an advanced degree at the University of British Columbia, I agree that the Library shall make it freely available for reference and study. I further agree that permission for extensive copying of this thesis for scholarly purposes may be granted by the head of my department or by his or her representatives. It is understood that copying or publication of this thesis for financial gain shall not be allowed without my written permission. HAO QI Dec2, 2003 Name of Author (pleaseprint) Date Title of Thesis: Schematic Capture Interface and Post-Processing for the OVNI Power System Simulation Degree: Master of Applied Science Year: 2003 ABSTRACT MISE started as a part of the ONVI project. In this project, two programs have been successfully built. Using Microtran as the simulation engine, MISE - an integrated simulation environment for power network transient analysis has been implemented. MISE has been successfully demonstrated from fast schematic capture, automatic node annotation, netlist generation, simulation, to results plotting. MTplot is an independent Windows application used to analyze the MISE simulation results. TABLE OF CONTENTS Abstract 1 1 List of Tables • v List of Figures V 1 Acknowledgement v m I. Introduction 1 1.1 Background 1 1.2 Project Goals • • 5 1.3 Scope of the Thesis 6 1.4 Notations 8 II. Microtran Integrated Simulation Environment 9 2.1 Background 9 2.2 MISE Design Requirements . . . 10 2.3 MISE Design Implementation 15 2.3.1 Code Organization. . . . i 15 2.3.2 Visual Control Design 17 Main Window 17 Part Select Window 18 Main Menu and Speed Buttons 20 2.3.3 Schematic Component Design 21 Component Classification . 21 Library Components Design 22 iii Single-Phase vs. Three-Phase Components 25 2.3.4 Schematics Drawing 26 2.3.5 Circuit Analysis and Netlist Generation 30 Node Annotation 30 Ammeter Connections 37 Voltmeter Connections 40 Netlist Generation 42 III. Microtran Plot GUI Design 47 3.1 Microtran Plot Specification 47 3.2 Microtran Plot Implementation 50 3.2.1 Visual Control Design 50 Main Window 50 Main Menu 53 Popup Menu 63 Speed Buttons 64 3.2.2 Charting Design Implementation 65 TLineSeries and TMChart 65 Charting Policies . 67 IV. Testing and Evaluation 70 V. Future Work 75 VI. Conclusions • 77 VII. Bibliography 78 Appendix I. Description of the Microtran Data Deck 80 iv Appendix II Data Structures of the Four MISE Canvas Elements Appendix HI Explanation of the MISE's Main Menu . . . . Appendix IV Explanation of the MISE Library Components LIST OF TABLES Table 1. Header, module files and their descriptions for the MISE project 15 Table 2. Classification of the MISE schematic and simulation components 21 Table 3. Six mutually exclusive operation modes 26 Table 4. Edit Commands from the Main Menu for parts, wires, texts and joints 27 Table 5. A coding scheme for the iout property of a three-phase component 44 Table 6. File menu and the explanations of its options 53 Table 7. Edit menu and the explanations of its options 56 Table 8. View menu and the explanations of its options 59 Table 9. Option menu and the explanations of its options 62 Table 10. Help menu and the explanations of its options 63 Table 11. Speed buttons and their corresponding menu commands 64 Table 12. Line series types and their priority index 68 vi LIST OF FIGURES Figure 1. Flowchart o f the M I S E simulation process 7 Figure 2. The graphical user interface of M I S E with the Part Select Window o p e n . . 18 Figure 3. Part Select Window 19 Figure 4. Part Edit Window - a three-phase transmission line 20 Figure 5. Data section o f a library component - resistor 23 Figure 6. Symbol image section of a library component - resistor 24 Figure 7. Comparison between the original and current three-phase symbols 25 Figure 8. A generic node with 13 lines and 12 joints 31 Figure 9. A tree structured node viewed from J l 32 Figure 10. A n algorithm used to annotate a generic node with a given nodeid m 33 Figure 11. Four basic types o f ammeter connections 37 Figure 12. A typical network node with an ammeter .39 Figure 13. Two basic types of voltmeter connections 40 Figure 14. Flowchart for checking a two-terminal voltmeter connection 41 Figure 15. Flowchart for Microtran schematic reading 43 Figure 16. MTplo t main window with a chart on-display 51 Figure 17. A d d New Chart Dialog box - opening a case file 54 Figure 18. Interface design for Print Preview 55 Figure 19. M a i n Window - Edit Menu 57 Figure 20. Edit A x i s Dialog box - displaying axis properties and settings 58 vn Figure 21 .Curve Properties Dialog box - displaying curve properties 59 Figure 22. Main Window-the pink left marker and the blue right marker in trace mode 61 Figure 23. Main Window - Label Font Dialog box 62 Figure 24. Main Window - Popup Menu 64 Figure 25. MSIE simulation process - the schematic of the test case 70 Figure 26. A sample chart from MTplot 74 vii i ACKNOWLEDGEMENTS I would like to thank the following people for their contributions to this work: - To Dr. J.R Marti for his supervision, guidance, financial support, and trust in this research topic, and to Dr. H.W. Dommel for his financial support. - To all my fellows in the Power Group at UBC for their pioneering work and direct help. - To colleagues pioneering in the field for their contributions, which allow me to cite their works. For any reference omissions, please accept my sincerely apology. Last, to my family and friends, near and far, for their love, support, and encouragement. HaoQi ix I. Introduction This report describes the continued effort in developing an integrated simulation environment for Microtran - a standard digital simulation tool for electromagnetic transient phenomena. 1.1 Background During the last few decades, the E M T P 1 has been established in the electrical engineering field as one o f standard tools for power networks electromagnetic transient simulations. Since digital computers cannot simulate electromagnetic transient phenomena in continuous time, the E M T P models each electrical component with equivalent discrete-time elements, translates an electric power circuit into network equations, and then solves these equations in the time domain. Cost, space, and flexibility are the main advantages of the E M T P over analog-scaled network simulators such as N T A s 2 . Wi th fast changing computer technologies, computers are becoming faster and cheaper, and high performance digital simulators have become faster and more accurate [1, 2, 3]. They have gradually come to dominate the power network transient simulation arena. Microtran is a D O S version o f the E M T P that was developed and implemented in the University of British Columbia (UBC) . Dr H . W . Dommel developed the E M T P in the early eighties for electromagnetic transient analysis. However, with the rapid evolution in 1 Electromagnetic Transients Program 2 Transient Network Analyzer 1 computer software and hardware technologies, the interface o f the DOS-based Microtran was severely limited in terms o f what is expected by present users. Digital real-time simulation is one o f the hottest research topics in power network simulation [4, 5]. For real-time simulation, simulators must be capable o f sampling and producing a stream o f data within certain error constraints to behave like real systems. The smaller the integration step At of the simulator the better the bandwidth resolution, but the higher the performance requirements on the simulator resources. The theoretical bandwidth is determined by the sampling rate and is given by the Nyquist frequency fny. With a tolerated magnitude distortion o f 3% and 2 K H z bandwidth requirement, a real-time digital simulator needs 50/i.s simulation step size [6]. New microprocessors are clocking faster and faster. This gives more room to meet real-time requirements. A t the time this project started, the fastest available commercial computer was 200 M H z , and now the fastest C P U is clocking at more than 2 G H z . Within about five years, the microprocessor speed has improved more than tenfold. The dramatic gain from computer speed directly enhances the performance o f digital simulators. However, more complicated component models are created for the power networks [7, 8], and new simulation algorithms are discovered [9, 10]. Wi th changes in these two factors, digital simulators have gradually replaced bulky T N A s in the field. The Power System Simulation Group at U B C has developed the object virtual network integrator (OVNI) . O V N I is an E M T P type simulator, but it targets both real-time and off-line simulations. The offline simulation is aimed at replacing the current E M T P - Microtran programs. O V N I is made up of two main programs: the network integrator (NI), and the user interface (OUT). 2". N I is the core o f O V N I , it is O V N I ' s network solution engine. The N I software architecture was developed as a PhD research topic [11]. A t the time this project started, the engine was not available for evaluation and testing. Microtran was the only available simulation engine for use, and since it also needed to be updated, it was chosen as the simulation engine for the final test. However, most of the design efforts can be reused for the future development o f O V N I . The preliminary phase of O U I was completed as a graduate research topic [12] and implemented in Delphi 2.0. A t the time the initial phase of O U I was completed, an alternative version of the schematic capture program was acquired with similar basic functionalities. This alternative schematic was chosen for continuation of the O U I project. The underlining reasons for choosing the alternative version are as follows: 1. Both versions were almost at the same stage o f development and had basic functions implemented (such as inserting components, drawing wires, copying, deleting, moving, saving and printing schematics, etc). The new version had more features, like component libraries. Thus, by choosing the new version, the project schedule would be kept on time. This was the most important factor. 2. The original version of O U I was implemented in Delphi 2.0 and the alternative version was in LabWindows/CVI 4.0. Delphi is Borland's object-oriented Pascal. However, LabWindows/CVI compiler is a 32-bit A N S I C compiler from National Instrument. The kernel o f the compiler uses the lcc 3 A N S I C compiler. It is a powerful interactive development environment based on the C programming language used to create virtual instrumentation applications. LabWindows/CVI is available on Windows 3 A hand-coded, retargetable compiler for ANSI C written by Dave Hanson 3 2000/NT/ME/9x platforms and Sun Solaris® platforms [13]. For long-term project development and maintenance, choosing the C programming language was more suitable than Delphi, because Delphi is a high-level application programming language and not widely used in engineering fields. Most project members have no prior experience with Delphi, but most of them are very proficient in C programming. 3. LabWindows/CVI contains a drag-and-drop editor for creating user interfaces, and tools for automatic code generation. The usability is comparable to Delphi's and allows users to rapidly build applications. 4. LabWindows/CVI has a complete multithreaded ANSI C environment for building testing, measuring, and automating applications. It includes high-level libraries for accessing the full functionality of the hardware while abstracting many of the low-level I/O details. Lab Windows/CVI provides libraries for interfacing with DAQ 4 , VXI 5 , and several other hardware devices. These libraries provide greater motivation for selecting Lab Windows/CVI over Delphi because engineers can connect external networks to simulation computers and achieve real-time interactions. Based on the above reasons, the alternative OUI implementation was chosen for continuation of the integrated simulation environment for OVNI and Microtran. The work of this thesis has been named MISE for "Microtran Integrated Simulation Environment". 4Data Acquisition 5 VMEbus Extension for Instrumentation 4 1.2 Project Goals MISE is the continuation of the first phase of OUI. In the first phase, the major criteria for both software and hardware were established with the basic functions implemented in the OUI prototype. This laid out the roadmap for the long-term project. Thus, it also motivated this project. The following are four major goals for this project. 1. Improve design efficiency A main goal for this project is to improve the design efficiency. Microtran is a DOS based simulator. It reads an ASCII data file, which describes the electrical circuit network. The designer has to assign every node a unique name, and create his design case in a text file before the simulation. This process is tedious and often error-prone. This project will add a user interface for describing the circuit network. With schematic capture, the program will allow the user to design a circuit free of syntax and typographic errors, and eliminate the node naming procedure. It will also allow the user to name particular nodes of interest and the rest of the nodes will be automatically assigned. Finally the software will produce a text file for the simulator. 2. Improve circuit readability and comprehension The program must improve readability and comprehension. A Microtran user has to develop his schematic design on a piece of paper, and translate the design into a deck file. When he checks the simulation results, he must read the design from the deck file. With schematic capture and automatic netlist generation, the circuit and the simulation results are directly connected together, thus, the program improves circuit readability and comprehension. 3. Look attractive and updated The program must look attractive and updated. In the past decade, software application design has gone through dramatic changes from design tools to operating systems. The attractive and updated appearance for an application is a design feature that current users take for granted. Usually, a software application with an attractive appearance would lure more users. Although Microtran is a technical application, a friendly interface will make this application easier to use and attractive to potential users. 4. Be a robust and integrated simulation tool manager Circuit simulation offers users fast and efficient means to test the circuits' performance characteristics. Within a single unified environment, users can build simulation cases graphically, or set up simulation variables and execute the simulation, or observe simulation results, or interact on-line with the simulation processes. This can improve design efficiency. 1.3 Scope of the Thesis This report covers the continued development effort for M I S E based on the first phase of OUI. Figure 1 shows the complete flowchart of the M I S E simulation process. Although it does not include all works done in this thesis, it represents the core of this project and the thesis follows this arrangement. 6 SCHEMATIC CAPTURE . CIRCUIT ANALYSIS NETLIST GENERATION SIMULATION C END *y= PLOTTING Figure 1: Flowchart of the MISE simulation process This thesis begins with an introduction describing the motivation and status of this project. Chapter 2 covers the control interface design of MISE, and the first three procedures in Figure 1 (schematic capture, circuit analysis, and netlist generation). The control interface design is not a process of the MISE simulation. It is designed for the interaction between user and machine. The first three procedures in the flowchart belong to "data preparation". Schematic capture involves schematic component design, component classification, and wire connections. Circuit analysis describes the node annotation algorithm, and analyzes ammeter and voltmeter connections. Netlist generation reads all the circuit components in a schematic and translates the circuit into Microtran's data deck file for simulation. The simulation stage is not covered in this thesis, because the simulation engine is an independent application. Chapter 3 covers the development effort for an independent plotting program, which is the last procedure in the flowchart. It details the design requirements and implementation efforts for visual controls and charting. Chapter 4 reports testing and evaluation for the whole project. It checks the five most important aspects of the project. Finally, Chapter 5 contains recommendations for future work. 1.4 Notations Throughout the report, much effort has been made to avoid using computer-related terms and acronyms. There are several categories of words in highlighted text with italic typefaces. Most of them are project-related names: - Program commands: any names of commands, menu items, and speed buttons in the program. For example, select mode, Part Select Window, etc. Variables used in program codes. For example, maxline, *line pointer, etc. - Keys on computer keyboard. For example, ESC key, Delete key - Book names: For example, the Microtran Reference Manual, etc. Also, there are several key words frequently used in this report. They are interchangeable and are listed as: - Netlist, data deck - Wire, line, connection - Joint, junction - Part, component, element 8 II. Microtran Integrated Simulation Environment 2.1 Background Microtran is a D O S application on personal computers for electromagnetic transient analysis of power systems. It solves differential equations of an electrical network step by step in the time domain with a step size of At. It provides models for basic circuit components: R , L, C , linear and nonlinear, single-phase and multi-phase. Complicated models are also available for system equipment: multiphase transmission lines with constant or frequency dependent parameters, synchronous generators, multi-winding power transformers, lightning arresters, and power electronic components. In Microtran, power networks and their components are described in text files, which are known as data deck files. Those files are plain A S C I I files, containing requests for output, component data, and simulation parameters (time step At, maximum simulation time t m a x , and various control flags). They can be prepared either directly with a plain text editor or interactively using the program mtData™, but they have strict formats. Each line in a data deck file is called a "card" and is 80 columns wide. A complete simulation case is called a "data deck". A data file is divided into data groups or sections separated by "blank cards". The detailed description of each section in the Microtran data deck is explained in Appendix I. With rapid development in computer software and hardware technologies in the past decade, personal computers have become faster and more powerful. Software interface designs for software applications have become user-friendlier. DOS-based applications 9 are not intuitive to the user making production less efficient. Most circuit simulation tools have become windows-based schematic drawings rather than text-based descriptions. A typical Microtran user has to complete his design on paper, and then analyze and name each node in the network. After that, he translates the schematic into the Microtran data deck file. He may w aste a lot of his time on unnecessary paper work rather than concentrating on the circuit design. The main advantage of a windows-based schematic drawing program is to provide a convenient schematic design platform and hide the text description from the user. The user can totally ignore the text file format and node naming. He can directly relate his design to the circuit schematic rather than read text descriptions. He can then launch the simulation program and check the results within seconds. Also, he can easily modify simulation cases. He can print out a design schematic and its results in charting analysis, etc. Every process is just a matter of clicking a button. MISE is the continuation of the OUI interface. The OUI's specification has been detailed in the thesis work of [12]. A brief outline of the project requirements is illustrated in the following section. 2.2 MISE Design Requirements Because MISE is the continuation of the long-term OVNI project, it contains a lot of previous research work. As an integrated part of the project, it is worthwhile to briefly review the design requirements. Being a GUI application, this software has visual control and functional design requirements. Visual control mainly covers the interaction between the application interface and the end user. The functional design covers the capabilities of the program. The visual design must satisfy these two general requirements: 10 1. Look simple, attractive, and intuitive The interface must look simple, attractive and understandable. As a great Indian poet Rabindranath Tagore said "It is very simple to be happy, but it is very difficult to be simple". Making the interface simple to use is a tough task and is a goal that was pursued throughout the project. On the one hand, complex tasks must be partitioned into small and simple tasks; on the other hand, w e must organize these small and simple tasks to perform dedicated tasks, but the appearance of the program must be simple, attractive and intuitive to its users. 2. Follow Windows programming conventions The windows format is intuitive to users already familiar with Windows applications employing common icons or menus. Therefore, during the implementation of MISE, many Windows components and functions such as menus, controls, buttons, copy, paste, cut etc. are applied in the same way as some of the most common Windows applications, such as Microsoft Word for Windows. For a person who is new to a computer, this may not be a factor. However, as an engineering application, many of its users are engineers with a lot of experience with computers, and they have become used to some Windows application conventions. If any GUI design does not follow these conventions, it may make the application confusing and less approachable. The functional design requirements define the capabilities of this program. Mostly, for a Microtran user, he needs to complete his design on paper, then analyze the electrical network design and name all nodes correctly. After these things are done, he now must 11 create a data card f or e ach e lectrical component according to the rules o utlined in the Microtran Reference Manual [14]. After the deck file is correctly set up, he then can use Microtran to simulate the electrical network and obtain the results. These tasks are very tedious and laborious. The main purpose for developing MISE is to improve the design efficiency for users. The following design requirements are committed to serve this purpose: 1. Must allow the user to draw electrical circuits quickly and efficiently This is the most important design requirement for MISE as a schematic capture program. As indicated, in Microtran an electrical network is described in a data deck (or netlist file) that is usually prepared by users with a text editor or MTD (mtData®). The circuit connections are implied in the node names of the pins that each component is connected to. The user must prepare the data deck file carefully without any error. If an error occurs at this level, it is usually hard to trace. With the capability of schematic capture, the user can directly layout his design on a computer screen. He can select any electrical component that he needs from the part library, and place it on the schematic canvas. He can modify the component parameters, move the component's position, and rotate it if necessary. After the components are placed, he can wire them up just like drawing them on a piece of paper. If he wants to make any change on some connections or move some components, he can do it at any time. This can dramatically improve the design speed. 2. Must be able to automatically generate a netlist 12 After the schematic drawing is complete, the user can specify any nodes that he might be interested in and put meters to monitor outputs. He does not need to know how to build the data deck file. He only needs to know the physical meaning of each parameter of a component. MISE is able to read the electrical network from the schematic canvas, analyze it and generate a netlist file that corresponds to a simulator type. In this case, it is a Microtran deck file. The user does not even need to know the structure of a Microtran deck file and can avoid much of the redundant work between schematic and netlist generation. Therefore, the second most important property for MISE is to hide node annotation and netlist creation from the user. Must be an integrated simulation environment The Microtran package mainly consists of three DOS programs: MTD, MT, and MTplot. MTD is a text editor program, which helps to prepare data deck files and automates their formats. MT is the power network solver or simulator, which takes a valid data deck file (netlist) to produce simulation results. MTplot is a plotting program, which takes the output from MT and plots results in a chart. These three main programs are executed in DOS, so the user must type commands to execute his tasks. Once one program is finished, the DOS shell must be closed in order to open the next one. This is a typical procedure for executing a DOS application. Compared with a Windows application, it is more tedious and less user-friendly. MISE has the capability of automatic node annotation and netlist generation. These laborious tasks are hidden from the user. With MISE, all the steps from creating a schematic design to saving the simulation case to plotting the simulation results are automatic, and all services can be integrated into a unified simulation 13 environment. The user does not need to type any DOS commands or work with DOS programs. They can be launched from the integrated environment. In this way, the user can quickly build up a simulation case and view the results. 4. Must allow the user to save and print designs If an application allows the user to build up a design, it also must allow him to save and print the design. This is a must for all design software applications. Otherwise, the usefulness of this software is greatly diminished, because the designer usually wants to modify and archive his designs. 5. Must support a full suite of electrical component models A full suite of electrical component models is another key feature of this engineering application. These components are the building blocks of an electric power network. An accurate and complete suite of component models enhances the program capability and usage. The above list incorporates the five most important requirements for developing MISE. Al l the requirements are focused on improving user-friendliness and work efficiency. In the following section, we will discuss the implementation of MISE. 14 2.3 MISE Design Implementation MISE was implemented in LabWindows/CVI, an ANSI C compiler. This environment has a visual programming capability, although it is not an OOP language. It provides many built-in graphical components for designing graphical user interfaces. CVI is callback-oriented and all the graphical components are associated with callback. Different from OOP programming, the design codes are organized in different modules. 2.3.1 Code Organization A software application is a program that is designed to execute predefined tasks. To systematically organize the project, the MISE source codes are partitioned into ten different module implementations according to data structures and their functionality. Table 1 describes the header and module implementation files used in the project. Table 1: The header, module files and their descriptions for the MISE project Module File Function Description MISCH.UIR Contains user interface controls, menus, buttons, panels, windows def.h Defines all global variables and data structures MISCH.h The header file for the main module (misch.c), defines parameters for speed buttons, menu items, and their events PROT.h Defines all schematic related procedures and events, includes creating and modifying parts, lines, junctions, texts and library. misch.c Main module implementation of all procedures described in misch.h menu.c Module implementation for handling menu and speed button related procedures and events file.c Module implementation for handling schematic file saving and opening run.c Module implementation for handling simulation related procedures parts.c Module implementation for all parts related procedures and events lines.c Module implementation for all lines related procedures and events juncts.c Module implementation for all junctions related procedures and events libs.c Module implementation for all library related procedures and events box.c Module implementation for handling selection box operations netlist.c Module implementation for analyzing schematic design and generating netlist for simulation 15 MISE's ten modules can be grouped into two categories: visual control and schematic drawing. Visual control implementation is mainly related to the main window and its control command implementation, which includes MISCH.UIR, misch.c, menu.c, file.c and run.c. A description of their functions is given in Table 1. Schematic drawing is isolated as an independent task in this project for its importance. Part, line, joint and text are the only four types of objects that are allowed to be placed on the schematic canvas. Except for text, the other three types are used to build up electrical circuits. Text is used to label or comment on any interesting points in a diagram. Schematic drawing is implemented by the following six modules: parts.c, lines.c, juncts.c, box.c, libs.c, and netlist.c. A description of their functions is given in Table 1. Part, line, and joint represent the three most important data types used in the schematic drawing. The programming code for these data types is listed and fully explained in Appendix II. Four p ointers a re u sed t o 1 ocate t he four t ypes o f o bj ects i ncluding 1 abel t ext, a nd point to memory blocks so that these dynamically created objects can be stored. For example, LineStruct is the structured data type for line and the pointer (* line) is defined in def.h. Associated with this pointer, the global variable maxline is used to count the maximum number of lines (wires) that have been created in the application. So the pointer and the (maxline-l)'h item point to the first and the last items in the list, correspondingly. The list can be easily searched. EXT LineStruct *line; //from def.h EXT int maxlines; Line = realloc (line, (++maxlines)*(sizeof(LineStruct) //lines.c 16 Before creating a new object, the corresponding object list must be searched to make sure there are no free objects; otherwise, unused objects should be used rather than creating new ones. This is to ensure that the memory is used efficiently. Therefore, part, line, joint, and label text objects are stored in dynamically expanded lists after they are created. The following sections are going to discuss these two parts of the program implementation in detail. 2.3.2 Visual Control Implementation The visual control is the main part of the GUI implementation. Its key components are: main window, main menu, speed buttons, popup menu, part select window, and part edit window. As mentioned before, most of these features were explained in detail in the first phase of the OVNI project. In this section, we mainly focus on some important features that have been modified and the main menu description is detailed in Appendix III. Main Window When the application is launched, its main window appears on the computer screen with the default maximum size. At the same time, the part select window is displayed on the top left corner of the window. The application defaults into the part-insertion mode. It is ready to create a simulation case. The main window is the operating platform where all speed button controls, menus, status bar, scroll bar and circuit symbols are located and the user drives the program to 17 complete the desired tasks. The details of the user interface for MISE are illustrated in Figure 2. Schematic Canvas Figure 2 The graphical user interface of MISE with the part select window open Part Select Window The Part Select Window allows the user to select a component one at a time to build a simulation case. It contains all components from a chosen library file. A circuit diagram cannot be built with components from two different libraries. In the example of Figure 3, a three-phase delta-wye-winding transformer is being selected, its symbol is shown at the top right corner and its name is highlighted in blue in the list box. 18 Symbol Bitmap K H § £ H TLG_FD I SW j SW3 1 DIODE i THYR I GTO ! TRIAC List Box | THY BRB STR " Value TR3 Woiking Library C \wDrkUb\mt lib Close Figure 3 Main Window - Part Select Window To place a circuit part in the schematic canvas, first the user selects the part from the list box on the right side of the Part Select Window. As the name of the part in the list box is highlighted or focused its symbol image is displayed on the left side. Then, the user can move the mouse cursor into the schematic canvas and point to a place where he wants to drop the part. By clicking the left mouse button, the selected part is dropped on the canvas. At the same time, the application is switched to the select mode, so the user can edit the component parameters. After a part is placed, the user can rotate, mirror or move it to the right place, or he can edit its parameters by double-clicking on the part, then the Edit Part Window appears as shown in Figure 4. The component symbol bitmap is shown on the top left corner of the window. Al l of its parameters and values are shown in the text box on the right. This version of MISE did not implement the component-based Part Edit Window, all parameters and values of a part are listed in text strings. A dedicated Part Edit Window 19 was prepared by another member in the project team[15]. In her program, each component has its own editing window. For editing parameters and values of a component in our version, please consult Appendix IV at the end of this report. Symbol Bitmap Text Box H E D I T P A R T !TL3_CP_B Value 180 OK : Show Netlist String —> Cancel J3-PH TRAN5M. LINE - BALANCED CGNSTAHT _± {1,2} $ LTYFE = Phase a {3,8} Ndde l a = '80 08' {9,14} Node 2a = '8150 0%' {27,36} R [ohm/kin] = '0 .5 ' {37,46} Zc [ohm] = '650' {47,56) Wave Speed [km/s] = '236e3 1 {57,66} Length = 'SvalueS' {67,6B} $ INPUT OPTION = '1' {69,70} SMODEL = 'D' {71,72} SNPHASE = '0' _ {79,79} SIFORM = 1 1 ' {80,80} SIOUT = '0 1 {0,0} {1,2} SITYPE = ' -2 ' Phase b {3,8} Node l b = '10 108' {9,14} Node 2b = '8150 108' {27,36} R [ohm/km] = '0.05' {37,46} Zc [ohm] = 1300' Figure 4 Part Edit Window - showing a three-phase balanced constant parameter transmission line Main Menu and Speed Buttons The main menu and speed buttons are like the steering wheel of the application, they direct commands in different categories. Please refer to the first phase development for details regarding the main menu and speed buttons. Appendix III is a brief description of these commands in the main menu and speed buttons and is included for the completeness of this report. 20 2.3.3 Schematic Component Design An electrical component in a schematic area is a graphical object. It has its image, name and value properties. It can be selected from the Part Select Window. The user can build up his component according to the nature of the device. This version of MISE uses a simple way to build electrical components and the rules are outlined in the following subsections. However, a better library component editor is needed in the future development of the project, which should include network partition and sub-circuit creation. Component Classification According to the functionality of each component and its Microtran type described in the Microtran Reference Manual, the components in MISE can be divided into the following 10 groups. Each group has a group name and an assigned group ID to easily identify them. They are categorized in Table 2. Table 2: Classification of the MISE schematic and simulation components Component Group Group ID Components GROUND 0 Ground CASEID 1 Case identification TIMECARD 2 Time card LINEAR 3 Linear c omponents s uch a s R ,L,C, R L, RLC, PI-circuit, transmission line, etc. TRANSFORMER 4 Transformer SWITCH 5 Non-linear components, such as switch, diode, thysistor, triac, etc. SOURCE 6 Voltage and current source, such dc, ramp, square, sinusoidal, triangle, step, etc. VOLTI 7 One-terminal voltmeter VOLTII 8 Two-terminal voltmeter AMMETER 9 Ammeter 21 According to their functions, there are only three types of objects in MISE: schematic, simulation and special. Schematic components are used to build electrical networks such as LINEAR, TRANSFORMER, SWITCH, and SOURCE. Simulation components are used to specify the simulation parameters such as CASEID and TIMECARD. The special group contains GROUND, VOLTI, and VOLTII. These components are fully explained in sections to After all the components are assigned to a group, they can be easily read according to their group IDs during the circuit analysis and the netlist generation. In the next s ub-section, we will discuss how a library of components is built. Library Components Design Although quite lengthy, for completeness of this report, we need to discuss how a library component is built. A l l library components are saved in a library file with the *.lib file extension. This is a text file and the user can modify it with any text editor. Each component in the library data file contains two parts: data and bitmap symbol image. These two parts are attached to each other without any space or blank line. To illustrate the structure of a library component in the lib file, a simple single-phase component, a resistor, is used as an example without losing generality. The data section of a resistor is shown in Figure 5. Al l parameters of the resistor have been commented inside the figure. The data section includes the part symbol name, group id, part value label and its visibility, part name label and its visibility, node name and its pin coordinates, etc. 22 R 3 // symbol name and group id "20" 1 //part value label and its value label visibility R? 0 //part name label and its it visibility "RESISTOR //part full name {1,2} $ I T Y P E = '0' //part type {3,8} Node 1 = '%10 0%' // node name deck position and its pin coordinates (10, 0) { 9,14 } Node 2 = '% 10 40%' // node name deck position and its pin coordinates(l 0, 40) {27,32} R [ohm] = '%value%' //part values in deck card {80,80} $I9UT = ' O " 5 ^ ^ // output switch Microtran parameter's values or pin coordinates. Start and end column position for Microtran oarameters Figure 5 Data section of a library component - resistor The first four lines are very clear and describe all the schematic properties of the resistor component. Starting from line 5, a pair of double quotations includes all information for a resistor's Microtran data deck card, which are: Microtran part type, node names, value, output switch, etc. Each parameter occupies a line. A pair of numbers inside a curly bracket indicates the starting and ending positions of each parameter in the Microtran data deck. Line 6 and line 7 not only indicate node name positions in a resistor data card, but also specify two terminal coordinates in the resistor symbol bitmap. A parser looks at these pin coordinates so that a line can be easily snapped onto the component's pins during the drawing of the schematic. Also , the parser looks at those joints that connect the pins of a component and substitutes the node names of the designated data card with node names of these annotated joints during netlist generation. This w i l l be fully explained in section 2.3.5. The symbol image section is located at the end of the data section. The first line of the symbol image section is a pair of integers, which indicate the image horizontal and 23 vertical sizes in number of pixels. A dot (.) represents a white pixel and a number sign (#) as a black pixel. Figure 6 shows the symbol image section of the resistor in the library file. The number signs (#) at the top and bottom sides of the symbol image represent two terminals o f t he r esistor. T heir p ositions correspond t o t he p in c oordinates i n t he d ata section. 2141 / / the horizontal and vertical sizes of the image # // this # represents the first pin coordinates (10,0) #.. # # # # # #.... #.. #... #.... # ....# ...# ..# ...# ....# # #.... #... #.. #... #.... # ....# ...# ..# ...# ....# # #.... #... #.. , #.... # # # # # ..# // this # represents the second pin coordinates (10,40) Figure 6 Symbol image section of a library component - resistor 24 Single-Phase vs. Three-Phase Components Two independent libraries for single-phase and three-phase components were used in the initial implementation of the interface and both libraries could not be used simultaneously. This design has caused some problems and has complicated circuit analysis. Since MISE is an electrical power network simulator, the network can have a combination of single and three phase components. It is therefore desirable to allow both types of components to co-exist in a network. In order to perform circuit analysis, each terminal of a component must have a pin to represent it; thus, a three-phase component like a transmission line must have three input pins and three output pins, accordingly. Figure 7 illustrates this change. cp> v C P y a) Original Design b) Current Design Figure 7 Comparison between the original and current three-phase transmission line symbols The original three-phase component design had a single pin to represent three terminals; this was based on the assumption that all network components were three-phase. However, this is not always the case. The current three-phase component symbols have pins for each input and output of the component. This allows node information to be represented in the schematic and facilitates analysis of the circuit. Also, this design treats three-phase components as sub-circuits. 25 2.3.4 Schematic Drawing Schematic drawing is a very complex operation in this program. It is not because it needs a complicated algorithm, but because it has many small details to be covered. Usually, a circuit schematic consists of four types of elements: part, text, wire, and joint. Part and text are called "graphical objects" and are not part of the canvas. When they are placed on the schematic canvas, they do not need to be refreshed when something is drawn. However, wires (sometimes, called lines or connections) and joints (or junctions) are drawing objects on the canvas and need to be updated. According to the types of operation, availability of mouse buttons and schematic objects, drawing operations are divided into 6 mutually exclusive modes: select, wire, junction, part, label text, and node. These modes and their functional descriptions are explained in Table 3 . Table 3: Six mutually exclusive operation modes Mode Description Select Allows to select and move any object on the schematic canvas Wire Allows to draw a wire and connect part pins Junction Allows to insert junction Part Allows the user to select a part from Part Select Window and to place it on the schematic canvas Node Allows the user to assign a node name to a node Text Allows the user to add text comments on the s chematic canvas As shown in Table 3 , except for the select and node modes, the other four modes are used to create a corresponding object. These four modes have a common characteristic: first, the user needs to set an operation mode, he then moves the mouse cursor over the 26 schematic canvas or a desired point on the canvas, and then clicks the mouse button. Finally, a corresponding object is created and placed on the canvas. As it might be noticed in the previous table, the select mode does not only allow the user to select an object, but it also combines move into this mode. Move and select are closely related and are two of the most frequently used operations. Furthermore, they do not conflict with each other in using the mouse resource. For example, to move an object, the user needs to put the mouse cursor on top of the object, and clicks the left mouse button, the object is then selected and a red-square is focused on it. Then, hold the button and drag the mouse cursor to the desired point. The select mode can be used for operations such as copy, delete, etc. Thus, it was concluded that the move command was not necessary and was omitted from the main menu to simplify the operation. The edit commands listed in Table 4 only apply to the selected object. The table lists five basic edit commands for parts, texts, wires, and junctions in the main menu. In the table, Yes means a command is available for the object. Table 4: Edit commands from the main menu for parts, texts, wires, and joints Command Part Text Wire Junction Copy Yes Yes Yes Yes Paste Yes Yes Yes Yes Delete Yes Yes Yes Yes Rotate Yes Yes No No Mirror Yes No No No For a part/text/wire/junction, when the mouse cursor touches the top of the object, a red rectangular box is set on it, indicating the object is selected or active. When the left 27 mouse button is held with the selected object, it automatically changes to the move action and the mouse pointer switches to hand cursor ( ^ ) accordingly. Once circuit components are moved in place on the canvas, they need to be connected together with wires. Wire (line) connection is one of the most complicated drawing objects in the application because it combines orthogonal line drawing, line split and merge, line contraction and extension, automatic junction insertion and deletion. To start the wire connection, the user needs to switch to the wire mode, and then he is able to draw wires. In this mode, junctions are automatically created and inserted. If there is a need for an additional junction, the user must switch to the junction mode. Al l lines and junctions must snap on the grid and lines are all straight. The following scenarios are encountered when drawing wire connections on the canvas. - Draw a line Move the mouse arrow cursor ( ^ ) close to a pin, and press down its left mouse button, the mouse cursor changes to the hand pointer ( ^ ) . This indicates it is in the wire connection mode, and it also automatically inserts a junction (•) between the wire and the pin. The user then releases the button, and moves the mouse cursor horizontally or vertically to the destination point or pin. Once the cursor is close to the destination point, clicks the left mouse button again to complete the wire connection. If the destination is a pin, it automatically inserts a junction. - Cancel drawing operation During the drawing of a wire connection, the user can click the right mouse button anytime to cancel the operation immediately, and the mouse cursor switches 28 from the hand pointer to the arrow pointer. Also, the user can press the ESC key from the keyboard to cancel. Draw orthogonal lines This is similar to drawing a horizontal line. After connecting to the first pin of a component, release the mouse button. As opposed to moving the mouse horizontally or vertically, the user needs to move the mouse cursor diagonally like drawing a rectangle. At the destination point, click the left mouse button again, then two lines are c reated and they are orthogonal to each other. At the intersection of these two orthogonal lines, there is no need for a junction to represent a node connection. Extend a line Put the mouse cursor close to one end of a wire (line), and stretch outwards along this line to extend a line. Contract a line Put the mouse cursor close to one end of a wire (line), and stretch inwards along this line to contract a line. Split a line There are two ways to split a line. First, in the wire mode, when a drawing line is pulled towards an existing line perpendicularly and connected to any part of this line (except the line ends), a junction is inserted on the existing line and then the line is split into two pieces. Second, in the junction mode, the user can insert a junction at any part of a line (except its ends) causing the line to split. Merge lines 29 Opposite to splitting a line, merging lines combines two pieces of straight lines into one. If the user wants to remove a junction between two lines, he needs to switch to the select mode and select the junction, and then press the Delete button. The two lines are then merged into one piece. After a schematic is completed, the design case is ready for circuit analysis. Contrary to the previous implementation, nodes are not created at the time when the wire connections are made, but the nodes are assigned automatically before a netlist is created. This permits the user to assign particular node names when desired. 2.3.5 Circuit Analysis and Netlist Generation Nodal analysis is a process of annotating all electrical nodes in a network. In the first phase design of this project, a node was represented by a class object (TNodeBranch). The object was created when drawing the schematic. This process was not ideal and inefficient. As we know, a node has no physical meaning when creating a schematic; it only has physical meaning when analyzing a schematic network. It is not necessary to trace node changes all the time. Node Annotation In order to analyze an electrical circuit, all nodes in the network must be defined correctly (no missing and duplication nodes). Physically, a node is an equal potential joint in a network without discontinuity; schematically, a node is in fact a collection of lines and junctions that are linked together. An example node is shown in Figure 8. It is. 30 made of 13 lines and 12 junctions, where terminal joints (Jl, J4, J5, J8, J9, J l 1, J12) are supposed to be connected with a component; otherwise they are floating or opened. o-J1 J4 9 L3 J3 1 L1 L4 <*J5 L2 _L5_ J2 4P L7 L8 LB J7 L9 J9 L10 J 1 .° L11 _ Q O J6 L12 L13 J12 -°J11 F i g u r e 8 A generic node with 13 lines and 12 joints Inter-connected lines and joints form a node. Nodal information must be maintained among these lines and joints. For details about data structure of lines and joints, please refer to Appendix II. In Microtran, network nodes are given alphanumeric names with six characters. Only identical sequences of six characters are recognized as the same nodes. Six blank spaces are the name reserved for the ground (common neutral or local ground). For lines and joints, there are two properties: nodeid and nodename, which are closely related node annotation. They are used to identify nodes in a c ircuit and each node is assigned a unique node id. Nodeid is an integer number. If lines and joints belong to the same node, their nodeids are the same, and so are their node names. Nodename is used to store the node name, particularly for user-defined node names. In order to analyze a circuit in detail, the generic node described in Figure 8 is transformed into Figure 9. Actually, if we look at point J l in Figure 8, it is very easy to understand this tree-structured node in Figure 9. Al l lines have equal lengths. If a joint exists, a big dot is 31 presented at the end of each line. In Figure 8, big solid circles (•) represent the terminal joints, which are assumed to connect to one of the pins of a component; unfilled circles (O) represent the joints between lines without connecting to the pin of a component. When only two orthogonal lines are connected together end by end, there is no graphical joint needed. But in a tree-structured node, they are necessary to build up the tree search. PI and P2 are two such joints in this example. J i t J8 h J l l F i g u r e 9 A tree-structured node viewed from J l From our analysis, joints are graphically essential to build a network node. In a circuit diagram, when an element is directly connected to another one without a line, a junction is needed to store the node name. This is the simplest node connection. As more and more lines and joints are used to form a node, lines become the more important elements. Both joints and lines are used to store and pass node information. As seen from Figure 9, L6 and L7 or LI2 and LI3 are connected, but there are no joints needed. The node information can be passed through lines during annotation. A node must start or end with a junction, where it is represented as a connection to a component; otherwise it is opened or floating. This is one of the rules for drawing a circuit. 32 Now, we are ready to use the tree-structured node to explore an efficient algorithm for nodal analysis. An algorithm is developed to find all lines and joints for a node like in Figure 9 and the flowchart diagram is shown in Figure 10. (xi,yi) nodelD = m ni =0 J=FindJointOplist[k].x,plist[k].y) JunctfJl.nodeid = m FindLinesOplist[k].x,plist[k].y, &nl, lind) i=0 start no P=FindSecEnd (lind[i], plist[k].x,plist[k].y ) Line[lind[i]].nodeid = m plist[nj++] = (P.x,P.y) ( end ) k++ Figure 10 An algorithm used to annotate a generic node with a given nodeid m 33 In Figure 10, plist is the list of points with x, y coordinates, nj is the maximum number of intersection points, nl is the number of the found lines at one intersection. Plist is used to store the intersection points at one node, k and i are the index counters. There are three procedures: FindJoint, FindLines, and FindSecEnd. FindJoint finds a joint at a given point and returns the index of the found joint, so that the joint can be annotated. FindLines finds lines connected at a given point and returns the number of lines (nl), their indexes are stored in the integer array (lind). When a line is found, it is then annotated with nodeid m. FindSecEnd finds the second end of a given line and returns its coordinates. With a given nodeid m and a point (x, y) - a terminal joint, which usually starts at one terminal of a circuit component, using this algorithm, all the joints and lines that connect to this point (x,y) are found and their nodeids are annotated with m. The following C code explains the flowchart in details. void AnnotateNode (int nodeid, intx, inty, int * annotated) { inti,j,k,l, nj, L, J, nl; int lind[6]; // number of line junction at one junction, max of 4 at one junction Point *plist=NULL; // initialize the pointer *annotated =-/; i=0; nj=0; plist = realloc(plist, (++nj)*sizeof(Point)); if (plist != NULL) k=nj-l; else { return;} /*Not enough space for more lines*/ plistfkj.x — x; plist[k].y = y; // initially start with one point for (k=0; k < nj; k++) { J= FindJoint(plist[k] .x,plist[k] .y); if ((J !=-l) && (junctfJJ .code -I)) { // terminal node junctfJJ'.code = nodeid; ^annotated = 1; } FindLines(plist[k]'.x, plist[k]'.y, &nl,lind); for (1=0; l< nl; 1++) { L = lindflj; if((L /= -l) && (linefLJ.code == -I)) { //not annotated linefLj.code = nodeid; ^annotated = 1; plist = realloc(plist, (++nj)*sizeof(Point)); 34 if((plist[k].x == HnefLJ.xl) && (plistfkj.y == line[L].yl)) { //find the second end plistfnj-lj.x = line[L].x2; plistfnj-lj.y = line[L].y2; } else { plist[nj-l].x = line[L].xl; plistfnj-lj.y = HnefLJ.yl; }} }} free (plist);} A s shown above, i f we apply this algorithm to the generic node shown in Figure 8, we need six iterations to successfully annotate all the junctions and lines connected to J l . The following steps show the order in which each line and junction is annotated. Iteration 1: Given plist with one point (J 1) Annotate: L I and J l are annotated and Return: add one point (J2) to plist and mark J l as terminal joint ( • ) Iteration 2: Given one point (J2) in plist Annotate: L 2 , L5 and J2 are annotated and Return: add two points (J3, J6) to plist Iteration 3: Given two points (J3, J6) in plist one at a time Annotate: J3, J6, L 3 , L 4 , L 6 , L10 Return: add four points (J4, J5, P I , J10) to plist, where P I is not a junction point, but a point connection between L 6 and L 7 . Iteration 4: Give four points (J4, J5, P I , J10) in plist one at a time, Annotate: J4, J5, L 7 L I 1, L12 , where J4 and J5 reach the end o f search Return: add three points (J7, J12, P2) to plist, where P2 is the connection point between L12 and L I 3, and J4, J5 marked as terminal joint ( • ) Iteration 5: Given three points (J7, J12, P2) in plist one at a time 3 5 Annotate: J7, J12, L8, L9, LI 3, where J12 reaches the end of search, Return: add three points (J8, J9, Jl 1) to plist, and J12 marked as terminal joint (• ) Iteration 6: Given three points (J8, J9, J l 1) in plist one at a time Annotate: J8, J9, J l 1, it reaches the end because there is no more line to be annotated, then the node code annotation is completed. Return: the end of plist, and J8, J9, Jl 1 marked as terminal joint (• ) The step-by-step illustration has traversed all the junctions and lines in Figure 9. If two lines connect with each other without a joint, an imaginary joint is used such as PI and P2 in Figure 9. Now, we have completed how to annotate a generic node. In a network, usually there are two groups of nodes: user-defined and automatically assigned. The user is allowed to define any nodes he wishes. The user switches the application into the node mode, then moves the mouse cursor to a node (a line or a junction), and clicks the left mouse button. Lines connecting to this node are highlighted in red and the Insert Node Name dialog box appears. The user can give a node name and click the OK button to close the dialog box. A user-defined node name is then generated and the node label is placed closely to where the mouse cursor points. The given node name is then stored as the nodename property of a line or a junction, but it is not copied to the other lines or junctions connected to this element. Before discussing these automatically assigned nodes, we need to consider three types of non-circuit components: ammeters, one-terminal voltmeters and two-terminal voltmeters. 36 Ammeter Connections Ammeter connections are closely related to nodal analysis and add some complexity to the process. An ammeter is a special element that is placed in series with a branch. It then splits a node into two. Figure 11 illustrates four basic types of ammeter connections in a circuit. Except the last case (Figure ll.d), the first three cases are supported by Microtran. Cases b and c in Figure 11 are essentially same. At one terminal of the ammeter, there is only one component connected, then the component is assigned to have the branch current output request. Figure 11 Four basic types of ammeter connections An ideal ammeter in a circuit does not cause a voltage drop from one terminal to another and both sides of an ammeter belong to the same node. In Microtran, the ammeter does not count as a circuit element, but it is represented by a parameter in the component card in a deck file. The following is an excerpt from [14], and indicates how Microtran requests branch voltages and branch currents. 3 7 IOUT(80) = 7 Branch current ikm will be included in output (replaced by instantaneous power if IPOWER = / in time card) = 2 Branch voltage Vk-Vm will be included in output = 3 Branch current (or instantaneous power) and branch voltage will be included in output IOUT is the output switch for requesting branch current and branch voltage in a component card (at column 80). Obviously, branch current and branch voltage are properties that belong to a component itself in Microtran. Therefore, we cannot request the current as shown incase D of Figure 11, because both sides of the ammeter have more than one circuit element. In the circuit analysis, the element that owns the ammeter must be treated specially. As shown in Figure 11, the common characteristic for cases A, B, and C is that one of the a mmeter t erminals i s c onnected w ith o nly o ne e lement. B ased o n t he f act t hat t he branch current is dependent on the element that the ammeter is connected in series to, we explore a method of deriving this value. With careful analysis, we can still use the algorithm t hat w e u sed for t he n odal a nnotation t o s implify t he c omplexity o f d ealing with this special element. After finding an ammeter, we start at one terminal annotating it with nodeid m for all the lines and joints that are connected to this terminal; then we do the same for the other terminal. At the same time, we count how many elements are connected to each terminal of an ammeter. We then have three cases: 1. If there is only one component connected to this ammeter we stop searching any further. This ammeter belongs to this component. 38 2. If there is more than one component connected to that terminal, then we stop the search and move to the other terminal. 3. If both terminals have more than one component connected like case D in Figure 11, then the program ignores the case. A warning message tells the user that the case is not supported by the program. To illustrate this idea, a generic case of a node with an ammeter as shown in case C of Figure 11 is explained in detail in Figure 12. It is necessary to traverse all the lines and junctions recursively starting from either terminal of an ammeter. Starting with the ammeter, it has two terminals at Ji (xi, yi) and J5 (X2, y2) , and we randomly pick either one of them to start the search. I ( x „ y , ) I ( X 2 ' ^ Figure 12 A typical network node with an ammeter It does not matter how many more components are connected to the network, once the second component is found, the search terminates for that terminal. The program moves onto the next terminal and continues the next search for the component that is in series with the ammeter. Until component B is found, the branch output request is assigned to component B. 39 Voltmeter Connections Compared to the ammeter topology, the voltmeter topology is rather simple, as shown in Figure 13. Case A of Figure 13 is used to acquire branch voltages and case B for outputting node voltages. Figure 13 Two basic types of voltmeter connection Since branch voltage is measured as the voltage drop across a component, a two-terminal voltmeter must be used. In Microtran, the request o f branch voltage output depends on the value o f IOUT (column 80 o f a component card). Therefore, it is a property o f a component. The voltmeter must be placed across one or more parallel components as shown in case A of Figure 13. The voltmeter does not split a node, and can be treated like a normal component during the nodal annotation. The technique in measuring the voltage across two nodes is different from that o f ammeter reading. Here, we must look for which component is in parallel with the two-terminal voltmeter. One direct approach is to begin one voltmeter terminal and search for components connected to it. Once a component is found, check whether its other pins are connected to the second terminal of the voltmeter. If they are connected, then this voltmeter can be 40 seen as the property of this component and the search can be terminated. The first component found is used to measure the branch voltage output even through there may be other components in parallel. The algorithm used for checking two-terminal voltmeter connections is shown in Figure 14. * C^StarTj^) Figure 14 Flowchart for checking a two-terminal voltmeter connection Since the network has been annotated and each node is assigned a unique id (integer number), we check to see whether the node id at the terminals of the voltmeter and component element is equal. As shown in Figure 14, for a given terminal (Pi) of a voltmeter, Find_Component is used to find the same nodeid between the joint connected to the terminal (Pi) and the joint connected to a pin of a component, and then returns the index (J) of the component. CheckCon is used to compare the nodeid of the joint connected to the second terminal (P2) of the voltmeter with the joint nodeid connected to the pins of the component (J). If an equal nodeid is found, then the component (J) is found. In this way, we can find which component owns the given two-terminal voltmeter. 41 The node voltage is the voltage difference between a node and its local ground, so a single-terminal voltmeter is used to measure node voltage. It does not matter how many components are connected to a node. As shown in Figure 13-b, just place a voltmeter at the node and the voltage will be acquired. In Microtran, the node name is specified in Section 7 of the data deck and the node voltage is obtained in the Microtran simulation output file. Netlist Generation Once the non-circuit components are defined for nodal analysis, it is time to complete the circuit analysis and generate the Microtran netlist file. The flowchart for reading the schematic in Microtran is shown in Figure 15. It is divided into 7 stages: C^StarT^) Initialization J l Annotate Ground JI Annotate Ammeter Annotate Node J i Check Bran Volt Mark User Node IE Output Netlist 7 End Figure 15: Flowchart for Microtran schematic reading 42 1. Initialization Node names are useful only when a netlist is generated, because the netlist describes component connections, which the simulator can understand. The initialization stage includes resetting the nodeid and iout properties for lines and junctions. Two "for" loops are used to reset them. The following code is used. for (i=0; i< maxlines; i++) { line[i] .nodeid = -1; linefij. iout = 0; linefij.m = 0; } for (i=0; i< maxjunct; i++) { junct[i]. nodeid—-!; junctfij.iout = 0; junctfij.m = 0; _ J : /*reset the line[i].nodeid*/ /*reset the linefij.iout*/ /*reset the line[i] marked flag */ /*reset junct[i].nodeid */ /*reset junctfij.iout * / /*reset junctfij marked flag */ The nodeid property for lines and junctions is an integer number. It is equal or greater than zero. For all the lines and junctions connected to a node, the nodeid values are the same. The nodeid for lines and junctions connected to the ground is zero. Node name is stored as a string property. In Microtran, it is a 6-letter string. If lines or junctions have the same nodeid, the node names must be the same. If a user-defined node is given, it is initially stored here. 2. Annotate_Ground After initialization, the best starting point to perform nodal analysis is to annotate all ground nodes. A ground node is represented by a ground symbol. If a line or junction is connected to the ground, then assign 0 (value for the ground) to all the nodeids that are connected to this node. 3. Annotate Ammeter 4 3 A s we discussed i n the previous section, an ammeter splits a node into two parts. In order to read the schematic, we assign the same nodeid to the lines and junctions that are connected to both terminals of an ammeter. Search though all ammeters in the parts list, and annotate their corresponding nodes. A t the same time, determine the branch current o f a component. If a component is found i n series with an ammeter, then update the iout property o f this component. A network may have both single-phase and three-phase components, the iout property of a component must be able to include the phase information and the output type. Therefore, a coding scheme was designed as shown i n Table 5. Table 5: A coding scheme for the iout property of a three-phase component iout Phase 1 Phase2 Phase3 All Phase Current 001 010 100 111 Voltage 002 020 200 222 Both 003 030 300 333 The masked integer numbers contain both phase information and output type. Each digit o f the three-digit integer represents a corresponding phase. B y using ten's modulus, an encoding and decoding procedure can easily be established. Annotate_Node After nodes with ammeters are annotated, it is time to search the rest o f the circuit components including L I N E A R , T R A N S F O R M E R , S W I T C H , and S O U R C E types. If the nodeid o f a junction is not equal to -1 , then it is already annotated; otherwise, annotate it with a new nodeid number. After all the junctions connected to the pins of components have been annotated, the nodal annotation is complete. 44 5. Check_Bran_Volt After all nodes have been annotated, the program is ready to search for two-terminal v oltmeters. If a c omponent i s f ound b y t he t wo-terminal v oltmeter s earch algorithm, and while the IOUT value o f that component is equal to 1, then the IOUT is updated to 3; otherwise it is set to 2. The I O U T values must be correctly encoded with the phase information according to Table 5. 6. Mark_User_Node In the node mode, the user gives a name to a node. This name is then stored in the nodename o f a junction or line structure. Now we have to search these lines and junctions whose nodename strings are not null. If one nodename is found, and it has a unique nodeid, then copy the nodename string to all lines and junctions with the same nodeid. 1. Output_Netlist N o w all the lines and junctions have been annotated and the user-defined nodes have been updated. Therefore, two-terminal voltmeters and ammeters are eliminated from the circuit and their information is translated to their corresponding components. A l l the nodal information is contained within the junctions connected to the pins o f the circuit components. N o w the program is ready to read the circuit and generate the Microtran formatted netlist, the so-called deck file. The output procedure is determined by the format of the Microtran deck file, which is described in Appendix I. The deck file is written according to the group ID, which we outline as: C A S E I D , T I M E C A R D , L I N E A R , T R A N F O R M E R , S W I T C H , S O U R C E , V O L T I . 45 Now, the simulation data deck file is ready, and the user can launch the Microtran simulator and produce analytical results. The result file is written into the Microtran working directory. The next chapter describes the effort in developing the Microtran plotting program. 46 III. Microtran Plot Design Microtran Plot (MTplot) is an independent DOS-based application. MTplot cannot be easily incorporated into other Windows applications. This section presents the design requirements and implementation of a new MTplot program. Since Borland Delphi was chosen to simplify the software development for the first phase of the OVNI development, it was also used for developing the plotting program before switching to LabWihdows/GVI. 3.1 Microtran Plot Requirements The new MTplot is a Windows application and the graphical u ser interface (GUI) becomes an important part of the design. As discussed earlier, the requirements for a GUI design can be categorized into two main groups: visual control and functional design requirements. The visual control requirements outline the interaction between the software interface and the end user. They are the general feel-and-look requirements. It must look simple, attractive, and understandable; and it must follow Windows programming conventions. Functional design requirements are the program specific requirements, and define the capability of the program. The detail requirements for this plotting program are given in the following. 1. Support multiple types of data files The program supports various different input data file types. It can read special formatted binary files from the Microtran simulation results as well as being capable 47 of reading a generic text data file. It allows users to import data from other simulations and analyze them in MTplot. 2. Analyze multiple files at a time It i s important to allow the analysis of multiple files in the application. As we build simulation cases and compare differences between cases, it is ideal to overlap the same interesting points or curves from different data files, and place them in the same chart. 3. Show multiple charts in the same window As a charting tool, it is very useful to allow users to choose a way to compare their results. In many cases, multiple charts in one window can achieve better comparison effect than a single chart. 4. Measure and trace curves As an engineering charting program, it is very convenient to allow users to measure and trace interesting points along the curves and mark significant events in the chart. 5. Have different types of curves in a chart Because curves may represent different types of physical quantities or have different magnitude orders, it is more meaningful to plot different types of curves on different scales. In Microtran, there are more than three types of curves, such as voltage, current, power, and flux. They have different physical units and they are usually in different orders of magnitudes. Particularly, for frequency scan operations, magnitude and phase responses are shown as two different quantities. If the quantities are displayed on the same scale, the chart may be misleading and the comparison may 48 be meaningless. When two curves have a large magnitude difference, it is also a good idea to set them along different axes. 6. Set font and size of all texts in charts The user is allowed to change the text font and size for all the texts in a chart, axis, or curve labels. 7. Print charts As a part of the program output, the program allows the printing of the on-display charts. Print Preview allows the user to adjust many print settings to produce a better-looking chart while the user can add comments prior to printing the pages. 8. Export text data for the selected chart for further analysis needs Some users may be interested in exporting curves in a chart to do further analysis or to compare them with other data files. The program allows the user to export data curves of the selected chart and save it in a text file. 49 3.2 Microtran Plot Implementation The MTplot implementation was done in Delphi 3.0, an object oriented, visual programming environment for rapid application development (RAD). With Delphi, it is very efficient to create Microsoft Windows applications requiring very little written code. Also, Delphi's integrated development environment (IDE) keeps development, testing and maintenance of applications within a single application. Delphi has a comprehensive library of reusable components and a suit of RAD design tools including application and form templates. It offers a whole range of visual objects, from basic control buttons to complex charts. In the plot program, many data types can be captured by objects offered in the Delphi object depository. This dramatically simplifies the software architecture and programming efforts. The program implementation is fully explained in the following sections. It includes two stages: visual control and charting. 3.2.1 Visual Control Implementation Visual control implementation is divided into four main components: main window, main menu, popup menu, and speed buttons. Although the main menu, popup menu, and speed buttons belong to the main window in the program visual design hierarchy, as independent functional groups, they need to be explained separately. Main Window The main window is like a container. It includes speed buttons, menu items, panels, charts, curves etc. It is the face of the application, where the user can interact with all the functions of the program. 50 When the application is executed, its main window is launched with the default maximum size. Initially, the main menu has only two menu options (File and Help) available because there is no file opened. Commands are available only when data is present. When a data file is opened in the program, all menu items are available as shown in Figure 16. Main Menu Active Chart Minimize/MaximizefRestoreVClose Selected Curve VMTN'iP(¥l 0 ) - sample_ca<;.- 1.,. Figure 16 MTplot main window with a chart on-display The main window features include title bar, main menu, speed buttons, popup menu etc. They link to the application commands, status, hints, and help. The user interacts with them by using the mouse cursor and keyboard. 51 The title bar indicates the program name, version and the opened data file. On the right corner of the title bar, there is the Minimize/Maximize(Restore)/Close button. The status bar at the bottom of the main window provides the user with the status of the application and hints as the mouse cursor flies over a Windows component. When the program is running, there is only one selected or active object in the main window. Only three types of selected objects exist: chart, curve and text label. When the application is in the select mode, - A little red square on the top left of a chart indicates this chart is selected or active, as shown in Figure 16. With the selected chart, the user can examine the details of a congested curve by zooming in/out; can add more curves or delete some of them; and can name the vertical axes or change its fonts. The user can copy the chart into the clipboard and paste it into other applications or can delete it from the main window. - A r ed h air-cross p laced along a c urve i ndicates the c urve i s s elected. W ith t he selected curve, the user can copy, cut, paste, check the curve's properties, trace the curve values, or change its name, color, and vertical axis. - A text label is selected when the label is highlighted in gray. With the selected text label, the user can double-click it to edit its content, change the text font and its size, and move or delete it. The selected curve and the label are dependent on the active chart. The chart is their parent. Therefore, they cannot be dragged from one chart to another. If the selected object is deleted, there is no selected object in the application and the red square at the top left corner of the chart or the hair-cross along with the curve does not indicate the object as 52 selected or active. This is to avoid any further accidental deletion and to allow the undelete (ctrl+z) command to recover the deleted object. In the subsequent subsections, we will discuss the implementation of the other three major main window components: main menu, popup menu and speed buttons. Main Menu The main menu includes the pull-down menus, which are the steering-wheel of the application. It integrates most of the application commands. It is divided into five groups, which are: file menu, edit menu, view menu, option menu, and help menu. 1. File Menu The file menu includes most commands related to file processes. Table 6 lists all menu options and their explanations. Except Open and Print Preview, the other commands are common in all Windows applications. Details for open and print preview are illustrated as follows. Table 6: File menu and the explanations of its options Options Descriptions Open Loads a data file, such *.plt, *.txt files Save Saves the on-display chart into a metafile or enhanced metafile Close Closes the current data files Print Opens a Print Dialog Box Printer Setup Sets up the basic printer settings Print Preview Opens the print preview window where the layout information of printing page can be viewed and edited Exit Exits the program While opening a file, a file format is determined by its file extension. The data is read in accordingly. The program can read Microtran's pit binary files, and generic text 53 format files. The generic text formatted file is specified in the Help of the application. After finishing reading the data file, a dialog box is popped up, as shown in Figure 17. Add New Panel Case List test cae 01 Unselected Node List Voltage Current Power All v[NDD0](1) v[N0D1](1) v[N0D2](1) v[NDDQ.ND01](1] v[N0D1.gnd](1) v[ND02.gndim v[N001.N0Q2](1) Add Case Remove Casej OK Selected Node List » Rename Cancel Help Figure 17 Add New Chart Dialog box - opening a case file There are three list boxes, which are used to contain signal names. The case list box contains all the data file names that were read into the application. By default, all voltage signals are prefixed with v, current with i, power with w, and flux with / ; thus, voltage, current, power or all signals can be viewed separately in the Unselected Node List box by clicking a corresponding button. As shown in Figure 17, the voltage button is down; therefore, only voltage signals in testcaseOl are viewed in the Unselected Node List box. The user can highlight signals in the Unselected Node List box by double-clicking or clicking the > button to execute the selection. The user can also de-select signals from the Selected Node L ist b ox by a s imilar p rocedure. The >> and << buttons p rovide quick selection or de-selection of signals. The user can rename any signal in either node list boxes by highlighting a signal, and clicking the rename button. The Add Case button allows the user to plot curves from more than one file at the same time. The Remove Case 54 button removes a case and its associated signals. As shown in Figure 17, all voltage signals in the Unselected Node List box have an extension "flJ ". This indicates that all these signals are coming from the first case file. Print Preview (Figure 18) is an important function. It allows the user to view the pre-printing layout, add header and footer comments, and adjust border margin lines. Delphi offers two special objects: TMtPreview and TMtPreviewPage, which greatly facilitates the creation of the print preview function. Print Preview is a special window, and it must be closed before the user can go back to the main window. rPrmt Optonr""""' ! r £« lo Page Margin Spin Edit -RcstAAon; More Zf ~jf Edit Box View Options""- - - -Peat TVs <t-t ii JHeedd j | fi? 4!Chat»/Cha!l ita | \ 9 P<*eT»fe> |oodmon ng.thewot)cS „: • :Good maraig, the worid! Text Coordinate Spin Edit Figure 18 Interface design for Print Preview 55 The Setup button in the Print Preview window allows the user to set the page orientation (horizontal or landscape). Print options allow the user to decide how to place a chart on a sheet o f paper. Four spin edit boxes in the margin box allow the user to adjust the margin size of each border. The resolution slide bar allows the user to choose the print resolution. View options allow the user to set the visibility o f the margin lines, choose a chart to be printed, and also enable/disable the page title. The text edit box allows the user to enter the text for the title page, the footer, and the header. The X and Y spin edit boxes allow the user to set the footer and header positions i n the print page. 2. Edit Menu The Edit Menu includes commands used to manipulate the chart, curves, axes, and text labels. Table 7 lists all commands in the Edit Menu and their explanations. Table 7: Edit Menu and the explanations o f its options Options Descriptions Undelete Undeletes the last objects Copy Active Chart to Clipboard Copies the selected chart to the clipboard Copy A l l Chart to Clipboard Copies all charts into the clipboard Export Data Exports curve data of the selected chart into a text file A d d Chart Creates a new chart into the current window Delete Chart Deletes the selected chart from the window Edit A x i s Edits the axis settings for the selected chart Cut Curve Cuts the selected curve from the selected chart Copy Copies the selected curve in the selected chart Paste Curve Pastes the copied curve into the selected chart Add / Delete Curves Adds more curves into the selected chart or delete them Rename Curve Renames the selected curve name Curve Properties Displays the selected curve's properties Delete Object Deletes the selected object The Edit Menu is divided into six groups according to their functionality, as shown in 56 Figure 19. The Undelete and Delete cornmands are in two separate groups because they are mutually exclusive. Copy Active Panel to ClipBoard Ctrl+B Copn All Panels to ClipBoard Cttl+Y | Export Data * Add Panel Ctrl+A Delete Panel Ctrl+D Edit Axis Drl+T Cut Curve CtrhX Copy Curve Ctrl+C Add Curves Ctrl+E Rename Curve Ctrl+R Curve Properties. Figure 19 Main Window - Edit Menu The second group from the top of the menu relates to data exporting. The user can copy the active chart or all the charts to the clipboard as images, and paste them into a Windows application such as Word. This is particularly useful for documentation. Also it can output a text data file for all curves in the selected chart and allow the same data to be analyzed in other applications such as Matlab. The third group is chart-related commands. The add chart option allows the user to add more charts by calling the Add New Chart dialog box, as shown in Figure 17. The delete chart option deletes an unwanted chart. The fourth group is axis-related commands. For the selected chart, it allows the user to change the chart axis properties and settings. The axis edit dialog box is shown in Figure 20. The user can give names for the axes of the selected chart, or select the display 57 range by modifying either horizontal or vertical ranges, or to change the grid size. Also, the Label Font button allows the user to evoke the font dialog box and change the axis label sizes. Lditf ing Horizontal Axis Settings pR , Horizontal Axis Label jLabelFont • j jTcme (ms) , -Axis Type — I \ C Left I) <• Horizontal 1 I r Right "flange ~ • —j f~ Automatic f -Scale"—j <• Linear C Log - G r i d — — F On/Off Fromju UC0£*r0O To|?0CCF001 J I8 OK j , Cancel; | Figure 20 Edit Axis Dialog box - displaying axis properties and settings The next group of commands in the Edit Menu is curve-related commands. When the application is in the select mode and the user clicks on the selected chart, a red hair-cross appears on the curve, closest to the mouse cursor. This indicates that the curve is selected, the curve can now be cut, copied, and pasted to another chart. It can also be renamed by clicking the rename curve option. A rename dialog box appears with the current name as default. It allows the user to view the curve properties such as sample size, simulation step size, color, axis dependency for the vertical axis, etc. The detail of these properties is shown in Figure 21. Axis dependency is an important property when this application has many types of curves. This allows the user to separate two types or two groups of curves with different orders of magnitude on two independent vertical axes. The Add Curve command evokes the Add Chart Dialog box, but it leaves all the curves in the selected 58 chart in the selected node list, and shows the un-display curves in the unselected node list. 1 Curve Properties Curve Name; v[NQ04](1) ; Case Name: case02b | Y Maximum: 1.630E-001 ] AtX: 4.675E-002 I Y Minimum: 1.630E-001 .- j AtX: 4.675E-002 j Verbcal Aws | C Right Current Value* > X:2.87$E-O02 j Y:4.431E-001 j 0 K | p Samples—- —j Step Size: 5.000E-005 j Sample Size: 2000 •> j Curve Color! Cancel)' .Simulation Information a Simulation 01 Help | Figure 21 The Curve Properties Dialog box - display curve properties 3. View Menu Table 8 lists all commands in the View Menu and their explanations. These commands allow the user to view the details of the curves in each chart and select the most interesting section to print. Table 8: View Menu and the explanations of its options Options Descriptions Refresh Resets chart settings to default and refresh them Zoom In sets in the zoom mode and zoom in a chart Zoom Out sets in the zoom mode and zoom out a chart Trace Traces measurement along curves Zoom commands are very intricate. They use a combination of mouse and keyboard events. There are three ways to execute these commands: 1. With the selected chart, by clicking on the Zoom In/Zoom Out menu items, the chart is zoomed in/out from its center by 15% each time. 2. The most useful zoom in/out function is achieved by using the mouse. In either the select or zoom mode, the user just holds down the mouse button and draws a red rectangle downwards on the selected chart. The chart will now zoom in; vice versa, drawing a red rectangle in the opposite direction, the chart will zoom out. This function is very convenient to locate a focal area. 3. When in the zoom mode, the user is allowed to move the selected chart horizontally and vertically by pressing four arrow keys. After inspecting all the curves, the user can print the area of interest in a chart, or return to the default settings by clicking the Reset button. Trace is an important function to examine the details of a chart. In the trace mode, there are two marker lines to indicate the measuring points. One is controlled by the left mouse button; and the other one is by the right mouse button. While clicking the right mouse button, a small circle locks at the intersection between a vertical maker line and the nearest curve. At the same time, the trace dialog box appears indicating measurements in this curve; similarly, clicking the left mouse button, a small rectangle locks at the intersection between another vertical line and its nearest curve as shown in Figure 22. By holding down the left or right mouse buttons, the small circle or rectangle slides along the curve. With two markers locked on the same curve, the user can measure curve values like the wave period, peak values, phase differences and slopes. 60 20.0 40.0 60.0 80.0 Time (ms) Figure 22 Main Window - the pink left marker and the blue right marker in trace mode Both markers are controlled by the mouse buttons or by a combination of arrow, ctrl and alt keys. Arrow keys are used to select curves and examine finer detail of each curve. Markers can be moved back and forth by pressing the left (<—) and right (—») arrow keys. While the Ctrl key is not down, all the arrow key events are related to the left marker; vice versa, while the Ctrl key is down, all these events are related to the right marker. The up (t) and down (|) arrow keys are used to select a curve. The Alt key controls the trace speed. Without pressing the Alt key down, fast tracing is obtained, a single arrow (left<—/right—*•) key moves five sample steps. With the Alt key down, the markers move a sample at a time. 61 4. Options Menu The Options menu contains some auxiliary commands used for charting. There are four commands and their explanations are listed in Table 9. Table 9: Options menu and the explanations of its options Options Descriptions Font Edits t he f ont a nd s ize f or a xis t itle, 1 abel o n a xis t icker, c omment label, curve label Select Enables the select mode Label Adds label texts in the selected chart Set Background Changes the chart background (black/white) Although the commands for changing axis title font can also be accessed from other places in the application, the Font in Options menu can pop up a complete form to change font for any types of text in the application as shown in Figure 23. In this dialog box, the user can change the font name and the size for the axis title, the labels on the axis ticker, and the comment labels and curve labels on the upper side of each chart. Label Font Dialog r Type of Label - — Axis Title Label On AMIS Ticker Comment Label Curve Label Font Font Font Font Close Figure 23 Main Window - Label Font Dialog box 62 The select mode is the most used operation mode. In this mode, the user is allowed to select objects such as a chart, a curve and a text label, and make queries or edit them. The label command evokes a simple form, allowing the user to add a text label to the active chart. The user can put his comments anywhere in the chart. The program allows the user to choose two types of backgrounds for the charts: black or white. The white background is the default. When changing the background, the new background applies to all charts in the main window, and the color of these curves in the charts also changes accordingly. 5. Help Menu •The Help menu is a common menu item for all programs. Its main purpose is to provide the user help on how to use commands, buttons, menu items in the program and also identify the program version and license number. Table 10 lists Help menu items and their explanations. Table 10: Help menu and the explanations of its options Options Descriptions Help Launches the help file and provides help for using the program About Shows a window with program name, version, copyright Popup Menu The popup menu is a very handy floating menu. It is available by clicking the right mouse button while the application is in the select mode. There is only one popup menu used in this program as shown in Figure 24. It contains most of the commonly used commands in editing the selected curve 63 Cut Curve Cttl+X Copy Curve Ctrl+C Add Curves Ctrl+E Rename Curve Ctrl+R Curve Properties ; Figure 24 Main Window - Popup Menu Speed Buttons All speed buttons are held in a rectangular panel right below the main menu. Each speed b utton h as a n i ntuitive i con a ssociated w ith i t a nd i ncludes t he most c ommonly used commands in the application. Most of these commands are exactly the same as the ones in the main menu, but they are more convenient to use. Table 11 1 ists the speed button icons and their corresponding menu items. Table 11: Speed buttons and their corresponding menu commands Speed Button Icon Equivalent Command & Main Menu -» File | Open ... Main Menu -» File | Save ... Main Menu -> File | Print SUB' frood Main Menu -> Edit | Add Chart Main Menu -> Edit | Add Curve Main Menu -» Options | Select Main Menu -» View Zoom | Zoom in or Zoom out Main Menu -> View | Trace Axis Main Menu -» Edit | Axis ABC Main Menu -> Options | Text Label A Main Menu -> Options | Font • Main Menu -> Options | Refresh 64 The speed buttons can be divided into four main groups - file-related, chart-related, action mode, and options. They are separated by a small gap between each group as shown in Figures 16 or 22. The speed buttons directly relate the commands in the main menu. Particularly, the action mode group is made of four mutually exclusive buttons. These four action modes require using the mouse cursor resource; but they are mutually independent. To fully explore the mouse capabilities in the application, these four mutually exclusive buttons are used to make the program simple and convenient to operate. 3.2.2 Chart Design Implementation In the previous section, we discussed the GUI interface of the plot program. In this section, we are going to discuss how data is arranged in the application. We divide this section into two subsections. The first subsection discusses how two Delphi main objects are used to encapsulate the plotting data file; then, the second subsection discusses what kinds of chart policies are used in displaying these curves. TLineSeries and TMChart TLineSeries and TMChart are the two most important classes used to store the data. TLineSeries is a direct component from the Delphi component depository (DCD). No matter what kind of files the plot program processes, the input data files must contain column-wise number series and these series must have the same number of items for each case. The first column must be either time or frequency, the others are dependent variables of time or frequency. Thus, these column-wise number series can be easily read 65 and captured in TLineSeries objects. Each dependent variable has a corresponding TLineSeries to hold its series data. TLineSeries can be assigned to a parent chart (TChart) object, then curves can be displayed in a chart. In this application, TMChart was created as a descendant of TChart to adapt to the application needs. It inherits all properties, methods, and events that TChart has. It also creates some new properties, which mainly relate to the curve markers in a chart. TMChart is the parent of TLineSeries objects; therefore, the initial instance of TMChart becomes a container of TLineSeries objects and holds all data information from the data files. When the application starts to read a data file, a chart and corresponding numbers of TLineSeries instances are created. The chart is stored in a chart list as chart[0]. A global variable gsamples is used to count the number of data samples and also used as a control limit of the application, which might be used in a trial version. The first created chart (chart[0]) is assigned to be the parent of these newly created TLineSeries. This can avoid using redundant memory. The structure of the chart and line series looks like the following, Chart[0]->Series[0,... , No - 1 , N 0 N 0 + N , - l , N 0 + N l f . . . , N 0 + Ni +N2-I,.... ] Where No, N], N2 are the number of dependent variables in different cases or data files. This application allows for multiple cases to be analyzed at the same time. For example, a case initially simulates in the time domain for some transient phenomena and then the results are saved in a data file. Then, a frequency scan is applied to the same circuit and the results are saved in another file. Finally, the two files could be read in the application 66 one at a time, and displayed in two or more charts to illustrate the system responses in both time and frequency domains. As all data series are read into the TLineSeries instances, all information in a file is captured in Chart[0]. Each instance of TLineSeries represents a curve. At the same time, the application pops up in the Add New Chart window as shown in Figure 17. Displaying curves i n a c hart i s r datively s imple, t he f unction o nly n eeds toe nable o r d isable t he visibility property of that curve. The following section details some policies for chart displaying. Charting Policies The plotting application can read multiple data files and display multiple charts in one w indow. It m ay h ave m any t ypes o f curves i n o ne c hart. T hese curves m ay h ave different physical properties like voltage, current, or may have different orders of magnitude. In order to plot these curves properly, some charting policies are established: 1. Only a time or frequency dependent series can be read in at one time. A data file can have anything at the beginning according to the data file format requirement. In the data section of the file, the first column must be either time or frequency. This column represents the horizontal axis of a curve and the rest of the data series columns must be dependent on the first column. 2. Chart[0] contains all the series obtained from all the cases or data files. Each case has a number of line series. So, if a case has N line series, then N line series are . added into chart[0], the index of the line series increments by N. If a case is 67 removed, the related line series are removed from the chart. TLineSeries objects are destroyed and memory space must be free. 3. If more than one type of series exists in a chart, the one that has the lowest priority index occupies the left axis of the chart, the rest of the curves occupy the right axis. Table 12 shows the line series types and their corresponding priority index. The lower the index number, the higher the priority of the line series. They will be the first to be assigned to the left axis. If there are more than three types of line series, then the rest of the line series will be assigned to the right axis. Table 12: Line series types and their priority indexes Type Time Frequency Amplitude Response (rms) Phase Response (rad) Voltage V(t) l V(f) 4 V(f) 7 Current i(t) 2 1(f) 5 1(f) 8 Power p(t) 3 P(f) 6 P(f) 9 Flux <p(t) 10 - - - -4. Since the application only allows either a time or frequency line series to be displayed in one chart, it means that the horizontal axis can only be either time or frequency. In the frequency domain, rms (root-mean-square) and phase types can be displayed in a chart. In the time domain, voltage, current, power, and flux curves can be displayed in a chart. 5. The application allows the user to change the selected series to be displayed on either the left or right axis. The program automatically decides the curve types and their axis dependencies. This may not always be what the user wants. So, it is very 68 important to let the user decide which curve is on either the left or right axis. This flexibility improves the user-friendliness. 6. When deleting a chart, chart[0] should not be deleted unless it is the last one remaining. Because chart[0] is the only chart in the chart list containing the full information on the data files, the other charts in the chart list are duplicated from chart[0]. If the deleted chart is not chart[0], then it is just destroyed and memory is free. If the deleted chart is chart[0] and there are more than two charts in the chart list, chart[0] is modified so that one of the undeleted charts becomes the new chart[0]. These six policies outlined above provide ways to arrange the data so that they can be presented in a chart. In summary, using visual objects in the Delphi component depository (DCD), data files have been captured into two important visual objects (TLineSeries and TMChart), and the plot GUI design implementation becomes relatively easy. 69 IV. Testing and Evaluation MISE is part of a continuous development effort based on the first phase of the OVM's implementation. It modified and extended many procedures from the first phase. Although testing and evaluation deserve a large chapter to cover every detail of the design, testing and debugging have been done throughout the implementation of the project. However, for completeness and reference, a comprehensive example is detailed in this chapter to illustrate the complete MISE simulation flow. The purpose of this test case is not to check the circuit itself, but to verify the simulation process flow and the related algorithms described in the previous chapters. The schematic of the test case is shown in Figure 25. GND — Figure 25 MSIE simulation process - the schematic of the test case 70 In Figure 25, a three-phase system is shown. It consists of 18 nodes with 17 circuit elements and 13 meters at various positions. The Microtran deck file generated by the application is listed below. Input f i l e f o r Microtran Automatically Generated by Microtran Schematics Copyright (c) 1985-2000 Microtran Corporation F i l e information: Case I d e n t i f i c a t i o n Card * Data f i l e name- C:\work4\dat\testcasel.dat * Schematic f i l e name: c:\work4\dat\testcasel.sch * Date of c r e a t i o n of Data f i l e : 09-29-2003; time: 11:53:25 * Simulation 01 * Time card 50.0E-6 0.2 -1 0 1 0 Lumped RLC branch 0 l b 20 0 N001 N010 50 0 foxb N001 20 0 N001 0.003 0 N002 foxa 10 1 -lgenc swcl 0.5 650 236e3 180 1 0 0 1 -2genb N014 0.05 300 299e3 1 1 -3gena N015 0.05 300 299e3 1 1 -lswc2 f oxc 0.5 650 236e3 180 1 0 0 1 -2N005 foxb 0.05 300 299e3 1 1 -3N017 foxa 0.05 300 299e3 1 1 0 N001 N010 15 3 0 N010 l b 0.02 0 N002 0.3 0 N002 5 0 N002 0.05 2 0 N003 N015 8 3 0 N005 N014 8 1 0 swc2 swcl 8 3 0 N017 N003 0. 2 0 N017 N003 12 $ = = * End of l e v e l 1: Linear and nonlinear elements = = = = = = = = = = = = * l i n e a r elements swcl swc2 -1. 0 0.05 0 0 0.10 0.150 = End of l e v e l 2: Switches and piecewise l i n e a r elements = = = 14gene 14genb 14gena $ = = = Voltage or current sources 0 1000 60.0 0.0 0 1000 60.0 -120.0 0 1000 60 120.0 End of l e v e l 3: Sources = = = = = = = = = = = = -1.0 -1.0 -1.0 foxc $ = = $ = = Voltage-output nodes l b foxb = End of l e v e l 4: User-defined voltage output = = = Level 5: End of data case = = = = = = = = = = = 71 Comparing the circuit schematic and the Microtran deck file, and then importing the simulation results into MTplot, we can conclude the following five points: 1. The most important test is that the circuit schematic can be drawn easily without any noticeable difficulties. With the developed program, the user can quickly deploy the circuit elements and wire them up, then he can assign parameter values to each element to establish a simulation case. It is now very easy to draw a straight or two orthogonal lines to wire up between two pins. Joints are automatically inserted. A line can be automatically split when another line intersects into its stem. Also, two straight lines m erge into one piece when the joint between them is removed. The features outlined in Chapter 2, they were fully tested to make sure they were implemented correctly. 2. The circuit annotation process works correctly. In the circuit diagram (Figure 25), the user has already defined some nodes such as gene, genb, gene, swcl, swc2, LB, etc. Some were intentionally left undefined to check the automatic node naming. The program traverses all elements in the network and annotates each node correctly. It creates 18 unique node names (not including the ground node) and proves that the algorithm described in Figure 10 is correct. Also, it treats both the user-defined and undefined nodes correctly. 3. Al l ammeters are assigned to their corresponding component correctly. Case one, AM4 is in series with R l and TM2, which is similar to the configuration in Figure 11 (a). Both R l and TM2 are three-phase components, AM4 is a single-phase component. As a result, the IOUT flag that controls the output current can be assigned to the second phase of either R l or TM2 depending on their precedence 72 in the component array. In the Microtran deck file, the second phase IOUT of R l is turned on as 1; Case two, AMI , AM2, AM3, AM5 are similar to cases b and c in Figure 11. One common characteristic of these connections is that there is only one element connected to one terminal of the ammeters. Because some of these ammeters are used in combination with voltmeters, the IOUTs of their corresponding elements are different. It can be either 1 for current or 3 for both current and voltage. For example, AM2 is assigned to R8 with IOUT of 1. AMI is for R5, but with VM2 parallel with R5, then IOUT of R5 is 3. As discussed previously, Figure 11 (D) is not supported by Microtran, the program just gives a warning message to inform the user. 4. Both single-terminal voltmeters and two-terminal voltmeters work correctly. The first case is for branch voltage. In Microtran, branch voltage is a property of a circuit component. It does not directly support a voltmeter to measure the voltage across two serial components. It only supports a voltmeter in parallel with one or many components as in Figure 13-a. In this case, both branch voltage and branch current are requested. There is only one flag (IOUT) in Microtran, and there are both single and three phase-phase components in the circuit. It becomes complicated to find which component owns a meter. The program must understand t he o utput t ype a nd t he p hase o f t he c omponent. A s a t ypical c ase, VM1 is seemly used to measure the branch voltage of SW1, but the IOUT of SW1 is 0. In fact, VM1 is in parallel with both SW1 and Rl, and the same phase of R l is also connected to the ammeter AM3. Therefore, the IOUT of Rl connected from swcl to swc2 is 3. The second case is node voltages. This is relatively simple and 73 all three single-terminal voltmeters are used to indicate these node voltage requests and are translated correctly as shown in the output section of the deck file. 5. The charting test was already demonstrated in the implementation in Chapter 3. As an example, Figure 26 is the result of a user-customized figure to illustrate the following aspects of charting. 1) It supports multiple charts in a single widow. 2) It supports curves with dependency on both left and right axes. 3) It allows the user to customize many chart properties, such as font size, color of any chart labels, curve color, axis names, etc. Many other capabilities of the program were tested, but they are not listed here, such as trace, zoom, curve copy etc. Figure 26 is the direct result from the Copy All Charts to Clipboard command in the Edit Menu. v[LB](1) v[SWC2,SWC1](1) l[SWC2,SWC1]C1) ° ° 50.0 100.0 150.0 200.0 Time (ms) Figure 26 A sample chart from MTplot 74 V. Future Work The core of NI (Network Integrator) was implemented by Dr Luis Linares in his PhD thesis [11]. In his work, he reported the development of the algorithm for the real-time power system simulator - OVNI [22]. OVNI is suitable for real-time closed-loop equipment testing under flexible constraints of bandwidth and network complexity. After full development, OVNI could replace Microtran in offline power network transient simulations. For solutions to large power networks, OVNI's network segmentation separates a system into smaller blocks, and then solves each system block simultaneously to meet real-time requirements. A real-time network simulator based on a PC-cluster architecture was p resented b y M r. Jo rge H oilman [ 16]. H e i mplemented a t est s ystem with 234 nodes and 349 branches on five Pentium II 400 MHz computers and achieved 46 microseconds per integration step. In terms of component modeling and parameter settings, a preprocessing tool was developed by Dai Nan [15]. Considering the development of the OVNI simulator, and taking the advantages of the present project work, four recommendations for future work are proposed: 1. A library component editor is needed to enhance the schematic program flexibility. This would allow the user to create customized components according to the rules outlined by a simulator. This editor must be capable of graphically creating and transforming a component symbol and adding component parameters. For a large system, the user could partition the system into smaller subsystems and create sub-circuit symbols for these small systems. 75 2. Incorporate the component editor into the schematic capture program. A component editor was created by. Nan Dai. By integrating this tool into the program, the user would only be allowed to modify the parameters of a component, without affecting the text string format. 3. Replace the Microtran simulation engine with OVNI and enable all the real-time capability. Communication channels between simulators or simulator and external hardware h ave b een e stablished b y M r. Jo rge Hollman a nd M r. Je sus C alvino-Fraga [17]. Also, many functions have been created by other project members. 4. Debugging and code maintenance are continuing efforts. Potential bugs could be found in the future, and also functional enhancements could be defined when the program goes into the application field. Therefore, bug fixing and code modification represent long-term tasks for future developers. 6 76 VI. Conclusions The main conclusion derived from this project is that an integrated simulation environment (MISE) for power transient analysis based on the Microtran simulator has been successfully implemented. It can be easily used to execute the Microtran simulation process flow and improve the design efficiency. In this project, two programs (MISE and Mtplot) have been successfully implemented. MISE started as a continuation of the original interface of OVNI project. In addition to its graphical capabilities, MISE is also an integrated simulation tool manager for power transient analysis. It allows the user to quickly choose circuit components from the component library and place them on the schematic canvas, where they can be wired up. The program has successfully demonstrated the automatic node annotation and the output request algorithms. It can properly handle both single-phase and three-phase components, and correctly generate formatted Microtran deck files. MTplot is an independent Windows application used to analyze the MISE simulation results. MTplot is able to analyze two types of input files: Microtran pit files and specially formatted text files. The application allows the user to import several files at the same time and create multiple charts in a single window. Also, it supports multiple vertical axis dependency and allows the user to customize curve and chart properties. 77 VII. Bibliography [I] Marti, J.R.; Linares, L.R., "Real-Time EMTP-Based Transients Simulation," IEEE Transactions on Power Systems, Vol.9, No. 3, pp.1309-1317, August 1994. [2] Marti, J.R.; Linares, L.R.; Calvino, J.; Lin, J.; Dommel, H.W., "Ovni: An object approach to real-time power system simulators," in Proceedings of the 1998 International Conference on Power System Technology, Beijing, China, April 1998, pp. 977-981, Powercom'98. [3] Jorge A. Hollman, J.R. Marti, "Real Time Network Simulation with PC-Cluster", IEEE Transactions on Power Systems, VOL. 18 No. 2, p563-569, May, 2003, [4] P.G. McLaren, R. Kufffel, R. Wierckx, J. Giesbrecht. L. Arendt, " A real time digital simulation for testing relays," IEEE Trans. On PWRD, Vol 7, No.l , pp207-213, January 1992 [5] Marti, J.R.; Linares, L.R., "Real-Time EMTP-based transients simulation," IEEE Transactions on Power Systems, Vol.9, No. 3, pp.1309-1317, August 1994. [6] Luis R. Linares R. "A Real Time Simulator for Power Electric Networks", M.A.Sc. thesis, The University of British Columbia, pp.15, 1993 [7] Yu, T.C.; Marti, J.R., "A Robust Phase-Coordinates Frequency Dependent Underground Cable Model (zCable) for the EMTP, ". IEEE Transactions on Transmission and Distribution, May 2002. [8] Moreira, F.; Hollman, J.A.; Linares, L.; Marti, J.R., "Network Decoupling by Latency Exploitation and Distributed Hardware Architecture," Proceedings of the International Conference on Power System Transients, Rio de Janeiro, Brazil, June 2001. [9] Linares, L.R.; Marti, J.R., "A Resynchronization Algorithm for Topological Changes in Real Time Fast Transients Simulation". Proceedings of the 14th Power Systems Computation Conference (PSCC 2002). Seville, Spain June 2002 [10] Kai Strunz, L.R. Linares, J.R. Marti, Oliver Huet, Xavier Lombard, "Efficient and Accurate Representation of Asynchronous Network Structure Changing Phenomena in Digital Real Time Simulators", IEEE Transactions on Power Systems, VOL. 15, NO. 2, pp. 586-591, May 2000 [II] Luis R. Linares R. "OVNI: (Object Virtual Network Integrator) A New Fast Algorithm for the Simulation of Very Large Electrical Networks in Real Time," PhD thesis, The University of British Columbia, June 2000 78 [12] Roberto Rosales, "Simulation Environment for Real-Time Power System Simulation", M.A.Sc. thesis, The University of British Columbia, Vancouver, BC, Canada, 1997 [13] "LabWindows/CVI Programmer Reference Manual", National Instrument, 1996 [14] "Microtran® Reference Manual - Transients Analysis Program for Power and Power Electronic Circuits Simulation", Microtran Power System Analysis Corporation, Canada, 1997 [15] Dai Nan, "Preprocessing tools for transient simulation programs at UBC", M.A.Sc thesis, The University of British Columbia, Vancouver, BC, Canada, 1999 [16] Jorge A. Hollman, "Real Time Distributed Network Simulation with PC-Cluster", M.A.Sc. thesis, The University of British Columbia, Vancouver, BC, Canada, 1999 [17] Jesus Calvino-Fraga, "Implementation of a Real-time Simulator for Protective Relay Testing", M.A.Sc. thesis, The University of British Columbia, Vancouver, BC, Canada, 1999 [18] Mark Minasi, "Secrets of Effective GUI Design", SYBEX, Canada, 1997 [19] Thomas H. Cormen, Charles E. Leiserson, Ronald L. Rivest. Clifford Stein, "Introduction to Algorithm", Second edition, The MIT Press, Cambridge, Massachusetts, 2001, p531-534 [20] Byron S. Gottfried " Schaum's Outline Theory and Problems of Programming with C", McGraw-Hill, 1990 [21] Dommel, H.W., "EMTP Theory Book", Microtran Power System Analysis Corporation, Vancouver, B.C., Canada, 2nd edition, May 1992. [22] Marti, J.R.; Linares, L.; Hollman, J.A.; Moreira, "OVNI: Integrated Software/Hardware Solution for Real-Time Simulation of Large Power Systems". Proceedings of the 14th Power Systems Computation Conference (PSCC 2002). Seville^ Spain June 2002. 79 I Appendix I Description of the Microtran Data Deck Description of the Microtran Data Deck The format of the data input file for the MT program is excerpted from the Microtran Reference Manual a nd 1 isted i n t he f ollowing t able. T he d ata d eck f ile i s d ivided i nto several sections according to the nature of the network components. The data file is a plain ASCII file and can be prepared directly using a text editor. Table 1-1: The Microtran's data deck file structure Item Description (1) Case identification card (2) Time card (3) Linear and non-linear branches $ Blank line (4) Switches and piecewise linear components $ Blank line (5) Sources $ Blank line (6) User-supplied initial conditions (7) Node voltage output $ Blank line if individual nodes specified in [7]. No blank line if "1" in column 2 used in [7]. (8) Point-by-point user-defined sources $ Blank line to terminate the data case NEXT DATA CASE NEXT DATA CASE $ Blank line to terminate set of cases 81 Appendix II Data Structures for the Four MISE Canvas Elements Data Structures for the Four MISE Canvas Elements Data structure for the Electrical and Control Element typedef struct { int controlID; /*Control ID of part body*/ int type; /*to indicate type of component*/ int or; /*Part orientation*/ int mi; /*Part mirroring*/ char name[16]; /*The name of the part in the library*/ int x; /*Horizontal position of part body*/ inty; /* Vertical position of part body*/ int h; /*horizontal pixel size of symbol bitmap*/ int v; /*vertical pixel size of symbol bitmap*/ unsigned char * bitmap[8]; int part; /*Control TJD of part value*/ int valvis; /*Value is visible or not*/ char value[80]; /*Part name shown in the schematic*/ int px; /*Relative horizontal position of part name*/ int py; /*Relative vertical position of part name*/ int ref; /*Control ED of part reference*/ int refvis; /*Reference is visible or not*/ char refname[ 16]; /*Reference name shown in the schematic*/ int rx; /*Relative horizontal position of ref name*/ int ry; /*Relative vertical position of ref name*/ char box; /*This part is in a selection box*/ int iout; /* masked output request parameter*/ char * net; /*This field requires some upgrade*/ } PartStruct; EXT PartStruct * part; /*pointer to part */ EXT int maxparts; /* maximum number of parts/ 83 Date Structure for the Line Element typedef struct { int used; /* indicate whether an existing line is used */ int x 1; /* x coordinate of the starting point */ int y l ; /* y coordinate of the starting point */ int x2; /* x coordinate of the ending point */ int y2; /* y coordinate of the ending point */ int nodeid; char nodename[13]; /*string for node names. It could be an int*/ int controlID; /*Control ID of line text*/ char label[13]; /*Given label name. This name overwrites nodename*/ int lx; /*Relative to x l * / int ly; /*Relative to y l * / char m; /*Marked line*/ char r; /*Revised line*/ char box; /*This line is in a selection box*/ } LineStruct; EXT LineStruct * line; EXT int maxlines; 84 Data Structure for the Junction Element typedef struct { int used; int x; int y; int nodeid; char nodename[13]; char box; } JunctStruct; /* indicate whether an existing junct is used*/ /* x coordinate of the junction point */ /* y coordinate of the junction point */ /*Used to get netlist. It could be an int*/ /*This junction is in a selection box*/ EXT JunctStruct * junct; EXT int maxjunct; Data Structure for the Text Label Element typedef struct { int controlID; /*Control ID of text message*/ char text[255 ]; /*Text*/ int x; /*Horizontal position of text*/ int y; /* Vertical position of text*/ char box; /*This text is in a selection box*/ } TextStruct; EXT TextStruct * text; EXT int maxtext; 85 Appendix III Explanation of the MISE's Main Menu Explanation of the MISE's Main Menu 1. File Menu Table III-1: File menu and its explanations Option Description Open. Opens and loads a schematic design from a file Save Saves a schematic design to a file Save As.. Saves the currently open schematic design into other file name New Creates a new schematic design while a file is open Print Opens the print dialog box Set paths Opens the set path dialog box to assign the locations of simulator, plotting program, data editor, and simulation output viewer Library Chooses an appropriate library for simulation Quit Exits the application. If there are unsaved, the confirmation message window is displayed. 2. Edit Menu Table III-2: Edit menu and its explanations Option Description Rotate Rotates the selected part by 90 degrees Mirror Mirrors the selected part Select Sets to the select mode to select parts or labels Connect Sets to the connect mode to draw wires Delete Deletes the selected parts Copy Copies the selected parts Paste Pastes the selected part(s) Node name Assigns a node name to a network node 3. Object Menu Table III-3: Object menu and its explanations Option Description Part Opens the part window and allows to select a part Wire Sets to the wire mode and allows the user to draw a wire Junction Sets to the junction mode and allows the user to draw a junction Text Allows the user to add a text label to the drawing schematic 87 4. Options Menu Table III-4. Options menu and its explanations Option Description Grid Disables or enables the grid of the canvas Refresh Refreshes the drawing canvas Raw Form Chooses the data form for each element 5. Net Menu Table III-5: Net menu and its explanations Option Description Crude Dumps out all the data for each element (N/A) Spice Produces the spice netlist from the schematic (N/A) Rtns Produces the R T N S netlist from the schematic (N/A) Microtran Produces the Microtran netlist from the schematic 6. Library Menu Table III-6: Library menu and its explanations Option Description Microtran Chooses the Microtran library R T N S Chooses the R T N S library Spice Chooses the spice library 7. Run Menu Table III-7. Run menu and its explanations Option Description Microtran Launches the Microtran simulator MTplot Launches the MTplot program View Input Launches the text editor to view the input file V iew Output Views the simulation output file 8. Help Menu Table III-8: Help menu and its explanations Option Description Help Launches the online help file About Provides the program and the copy right information 88 Speed Buttons Table III-9: Speed buttons and its explanations Speed Buttons Description Creates a new schematic drawing Opens and load a schematic from a file Saves the schematic drawing to a file Opens the print dialog box Enables/Disables the grids on the drawing canvas Deletes the selected parts Copes the selected parts 151 Pastes the parts from the clipboard Mirrors the selected part Rotates the selected part Sets into the select mode Sets into the wire mode • Sets into the junction mode HH Sets into the part mode rr Sets into the node assign mode A Adds the text label to the schematic drawing Launches the Microtran simulator Launches the MTplot program m Launches a text editor to view the simulation data deck file |H Launches a text editor to view the simulation output file 89 Appendix IV Explanation of the MISE Library Components Explanation of the MISE Library Components The following three tables list circuit elements created in the application library, they are simulation control table (Table IV-1), single-phase part table (Table IV-2), and multi-phase part table (Table IV-3). Column 1 for each table is the part symbol icon used in the schematic drawing. Column 2 is the parameter name, which are the parameters used to define the part in Microtran. Column 3 is the column positions, which specify the starting and ending positions of each corresponding parameter in the Microtran's deck card. Column 4 is the description, describing the values, or meaning of each parameter. These three tables present the status of the part modeling. Some of these parts only have their circuit symbols available. This appendix is a concise guide to help a user to build more circuit symbols. Table IV-1: Simulation control elements Part Symbol Parameter Column Position Descriptions C A S E TITLE 1-66 Any alphanumeric text to identify the case, except that the first four characters must not be blank. V j L 7 Case Identification Card IFILE 67-68 Meaningless for ac steady-state solutions at one frequency. Otherwise, if, < 0 Results are printed only and not saved on file for later plotting = blank, 0 or 1 Results are printed and saved on file for later plotting = 2 Results are not printed but only saved on file for later plotting X O P T 69-74 = 0 A l l inductance values on branch cards are interpreted as L in mH and converted by the program to L in H > 0 A l l inductance values on branch cards are read as reactances o)L in Q., based on the frequency XOPT (in Hz) and converted by the program to L in H . COPT 75-80 = 0 A l l capacitance values on branch cards are interpreted as C in uF, and converted by the program to C in F. > 0 A l l capacitance values on branches cards are read as caC in uS, based on the frequency COPT (in Hz), and converted by the program to C in F 91 0 e At 1-10 Step width (seconds). Transients wil l simulate step by step in intervals At at t = 0, At, ... Meaningless for ac. steady-state solutions. Time Card tmax 11-20 > 0 Maximum time for the transients simulations (seconds). = 0 program terminates after computation of the ac steady state solution. IOUT 21-23 Used to control the amount of printed output (parameter ignored if IFILE =2 on case identification card). Meaningless for ac steady state solutions. / Results are printed in every IOUT-th step. > 1 Results are not printed step by step. Instead, the program searches for maximum absolute values of each out quality and prints only these maxima. IPUNCH 24-26 > 0 Node voltage and branch current (plus capacitor voltage on series R L C branches) at the last time step are written into the "punch" file. = 0 Voltage and currents are not written into the punch file ISKIP 27-29 > 0 Only the results at every ISKJP-th computed step are for plotting. = 0 Every point are used for plotting e 30-37 Near-zero tolerance is used for checking matrix singularities. Unless it is non-zero, E wil l automatically be set to 10"8 I S T E A D Y 38 = / Complete printout of the ac steady-state solution. If = 0 then only the steady-state solution is computed. If W > 0, the steady-state solution is also the initial conditions for the transients simulations = 0 No complete printout of ac steady-state solution. If t ^ = 0, then the steady-state values of quantities selected for transients outputs are printed. IPOWER 39 Meaningless for ac steady-state solution. Otherwise, i f = 1 Values of current are replaced by values of instantaneous power. = 0 Normal output of current fxmni ft fvazx 40-47 48-55 56-63 Zero or blank for time domain transient simulation. If any of these parameters are nonzero, ac steady-state solution with automatic frequency variation is obtained. I F L U X 64 Normally zero or blank. If I F L U X = 1, then current jumps are avoided in piecewise linear inductance at the expense of current offsets from the origin. ISHORT 66 = 0 Sinusoidal voltage sources with T s t a r t > 1, or these whose frequency differs from the steady-state frequency, and non-sinusoidal voltage sources are shorted in the steady-state solutions. Current source of that type are ignored. = 1 The voltage sources of the type mentioned above are disconnected in the steady-state solution. ISWITCH 67 =0 The close and opening times are switches and thyristors are included in the printout. = 1 The closing and opening times of switches and thyristors are not printed. IOSCIL 68 =0 The critical damping adjustment scheme (CD A) is used to eliminate numerical oscillations. = 1 The critical damping adjustment scheme is not used. 92 P U S L E 69-76 =0 the gate pulse of thyristors is positive for a duration of Vi period in case of thyristors, or % period in case of anti-parallel thyristors >0 The gate pulse duration is specified by the user (in degrees). N P D E C 77-78 >0 Number of points per decade for logarithm frequency scans. <0 No request for logarithmic frequency scans Node Voltmeter 3-80 Node voltage is the voltage from node to ground. There are two options available: a) A l l node voltage desired, and b) Only some voltage desired. * Provide a single card with nothing else but a "1" in column 2. Branch Voltmeter IOUT 80 = 2 Branch voltage Vk- V m wil l be included in output H S r -Branch Ammeter IOUT 80 = 1 Branch current ^ w i l l be included in output (replaced by instantaneous power i f IPOWER = 1 on time card) Common Ground Common ground, used 6 space chars or blank for the ground as node names in cards 93 Table IV-2: Single phase circuit parts Part Symbols Parameter Column Position Descriptions Resistor ITYPE 1-2 = 0 or blank N O D E N A M E S 3-14 Specify two nodes by alphanumeric names. One name may be grounded (identified by six blanks) R 27-32 Specify resistance R in Cl Nonlinear Resistor ITYPE 1-2 = 92 N O D E N A M E S 3-14 Specify two nodes by alphanumeric names' R 15-24 Finite slope AV/AI in conducting region of first and third quadrants. ^saturation 35-44 Voltage where piecewise linear resistance changes between infinite and finite resistance Vsparkover 45-54 For a piecewise linear resistance alone, Vsparkover 0 -^switch 55-64 Series resistance in Cl a Time-varying resistor ITYPE 1-2 = 91 N O D E N A M E S 3-14 Specify two nodes by alphanumeric names N O D E N A M E S OF R E F E R A N C E B R A N C H 15-26 If the characteristic of the time-varying resistance is identical with that of a preceding reference branch, then the following storage-saving option may be used. Rstart 27-32 The time count for R(t) starts as soon as |V| >v s t a r t Inductor ITYPE 1-2 = 0 or blank N O D E N A M E S 3-14 Specify two nodes by alphanumeric names. One name may be grounded (identified by six blanks) L 33-38 Specify inductance L in mH or as caL in Cl depending on X O P T on case identification card) Nonlinear Inductor ITYPE 1-2 = 93 N O D E N A M E S 3-14 Specify two node names by alphanumeric names residual 15-24 = 0 initial flux is zero for cases with zero initial conditions or with initial conditions read in. > initial flux O residual L , 25-34 Unsaturated inductance value L i in mH or w L ! U 35-44 Unsaturated inductance value L 2 in mH or w L 2 ® saturation 45-54 Flux where piecewise linear inductance goes into saturation from slope L! to slope U. R switch 55-64 Series resistance in Cl H h Capacitor ITYPE 1-2 = 0 or blank 94 N O D E N A M E S 3-14 Specify two nodes by alphanumeric names. One name may be grounded (identified by six blanks) C 39-44 Specify capacitance C in uF or as (oC in uS (depending on COPT on case identification card) Series R L ITYPE 1-2 = 0 or blank N O D E N A M E S 3-14 Specify two nodes by alphanumeric names. One name may be grounded (identified by six blanks) R L 27-38 Specify resistance R in D. an inductance L in mH or as coL in Cl (depending on XOPT on case identification card) Series R L C ITYPE 1-2 = 0 or blank N O D E N A M E S 3-14 Specify two nodes by alphanumeric names. One name may be grounded (identified by six blanks) R L C 27-44 Specify resistance R in O, inductance L in mH or as coL in Q (depending on XOPT on case identification card), and capacitance C in uF or as <oC in uS (depending on COPT on case identification card) Pi Circuit ITYPE 1-2 Number the branches ITYPE = 1,..,50. N O D E N A M E S 3-14 Specify the nodes at the end of each branch 1,2,..N, by alphanumeric names. -N O D E N A M E S OF R E F E R A N C E B R A N C H 15-26 If branch data are identical with those on a preceding set of N (reference) branch cards, then the following storage-saving options maybe used: Repeat node names of the first branch of that preceding set of reference branch cards in the provided columns 15-26 of the first branch in the same sequence and leave R, L , and C blank. R L C 27-80 Caution: C on the card is the total capacitance. The program divides it by 2 and inserts 14 C at both ends of the pi circuit. ' 3— Switch ITYPE 1-2 = 0 or blank N O D E N A M E S 3-14 Specify two nodes by alphanumeric names Tclose 15-24 > 0 Closing time in seconds. Switch is initially open (including the initial ac steady state) and will close at the time step closest to T c i o s e <0 the negative sign indicates to the program that the switch is already closed in the initial state at t = 0. T 1 open 25-34 Opening time in second C U R R E N T M A R G I N 35-44 = 0 Switch opens after the timestep closest to T o p e n as soon as the switch current iswitch j has gone through zero. > 0 Switch opens after the time step closest to T o p e n as soon as | i s w i t c h | < CURRENT M A R G I N or as soon as the switch current has gone through zero. 95 -^switch 55-64 Series resistance in Cl * Diode ITYPE 1-2 = -1 NODE N A M E S 3-14 Specify two nodes by alphanumeric names. Tclose 15-24 = 0 The diode is OFF state initially and turns on as soon as V k - V m > V c > 0 The diode turns on after t > T c l o s e as soon as V k - V m > V c < 0 The negative sign indicates to the program that the diode is already conducting in the initial state at t = 0 Tdelay 25-34 >0 after a diode is turned on, it will not turn off during the time interval T&by, counted from the beginning of conduction, even i f the current goes negative during this time interval. < 0 T d e i a v is zero CURRENT M A R G I N 35-44 = 0 Diode turns off whenever current cross zero from a positive to a negative value, provided the time interval T d e i a y has elapsed since the beginning of conduction (normal value) > 0 Diode turns off whenever current magnitude | ii™ | < C U R R E N T M A G I N , after elapse of time interval T d e i a y since the beginning of conduction P 45-54 < 0 Use any negative real number to signal that it is a diode rather than a thyristor. ^switch 55-64 = 0 The diode resistance in the O N state is zero > 0 Diode resistance in Cl V 0 65-70 = 0 No voltage offset in i-v curve > 0 Voltage offset in i-v curve SPECIAL 77 = 0 Normal diode operation Thyristor Most parameters are same as diode P 45-54 > 0 "Modified" firing angle (in degrees), which defines the instant counted from t = 0 where the first gate pulse appears. f 71-76 Frequency in Hz for periodic triggering of thyristor. ID No. 78-79 = 0 the modified firing angle P is fixed > 0 Identification number between 1 and 51, which uniquely identifies the thyristor i f its modified firing angle /? is automatically changed by A/? in a user-supplied subroutine A L P H A . Anti-parallel Thyristors (TRIACS) ITYPE 1-2 = -2 The modified firing angle /? applies to the first thyristor to be turned on between 0 and 180. The modified firing angle for the second thyristor wil l be p +180. The V 0 offset is not allowed for anti-parallel thyristors. 96 Gate Turn-Off Thyristor (GTO) A l l parameters are same as thyristor. Simply set Tdeiay= conduction time after turn on (in second) C U R R E N T M A R G I N = 10 2 0 C P ITYPE 1-2 Number the phase ITYPE = -1, -2, -3, - N . Constant Parameter N O D E N A M E S 3-14 Specify the nodes at the end of each phase by alphanumeric names Transmission Line N O D E N A M E S OF R E F E R E N C E B R A N C H 15-26 If the parameters for this line are identical to those of another N phase line, then the same rule apply. R' 27-32 Resistance (Q/unit length). L ' 37-46 Inductance (uH/unit length) i f XOPT = 0; or reactance (£2 /unit length) if XOPT >0 C 47-56 Capacitance (uF/unit length) if COPT = 0; or reactance (uS/unit length) i f COPT >0 Z c 37-46 Surge impedance. Value must be non-zero W A V E SPEED 47 56 Wave speed. Value must be non-zero. T R A V E L TIME 47-56 Travel time. Value must be non-zero L E N G T H 57-66 Length in same unit as used for R', L ' or o L ' , C or coC INPUT OPTION 67-68 = 0 for R', L ' or caL', C or coC = 1 for Z c and wave speed = 2 for Z c and travel time M O D E L 69-70 = 0 or blank Program wil l used the lumped resistance line model = 1 Program wil l use the distortionless model = -1 Flag for the frequency dependent line model N P H A S E 71-72 = 0 or blank Line is assumed to be balanced >0 Number of phase of an untransposed line F D A l l the parameters are same as the constant Frequency-Dependent Transmission Line parameter transmission line. M O D E L 69-70 = -1 Flag for the frequency dependent line model a< > l ITYPE 1-2 = 18 Ideal Transformer N O D E N A M E S 3-26 Specify the four node names by alphanumeric names. 97 t 27-32 Turn ratio t a Auto Transformer Not Available <& 3 Winding Transformer Not Available C M < 2 > Wye-ungrounded Synchronous Machine Card 1 ITYPE 50 ITYPE = 50 must be specified on the card for the first winding I. For winding II and HI, ITYPE is ignored. Card 1 to 3 contain the node names for each of the armature windings and additional data N O D E N A M E S 3-14 Alphanumeric names of nodes at both ends of armature windings. On line 1 for winding I, on line 2 for winding II, on line 3 for Winding III / 15-24 Rated frequency in Hz. It assumes that the machine is operating at this frequency in steady state. |E"| or | V t e r m i n a j | 25-34 For the first winding I, the peak magnitude of the internal voltage l E ' V 9 behind the negative sequence impedance. T H E T A 35-44 Angle for E " or V t e r m i n a I in degrees 1 Itenniiial! 45-54 In the first winding I, the peak magnitude of terminal current ILerminail e*9 flowing into the network (or out of the machine). A L P H A 55-64 Angle for I,erminai in degrees Card 2 r^ating 15-24 Three-phase apparent power rating (always in M V A ) for wye- and delta- connections. r^ating 25-34 R M S voltage rating (always in K V , independent of unit used in E" . ICONVERT 65-70 Optional Parameter for controlling the conversion of test data (synchronous transient and subtransient reactance, and time constants) into self and mutual impedance required by Microtran. = blank or 0 Canay's data conversion is used.. = 1 The minor refinement is omitted. = -1 The approximate conversion is used. 98 INPUT OPITION 71-75 = blank or 0 standard input option: the machine is described by synchronous, transient and subtransient reactance and time constant (standard test data). = nonzero Nonstandard input option: The machine is described by self and mutual impedance Card 3 -^internal 15-24 Internal Resistance in Q -^ internal 25-34 Internal reactance in Q, Delta-ungrounded Synchronous Machine It is same as the wye-winding-ungrounded synchronous machine. Sinusoidal Voltage Source ITYPE 1-2 = 14 a(t) = AMAX cos [ro (t-T s t a r t) +<p„] a(t) = A M A X cos [ ro(t-Tstart +T0)1 N O D E N A M E S 3-8 Specify the node to which the source is connected by its alphanumeric name. ISOURCE 9-10 > 0 Indicates it is voltage source A -^ max 11-20 The amplitude of the wave / 21-30 The frequency of the voltage source T0 or cp0 31-40 The initial phase delay A , 41-50 Initial starting voltage ti 51-60 Tstan 61-70 T AStOD 71-80 0 Step Function Voltage Source ITYPE 1-2 = 11 a(t) = A M A X for T s t a r t<t< T s t o p The other parameters are the same as Sinusoidal Voltage Source Surge Function Voltage Source ITYPE 1-2 = 15 a(t) = A™, ( e a t l - e^ 'V with t, = t - T 5 t a r t N O D E N A M E 3-8 Specify the node to which the source is connected ISOURCE 9-10 0 indicates it is a voltage source Amax Or A c r e s t 11-20 The amplitude of the surge function TFR 21-30 Virtual front time Ttail 31-40 Virtual time to half value TSTART 61-70 The starting point of surge function TSTOP 71-80 The end point of surge function <$> Triangular Voltage Source ITYPE 1-2 = 13 The other parameters are the same as Sinusoidal Voltage Source 99 ITYPE 1-2 = 12 v Ramp Voltage Source ITYPE 1-2 = 16 DC Voltage Source A 11-20 The amplitude of the dc source ITYPE 1-2 = 16 Current-Controlled Voltage Source Cardl N O D E N A M E S 3-8 Node name on the cathode side M O D E 9-10 = 1 i f source operates initially on constant current control = 2 i f source operates initially at maximum voltage = 3 i f source operates initially at minimum voltage K 11-20 Regulator gain K in equation G(s) = K(l+sT 2)/[( l+sT,)( l+sT3)] Vdc(0),ISetting 21-30 Initial steady-state dc voltage i f M O D E = 1, or current setting Isettineif M O D E =2 or 3. T, , T 2 T 3 31-60 Time constants (in seconds) in equation G(s) = K(l+sT2)/r( l+sT0( l+sT 3)l Idc 61-70 Initial steady-state dc current Card 2 N O D E N A M E 3-8 Node name on anode side k , k 2 11-30 Coefficients in equation V d c = k,+ k 2 e a ^dcmin.^dcmax 31-50 Minimum and maximum steady-state dc voltage ISOURCE 9-10 < 0 Indicates it is current source The other parameters are same as sinusoidal voltage supply Sinusoidal Current Supply 100' Table IV-3. Three-phase circuit elements Part Symbols Parameter Column Position Descriptions 3(p Resistor Deck card is same as its single phase part 3<p Inductor Deck card is same as its single phase part 3(p Capacitor Deck card is same as its single phase part 3tp Series R L Deck card is same as its single phase part 3(p Series R L C Deck card is same as its single phase part re X 3(p Pi Circuit Deck card is same as its single phase part 3 (p Switch Deck card is same as its single phase part 3 <p 6-valve Thyristor Bridge Not available C F> U 3 <p Constant Parameter Transmission Line Deck card is same as its single phase part F D 3 (p Frequency Dependent Transmission Line Deck card is same as its single phase part n 6 (p Unbalanced Constant Parameter Transmission Line Not available 3 3 ) W ( 6 (p Frequency Dependent Transmission Line Not available 101 Not available 3 <p Three-Winding Transformer 3 cp Del-Wye Transformer Not available h § 8 ^ 3 (p Del-Wye Grounded Transformer Not available H § g H 3 cp Del-Del Transformer Not available 3<p Wye-Wye Grounded Transformer Not available 3 (p Auto Transformer Not available 3 cp Auto Transformer Not available 3 cp Sinusoidal Voltage Source Not available Not available 3cp Wye-Connection Sinusoidal Grounded Voltage 102 ( / \ ) 3(p Del-Connection Sinusoidal Voltage Supply Not available 3(p Sinusoidal Current Supply Deck card is same as its single part 103 


Citation Scheme:


Citations by CSL (citeproc-js)

Usage Statistics



Customize your widget with the following options, then copy and paste the code below into the HTML of your page to embed this item in your website.
                            <div id="ubcOpenCollectionsWidgetDisplay">
                            <script id="ubcOpenCollectionsWidget"
                            async >
IIIF logo Our image viewer uses the IIIF 2.0 standard. To load this item in other compatible viewers, use this url:


Related Items