PIPS-NLP
ps.h
Go to the documentation of this file.
1 /* PIPS-NLP *
2  * Authors: Nai-Yuan Chiang *
3  * (C) 2015 Argonne National Laboratory */
4 
5 #ifndef __PS_H
6 #define __PS_H
7 
8 #include <constants.h>
9 /* PS.H is the header file containing the forward declarations for the PS data structs.
10  It also contains its API declarations
11 */
12 
13 class DCBUS;
14 class DCGEN;
15 class DCLINE;
16 
17 
18 /* Bus data struct */
19 class DCBUS{
20  public:
21  DCBUS();
22  ~DCBUS(){};
23 
24  int bus_i; /* Integer bus number */
25  char i[20]; /* Bus Number */
26  char name[20]; /* Bus Name */
27  double va; /* Bus voltage phase angle */
28 
29 
30  /* Info of connected edges to this bus */
33 
34  int ngen; /* Number of generators incident at this bus */
36  double loads;
37 
38  /* Starting location for the variables for this bus in the application residual "local" array.
39  The local array also contains ghosted values. startloc is typically used to access values in
40  the local vector, while startlocglob is used for setting the values in the matrix */
41  int startloc;
42 
44 
45  int partID;
46 
48 
49  void DCBUSGetNGen(int*);
50  void DCBUSGetGen(int,DCGEN**);
51  void DCBUSGetLoad(double*);
52  void DCBUSGetVariableLocation(int*);
54  void DCBUSGetSupportingLines(int*, DCLINE***);
55 
56 };
57 
58 
59 /* Generator data struct */
60 class DCGEN{
61  public:
62 
63  DCGEN();
64  ~DCGEN(){};
65 
66  int bus_i;
67  char i[20]; /* Bus Number or extended bus name*/
68  char id[2]; /* Generator identifier, in case of multiple generators at same bus. 1 by default */
69 
70  double pg; /* Generator active power output */
71 
72  double pt; /* Gen max active power output: MW */
73  double pb; /* Gen min active power output: MW */
74 
75  /* Quadratic cost function is alpha*Pg^2 + beta*Pg + gamma */
76  double cost_gamma;
77  double cost_beta;
78  double cost_alpha;
79 
80 
81  int partID;
82 
83 };
84 
85 /* Line data structure */
86 class DCLINE{
87  public:
88 
89  DCLINE();
90  ~DCLINE(){};
91 
92  int fbus;
93  int tbus;
94  char i[20]; /* Bus Number or extended bus name*/
95  char j[20]; /* Bus Number or extended bus name*/
96 
97  double resistance; /* Branch resistance: pu */
98  double reactance; /* Branch reactance: pu */
99 
100  double flowLimit; /* Branch flow limit*/
101 
102  double tapratio;
103 
104  /* From and to buses */
105  DCBUS *connbuses[2];
106 
107  int partID;
108 
109 
110  void DCLINEGetConnectedBuses( DCBUS***);
111 
112 };
113 
114 /* Power system data structure */
115 class DCPS{
116 public:
117  double MVAbase; /* System base MVA */
118  int Nbus,Ngen,Nbranch; /* global # of buses,gens,branches, and loads (includes elements which are
119  out of service */
120 // int nbus,ngen,nbranch; /* local # of buses,gens,branches,and loads */
124 
125  /* keys for components */
126  int compkey[10];
127 
128  bool setupcalled; /* Is setup called on PS? */
129 
130  int refBusID;
131 
132 
133 
134  DCPS();
135  ~DCPS();
136 
137 // void PSReadMatPowerData(const char[]){};
138 
139  void PSReadDCData(const char[]);
140 
141  void PSGetNumGenerators(int*);
142 
143  void writeGraphFile(const char[], const int);
144 
145  void setPartitioning(const int *partID_, const int actparts_,const int num_cuts);
146 
147 
148 
149  int Nparts;
150  int Ncuts;
152 
154 
156 
157 
158 
160 
161 private:
162  void SetUpPS();
163 
164 };
165 
166 
167 #endif
168 
int refBusID
Definition: ps.h:130
double flowLimit
Definition: ps.h:100
bool setupcalled
Definition: ps.h:128
int partID
Definition: ps.h:81
DCGEN * gen
Definition: ps.h:122
double pg
Definition: ps.h:70
int partID
Definition: ps.h:107
int bus_i
Definition: ps.h:22
DCBUS * bus
Definition: ps.h:121
char name[20]
Definition: ps.h:26
double MVAbase
Definition: ps.h:117
char i[20]
Definition: ps.h:25
Definition: ps.h:19
double pt
Definition: ps.h:72
int ngen
Definition: ps.h:34
#define NGEN_AT_BUS_MAX
Definition: constants.h:16
~DCGEN()
Definition: ps.h:64
double cost_gamma
Definition: ps.h:76
int startloc_Part
Definition: ps.h:43
Definition: ps.h:86
int partID
Definition: ps.h:45
int startloc
Definition: ps.h:41
DCGEN * gens[NGEN_AT_BUS_MAX]
Definition: ps.h:35
~DCBUS()
Definition: ps.h:22
void DCBUSGetNGen(int *)
Definition: ps.cpp:22
double va
Definition: ps.h:27
bool haveCutLine
Definition: ps.h:47
Definition: ps.h:60
double resistance
Definition: ps.h:97
int ** BusInEachPart
Definition: ps.h:159
double cost_beta
Definition: ps.h:77
void DCBUSGetSupportingLines(int *, DCLINE ***)
Definition: ps.cpp:51
int * num_BusInEachPart
Definition: ps.h:153
int * num_LineInEachPart
Definition: ps.h:151
void DCBUSGetGen(int, DCGEN **)
Definition: ps.cpp:27
#define MAXCONNLINES
Definition: constants.h:25
double cost_alpha
Definition: ps.h:78
~DCLINE()
Definition: ps.h:90
int tbus
Definition: ps.h:93
double tapratio
Definition: ps.h:102
int nconnlines
Definition: ps.h:31
double loads
Definition: ps.h:36
int * num_CutInEachPart
Definition: ps.h:155
DCBUS()
Definition: ps.cpp:17
double pb
Definition: ps.h:73
DCLINE * line
Definition: ps.h:123
int Ncuts
Definition: ps.h:150
int Ngen
Definition: ps.h:118
int Nparts
Definition: ps.h:149
double reactance
Definition: ps.h:98
void DCBUSGetLoad(double *)
Definition: ps.cpp:36
Definition: ps.h:115
void DCBUSGetVariableLocation(int *)
Definition: ps.cpp:41
DCLINE * connlines[MAXCONNLINES]
Definition: ps.h:32
void DCBUSGetVariableLocation_Part(int *)
Definition: ps.cpp:46