-
Notifications
You must be signed in to change notification settings - Fork 10
Expand file tree
/
Copy pathtest_parse_gen_row.cpp
More file actions
55 lines (44 loc) · 1.66 KB
/
Copy pathtest_parse_gen_row.cpp
File metadata and controls
55 lines (44 loc) · 1.66 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
#include <iostream>
#include "MatPowerTesting.hpp"
#include <Model/PowerFlow/MatpowerParser.hpp>
#include <Model/PowerFlow/PowerFlowData.hpp>
using namespace GridKit;
using namespace GridKit::Testing;
using namespace GridKit::PowerFlowData;
namespace
{
using IdxT = int;
using RealT = double;
static const std::string matpower_data{
R"(
%% generator data
% bus Pg Qg Qmax Qmin Vg mBase status Pmax Pmin Pc1 Pc2 Qc1min Qc1max Qc2min Qc2max ramp_agc ramp_10 ramp_30 ramp_q apf
mpc.gen = [
1 40 0 30 -30 1 100 1 40 0 0 0 0 0 0 0 0 0 0 0 0;
1 170 0 127.5 -127.5 1 100 1 170 0 0 0 0 0 0 0 0 0 0 0 0;
3 323.49 0 390 -390 1 100 1 520 0 0 0 0 0 0 0 0 0 0 0 0;
4 0 0 150 -150 1 100 1 200 0 0 0 0 0 0 0 0 0 0 0 0;
5 466.51 0 450 -450 1 100 1 600 0 0 0 0 0 0 0 0 0 0 0 0;
];
)"};
} // namespace
int main(int /* argc */, char** /* argv */)
{
int fail = 0;
std::vector<GenData<RealT, IdxT>> gen_answer{
{1, 40, 0, 30, -30, 1, 100, 1, 40, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
{1, 170, 0, 127.5, -127.5, 1, 100, 1, 170, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
{3, 323.49, 0, 390, -390, 1, 100, 1, 520, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
{4, 0, 0, 150, -150, 1, 100, 1, 200, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
{5, 466.51, 0, 450, -450, 1, 100, 1, 600, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}};
SystemModelData<RealT, IdxT> mp;
{
std::istringstream iss(matpower_data);
GridKit::readMatPower(mp, iss);
if (!isEqual(mp.gen, gen_answer))
fail++;
std::cout << "After reading the gen component, fail == " << fail << "\n";
}
std::cout << "Tests " << (fail ? "FAILED" : "PASSED") << "\n";
return fail;
}