Gauss Program on C++

Satisfactory Essays
% Program for Gauss - Seidel Load Flow Analysis
% Assumption, Bus 1 is considered as Slack bus. ybus = ybusppg(); % Calling program "ybusppg.m" to get Y-Bus. busdata = busdata6(); % Calling "busdata6.m" for bus data. bus = busdata(:,1); % Bus number. type = busdata(:,2); % Type of Bus 1-Slack, 2-PV, 3-PQ.
V = busdata(:,3); % Initial Bus Voltages. th = busdata(:,4); % Initial Bus Voltage Angles.
GenMW = busdata(:,5); % PGi, Real Power injected into the buses.
GenMVAR = busdata(:,6); % QGi, Reactive Power injected into the buses.
LoadMW = busdata(:,7); % PLi, Real Power Drawn from the buses.
LoadMVAR = busdata(:,8); % QLi, Reactive Power Drawn from the buses.
Qmin = busdata(:,9); % Minimum Reactive Power Limit
Qmax = busdata(:,10); % Maximum Reactive Power Limit nbus = max(bus); % To get no. of buses
P = GenMW - LoadMW; % Pi = PGi - PLi, Real Power at the buses.
Q = GenMVAR - LoadMVAR; % Qi = QGi - QLi, Reactive Power at the buses.
Vprev = V; toler = 1; % Tolerence. iteration = 1; % iteration starting while (toler > 0.00001) % Start of while loop for i = 2:nbus sumyv = 0; for k = 1:nbus if i ~= k sumyv = sumyv + ybus(i,k)* V(k); % Vk * Yik end end if type(i) == 2 % Computing Qi for PV bus Q(i) = -imag(conj(V(i))*(sumyv + ybus(i,i)*V(i))); if (Q(i) > Qmax(i)) || (Q(i) < Qmin(i)) % Checking for Qi Violation. if Q(i) < Qmin(i) % Whether violated the lower limit. Q(i) = Qmin(i); else % No, violated the upper limit. Q(i) = Qmax(i); end type(i) = 3; % If Violated, change PV bus to PQ bus. end end V(i) = (1/ybus(i,i))*((P(i)-j*Q(i))/conj(V(i)) - sumyv);

You May Also Find These Documents Helpful

  • Satisfactory Essays

    c ++ program

    • 252 Words
    • 1 Page

    and letters. b. In C++, there is no difference between a reserved word and a pre- 
defined identifier. c. A C++ identifier can start with a digit. d. The operands of the modulus operator must be integers. e. Ifa=4;andb=3;,thenafterthestatementa=b;thevalueofbisstill3. f. In the statement cin >> y;, y can only be an int or a double variable. g. In an output statement, the newline character may be a part of the string. h. The following is a legal C++ program: 
 10. Which of the…

    • 252 Words
    • 1 Page
    Satisfactory Essays
  • Good Essays

    C++ Programs

    • 716 Words
    • 3 Pages

    EC101A: Computer Systems and Programming Spring Semester: 2010-2011 January 20, 2011 1. Write a program program in C++ to find the square of the numbers from 1 to 10 using : (a) for loop (b) while loop (c) do-while loop The output of the program should be in the following format: Number Square ……… ……… 2. Write a program in C++ that calculates the value of π from the infinite series [pic] Print a table that shows the value of π approximately…

    • 716 Words
    • 3 Pages
    Good Essays
  • Good Essays

    C Program

    • 808 Words
    • 4 Pages

    possible operations, which can be performed with the variable However, we never considered the permanence of a variable or its scope i.e. the portion of the program where the variable is valid or recognized. All these factors are considered with storage classes. In C, variables differ in behavior from those in most of the other languages. A variable in C can have anyone of the four storage classes: 1. Automatic Storage class 2. External Storage class 3. Static Storage class 4. Register…

    • 808 Words
    • 4 Pages
    Good Essays
  • Good Essays

    C Program

    • 767 Words
    • 4 Pages

    Some of the questions/programs are required to be typed, complied, run and then observed. 2. If possible try experimenting with concepts revealed by each question. 3. There are 20 objective type questions on ANSI C. PART - A With every use of a memory allocation function, what function should be used to release allocated memory which is no longer needed? a.) b.) c.) d.) unalloc() dealloc() release() free() What will print when the sample code above is executed? a.) b.) c.) d.) y= y= Compiler…

    • 767 Words
    • 4 Pages
    Good Essays
  • Powerful Essays

    C Program

    • 2161 Words
    • 9 Pages

    Code Wizard Start //// //}}NodeBuilder Code Wizard End ////////////////////////////////////////////////////////////////////////////// // File: closedLoopSensor.nc // // // Generated by NodeBuilder Code Wizard Version 3.14.03 // Copyright (c) 2001-2005 Echelon Corporation. All rights reserved. // // ECHELON MAKES NO REPRESENTATION, WARRANTY, OR CONDITION OF // ANY KIND, EXPRESS, IMPLIED, STATUTORY, OR OTHERWISE OR IN // ANY COMMUNICATION WITH YOU, INCLUDING, BUT NOT LIMITED TO, //…

    • 2161 Words
    • 9 Pages
    Powerful Essays
  • Better Essays

    Universidad Autónoma de Querétaro Facultad de Ingeniería “Iterative Methods” “Gauss and Gauss-Seidel” Profesor | | Nieves Fonseca Ricardo | Mentado Camacho Félix Navarro Escamilla Erandy Péloquin Blancas María José Rubio Miranda Ana Luisa Abstract Many real life problems give us several simultaneous linear equations to solve. And we have to find a common solution for each of them. There are several techniques to use. Instead of using methods that provide a solution to a set…

    • 1133 Words
    • 5 Pages
    Better Essays
  • Good Essays

    89s52 C Program

    • 1000 Words
    • 4 Pages

    Simple C program for 89S52 Here is a very simple but complete example program to blink a LED. Actually it is the source code of the example project that we are going to construct in the next part of the tutorial, but for now it is important to concentrate on the programming to summarize the notions discussed above. ------------------------------------------------- #include <REGX52.h> ------------------------------------------------- #include <math.h>…

    • 1000 Words
    • 4 Pages
    Good Essays
  • Good Essays

    The Gauss Rifle

    • 454 Words
    • 2 Pages

    The Gauss Rifle | Physics or Astronomy Science Fair Project Abstract The objective: I continued in this project because I felt that I had more to learn in this subject and that my project had not yet been able to reach to its full potential. In my research, I discovered the many laws that when using magnetic acceleration you are altering the forces that are attracting one magnet to an object. The reversal is used in switching plates and gears in most machines because the heavy equipment can only…

    • 454 Words
    • 2 Pages
    Good Essays
  • Good Essays

    Gauss Law

    • 1084 Words
    • 5 Pages

    elGauss’ Law AP Physics C Electric Flux Let's start be defining an area on the surface of an object. The magnitude is “A” and the direction is directed perpendicular to the area like a force normal. A E Flux ( or FLOW) is a general term associated with a FIELD that is bound by a certain AREA. So ELECTRIC FLUX is any AREA that has a ELECTRIC FIELD passing through it. We generally define an AREA vector as one that is perpendicular to the surface of the material. Therefore, you can…

    • 1084 Words
    • 5 Pages
    Good Essays
  • Better Essays

    Carl Gauss

    • 1551 Words
    • 7 Pages

    Carl Gauss was a man who is known for making a great deal breakthroughs in the wide variety of his work in both mathematics and physics. He is responsible for immeasurable contributions to the fields of number theory, analysis, differential geometry, geodesy, magnetism, astronomy, and optics, as well as many more. The concepts that he himself created have had an immense influence in many areas of the mathematic and scientific world. Carl Gauss was born Johann Carl Friedrich Gauss, on the thirtieth…

    • 1551 Words
    • 7 Pages
    Better Essays