-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpf.h
More file actions
136 lines (124 loc) · 5.59 KB
/
Copy pathpf.h
File metadata and controls
136 lines (124 loc) · 5.59 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
#ifndef PF_H
#define PF_H
# include "petsc.h"
# define MAXLINE 1000
#define REF_BUS 3
#define PV_BUS 2
#define PQ_BUS 1
#define ISOLATED_BUS 4
#define NGEN_AT_BUS_MAX 15
#define NLOAD_AT_BUS_MAX 1
/* 2. Bus data */
/* 11 columns */
struct _p_VERTEXDATA{
PetscInt bus_i; /* Integer bus number .. used by some formats like Matpower */
char i[20]; /* Bus Number */
char name[20]; /* Bus Name */
PetscScalar basekV; /* Bus Base kV */
PetscInt ide; /* Bus type code */
PetscScalar gl; /* Active component of shunt admittance to ground */
PetscScalar bl; /* Reactive component of shunt admittance to ground */
PetscInt area; /* Area number */
PetscInt zone; /* Zone number */
PetscScalar vmin; /* Minimum voltage threshold */
PetscScalar vmax; /* Maximum voltage threshold */
PetscScalar vm; /* Bus voltage magnitude; in pu */
PetscScalar va; /* Bus voltage phase angle */
PetscInt owner; /* Owner number */
PetscInt internal_i; /* Internal Bus Number */
PetscInt ngen; /* Number of generators incident at this bus */
PetscInt gidx[NGEN_AT_BUS_MAX]; /* list of inndices for accessing the generator data in GEN structure */
PetscInt nload;
PetscInt lidx[NLOAD_AT_BUS_MAX];
} PETSC_ATTRIBUTEALIGNED(sizeof(PetscScalar));
typedef struct _p_VERTEXDATA *VERTEXDATA;
/* 3. Load data */
/* 12 columns */
struct _p_LOAD{
PetscInt bus_i; /* Bus number */
char i[20]; /* Bus Number or extended bus name*/
char id[20]; /* Load identifier, in case of multiple loads. 1 by default */
PetscInt status; /* Load status */
PetscInt area; /* Area to which load is assigned */
PetscInt zone; /* Zone to which load is assigned */
PetscScalar pl; /* Active power component of constant MVA load */
PetscScalar ql; /* Reactive power component of constant MVA load */
PetscScalar ip; /* Active power component of constant current load: MW pu V */
PetscScalar iq; /* Reactive power component of constant current load: Mvar pu V */
PetscScalar yp; /* Active power component of constant admittance load: MW pu V */
PetscScalar yq; /* Reactive power component of constant admittance load: Mvar pu V */
PetscInt owner; /* Owner number */
PetscInt internal_i; /* Internal Bus Number */
PetscScalar scale_load;
} PETSC_ATTRIBUTEALIGNED(sizeof(PetscScalar));
typedef struct _p_LOAD *LOAD;
/* 4. Generator data */
/* 20+ columns */
/******* 20, USING ONLY 1 OWNER's WORTH OF DATA. COME BACK TO THIS LATER, if necessary ******/
struct _p_GEN{
PetscInt bus_i;
char i[20]; /* Bus Number or extended bus name*/
char id[20]; /* Generator identifier, in case of multiple generators at same bus. 1 by default */
PetscScalar pg; /* Generator active power output */
PetscScalar qg; /* Generator reactive power output */
PetscScalar qt; /* Maximum reactive power output: Mvar */
PetscScalar qb; /* Minimum reactive power output: Mvar */
PetscScalar vs; /* Regulated voltage setpoint: pu */
PetscInt ireg; /* Remote bus number/identifier */
PetscScalar mbase; /* MVA base of the machine */
PetscScalar zr; /* Complex machine impedance ZSOURCE in pu on mbase */
PetscScalar zx; /* ----------------------"------------------------- */
PetscScalar rt; /* Step-up transformer impedance XTRAN in pu on mbase */
PetscScalar xt; /* -----------------------"-------------------------- */
PetscScalar gtap; /* Step-up transformer turns ratio */
PetscInt status; /* Machine status */
PetscScalar rmpct; /* Mvar % required to hold voltage at remote bus */
PetscScalar pt; /* Gen max active power output: MW */
PetscScalar pb; /* Gen min active power output: MW */
PetscInt o1; /* Owner number */
PetscScalar f1; /* Fraction of ownership */
PetscInt internal_i; /* Internal Bus Number */
PetscScalar scale_gen;
} PETSC_ATTRIBUTEALIGNED(sizeof(PetscScalar));
typedef struct _p_GEN *GEN;
/* 17+ columns */
struct _p_EDGEDATA{
PetscInt fbus;
PetscInt tbus;
char i[20]; /* Bus Number or extended bus name*/
char j[20]; /* Bus Number or extended bus name*/
char ckt[20]; /* Circuit identifier. 1 by default */
PetscScalar r; /* Branch resistance: pu */
PetscScalar x; /* Branch reactance: pu */
PetscScalar b; /* Branch charging susceptance: pu */
PetscScalar rateA; /* rate A in MVA */
PetscScalar rateB; /* rate B in MVA */
PetscScalar rateC; /* rate C in MVA */
PetscScalar tapratio;
PetscScalar phaseshift;
PetscScalar gi; /* Complex admittance at 'i' end: pu */
PetscScalar bi; /* Complex admittance at 'i' end: pu */
PetscScalar gj; /* Complex admittance at 'j' end: pu */
PetscScalar bj; /* Complex admittance at 'j' end: pu */
PetscInt status; /* Service status */
PetscScalar length; /* Line length */
PetscInt o1; /* Owner number */
PetscScalar f1; /* Fraction of ownership */
PetscInt internal_i; /* Internal From Bus Number */
PetscInt internal_j; /* Internal To Bus Number */
PetscScalar yff[2],yft[2],ytf[2],ytt[2]; /* [G,B] */
PetscScalar pf,qf,sf,pt,qt,st; /* The from and to end real, reactive, and apparent power flows (pu) */
} PETSC_ATTRIBUTEALIGNED(sizeof(PetscScalar));
typedef struct _p_EDGEDATA *EDGEDATA;
/* PTI format data structure */
typedef struct{
PetscScalar sbase; /* System base MVA */
PetscInt nbus,ngen,nbranch,nload; /* # of buses,gens,branches, and loads (includes elements which are
out of service */
VERTEXDATA bus;
LOAD load;
GEN gen;
EDGEDATA branch;
}PFDATA PETSC_ATTRIBUTEALIGNED(sizeof(PetscScalar));
extern PetscErrorCode PFReadMatPowerData(PFDATA*,char*);
#endif