Top Banner

of 43

MainAn Optimizing Compiler for Floating Point Operations

Jul 04, 2018

Download

Documents

Praful Gupta
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
  • 8/15/2019 MainAn Optimizing Compiler for Floating Point Operations

    1/43

    An Optimizing Compiler for Low-Level Floating

    Point Operations

    by

    Lucien William Van Elsen

    Submitted to the Department of Electrical Engineering and Computer

    Science

    in partial fulfillment of the requirements for the degree of 

    Bachelor of Science in Computer Science and Engineering

    at the

    MASSACHUSETTS INSTITUTE OF TECHNOLOGY

    June 1990

    c   Massachusetts Institute of Technology 1990. All rights reserved.

    Author . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .Department of Electrical Engineering and Computer Science

    May 18, 1990

    C e r t i fi e d b y . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

    William J. Dally

    Associate Professor

    Thesis Supervisor

    Accepted by . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

    Arthur C. Smith

    Chairman, Department Committee on Graduate Theses

  • 8/15/2019 MainAn Optimizing Compiler for Floating Point Operations

    2/43

    2

  • 8/15/2019 MainAn Optimizing Compiler for Floating Point Operations

    3/43

    An Optimizing Compiler for Low-Level Floating Point

    Operations

    by

    Lucien William Van Elsen

    Submitted to the Department of Electrical Engineering and Computer Scienceon May 18, 1990, in partial fulfillment of the

    requirements for the degree of Bachelor of Science in Computer Science and Engineering

    Abstract

    In this thesis, I designed and implemented a compiler which performs optimizationsthat reduce the number of low-level floating point operations necessary for a specifictask; this involves the optimization of chains of floating point operations as wellas the implementation of a “fixed” point data type that allows some floating pointoperations to simulated with integer arithmetic. The source language of the compileris a subset of C, and the destination language is assembly language for a micro-floatingpoint CPU. An instruction-level simulator of the CPU was written to allow testingof the code. A series of test pieces of codes was compiled, both with and withoutoptimization, to determine how effective these optimizations were.

    Thesis Supervisor: William J. DallyTitle: Associate Professor

    3

  • 8/15/2019 MainAn Optimizing Compiler for Floating Point Operations

    4/43

    4

  • 8/15/2019 MainAn Optimizing Compiler for Floating Point Operations

    5/43

    Acknowledgments

    This is the acknowledgements section. You should replace this with your own ac-

    knowledgements.

    5

  • 8/15/2019 MainAn Optimizing Compiler for Floating Point Operations

    6/43

    6

  • 8/15/2019 MainAn Optimizing Compiler for Floating Point Operations

    7/43

    Contents

    1 Introduction 13

    1.1 Background . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13

    1.2 Problem Statement . . . . . . . . . . . . . . . . . . . . . . . . . . . . 141.3 Objectives . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14

    1.3.1 Report Outline . . . . . . . . . . . . . . . . . . . . . . . . . . 15

    2 Background 17

    2.1 Indian Power Distribution System . . . . . . . . . . . . . . . . . . . . 17

    2.2 The voltage drop . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18

    2.3 Voltage Control . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19

    2.3.1 Tap-changing transformers . . . . . . . . . . . . . . . . . . . . 19

    2.3.2 LDC system (Line Drop Compensation) . . . . . . . . . . . . 19

    2.3.3 Compensation with reactive elements . . . . . . . . . . . . . . 20

    2.4 On Load Tap Changing Transformer . . . . . . . . . . . . . . . . . . 20

    2.5 Controllers Available . . . . . . . . . . . . . . . . . . . . . . . . . . . 21

    3 Modelling OLTC transformer control system 23

    3.1 Voltage Regulator and Time-Delay Elements . . . . . . . . . . . . . . 24

    3.2 Motor Drive Unit . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24

    3.3 Tap Changing Transformer . . . . . . . . . . . . . . . . . . . . . . . . 25

    3.4 Measuring transformers . . . . . . . . . . . . . . . . . . . . . . . . . . 26

    3.5 Line-Drop Compensators (LDC) . . . . . . . . . . . . . . . . . . . . . 26

    7

  • 8/15/2019 MainAn Optimizing Compiler for Floating Point Operations

    8/43

    4 Controllers 27

    4.1 The Classical Controller . . . . . . . . . . . . . . . . . . . . . . . . . 28

    4.2 Type-1 Fuzzy Logic Control . . . . . . . . . . . . . . . . . . . . . . . 29

    4.2.1 Linguistic Variables . . . . . . . . . . . . . . . . . . . . . . . . 304.2.2 Membership Functions . . . . . . . . . . . . . . . . . . . . . . 30

    4.2.3 Fuzzy Rules . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30

    4.2.4 Fuzzy Set Operations . . . . . . . . . . . . . . . . . . . . . . . 30

    4.2.5 Defuzzification . . . . . . . . . . . . . . . . . . . . . . . . . . 31

    4.2.6 Type-1 Fuzzy Logic Controller for OLTC Transformer . . . . . 32

    4.3 Type-2 Fuzzy Logic Control . . . . . . . . . . . . . . . . . . . . . . . 34

    5 Experimental Results and Discussions 37

    5.1 The Classical Controller . . . . . . . . . . . . . . . . . . . . . . . . . 37

    A Tables 39

    B Figures 41

    8

  • 8/15/2019 MainAn Optimizing Compiler for Floating Point Operations

    9/43

    List of Figures

    B-1 Armadillo slaying lawyer. . . . . . . . . . . . . . . . . . . . . . . . . . 41

    B-2 Armadillo eradicating national debt. . . . . . . . . . . . . . . . . . . 42

    9

  • 8/15/2019 MainAn Optimizing Compiler for Floating Point Operations

    10/43

    10

  • 8/15/2019 MainAn Optimizing Compiler for Floating Point Operations

    11/43

    List of Tables

    A.1 Armadillos . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39

    11

  • 8/15/2019 MainAn Optimizing Compiler for Floating Point Operations

    12/43

    12

  • 8/15/2019 MainAn Optimizing Compiler for Floating Point Operations

    13/43

    Chapter 1

    Introduction

    The several components of a power system have a specific purpose. The generators

    produce the power, the transmission grid makes it available all around the country

    and the distribution grid links the transmission grid to the consumers. The last step

    might seem the simplest but it raises lots of issues. An important one is the respect of 

    voltage limits: voltage is supposed to be within a range around the nominal value. A

    voltage too low involves a bad functioning or no functioning of the appliances supplied

    while a voltage too high might damage them permanently. It is thus very important

    to keep the voltage within the limits not to disturb the final consumers.

    1.1 Background

    In nowadays systems, due to existing load patterns and fast acting controllers on

    the load level, fast and significant changes of the load may occur. Also, because of 

    the growing number of renewable energy producers which are directly connected to

    the distribution grid, producers tend to increase the voltage at their connection point

    when they generate electricity, and in some scenarios of high production and low load,

    the upper limit of the voltage might be exceeded. This may cause, in turn, fast and

    significant changes of the voltage magnitudes at the distribution buses. On the other

    hand, there is a need to supply high quality electric power to the customers.

    Since the voltage deviations at a distribution bus are together with the frequency

    13

  • 8/15/2019 MainAn Optimizing Compiler for Floating Point Operations

    14/43

    the most important factors defining the quality of delivered electricity, the distribution

    grid needs thus new methods to be more flexible and be able to deal with both the

    new overvoltage problems as well as the usual under voltage problem in case of high

    load in winter, which is not always handled well.One of the possible solutions to this problem is the use of on-load tap changing

    transformer (OLTC) in which tap changes are initiated automatically based usually on

    the local measurements. Thus, the aim of our project is to design efficient controller

    for OLTC to address the above mentioned problems.

    1.2 Problem Statement

    The literature review of the concerned subject is concluded by the problem description

    listed below:

    •   How to design an efficient controller to regulate the position of the tap of OLTC?

    •  How to regulate the frequency of tap changes as much as possible?

    •  How could tap-changer operation as a function of Voltage error (due to loadchanges) and initial tap position?

    1.3 Objectives

    •  In this project, the main issue is to design the voltage controller for on-load tap-

    changers on the transformers regulating the voltage within the desired range of 

    operation. We implemented the Type-2 Fuzzy Logic Controller for the TapChanging Transformer and compared the results of its operation with the avail-

    able methods in the literature.

    •  Another objective of the project is to show the real time simulation of Volt-

    age Control using different types of controller for tap change mechanism and

    compare the results.

    14

  • 8/15/2019 MainAn Optimizing Compiler for Floating Point Operations

    15/43

    The proposed study method will be tested using the Simulink MatLab 2014 and also

    implemented on Real Time Digital Simulator (RTDS).

    1.3.1 Report Outline

    The organization of the report is as follows.

    •  Chapter 2 gives a large background on Indian Power Distribution System, the

    tap changing mechanism of the transformer and the state of the art methods

    used for other tap changing control techniques.

    •  Chapter 3 gives a detailed explanation of the modeling of the on Load Tap

    Changing transformer (OLTC).

    •  Chapter 4 discusses about various Classical and Fuzzy control techniques and

    comparison with the proposed method of control for tap changing.

    •  Chapter 5 discusses the simulation results of Simulink and RTDS.

    •  Chapters 6 and 7 gives conclusion of report and the scope for future work.

    15

  • 8/15/2019 MainAn Optimizing Compiler for Floating Point Operations

    16/43

    16

  • 8/15/2019 MainAn Optimizing Compiler for Floating Point Operations

    17/43

    Chapter 2

    Background

    Present distribution systems cover comparatively large geographic territories and have

    numerous interconnections and distribution points of various voltages. At any point

    where the change of the voltage level is required, distribution transformers are applied.

    These transformers are equipped with tap changing mechanism to restrict voltage

    fluctuations at the consumer end.

    2.1 Indian Power Distribution System

    Electric power is normally generated at 11-25kV in a power station. To transmit over

    long distances, it is then stepped-up to 400kV, 220kV or 132kV as necessary. Power is

    carried through a transmission network of high voltage lines. Usually, these lines run

    into hundreds of kilometres and deliver the power into a common power pool called

    the grid. The grid is connected to load centres (cities) through a sub-transmission

    network of normally 33kV (or sometimes 66kV) lines. These lines terminate into a

    33kV (or 66kV) substation, where the voltage is stepped-down to 11kV for power

    distribution to load points through a distribution network of lines at 11kV and lower.

    The power network, which generally concerns the common man, is the distribu-

    tion network of 11kV lines or feeders downstream of the 33kV substation. Each 11kV

    feeder which emanates from the 33kV substation branches further into several sub-

    sidiary 11kV feeders to carry power close to the load points (localities, industrial areas,

    17

  • 8/15/2019 MainAn Optimizing Compiler for Floating Point Operations

    18/43

    villages, etc.,). At these load points, a transformer further reduces the voltage from

    11kV to 415V to provide the last-mile connection through 415V feeders (also called

    as Low Tension (LT) feeders) to individual customers, either at 240V (as single-phase

    supply) or 415V (as three-phase supply). A feeder could be either an overhead lineor an underground cable.

    2.2 The voltage drop

    Voltage has a different value everywhere in the network. Both consumers and pro-ducers have an impact on voltage because they generate currents through the lines.

    Consumption decreases the voltage and production increases it. This is valid for both

    active and reactive power. A good way to illustrate it is KappâĂŹs formula. We

    assume that the 3-phase network is balanced and work with the 1-phase equivalent.

    The system is very simple: a transmission line with a constant voltage on one side

    and a load (or producer) on the other side. The voltage variation becomes:

    ∆V   ≈ R · V   · cosϕ + X  · L · sinϕ   (2.1)

    where ϕ is the power factor of the load (or producer).

    Moreover, the definitions of the active and reactive powers are

    P   = 3 · V   · I  · cosϕ   (2.2)

    Q = 3 · V   · I  · sinϕ   (2.3)

    ∆V   = R · P  + X  ·Q

    3 · V   (2.4)

    This approximate expression of the voltage variation shows what was said ear-

    18

  • 8/15/2019 MainAn Optimizing Compiler for Floating Point Operations

    19/43

    lier: any production, active or reactive, increases the voltage and any consumption

    decreases it. Another conclusion that can be drawn is that the voltage drop due to

    active production or load depends on the resistance of the line and the reactive one

    on the reactance of the line. This is important because in distribution networks andespecially in the LV network, the resistances of the lines are greater than their reac-

    tances. The result is that active power, both production and consumption, has more

    impact on the voltage variations than reactive power. This is actually the opposite

    of the transmission grid where the resistance of the lines is small compared to the

    reactance and it is even often neglected. In our case, the reactance is smaller but not

    negligible, that is why it is still interesting to test the strategies using reactive power

    such as capacitor banks.When Low and high voltages occur?

    2.3 Voltage Control

    There are several methods to control the voltage in order to keep high quality elec-

    tricity supply. Some of them are introduced below:

    2.3.1 Tap-changing transformers

    A tap changer can vary the number of turns in one side of the transformer and

    thereby, change the transformer ratio. Normally, this can vary between 10-15% in

    steps of 0.6-2.1%. There are several options to design the control of the voltage. One

    of them is to set a nominal value of the voltage with a deadband in a point of the

    line, and to control it with an integral controller.

    2.3.2 LDC system (Line Drop Compensation)

    It is based on calculating the voltage drop knowing the reactance and resistance of the

    line and then, applying the set voltage based on these values with the tap changers

    of the transformers.

    19

  • 8/15/2019 MainAn Optimizing Compiler for Floating Point Operations

    20/43

    2.3.3 Compensation with reactive elements

    For mainly reactive networks voltage is correlated with the reactive power so, one way

    to control it is to connect compensators and reactors in the nodes. In distribution

    lines, there are several methods to control the power from the reactive elements like

    switched fixed capacitors/inductors, Static Var Compensator "SVC" or the static

    synchronous compensator (STATCOM). They are based on measuring the line voltage

    and comparing it with a given reference. So, we connect capacitive compensators if we

    have to increase the voltage or we connect reactive compensation if we have to decrease

    it. This method depends totally on the R/X ratio of the line. The compensation

    with reactive elements is more useful with a low resistance cable, i.e. a cable with

    a low R/X ratio, because the reactive power has a larger impact on voltage. In a

    transmission network, that uses overhead lines and transformers, this R/X ratio is

    usually low, around 0.1, so this would be a good tool to control the voltage. However,

    in distribution lines frequently underground cables are used, with a higher resistance

    and R/X ratio around 0.5-1. That means that reactive compensation is not as much

    efficient as in transmission lines but these compensation methods are also used in

    distribution systems.

    2.4 On Load Tap Changing Transformer

    Transformers are dimensioned for specific uses. There are very big ones able to

    transmit great amounts of power such as the ones linking the large power plants to

    the transmission network. Other ones used in domestic appliances are very small.

    Their characteristics are of course very different. Focusing on the various MV/LV

    transformers (20kV/400V), the ones with a higher rated value have lower impedances,

    which means that the copper losses and voltage drop are smaller. On the other hand,

    the iron losses are greater in transformers with higher rated values. Transformers

    are chosen based on the power transmitted by them but these properties could be

    interesting for our voltage problems.

    The way a tap changer operates is straight-forward. As the transformation ratio

    20

  • 8/15/2019 MainAn Optimizing Compiler for Floating Point Operations

    21/43

    depends on the number of turns of the primary and secondary coils, changing one of these numbers changes the ratio. For example, decreasing the voltage at the secondary

    side can be done by increasing the number of turns of the secondary coil or decreasing

    the number of turn of the primary coil because it increases the transformation ratio.

    It seems technically simple but the constraints on the system are great. Most of these

    transformers make the changeover mechanically, which creates arcing and deteriorates

    the system. As a result, the device needs a lot of maintenance and even then the tap

    changer is the main reason of faults happening in transformers. The best way to slow

    down the deterioration and limit the faults is to make as few changeovers as possible.

    The control of such devices is usually quite simple. There is a node in the network,

    which can be the secondary side of the transformer or another one farther, where the

    voltage is set to a desired value. If the voltage at this point becomes too far away

    from this value for a certain 22 period (60 seconds for example), the tap setting is

    changed until the voltage gets back close enough to the set value. This is a good

    strategy when a bus can represent accurately enough the whole network, which is

    often true in MV networks. However it does not seem to fit very well LV networks

    where the voltage might vary a lot depending on the busses, even consecutive ones.

    2.5 Controllers Available

    The main function of distribution voltage control equipment is to reduce the number

    of tap changing operation which help in decreasing the error between the Sending End

    Voltage (SEV) and the Sending End Reference Voltage (SERV) and hence improve

    the characteristics of voltage signal. However, voltage control and frequency of tap

    changer are in a trade-off relationship, so it is hard to find solution which optimizes

    the both parameter. Moreover, the conventional voltage control equipment lacks

    intelligent judgemental skill, so they have the limitation of voltage control.

    21

  • 8/15/2019 MainAn Optimizing Compiler for Floating Point Operations

    22/43

    Artificial Intelligence (AI) techniques for controlling the ULTC are mainly used

    to handle this issue. The classical approach uses inverse-time delay between the tap

    changes based on voltage error. In this approach, voltage error is taken as the only

    input; however, time delay should also depend on other parameters such as the presenttap position etc.

    Kojima et al.[4] uses approach of ANN to control transformer taps and shunt

    capacitors simultaneously. In this method Artificial Neural Network is first trained

    for this, they need many data for the training, and it is hard to get sufficient input data

    for the optimal training. The tap control can be treated as expert control problem,

    which depends on a number of factors such as the direction of the last tap change,

    the present tap position with respect to the limits, the last delay applied, etc. Fuzzylogic implement non-linear mapping of these inputs to action and hence it suit well

    for this kind of applications.

    22

  • 8/15/2019 MainAn Optimizing Compiler for Floating Point Operations

    23/43

    Chapter 3

    Modelling OLTC transformer control

    system

    The components are used for OLTC control system help in changing the transformer

    turn ratio and hence form voltage-reactive (or VAR) flow control .The main part

    of the system is automated controller. The main function of this controller is to

    detect voltage error by comparing voltage variation with the reference voltage value

    at the controlled bus and it also gives command to motor drive unit associated with

    tap changer system. Apart from controller and motor drive unit, this system also

    includes measuring transformer (current and potential transformer), tap changing

    transformer, tap changing mechanism and compensators. OLTC control system is

    step by step control system which is slow, discontinuous and also electromechanical

    in nature. Although OLTC control system consist of simple devices, which can be

    modelled mathematically easily but overall system becomes complex because of non-

    linearity and saturation.

    The general block diagram of an OLTC transformer automatic control system

    consists of the following different parts:

    •  OLTC transformer with tap-changing mechanism

    •  Motor-drive unit

    •  Interlocking protective devices

    23

  • 8/15/2019 MainAn Optimizing Compiler for Floating Point Operations

    24/43

    •  Voltage regulator (includes measuring element, time-delay element and line-

    drop compensator)

    •  Measuring-current and potential transformers

    •  Additional auxiliary equipment

    3.1 Voltage Regulator and Time-Delay Elements

    Voltage error is calculated as:

    ∆V   = V 2r − V 2m   (3.1)

    where

    V 2r is the transformer secondary reference voltage(in pu) V 2m is the measured voltage,

    after compensating the line drop, (in pu)

    3.2 Motor Drive Unit

    Motor Drive unit is responsible for driving the tap changer mechanism of the OLTC

    transformer so that it can take step by step changes. This integral component can be

    represented as a time-delay relay element. Tap position is changed using the following

    mechanism:

    ∆n =

    0,   if  t ≤ T m, b =  arbitrary1,   if  t ≥ T m, b = −1

    −1,   if  t ≥ T m, b = +1

    New tap changer position can be determined using

    ni =  ni−1 + ∆ni   (3.2)

    24

  • 8/15/2019 MainAn Optimizing Compiler for Floating Point Operations

    25/43

    Transformer turn ratio becomes:

    ai = 1 + ni∆a = 1 + (ni−1 + ∆ni)∆a   (3.3)

    a =

    ai,   if   − am ≤ ai  ≤ am

    +am,   if  ai>am

    −am,   if  ai

  • 8/15/2019 MainAn Optimizing Compiler for Floating Point Operations

    26/43

    3.4 Measuring transformers

    Potential transformers and Current transformers, both, are assumed to be ideal loss-

    less components:

    mPT   =  V   ′2r

    V   ′′2 r  (3.6)

    mCT    =  I ′2r

    I ′′2 r  (3.7)

    where V   ′2r  and  V   ′′

    2r  are PT primary and secondary voltages in pu

    and  I ′2r  and  I ′′

    2r  are CT primary and secondary currents in pu

    3.5 Line-Drop Compensators (LDC)

    Since PT and CT measure secondary voltages and currents of the transformer, it

    becomes necessary to accomodate the impedance losses that takes place in the trans-

    mission lines distributing power to the consumers. Thus the impedance losses are

    subtracted for compensation of the voltage drop across the transmission line.

    Line voltage drop  V̄ c  can be formulated as follows:

    mPT  V̄ c  =  Rc + jX c Ī ′′2mPT   = k(RL + jX L)Ī 2   (3.8)

    where  Z̄ L =  RL + jX L is the line impedance (in ohms).

    For calculating the measuring voltage  V 2m,

    26

  • 8/15/2019 MainAn Optimizing Compiler for Floating Point Operations

    27/43

    Chapter 4

    Controllers

    Goals that are essential for the control algorithm of any tap mechanism are as follows:

    •  Keep minimum voltage deviations at the secondary terminal whose end users

    are the customers. The target of the tap control mechanism must be to restrict

    the voltage error limits to a pre-defined desired value, (this value is not the

    voltage error at transformer secondary, but at some distance, near consumers).

    This makes necessary for the control system to measure the load or transformer

    current to accommodate for the compensation due to active and reactive losses

    in the transmission line.

    •  Under non-usual circumstances like the failure of motor drive unit, system

    faults, overload of the transformer, tap changer failure, etc. operation of the

    tap changer mechanism must be restrained to avoid any further losses.

    •   Frequency of tap changes must be reduced as much as possible so that operationof tap changer can be restrained at the time of sudden load changes.

    Objective (1) is the primary target for any tap changer mechanism; Objective (2)

    covers for any limitations, while objective (3) defines the optimum working condi-

    tions for the tap changer mechanism, which is still responsible for high percentage of 

    internal system faults in distribution transformers.

    27

  • 8/15/2019 MainAn Optimizing Compiler for Floating Point Operations

    28/43

    Tap Changer mechanism would normally function according to the given set prop-

    erties:

    •  Tap changing mechanism is slow acting (it can take from few milliseconds to

    seconds for a single change in the tap position). Thus, whole cycle would take

    around tens of seconds to bring voltage to desired range.

    •  It is discontinuous (varied actions can be taken for same set of inputs making

    the system more dynamic).

    •  It takes action in steps (change in tap position is discrete, either +1 or -1 , not

    continuous, thus, each change in tap position is equivalent to small percentageof change in transformer turns ratio )

    4.1 The Classical Controller

    The classical controller works on the principle of inverse time characteristics of the

    delay applied between the step changes of the tap. It has a configuration of a bang-

    bang type controller with a specified degree of bandwidth set according to the desiredworking range. Its results are discussed to show comparison with more advanced

    controllers. In classical controller, time delay between the step changes should vary

    inversely with the voltage variations. Higher time delay for low voltage deviations and

    vice versa to reduce the number of unnecessary tap changes. Thus the mathematical

    model for the time-delay relay element is as follows:

    b =

    0,   if  t ≤ T d, e =  arbitrary

    1,   if  t ≥ T d, e = −1

    −1,   if  t ≥ T d, e = +1

    Where   T d   is the adaptive time-delay (in seconds). For some regulators,   T d   is

    independent of any parameter (  T d=T do), thus, it is a constant. For other regulators

    with inverse time-delay characteristics, it is a function of votage error  (∆V  ), dead-

    28

  • 8/15/2019 MainAn Optimizing Compiler for Floating Point Operations

    29/43

    band, and initial time-delay setting  T do. Normally inverse time-delay is assumed to

    dependent on these factors as follows:

    T d =

      T do∆v/DB   (4.0)

    4.2 Type-1 Fuzzy Logic Control

    A fuzzy logic system is a technique which is based on the non-linear mapping of 

    input variables to a set of output variables. In general, any fuzzy logic system (FLS)

    is composed of these elements:

    •  Fuzzifier, (to fuzzify crisp values)

    •   Inference block

    •  Rules

    •  Defuzzifier, (to obtain crisp values)

    The architecture followed by a general fuzzy logic system is given below

    Explanation of fuzzy logic process:

    Step 1:  The input data is collected in the crisp form and converted to a fuzzy

    set using fuzzifier (which converts these inputs to set of fuzzy linguistic variables and

    membership functions). This process is known as fuzzification.

    Step 2:  Set of rules are generated and inference is made from these rules using

    membership function and the linguistic variables.

    Step 3:   In the defuzzification stage, crisp output is generated from the fuzzy

    output after mapping on membership functions.

    29

  • 8/15/2019 MainAn Optimizing Compiler for Floating Point Operations

    30/43

    4.2.1 Linguistic Variables

    These variables are generally words or sentences used for input or output variables,

    and not the numerical values. Thus, the system becomes fuzzy when instead of crisp

    inputs and outputs these linguistic variables are used.

    4.2.2 Membership Functions

    Membership functions are used to map crisp inputs (no fuzzy values) to a set of 

    fuzzy linguistic set and vice versa. Both important processes of fuzzification and

    defuzzification use membership functions for mapping. Essentially, quantification of 

    fuzzy variables can be done using these functions and it is not just one functionwhich does that, but set of several membership functions are used for fuzziying and

    defuzzifying input and output variables respectively. Thus, it is true that any value

    can belong to more than one set at the same time.

    Few shapes of membership functions that are commonly used are trapezoidal,

    Gaussian and Triangular.

    4.2.3 Fuzzy Rules

    In a fuzzy Logic System, rules are designed to control the mapping of input variables

    to the output variables. It is a set of simple IF-THEN rules with certain conditions

    on input variables and conclusion in the form of desired output. These rules can be

    presented in a tabular form for easy comprehension. It is important to note here that,

    these rules are designed by the experts. It is an expert problem which can be a little

    problematic for users with new problem definition.

    4.2.4 Fuzzy Set Operations

    Fuzzy set operations are used to combine results of individual fuzzy rules. The oper-

    ations on fuzzy sets are different than the operations on non-fuzzy sets. Mostly used

    fuzzy sets are of OR and AND operators generated using max and min operations.

    30

  • 8/15/2019 MainAn Optimizing Compiler for Floating Point Operations

    31/43

    NOT operation is also used according to the situations. After evaluation of the result

    from each rule, the results are combined using different set of operators to form a

    final result. This process of combining different rules is known as inference. This

    combining of individual rules can be done in different ways which is shown in theaccumulation methods in Table.

    4.2.5 Defuzzification

    Once inference is done, obtained result is the fuzzified value. This fuzzy value has

    to be converted to a crisp value using a particular method. This processs is known

    as Defuzzification. It is performed on the set of membership functions of outputvariables. There are various methods of Defuzzification such as Centre of Gravity,

    centre of gravity of singletons, Centroid calculation, left most maximum, right-most

    maximum etc. Calculations for each of the methods is given in the table. For example,

    let the results after inference from all the individual rules comes out as shown in the

    figure, defuzzification approach will calculate a crisp value from the shaded region.

    Algorithm for Fuzzy Logic Design

    •  Define the linguistic variables and terms.

    •  Construct the membership function.

    •  Construct the rule base.

    •  Fuzzification: Convert crisp values to fuzzy values.

    •  Evaluate the rules in the rule base.

    •  Combine the results of each rule.

    •  Defuzzification: Convert the fuzzy output to non-fuzzy values.

    31

  • 8/15/2019 MainAn Optimizing Compiler for Floating Point Operations

    32/43

    4.2.6 Type-1 Fuzzy Logic Controller for OLTC Transformer

    The input and output signals

    In this report we have considered the following input variables:

    •  Voltage error, ∆V  ,

    •  present position of the tap,  n

    and following set of output variables:

    •  tap change direction,  ∆n,

    •  time delay,  T d

    Linguistic Variables for the above mentioned input and output variables are taken

    as follows:

    •   Voltage error: highly negative (HNEG), negative (NEG), zero (ZER), positive

    (POS), highly positive (HPOS);

    •  Present tap position: low (LOW), Normal (NOR), high (HIGH);

    •   Tap change direction: up (UP), unchanged (UC), down (down);

    •   time delay: small (SM), Medium (M), Long (L), Extra long (EL);

    The Control Rules

    Number of control rules used for time delay to be applied and the direction of tap

    change are taken as 15 for each case.

    The concept behind designing of these rules can be summarized as follows:

    •  When the voltage error is negative, transformer ratio is reduced to increase the

    voltage.

    32

  • 8/15/2019 MainAn Optimizing Compiler for Floating Point Operations

    33/43

    •   When the voltage error is positive, transformer ratio is increased to reduce the

    voltage.

    •  When voltage error is close to zero, Voltage is not changed.

    •   When the control margin is high, short time delays are applied between tap

    changes.

    •  When the voltage error is high, short time delays are applied.

    Defuzzification and other computations

    •  Firing level is computed by ANDing the IF- and THEN- rules.

    •   Center of Gravity method is used for the defuzzificztion process.

    Thus, the entire fuzzy model can be summarised to following set of implications.

    (Voltage error, tap position)  ⇒ (TimeDelay)

    (Voltage error, tap position)  ⇒ (DirectionofTapchange)

    Rule Base for Time Delay of FLC

    ∆V 

    HNEG NEG ZER POS HPOS

    HIGH SM M EL EL L

    n NOR M L EL L M

    LOW L EL EL M SM

    Rule Base for Tap Change Direction of FLC

    ∆V 

    HNEG NEG ZER POS HPOS

    HIGH UP UP UC DOWN DOWN

    n NOR UP UP UC DOWN DOWN

    LOW UP UP UC DOWN DOWN

    33

  • 8/15/2019 MainAn Optimizing Compiler for Floating Point Operations

    34/43

    4.3 Type-2 Fuzzy Logic Control

    As discussed in the previous sections, the design of membership function in itself 

    is an expert problem. As the problem can be highly diverse, it is difficult for any

    beginner to apply fuzzy logic systems (FLC) in the concerned field of study. There

    is uncertainty in the construction of fuzzy rules. Sources from where this uncertainty

    may arise are as follows:

    •  Words or sentences used in consequents or antecedents can be understood dif-

    ferently by different individuals;

    •  Agreement of experts on a single consequent is a matter of concern as eachindividual has different sets of comprehension skills.

    •  Data used for training may be noisy which can deviate results.

    The uncertainties in consequents and antecedents can lead to uncertain Type-I

    fuzzy membership function which cannot directly handle the uncertainties in rules.

    Thus a more robust system is needed which can accommodate uncertainties in fuzzy

    rules. Type-II FLS is an extension of Type-1 FLS to cover fuzzy rule uncertainties.

    Its description and detailed analysis is explained later in this section.

    The theory behind type-II fuzzy logic system was given by Zadeh. This novel

    method is an extension of the ordinary fuzzy logic, i.e., a Type-I fuzzy logic system.

    TypeŰII fuzzy sets have fuzzy membership functions, i.e., crisp values of each mem-

    bership function in type-I converted to fuzzy sets. Regular Type-II fuzzy logic system

    is computationally very complex as membership function exist in three dimensions.

    Thus, to make things simpler and reduce the type-reduction complexities, interval

    Type-II fuzzy logic system is used in which secondary membership functions.

    Fig. 2 shows the schematic diagram of an IT2 FLS. It is similar to its T1 coun-

    terpart, the major difference being that at least one of the FSs in the rule base is an

    IT2 FS. Hence, the outputs of the inference engine are IT2 FSs, and a type-reducer

    is needed to convert them into a T1 FS before defuzzification can be carried out.

    34

  • 8/15/2019 MainAn Optimizing Compiler for Floating Point Operations

    35/43

    Type-2 FLS Theory

    Rule base of IT2 FLS with N rules can be summed up as:

    Rn

    : IF x1 is X 1n and   · · ·· and  xi is X in, THEN y is  Y  nn=1,2,...,N

    where X in (i = 1, 2,..,I ) are IT2 FSs, and  Y  n = [yn,  ȳn] is an interval which can beassumed to be the consequent of IT2 FS.

    Following are the steps for computing output from IT2 FLS:

    •  For calculating membership of each input vector x′i on  X in, [µX in(x

    i), µ  X̄ in(x

    i)],

    i = 1, 2,...,I,n = 1, 2,...,N.

    •  Formula for computing Firing interval,  F n(x′):

    F n(x′) = [µX 1n(x′

    1)×....×µX I n(x′

    I ), µ   ¯X 1n(x

    1)×....×µ   ¯X I n(x′

    I ), ] ≡ [f n,  f̄ n], n = 1, 2, .....N 

    (4.0)

    •   There are many methods of type reducing algorithms. One such method is KM

    algorithm for computing the final crisp output which uses center-of-sets as given

    below:

    Y cos(x′) = f nyn

    f n  = [yl, yr]   (4.0)

    •   Final defuzzified output is calculated as:

    y = yl + yr

    2  (4.0)

    Type-2 FLC for OLTC Transformers

    Input variables for the type-2 FLC are taken as Voltage error and current tap position

    and the output variables are Time Delay and the direction of tap change. (Same as

    in case of Type-1 FLC for OLTC Transformers). The fuzzy rules taken in type-2

    FLC are fuzzified to some degree to incorporate uncertainties present in the system.

    35

  • 8/15/2019 MainAn Optimizing Compiler for Floating Point Operations

    36/43

    However, linguistic variables and terms for the input and output variabls are kept

    same as in Type-1 FLC. Figure shows membership functions for the Voltage error

    and current tap position.

    36

  • 8/15/2019 MainAn Optimizing Compiler for Floating Point Operations

    37/43

    Chapter 5

    Experimental Results and Discussions

    To verify the derivations of the modelled distributed OLTC transformer control sys-

    tem, specifications of the transformer are kept 63MVA, 110/36, 75 kV rating as an

    example. Other specifications and engineering data are given in Appendix 2. Var-

    ious simulations were carried out in the study changing the input variables such as

    disturbances in active and reactive load, reference voltage, initial conditions of the

    tap and time delay etc. The above discussed models of Classical Controller (Inverse

    time controller), Type-I fuzzy logic controller and Type-II fuzzy controller for OLTC

    transformer are implemented in Simulink Library of Matlab.

    5.1 The Classical Controller

    37

  • 8/15/2019 MainAn Optimizing Compiler for Floating Point Operations

    38/43

    38

  • 8/15/2019 MainAn Optimizing Compiler for Floating Point Operations

    39/43

    Appendix A

    Tables

    Table A.1: Armadillos

    Armadillos areour friends

    39

  • 8/15/2019 MainAn Optimizing Compiler for Floating Point Operations

    40/43

    40

  • 8/15/2019 MainAn Optimizing Compiler for Floating Point Operations

    41/43

    Appendix B

    Figures

    Figure B-1: Armadillo slaying lawyer.

    41

  • 8/15/2019 MainAn Optimizing Compiler for Floating Point Operations

    42/43

    Figure B-2: Armadillo eradicating national debt.

    42

  • 8/15/2019 MainAn Optimizing Compiler for Floating Point Operations

    43/43

    Bibliography