A PROJECT REPORT ON VISUALIZATION OF EQUAL AREA CRITERION USING JAVA APPLET Conducted at I.I.T. Mumbai Submitted in partial fulfillment of the requirements for degree of BACHELOR OF ELECTRICAL ENGINEERING (UNIVERSITY OF MUMBAI) Prepared by PRAKASH NAIR BHUPENDRA AMODEKAR ROHIT BHUTE ANWESH DAS Department of Electrical Engineering Sardar Patel College of Engineering Munshi Nagar, Andheri (West), Mumbai - 400058 1
99
Embed
VISUALIZATION OF EQUAL AREA CRITERION …nptel.ac.in/courses/Webcourse-contents/IIT Bombay/Power System...A PROJECT REPORT ON VISUALIZATION OF EQUAL AREA CRITERION USING JAVA APPLET
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
APROJECT REPORT
ON
VISUALIZATION OF EQUAL AREA CRITERIONUSING JAVA APPLET
Conducted atI.I.T. Mumbai
Submitted in partial fulfillment of the requirements for degree of
BACHELOR OF ELECTRICAL ENGINEERING(UNIVERSITY OF MUMBAI)
Prepared byPRAKASH NAIR
BHUPENDRA AMODEKARROHIT BHUTEANWESH DAS
Department of Electrical EngineeringSardar Patel College of Engineering
8. Gross, C., "Power System Analysis", John Wiley & Sons Inc, 2nd edition, 1998
64
Appendix 1
This is the source code for the PowerSystem class whose documentation is provided in Appendix 2.
001 /*002 Power System Stability - a JAVA applet to study power system stability using003 Equal Area Criterion004 005 Copyright (c) 2006 authors006 007 Prof. S. A. Soman, Electrical Engineering Dept., I.I.T., Mumbai008 Prof. Shubha Pandit, Electrical Engineering Dept., S.P.C.E., Mumbai009 010 Bhupendra Amodekar, B.E. (Electrical Engineering), S.P.C.E., Mumbai011 Rohit Bhute, B.E. (Electrical Engineering), S.P.C.E., Mumbai012 Anwesh Das, B.E. (Electrical Engineering), S.P.C.E., Mumbai013 Prakash Nair, B.E. (Electrical Engineering), S.P.C.E., Mumbai014 015 This program is free software; you can redistribute it and/or modify016 it under the terms of the GNU General Public License as published by017 the Free Software Foundation; either version 2 of the License, or018 (at your option) any later version.019 020 This program is distributed in the hope that it will be useful,021 but WITHOUT ANY WARRANTY; without even the implied warranty of022 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the023 GNU General Public License for more details.024 025 You should have received a copy of the GNU General Public License026 along with this program; if not, write to the Free Software027 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA028 You can also see the license at <http://www.gnu.org/copyleft/gpl.html>029 */030 031 import static java.lang.Math.*;032 033 /**034 *This class contains the basic SMIB model. It takes in the parameter values,035 *validates them and determines system stability using EAC. Various I/O 036 *functions are provided to utilize the model parameters; inlcuding those 037 *specific for graphic routines. The class can be extended to increase its038 *functionality. Variables are explained in the code listing.039 */040 041
65
042 public class PowerSystem {043 // miscellaneous variables044 protected int FLAGS, STABLE;045 protected double eNum, freq = 50, rem, stability_margin;046 047 // system model parameters obtained from input048 protected double049 Pm, // mechanical power input050 H, // inertia constant051 E, // voltage behind transient reactance052 Xt1, // reactance before generator and parallel link053 X1, // healthy transmission line054 X2, // soon-to-be faulty transmission line055 Xt2, // reactance betn parallel link & infinite bus056 V, // infinite bus assumed at angle 0057 tc, // fault clearing time058 ts; // step time for swing curve calculation059 060 protected int061 loc, // location of fault - near a bus or midline062 met; // method of integration for swing curve063 064 // system parameters in three stages065 protected double066 // before fault X, Pmax and delta zero067 Xbf, Pmaxbf, delta_0, 068 069 //during fault X, Pmax070 Xdf, Pmaxdf,071 072 // after fault X, Pmax073 Xaf, Pmaxaf,074 delta_max, // max delta for stable system 075 delta_cr; // critical clearing angle076 077 // swing curve variables078 protected double079 M, // inertia constant in elect. degrees080 delta_c, // clearing delta081 Paminus, Paplus;082 protected double[] ang; // data array for delta (in deg)083 protected int fault_cleared_index;084 085 086 // EAC variables087 protected double delta2, a_area, d_area, rem_d_area; 088 // acc. area, dec. area089 090 // methods091 092 /**093 *This method sets the model parameters to a default value.094 */095 public void SetDefaults() {096 Pm = 1; H = 2.52; E = 1.2; 097 Xt1 = 0.25; X1 = 0.5; X2 = 0.4;
66
098 Xt2 = 0.05; V = 1; tc = 0.12; 099 ts = 0.0001; loc = 1; met = 1;100 }101 102 /**103 *This method sets the model parameters to zero. Not recommended for use in104 *model initialization. Use SetDefaults() instead.105 */106 public void SetZero() {107 Pm = 0; H = 0; E = 0; 108 Xt1 = 0; X1 = 0; X2 = 0; 109 Xt2 = 0; V = 0; tc = 0; 110 ts = 0; loc = 0; met = 0;111 }112 113 // constructor114 PowerSystem() {115 SetDefaults();116 }117 118 /**119 *This method assigns input values to model parameters.120 *The following values are transferred through a vector: Pm, H, E, Xt1, 121 *X1, X2, Xt2, V, tc, ts122 *@param arg_list vector of above values123 *@param location location of fault124 *@param method method of integration for swing curve solution125 */126 public void Initialize(double[] arg_list, int location, int method) {127 Pm = arg_list[0];128 H = arg_list[1];129 E = arg_list[2];130 Xt1 = arg_list[3];131 X1 = arg_list[4];132 X2 = arg_list[5];133 Xt2 = arg_list[6];134 V = arg_list[7];135 tc = arg_list[8];136 ts = arg_list[9];137 loc = location;138 met = method;139 140 // call ApplyEAC141 ApplyEAC();142 }143 144 /**145 *This method calculates the model in the three stages - before fault,146 *during fault and after fault. It also validates the parameter values.147 *@return model status - non-zero for errors 148 */149 protected int CalculateModel() {
67
150 // first validate inputs151 if (Pm <= 0)152 return 1;153 if (H <= 0)154 return 2;155 if (E <= 0)156 return 3;157 if (Xt1 < 0)158 return 4;159 if (X1 <= 0)160 return 5;161 if (X2 <= 0)162 return 6;163 if (Xt2 < 0)164 return 7;165 if (V <= 0)166 return 8;167 if (tc < 0)168 return 9;169 if (ts > 0.1 || ts < 0.000001)170 return 10;171 if (loc != 1 && loc != 2)172 return 11;173 if (met != 1 && met != 2 && met != 3 && met !=4)174 return 12;175 176 // before fault model177 Xbf = Xt1+X1*X2/(X1+X2)+Xt2;178 Pmaxbf = E*V/Xbf;179 delta_0 = asin(Pm/Pmaxbf);180 181 // during fault model182 if (loc == 1) // 1 - near bus fault183 Pmaxdf = 0; // Xdf is not needed, hence ignored184 185 if (loc == 2) // 2 - midline fault186 {187 double188 Za = X2/2, // midline, Za and Zb can be in any ratio189 Zb = X2/2,190 Z10 = Xt1+X1*Za/(X1+X2), // delta - star conversion191 Z20 = Xt2+X1*Zb/(X1+X2), // we lump the reactances in the limbs192 Z30 = Za*Zb/(X1+X2),193 Xdf = Z10+Z20+Z10*Z20/Z30; // star - delta, for Xdf only194 Pmaxdf = E*V/Xdf;195 if (Pm <= Pmaxdf*sin(delta_0))196 return 13; // we won't get an accelerating area197 }198 199 // after fault model200 Xaf = Xt1+X1+Xt2;201 Pmaxaf = E*V/Xaf;202
68
203 if (Pmaxaf <= Pm) // we won't get a decelerating area204 return 14; 205 206 delta_max = PI-asin(Pm/Pmaxaf);207 // we will use eNum in the expression for delta_cr208 eNum = Pm*(delta_max-delta_0)-Pmaxdf*cos(delta_0)+Pmaxaf*cos(delta_max);209 delta_cr = acos(eNum/(Pmaxaf-Pmaxdf)); 210 211 // if we get this far, the user's model has no errors212 return 0;213 } 214 215 /**216 *This method calculates the accelerating power, Pa, at a given instant.217 *@param delta angle for which Pa has to be caluclated218 *@param i value which determines instant of Pa - pre,post or during fault219 *@return Pa220 */221 protected double accPower(double delta, int i) {222 double P = 0;223 if (i < fault_cleared_index)224 P = Pm-Pmaxdf*sin(delta);225 226 if (i == fault_cleared_index)227 {228 Paminus = Pm-Pmaxdf*sin(delta);229 Paplus = Pm-Pmaxaf*sin(delta);230 P = (Paminus+Paplus)/2;231 }232 233 if (i > fault_cleared_index)234 P = Pm-Pmaxaf*sin(delta);235 236 return P;237 }238 239 240 /**241 *The main method in this class. Look here when things act funny.242 *This method does the following: calculate swing curve using either of 243 *the 4 available methods and then determine system stability using EAC.244 */245 protected void ApplyEAC() {246 FLAGS = CalculateModel();247 248 if (FLAGS == 0)249 {250 // Swing Curve251 double 252 t = 0, tf = 2.0, // plot till tf in steps of ts 253 delta = delta_0, d_delta = 0, // delta and
69
incremental delta 254 Pa = 0; // accelerating power255 256 if (tc > 0.25) // plot for atleast 2 sec.257 tf = 8*tc;258 259 int size = (int)(tf/ts); //size of data arrays260 ang = new double[size];261 262 int i;263 M = H/(PI*freq);264 fault_cleared_index = (int)(tc/ts);265 266 // step by step solution of swing equation267 if (met == 1)268 {269 for (i = 0; i < size; i++)270 {271 if (i == 0)272 {273 ang[i] = toDegrees(delta_0);274 Paminus = 0;275 Paplus = Pm-Pmaxdf*sin(delta);276 Pa = (Paminus+Paplus)/2;277 continue;278 }279 280 d_delta = d_delta+(ts*ts*Pa/M);281 delta = delta+d_delta;282 ang[i] = toDegrees(delta);283 284 // calculate Pa for next iteration 285 Pa = accPower(delta, i);286 }287 288 }289 290 // euler291 if (met == 2)292 {293 double w = 0;294 for (i = 0; i < size; i++)295 {296 if (i == 0)297 {298 ang[i] = toDegrees(delta_0);299 w = 0;300 Paminus = 0;301 Paplus = Pm-Pmaxdf*sin(delta);302 Pa = (Paminus+Paplus)/2;303 continue;304 }305 306 w = w+(ts*Pa/M);307 delta = delta+ts*w;
70
308 ang[i] = toDegrees(delta);309 310 // calculate Pa for next iteration311 Pa = accPower(delta, i);312 }313 }314 315 // modified euler316 if (met ==3)317 {318 double w = 0, wp = 0, dp = 0, k = 0, q = 0;319 for (i = 0; i < size; i++)320 {321 if (i == 0)322 {323 ang[i] = toDegrees(delta_0);324 w = 0;325 Paminus = 0;326 Paplus = Pm-Pmaxdf*sin(delta);327 Pa = (Paminus+Paplus)/2;328 continue;329 }330 331 wp = w+Pa*ts/M;332 dp = delta+wp*ts;333 334 k = accPower(delta, i)/M;335 q = accPower(dp, i)/M;336 337 delta = delta+ts*(w+wp)/2;338 w = w+ts*(k+q)/2;339 ang[i]=toDegrees(delta);340 341 // Pa for next iteration342 Pa=accPower(delta, i);343 }344 }345 346 // RK-4347 if (met == 4)348 {349 double 350 w = 0, 351 k1 = 0, k2 = 0, k3 = 0, k4 = 0,352 q1 = 0, q2 = 0, q3 = 0, q4 = 0;353 354 for (i = 0; i < size; i++)355 {356 if (i == 0)357 {358 ang[i] = toDegrees(delta_0);359 w = 0;360 Paminus = 0;361 Paplus = Pm-Pmaxdf*sin(delta);362 Pa = (Paminus+Paplus)/2;
71
363 continue;364 }365 366 k1 = w;367 q1 = accPower(delta, i)/M;368 369 k2 = w+ts*q1/2;370 q2 = accPower((delta+ts*k1/2), i)/M;371 372 k3 = w+ts*q2/2;373 q3 = accPower((delta+ts*k2/2), i)/M;374 375 k4 = w+ts*q3;376 q4 = accPower((delta+ts*k1), i)/M;377 378 w = w+ts*(q1+2*q2+2*q3+q4)/6;379 delta = delta+ts*(k1+2*k2+2*k3+k4)/6;380 ang[i]=toDegrees(delta);381 }382 }383 384 385 // to find delta_c 386 delta_c = toRadians(ang[fault_cleared_index]);387 388 // Equal Area Criterion389 double e; // e = a_area-d_area, should be zero390 391 for (delta2 = delta_c; delta2 <= delta_max+0.5; delta2 = delta2+0.0001)392 {393 a_area = Pm*(delta_c-delta_0)+Pmaxdf*(cos(delta_c)-cos(delta_0));394 d_area = Pmaxaf*(cos(delta_c)-cos(delta2))-Pm*(delta2-delta_c);395 e = a_area-d_area;396 if (e < 0) /* practically will check for zero */397 break;398 }399 400 // system stability check401 if (delta2 <= delta_max)402 {403 STABLE = 1; 404 rem_d_area = Pmaxaf*(cos(delta2)-cos(delta_max))-Pm*(delta_max-delta2);405 stability_margin = rem_d_area/(rem_d_area+d_area); 406 }407 408 else409 {410 STABLE = 0;411 stability_margin = -1;412 }413
72
414 415 416 } // end FLAGS check417 } 418 419 /**420 * This method fetches the model status for use outside the class.421 */422 public int GetStatus() {423 return FLAGS;424 }425 426 /**427 *This method is used to extract various power angles for use outside 428 *the class. The vector contains: initial angle, critical clearing angle,429 *clearing angle, maximum angle for system to be stable, angle which the430 *system swings up to (according to EAC), stability status and stability431 *margin.432 *@return vector 433 */434 public double[] GetParameters() {435 double[] param_list = new double[7];436 param_list[0] = rint(toDegrees(delta_0)*10000)/10000;437 param_list[1] = rint(toDegrees(delta_cr)*10000)/10000;438 param_list[2] = rint(toDegrees(delta_c)*10000)/10000;439 param_list[3] = rint(toDegrees(delta_max)*10000)/10000;440 param_list[4] = rint(toDegrees(delta2)*10000)/10000;441 param_list[5] = (double)STABLE;442 param_list[6] = rint(stability_margin*1000000)/10000;443 return param_list;444 }445 446 /**447 *This method is used to get data related to Swing Curve448 *@return vector449 */450 public int[] GetSwingCurveParameters() {451 int[] param_list = new int[2];452 param_list[0] = fault_cleared_index;453 param_list[1] = ang.length;454 return param_list;455 }456 457 /**458 *This method retrieves the data actually used to plot a swing curve459 *@return vector 460 */461 public double[] GetSwingCurveData() {462 return ang;463 }464
73
465 /**466 *This method extracts the four power parameters from the model -467 *mechanical input power - Pm; and power during the three phases - pre-, 468 *during- and post-fault.469 *@return vector470 */471 public double[] GetEACPowerValues() {472 double[] param_list = new double[4];473 param_list[0] = Pm;474 param_list[1] = Pmaxbf;475 param_list[2] = Pmaxdf;476 param_list[3] = Pmaxaf;477 return param_list;478 }479 480 481 /**482 *This method gives the values of delta angles necessary for plotting 483 *EAC curves - initial angle, clearing angle and maximum swing angle.484 *@return vector485 */486 public double[] GetEACDeltaValues() {487 double[] param_list = new double[3];488 param_list[0] = delta_0;489 param_list[1] = delta_c;490 param_list[2] = delta2;491 return param_list;492 }493 }
74
Appendix 2Class Documentation
The main class in this software is the PowerSystem class whose documentation has been provided here. This documentation has been generated using the javadoc utility from comments embedded in the source code.
Class PowerSystemjava.lang.Object PowerSystem
public class PowerSystemextends java.lang.Object
This class contains the basic SMIB model. It takes in the parameter values, validates them and determines system stability using EAC. Various I/O functions are provided to utilize the model parameters; inlcuding those specific for graphic routines. The class can be extended to increase its functionality. Variables are explained in the code listing.
Field Summaryprotecte
d double
a_area
protected
double[]
ang
protected
doubled_area
protected
doubledelta_0
protected
doubledelta_c
protected
doubledelta_cr
protected
doubledelta_max
75
protected
doubledelta2
protected
doubleE
protected
doubleeNum
protected int fault_cleared_index
protected int FLAGS
protecte
d double
freq
protected
doubleH
protected int loc
protecte
d double
M
protected int met
protecte
d double
Paminus
protected
doublePaplus
protected
doublePm
protected
doublePmaxaf
protected
doublePmaxbf
protected
doublePmaxdf
protected
doublerem
76
protected
doublerem_d_area
protected
doublestability_margin
protected int STABLE
protecte
d double
tc
protected
doublets
protected
doubleV
protected
doubleX1
protected
doubleX2
protected
doubleXaf
protected
doubleXbf
protected
doubleXdf
protected
doubleXt1
protected
doubleXt2
Constructor SummaryPowerSystem()
Method Summary
77
protected
doubleaccPower(double delta, int i) This method calculates the accelerating power, Pa, at a given instant.
protected void ApplyEAC()
The main method in this class.protected int CalculateModel()
This method calculates the model in the three stages - before fault, during fault and after fault.
double[]GetEACDeltaValues() This method gives the values of delta angles necessary for plotting EAC curves - initial angle, clearing angle and maximum swing angle.
double[]GetEACPowerValues() This method extracts the four power parameters from the model - mechanical input power - Pm; and power during the three phases - pre-, during- and post-fault.
double[]GetParameters() This method is used to extract various power angles for use outside the class.
int GetStatus() This method fetches the model status for use outside the class.
double[]GetSwingCurveData() This method retrieves the data actually used to plot a swing curve
int[] GetSwingCurveParameters() This method is used to get data related to Swing Curve
void Initialize(double[] arg_list, int location, int method) This method assigns input values to model parameters.
void SetDefaults() This method sets the model parameters to a default value.
void SetZero() This method sets the model parameters to zero.
Methods inherited from class java.lang.Objectclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait Field Detail
78
FLAGS
protected int FLAGS
STABLE
protected int STABLE
eNum
protected double eNum
freq
protected double freq
rem
protected double rem
stability_margin
protected double stability_margin
Pm
protected double Pm
79
H
protected double H
E
protected double E
Xt1
protected double Xt1
X1
protected double X1
X2
protected double X2
Xt2
protected double Xt2
V
protected double V
80
tc
protected double tc
ts
protected double ts
loc
protected int loc
met
protected int met
Xbf
protected double Xbf
Pmaxbf
protected double Pmaxbf
delta_0
protected double delta_0
81
Xdf
protected double Xdf
Pmaxdf
protected double Pmaxdf
Xaf
protected double Xaf
Pmaxaf
protected double Pmaxaf
delta_max
protected double delta_max
delta_cr
protected double delta_cr
M
protected double M
82
delta_c
protected double delta_c
Paminus
protected double Paminus
Paplus
protected double Paplus
ang
protected double[] ang
fault_cleared_index
protected int fault_cleared_index
delta2
protected double delta2
a_area
protected double a_area
83
d_area
protected double d_area
rem_d_area
protected double rem_d_area
Constructor Detail
PowerSystem
PowerSystem()
Method Detail
SetDefaults
public void SetDefaults()
This method sets the model parameters to a default value.
SetZero
public void SetZero()
This method sets the model parameters to zero. Not recommended for use in model initialization. Use SetDefaults() instead.
Initialize
public void Initialize(double[] arg_list, int location, int method)
This method assigns input values to model parameters. The following values are transferred through a vector: Pm, H, E, Xt1, X1, X2, Xt2, V, tc, ts
84
Parameters:arg_list - vector of above valueslocation - location of faultmethod - method of integration for swing curve solution
CalculateModel
protected int CalculateModel()
This method calculates the model in the three stages - before fault, during fault and after fault. It also validates the parameter values.
Returns:model status - non-zero for errors
accPower
protected double accPower(double delta, int i)
This method calculates the accelerating power, Pa, at a given instant.
Parameters:delta - angle for which Pa has to be caluclatedi - value which determines instant of Pa - pre,post or during fault
Returns:Pa
ApplyEAC
protected void ApplyEAC()
The main method in this class. Look here when things act funny. This method does the following: calculate swing curve using either of the 4 available methods and then determine system stability using EAC.
85
GetStatus
public int GetStatus()
This method fetches the model status for use outside the class.
GetParameters
public double[] GetParameters()
This method is used to extract various power angles for use outside the class. The vector contains: initial angle, critical clearing angle, clearing angle, maximum angle for system to be stable, angle which the system swings up to (according to EAC), stability status and stability margin.
Returns:vector
GetSwingCurveParameters
public int[] GetSwingCurveParameters()
This method is used to get data related to Swing Curve
Returns:vector
GetSwingCurveData
public double[] GetSwingCurveData()
This method retrieves the data actually used to plot a swing curve
Returns:vector
86
GetEACPowerValues
public double[] GetEACPowerValues()
This method extracts the four power parameters from the model - mechanical input power - Pm; and power during the three phases - pre-, during- and post-fault.
Returns:vector
GetEACDeltaValues
public double[] GetEACDeltaValues()
This method gives the values of delta angles necessary for plotting EAC curves - initial angle, clearing angle and maximum swing angle.
Returns:vector
87
Appendix 3
GNU GENERAL PUBLIC LICENSE
Version 2, June 1991
Copyright (C) 1989, 1991 Free Software Foundation, Inc.
51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
The licenses for most software are designed to take away your
freedom to share and change it. By contrast, the GNU General Public
License is intended to guarantee your freedom to share and change free
software--to make sure the software is free for all its users. This
General Public License applies to most of the Free Software
Foundation's software and to any other program whose authors commit to
using it. (Some other Free Software Foundation software is covered by
the GNU Library General Public License instead.) You can apply it to
your programs, too.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
this service if you wish), that you receive source code or can get it
if you want it, that you can change the software or use pieces of it
in new free programs; and that you know you can do these things.
To protect your rights, we need to make restrictions that forbid
88
anyone to deny you these rights or to ask you to surrender the rights.
These restrictions translate to certain responsibilities for you if you
distribute copies of the software, or if you modify it.
For example, if you distribute copies of such a program, whether
gratis or for a fee, you must give the recipients all the rights that
you have. You must make sure that they, too, receive or can get the
source code. And you must show them these terms so they know their
rights.
We protect your rights with two steps: (1) copyright the software, and
(2) offer you this license which gives you legal permission to copy,
distribute and/or modify the software.
Also, for each author's protection and ours, we want to make certain
that everyone understands that there is no warranty for this free
software. If the software is modified by someone else and passed on, we
want its recipients to know that what they have is not the original, so
that any problems introduced by others will not reflect on the original
authors' reputations.
Finally, any free program is threatened constantly by software
patents. We wish to avoid the danger that redistributors of a free
program will individually obtain patent licenses, in effect making the
program proprietary. To prevent this, we have made it clear that any
patent must be licensed for everyone's free use or not licensed at all.
The precise terms and conditions for copying, distribution and
modification follow.
89
GNU GENERAL PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. This License applies to any program or other work which contains
a notice placed by the copyright holder saying it may be distributed
under the terms of this General Public License. The "Program", below,
refers to any such program or work, and a "work based on the Program"
means either the Program or any derivative work under copyright law:
that is to say, a work containing the Program or a portion of it,
either verbatim or with modifications and/or translated into another
language. (Hereinafter, translation is included without limitation in
the term "modification".) Each licensee is addressed as "you".
Activities other than copying, distribution and modification are not
covered by this License; they are outside its scope. The act of
running the Program is not restricted, and the output from the Program
is covered only if its contents constitute a work based on the
Program (independent of having been made by running the Program).
Whether that is true depends on what the Program does.
1. You may copy and distribute verbatim copies of the Program's
source code as you receive it, in any medium, provided that you
conspicuously and appropriately publish on each copy an appropriate
copyright notice and disclaimer of warranty; keep intact all the
notices that refer to this License and to the absence of any warranty;
and give any other recipients of the Program a copy of this License
along with the Program.
You may charge a fee for the physical act of transferring a copy, and
you may at your option offer warranty protection in exchange for a fee.
90
2. You may modify your copy or copies of the Program or any portion
of it, thus forming a work based on the Program, and copy and
distribute such modifications or work under the terms of Section 1
above, provided that you also meet all of these conditions:
a) You must cause the modified files to carry prominent notices
stating that you changed the files and the date of any change.
b) You must cause any work that you distribute or publish, that in
whole or in part contains or is derived from the Program or any
part thereof, to be licensed as a whole at no charge to all third
parties under the terms of this License.
c) If the modified program normally reads commands interactively
when run, you must cause it, when started running for such
interactive use in the most ordinary way, to print or display an
announcement including an appropriate copyright notice and a
notice that there is no warranty (or else, saying that you provide
a warranty) and that users may redistribute the program under
these conditions, and telling the user how to view a copy of this
License. (Exception: if the Program itself is interactive but
does not normally print such an announcement, your work based on
the Program is not required to print an announcement.)
These requirements apply to the modified work as a whole. If
identifiable sections of that work are not derived from the Program,
and can be reasonably considered independent and separate works in
themselves, then this License, and its terms, do not apply to those
sections when you distribute them as separate works. But when you
distribute the same sections as part of a whole which is a work based
on the Program, the distribution of the whole must be on the terms of
91
this License, whose permissions for other licensees extend to the
entire whole, and thus to each and every part regardless of who wrote it.
Thus, it is not the intent of this section to claim rights or contest
your rights to work written entirely by you; rather, the intent is to
exercise the right to control the distribution of derivative or
collective works based on the Program.
In addition, mere aggregation of another work not based on the Program
with the Program (or with a work based on the Program) on a volume of
a storage or distribution medium does not bring the other work under
the scope of this License.
3. You may copy and distribute the Program (or a work based on it,
under Section 2) in object code or executable form under the terms of
Sections 1 and 2 above provided that you also do one of the following:
a) Accompany it with the complete corresponding machine-readable
source code, which must be distributed under the terms of Sections
1 and 2 above on a medium customarily used for software interchange; or,
b) Accompany it with a written offer, valid for at least three
years, to give any third party, for a charge no more than your
cost of physically performing source distribution, a complete
machine-readable copy of the corresponding source code, to be
distributed under the terms of Sections 1 and 2 above on a medium
customarily used for software interchange; or,
c) Accompany it with the information you received as to the offer
to distribute corresponding source code. (This alternative is
allowed only for noncommercial distribution and only if you
92
received the program in object code or executable form with such
an offer, in accord with Subsection b above.)
The source code for a work means the preferred form of the work for
making modifications to it. For an executable work, complete source
code means all the source code for all modules it contains, plus any
associated interface definition files, plus the scripts used to
control compilation and installation of the executable. However, as a
special exception, the source code distributed need not include
anything that is normally distributed (in either source or binary
form) with the major components (compiler, kernel, and so on) of the
operating system on which the executable runs, unless that component
itself accompanies the executable.
If distribution of executable or object code is made by offering
access to copy from a designated place, then offering equivalent
access to copy the source code from the same place counts as
distribution of the source code, even though third parties are not
compelled to copy the source along with the object code.
4. You may not copy, modify, sublicense, or distribute the Program
except as expressly provided under this License. Any attempt
otherwise to copy, modify, sublicense or distribute the Program is
void, and will automatically terminate your rights under this License.
However, parties who have received copies, or rights, from you under
this License will not have their licenses terminated so long as such
parties remain in full compliance.
5. You are not required to accept this License, since you have not
signed it. However, nothing else grants you permission to modify or
distribute the Program or its derivative works. These actions are
93
prohibited by law if you do not accept this License. Therefore, by
modifying or distributing the Program (or any work based on the
Program), you indicate your acceptance of this License to do so, and
all its terms and conditions for copying, distributing or modifying
the Program or works based on it.
6. Each time you redistribute the Program (or any work based on the
Program), the recipient automatically receives a license from the
original licensor to copy, distribute or modify the Program subject to
these terms and conditions. You may not impose any further
restrictions on the recipients' exercise of the rights granted herein.
You are not responsible for enforcing compliance by third parties to
this License.
7. If, as a consequence of a court judgment or allegation of patent
infringement or for any other reason (not limited to patent issues),
conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot
distribute so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you
may not distribute the Program at all. For example, if a patent
license would not permit royalty-free redistribution of the Program by
all those who receive copies directly or indirectly through you, then
the only way you could satisfy both it and this License would be to
refrain entirely from distribution of the Program.
If any portion of this section is held invalid or unenforceable under
any particular circumstance, the balance of the section is intended to
apply and the section as a whole is intended to apply in other
circumstances.
94
It is not the purpose of this section to induce you to infringe any
patents or other property right claims or to contest validity of any
such claims; this section has the sole purpose of protecting the
integrity of the free software distribution system, which is
implemented by public license practices. Many people have made
generous contributions to the wide range of software distributed
through that system in reliance on consistent application of that
system; it is up to the author/donor to decide if he or she is willing
to distribute software through any other system and a licensee cannot
impose that choice.
This section is intended to make thoroughly clear what is believed to
be a consequence of the rest of this License.
8. If the distribution and/or use of the Program is restricted in
certain countries either by patents or by copyrighted interfaces, the
original copyright holder who places the Program under this License
may add an explicit geographical distribution limitation excluding
those countries, so that distribution is permitted only in or among
countries not thus excluded. In such case, this License incorporates
the limitation as if written in the body of this License.
9. The Free Software Foundation may publish revised and/or new versions
of the General Public License from time to time. Such new versions will
be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
Each version is given a distinguishing version number. If the Program
specifies a version number of this License which applies to it and "any
later version", you have the option of following the terms and conditions
95
either of that version or of any later version published by the Free
Software Foundation. If the Program does not specify a version number of
this License, you may choose any version ever published by the Free Software
Foundation.
10. If you wish to incorporate parts of the Program into other free
programs whose distribution conditions are different, write to the author
to ask for permission. For software which is copyrighted by the Free
Software Foundation, write to the Free Software Foundation; we sometimes
make exceptions for this. Our decision will be guided by the two goals
of preserving the free status of all derivatives of our free software and
of promoting the sharing and reuse of software generally.
NO WARRANTY
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO
WARRANTY
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
EXCEPT WHEN
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER
PARTIES
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER
EXPRESSED
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE
RISK AS
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU.
SHOULD THE
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY
SERVICING,
REPAIR OR CORRECTION.
96
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN
WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY
AND/OR
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR
DAMAGES,
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL
DAMAGES ARISING
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT
LIMITED
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES
SUSTAINED BY
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH
ANY OTHER
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF
THE
POSSIBILITY OF SUCH DAMAGES.
END OF TERMS AND CONDITIONS
97
How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.
To do so, attach the following notices to the program. It is safest
to attach them to the start of each source file to most effectively
convey the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.
<one line to give the program's name and a brief idea of what it does.>
Copyright (C) <year> <name of author>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Also add information on how to contact you by electronic and paper mail.
98
If the program is interactive, make it output a short notice like this
when it starts in an interactive mode:
Gnomovision version 69, Copyright (C) year name of author
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
The hypothetical commands `show w' and `show c' should show the appropriate
parts of the General Public License. Of course, the commands you use may
be called something other than `show w' and `show c'; they could even be
mouse-clicks or menu items--whatever suits your program.
You should also get your employer (if you work as a programmer) or your
school, if any, to sign a "copyright disclaimer" for the program, if
necessary. Here is a sample; alter the names:
Yoyodyne, Inc., hereby disclaims all copyright interest in the program
`Gnomovision' (which makes passes at compilers) written by James Hacker.
<signature of Ty Coon>, 1 April 1989
Ty Coon, President of Vice
This General Public License does not permit incorporating your program into
proprietary programs. If your program is a subroutine library, you may
consider it more useful to permit linking proprietary applications with the
library. If this is what you want to do, use the GNU Library General