Skip to content

Commit b0f7a9d

Browse files
committed
AMENDME
1 parent 59dcbd0 commit b0f7a9d

File tree

7 files changed

+1093
-2
lines changed

7 files changed

+1093
-2
lines changed

include/private/psse.hpp

Lines changed: 187 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,187 @@
1+
#pragma once
2+
3+
#include <array>
4+
#include <istream>
5+
#include <string>
6+
#include <vector>
7+
8+
#include <ps.h>
9+
10+
namespace exago {
11+
namespace psse {
12+
13+
struct CaseID
14+
{
15+
int ic;
16+
double sbase;
17+
int rev;
18+
int xfrrat;
19+
int nxfrat;
20+
double basfrq;
21+
std::array<std::string, 3> extra;
22+
};
23+
24+
struct Bus {
25+
int i;
26+
std::string name;
27+
double baskv;
28+
int ide;
29+
int area;
30+
int zone;
31+
int owner;
32+
double vm;
33+
double va;
34+
double nvhi{1.1};
35+
double nvlo{0.9};
36+
double evhi{1.1};
37+
double evlo{0.9};
38+
}; // namespace pssestruct Bus
39+
40+
struct Load {
41+
int i; // TODO: could also be specified as bus name (???)
42+
std::string id;
43+
int status;
44+
int area;
45+
int zone;
46+
double pl;
47+
double ql;
48+
double ip;
49+
double iq;
50+
double yp;
51+
double yq;
52+
int owner;
53+
int scale;
54+
int intrpt;
55+
};
56+
57+
struct FixedBusShunt
58+
{
59+
int i; // TODO: could be bus name (???)
60+
std::string id;
61+
int status;
62+
double gl;
63+
double bl;
64+
};
65+
66+
struct Ownership {
67+
int owner;
68+
double fraction;
69+
};
70+
71+
struct Generator {
72+
int i; // TODO: could be bus name (???)
73+
std::string id;
74+
double pg;
75+
double qg;
76+
double qt;
77+
double qb;
78+
double vs;
79+
int ireg; // TODO: could be bus name (???)
80+
double mbase;
81+
double zr;
82+
double zx;
83+
double rt;
84+
double xt;
85+
double gtap;
86+
int stat;
87+
double rmpct;
88+
double pt;
89+
double pb;
90+
std::array<Ownership, 4> owners;
91+
int wmod{0};
92+
double wpf{1.0};
93+
};
94+
95+
struct Branch {
96+
int i; // TODO: could be bus name (???)
97+
int j; // TODO: could be bus name (???)
98+
std::string ckt;
99+
double r;
100+
double x;
101+
double b;
102+
double ratea;
103+
double rateb;
104+
double ratec;
105+
double gi;
106+
double bi;
107+
double gj;
108+
double bj;
109+
int st;
110+
int met;
111+
double len;
112+
std::array<Ownership, 4> owners;
113+
};
114+
115+
struct Impedence {
116+
double r;
117+
double x;
118+
double sbase;
119+
};
120+
121+
struct Winding {
122+
double windv;
123+
double nomv;
124+
double ang;
125+
double rata;
126+
double ratb;
127+
double ratc;
128+
int cod;
129+
int cont;
130+
double rma;
131+
double rmi;
132+
double vma;
133+
double vmi;
134+
int ntp;
135+
int tab;
136+
double cr;
137+
double cx;
138+
double cnxa;
139+
};
140+
141+
struct Transformer {
142+
int i;
143+
int j;
144+
int k;
145+
std::string ckt;
146+
int cw;
147+
int cz;
148+
int cm;
149+
double mag1;
150+
double mag2;
151+
int nmetr;
152+
std::string name;
153+
int stat;
154+
std::array<Ownership, 4> owners;
155+
Impedence imp12;
156+
Impedence imp23;
157+
Impedence imp31;
158+
double vmstar;
159+
double anstar;
160+
std::array<Winding, 3> windings;
161+
};
162+
163+
struct Area
164+
{
165+
int i;
166+
int isw; // TODO: could be bus name (???)
167+
double pdes;
168+
double ptol;
169+
std::string arname;
170+
};
171+
172+
struct Network {
173+
CaseID case_id;
174+
std::vector<Bus> buses;
175+
std::vector<Load> loads;
176+
std::vector<Generator> generators;
177+
std::vector<Branch> branches;
178+
std::vector<Transformer> transformers;
179+
};
180+
181+
Network parse_network(std::istream& is);
182+
Network parse_network(const std::string& filename);
183+
184+
PetscErrorCode convert_to_ps(PS ps, const Network& nw);
185+
186+
}
187+
} // namespace exago

src/ps/CMakeLists.txt

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
# Specify PowerSystem module sources (shared across libraries)
2-
set(PS_SRC ps.cpp psreaddata.cpp psoutput.cpp psislanding.cpp)
2+
set(PS_SRC ps.cpp psreaddata.cpp psoutput.cpp psislanding.cpp psse.cpp)
33

4-
set(PS_HEADERS ${CMAKE_SOURCE_DIR}/include/ps.h)
4+
set(PS_HEADERS ${CMAKE_SOURCE_DIR}/include/ps.h
5+
${CMAKE_SOURCE_DIR}/include/psse.hpp)
56

67
set_source_files_properties(${PS_SRC} PROPERTIES LANGUAGE CXX)
78

0 commit comments

Comments
 (0)