deltaFlow
OutputFile.H
Go to the documentation of this file.
1/*
2 * Copyright (c) 2024 Saud Zahir
3 *
4 * This file is part of deltaFlow.
5 *
6 * deltaFlow is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public
8 * License as published by the Free Software Foundation; either
9 * version 3 of the License, or (at your option) any later version.
10 *
11 * deltaFlow is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public
17 * License along with deltaFlow. If not, see
18 * <https://www.gnu.org/licenses/>.
19 */
20
27#ifndef OUTPUT_FILE_H
28#define OUTPUT_FILE_H
29
30#include <chrono>
31#include <cmath>
32#include <complex>
33#include <fstream>
34#include <string>
35#include <vector>
36
37#ifdef _WIN32
38 #include <windows.h>
39#else
40 #include <unistd.h>
41#endif
42
43#include <Eigen/Dense>
44#include <fmt/chrono.h>
45#include <fmt/core.h>
46
47#include "Display.H"
48#include "Data.H"
49#include "Version.H"
50
55namespace OutputFile {
56
60 inline std::string hostname() {
61 #ifdef _WIN32
62 char buf[MAX_COMPUTERNAME_LENGTH + 1];
63 DWORD bufLen = sizeof(buf);
64 if (GetComputerNameA(buf, &bufLen)) return std::string(buf);
65 #else
66 char buf[256];
67 if (gethostname(buf, sizeof(buf)) == 0) return std::string(buf);
68 #endif
69 return "unknown";
70 }
71
75 inline std::string timestamp() {
76 auto now = std::time(nullptr);
77 return fmt::format("{:%d-%b-%Y %H:%M:%S}", fmt::localtime(now));
78 }
79
83 inline std::string dateStr() {
84 auto now = std::time(nullptr);
85 return fmt::format("{:%d-%b-%Y}", fmt::localtime(now));
86 }
87
91 inline std::string timeStr() {
92 auto now = std::time(nullptr);
93 return fmt::format("{:%H:%M:%S}", fmt::localtime(now));
94 }
95
112 inline bool writeOutputFile(
113 const std::string& jobName,
114 const std::string& inputFile,
115 const std::string& solverName,
116 const std::string& formatName,
117 const BusData& busData,
118 const BranchData& branchData,
119 const Eigen::MatrixXcd& Y,
120 int iterations,
121 double finalError,
122 double tolerance,
123 double elapsedSec,
124 double basemva = 100.0
125 ) {
126 std::string outFile = jobName + ".out";
127 std::ofstream out(outFile);
128 if (!out.is_open()) return false;
129
130 int nBus = busData.V.size();
131 int nBranch = branchData.From.size();
132 int W = Display::pageWidth;
133
134 out << Display::fileBanner();
135
136 out << fmt::format("\n deltaFlow v{:<32s}Date {:>14s} Time {:>8s}\n",
137 deltaFlow_VERSION, dateStr(), timeStr());
138 out << "\n";
139
140 out << Display::sectionHeader("S Y S T E M I N F O R M A T I O N");
141 out << fmt::format(" Hostname : {}\n", hostname());
142 out << fmt::format(" CMake Version : {}\n", CMake_VERSION);
143 out << fmt::format(" Compiler Version : GCC {}\n", gcc_VERSION);
144 out << fmt::format(" deltaFlow Version : {}\n", deltaFlow_VERSION);
145 out << "\n";
146
147 out << Display::sectionHeader("J O B P A R A M E T E R S");
148 out << fmt::format(" Job Name : {}\n", jobName);
149 out << fmt::format(" Input File : {}\n", inputFile);
150 out << fmt::format(" Input Format : {}\n", formatName);
151 out << fmt::format(" Solver Method : {}\n", solverName);
152 out << fmt::format(" Convergence Tol. : {:.6e}\n", tolerance);
153 out << "\n";
154
155 out << Display::sectionHeader("M O D E L S U M M A R Y");
156
157 int nSlack = 0, nPV = 0, nPQ = 0;
158 for (int i = 0; i < nBus; ++i) {
159 if (busData.Type(i) == 1) nSlack++;
160 else if (busData.Type(i) == 2) nPV++;
161 else nPQ++;
162 }
163
164 out << fmt::format(" Number of Buses : {:>6d}\n", nBus);
165 out << fmt::format(" Slack Buses : {:>6d}\n", nSlack);
166 out << fmt::format(" PV Buses : {:>6d}\n", nPV);
167 out << fmt::format(" PQ Buses : {:>6d}\n", nPQ);
168 out << fmt::format(" Number of Branches : {:>6d}\n", nBranch);
169 out << fmt::format(" Base MVA : {:>10.1f}\n", basemva);
170 out << "\n";
171
172 out << Display::sectionHeader("S O L V E R S U M M A R Y");
173 out << fmt::format(" Method : {}\n", solverName);
174 out << fmt::format(" Iterations : {:>6d}\n", iterations);
175 out << fmt::format(" Final Error : {:.6e}\n", finalError);
176 out << fmt::format(" Tolerance : {:.6e}\n", tolerance);
177 out << fmt::format(" Status : CONVERGED\n");
178 out << fmt::format(" Elapsed Time (sec) : {:.3f}\n", elapsedSec);
179 out << "\n";
180
181 out << Display::sectionHeader("B U S D A T A R E S U L T S");
182 out << fmt::format(" {:>4s} {:>9s} {:>9s} {:>10s} {:>10s} {:>10s} {:>10s} {:>10s}\n",
183 "Bus", "Voltage", "Angle", "Load", "Load", "Gen", "Gen", "Injected");
184 out << fmt::format(" {:>4s} {:>9s} {:>9s} {:>10s} {:>10s} {:>10s} {:>10s} {:>10s}\n",
185 "No.", "Mag.", "Degree", "MW", "Mvar", "MW", "Mvar", "Mvar");
186 out << " " << std::string(W - 4, '=') << "\n";
187
188 for (int i = 0; i < nBus; ++i) {
189 double injectedMvar = busData.Qg(i) - busData.Ql(i);
190 out << fmt::format(" {:>4d} {:>9.4f} {:>9.4f} {:>10.4f} {:>10.4f} {:>10.4f} {:>10.4f} {:>10.4f}\n",
191 i + 1, busData.V(i), busData.delta(i),
192 busData.Pl(i), busData.Ql(i), busData.Pg(i), busData.Qg(i), injectedMvar);
193 }
194
195 double totalPl = busData.Pl.sum();
196 double totalQl = busData.Ql.sum();
197 double totalPg = busData.Pg.sum();
198 double totalQg = busData.Qg.sum();
199 double totalInjected = totalQg - totalQl;
200
201 out << " " << std::string(W - 4, '=') << "\n";
202 out << fmt::format(" Total{:>27.4f} {:>10.4f} {:>10.4f} {:>10.4f} {:>10.4f}\n",
203 totalPl, totalQl, totalPg, totalQg, totalInjected);
204 out << "\n";
205
206 out << Display::sectionHeader("L I N E F L O W A N D L O S S E S");
207 out << fmt::format(" {:>4s} {:>4s} {:>9s} {:>9s} {:>9s} {:>9s} {:>9s} {:>9s}\n",
208 "From", "To", "MW", "Mvar", "MVA", "Loss MW", "Loss Mvar", "Tap");
209 out << " " << std::string(W - 4, '=') << "\n";
210
211 auto Bc = branchData.B;
212 int nLine = nBranch;
213
214 Eigen::VectorXcd Vc(nBus);
215 Eigen::VectorXcd S(nBus);
216 for (int i = 0; i < nBus; ++i) {
217 double mag = busData.V(i);
218 double ang_rad = busData.delta(i) * M_PI / 180.0;
219 Vc(i) = std::polar(mag, ang_rad);
220 double P = busData.Pg(i) - busData.Pl(i);
221 double Q = busData.Qg(i) - busData.Ql(i);
222 S(i) = std::complex<double>(P, Q);
223 }
224
225 std::complex<double> SLT = 0.0;
226
227 for (int n = 1; n <= nBus; ++n) {
228 int n_idx = n - 1;
229 bool busprt = false;
230
231 for (int L = 0; L < nLine; ++L) {
232 if (!busprt) {
233 double P_inj = busData.Pg(n_idx) - busData.Pl(n_idx);
234 double Q_inj = busData.Qg(n_idx) - busData.Ql(n_idx);
235 double S_mag = std::abs(S(n_idx)) * basemva;
236 out << fmt::format(" {:>4d} {:>9.3f} {:>9.3f} {:>9.3f}\n",
237 n, P_inj, Q_inj, S_mag);
238 busprt = true;
239 }
240
241 auto writeLineFlow = [&](int from, int to, int L) {
242 int f_idx = from - 1;
243 int t_idx = to - 1;
244 double aL = (branchData.tapRatio(L) == 0.0) ? 1.0 : branchData.tapRatio(L);
245
246 std::complex<double> In, Ik;
247 if (branchData.From(L) == from) {
248 In = (Vc(f_idx) - aL * Vc(t_idx)) * Y(L) / (aL * aL) + Bc(L) / (aL * aL) * Vc(f_idx);
249 Ik = (Vc(t_idx) - Vc(f_idx) / aL) * Y(L) + Bc(L) * Vc(t_idx);
250 } else {
251 In = (Vc(f_idx) - Vc(t_idx) / aL) * Y(L) + Bc(L) * Vc(f_idx);
252 Ik = (Vc(t_idx) - aL * Vc(f_idx)) * Y(L) / (aL * aL) + Bc(L) / (aL * aL) * Vc(t_idx);
253 }
254 std::complex<double> Snk = Vc(f_idx) * std::conj(In) * basemva;
255 std::complex<double> Skn = Vc(t_idx) * std::conj(Ik) * basemva;
256 std::complex<double> SL = Snk + Skn;
257 SLT += SL;
258
259 if (aL != 1.0) {
260 out << fmt::format(" {:>4d} {:>9.3f} {:>9.3f} {:>9.3f} {:>9.3f} {:>9.3f} {:>9.3f}\n",
261 to, std::real(Snk), std::imag(Snk), std::abs(Snk),
262 std::real(SL), std::imag(SL), aL);
263 } else {
264 out << fmt::format(" {:>4d} {:>9.3f} {:>9.3f} {:>9.3f} {:>9.3f} {:>9.3f}\n",
265 to, std::real(Snk), std::imag(Snk), std::abs(Snk),
266 std::real(SL), std::imag(SL));
267 }
268 };
269
270 if (branchData.From(L) == n) {
271 writeLineFlow(n, branchData.To(L), L);
272 } else if (branchData.To(L) == n) {
273 writeLineFlow(n, branchData.From(L), L);
274 }
275 }
276 }
277
278 SLT /= 2.0;
279 out << "\n";
280 out << fmt::format(" Total loss {:>9.3f} {:>9.3f}\n",
281 std::real(SLT), std::imag(SLT));
282 out << "\n";
283
284 out << "\n";
285 out << "\n";
286 out << " JOB TIME SUMMARY\n";
287 out << fmt::format(" TOTAL CPU TIME (SEC) = {:>12.5f}\n", elapsedSec);
288 out << fmt::format(" WALLCLOCK TIME (SEC) = {:>12d}\n", static_cast<int>(std::round(elapsedSec)));
289 out << "\n";
290
291 out << Display::sectionHeader("A N A L Y S I S C O M P L E T E");
292 out << Display::center("THE ANALYSIS HAS BEEN COMPLETED SUCCESSFULLY") << "\n";
293 out << "\n";
294
295 out.close();
296 return true;
297 }
298
314 inline bool writeStatusFile(
315 const std::string& jobName,
316 const std::string& inputFile,
317 const std::string& solverName,
318 const std::string& formatName,
319 int nBus,
320 int nBranch,
321 int iterations,
322 double finalError,
323 double tolerance,
324 bool converged,
325 double elapsedSec
326 ) {
327 std::string staFile = jobName + ".sta";
328 std::ofstream out(staFile);
329 if (!out.is_open()) return false;
330
331 out << fmt::format("deltaFlow v{:<36s}Date {:>14s} Time {:>8s}\n",
332 deltaFlow_VERSION, dateStr(), timeStr());
333
334 out << " SUMMARY OF JOB INFORMATION:\n";
335 out << fmt::format(" {:>6s} {:>6s} {:>10s} {:>12s} {:>12s} {:>8s}\n",
336 "ITER", "STATUS", "ERROR", "TOLERANCE", "ELAPSED", "RESULT");
337
338 out << fmt::format(" {:>6d} {:>6s} {:>10.3e} {:>12.3e} {:>12.3f} {:>8s}\n",
339 iterations,
340 converged ? "CONV" : "FAIL",
341 finalError,
342 tolerance,
343 elapsedSec,
344 converged ? "OK" : "FAILED");
345
346 out << "\n";
347 if (converged) {
348 out << " THE ANALYSIS HAS COMPLETED SUCCESSFULLY\n";
349 } else {
350 out << " THE ANALYSIS HAS FAILED TO CONVERGE\n";
351 }
352
353 out << "\n";
354 out << "Jobinfo File:\n";
355 out << fmt::format("Inputfile: {}\n", inputFile);
356 out << fmt::format("Solver: {}\n", solverName);
357 out << fmt::format("Format: {}\n", formatName);
358 out << fmt::format("Hostname: {}\n", hostname());
359 out << "\n";
360
361 out << "solver and hardware info\n";
362 out << "------------------------\n";
363 out << fmt::format("version : {}\n", deltaFlow_VERSION);
364 out << fmt::format("compiler : GCC {}\n", gcc_VERSION);
365 out << fmt::format("cmake : {}\n", CMake_VERSION);
366 out << fmt::format("hostname : {}\n", hostname());
367 out << "\n";
368
369 out << "model info\n";
370 out << "----------\n";
371 out << fmt::format(" # of buses : {}\n", nBus);
372 out << fmt::format(" # of branches : {}\n", nBranch);
373 out << "\n";
374
375 out << "run and timing info\n";
376 out << "-------------------\n";
377 out << fmt::format("simulation end : {}\n", timestamp());
378 out << fmt::format("elapsed time : {:.3f} seconds\n", elapsedSec);
379 out << fmt::format("iterations : {}\n", iterations);
380 out << fmt::format("final error : {:.6e}\n", finalError);
381 out << fmt::format("termination status: {}\n", converged ? "normal" : "failed");
382 out << "\n";
383
384 out.close();
385 return true;
386 }
387
397 inline bool writeMessageFile(
398 const std::string& jobName,
399 const std::string& solverName,
400 const std::vector<std::pair<int, double>>& iterationHistory,
401 double tolerance,
402 bool converged
403 ) {
404 std::string msgFile = jobName + ".msg";
405 std::ofstream out(msgFile);
406 if (!out.is_open()) return false;
407
408 out << Display::fileBanner();
409
410 out << fmt::format("\n deltaFlow v{:<32s}Date {:>14s} Time {:>8s}\n",
411 deltaFlow_VERSION, dateStr(), timeStr());
412 out << "\n";
413
414 out << Display::sectionHeader("I T E R A T I O N H I S T O R Y");
415
416 out << fmt::format(" {:>6s} {:>16s} {:>12s} {:>8s}\n",
417 "Iter", "Max Mismatch", "Tolerance", "Status");
418 out << " " << std::string(Display::pageWidth - 4, '-') << "\n";
419
420 for (const auto& [iter, error] : iterationHistory) {
421 std::string status = (error < tolerance) ? "CONV" : "";
422 out << fmt::format(" {:>6d} {:>16.6e} {:>12.6e} {:>8s}\n",
423 iter, error, tolerance, status);
424 }
425
426 out << " " << std::string(Display::pageWidth - 4, '-') << "\n";
427 out << "\n";
428
429 if (converged) {
430 out << " " << solverName << " CONVERGED\n";
431 } else {
432 out << " *** WARNING: " << solverName << " DID NOT CONVERGE\n";
433 }
434
435 out << "\n";
436 out.close();
437 return true;
438 }
439
457 inline bool writeDatFile(
458 const std::string& jobName,
459 const std::string& inputFile,
460 const std::string& solverName,
461 const std::string& formatName,
462 const BusData& busData,
463 const BranchData& branchData,
464 const std::vector<std::pair<int, double>>& iterationHistory,
465 int totalIterations,
466 double finalError,
467 double tolerance,
468 bool converged,
469 double elapsedSec,
470 double basemva = 100.0
471 ) {
472 std::string datFile = jobName + ".dat";
473 std::ofstream out(datFile);
474 if (!out.is_open()) return false;
475
476 int nBus = busData.V.size();
477 int nBranch = branchData.From.size();
478 int W = Display::pageWidth;
479
480 out << Display::fileBanner();
481 out << fmt::format("\n deltaFlow v{:<32s}Date {:>14s} Time {:>8s}\n",
482 deltaFlow_VERSION, dateStr(), timeStr());
483
484 out << Display::sectionHeader("I N P U T P R O C E S S I N G");
485 out << fmt::format(" Input File : {}\n", inputFile);
486 out << fmt::format(" Input Format : {}\n", formatName);
487
488 int nSlack = 0, nPV = 0, nPQ = 0;
489 for (int i = 0; i < nBus; ++i) {
490 if (busData.Type(i) == 1) nSlack++;
491 else if (busData.Type(i) == 2) nPV++;
492 else nPQ++;
493 }
494
495 out << fmt::format(" Number of Buses : {:>6d}\n", nBus);
496 out << fmt::format(" Slack Buses : {:>6d}\n", nSlack);
497 out << fmt::format(" PV Buses : {:>6d}\n", nPV);
498 out << fmt::format(" PQ Buses : {:>6d}\n", nPQ);
499 out << fmt::format(" Number of Branches : {:>6d}\n", nBranch);
500 out << fmt::format(" Base MVA : {:>10.1f}\n", basemva);
501
502 std::string solverBanner;
503 for (const char &c : solverName) {
504 solverBanner += std::toupper(c);
505 solverBanner += ' ';
506 }
507 out << Display::sectionHeader(solverBanner + " S O L V E R E X E C U T I O N");
508 out << fmt::format(" Method : {}\n", solverName);
509 out << fmt::format(" Max Iterations : {:>6d}\n", static_cast<int>(iterationHistory.size()) > 0 ?
510 static_cast<int>(iterationHistory.back().first) : totalIterations);
511 out << fmt::format(" Convergence Tol. : {:.6e}\n", tolerance);
512 out << "\n";
513
514 out << fmt::format(" {:>6s} {:>16s} {:>12s} {:>8s}\n",
515 "Iter", "Max Mismatch", "Tolerance", "Status");
516 out << " " << std::string(W - 4, '-') << "\n";
517
518 for (const auto& [iter, error] : iterationHistory) {
519 std::string status;
520 if (error < tolerance)
521 status = "CONV";
522 else
523 status = "----";
524 out << fmt::format(" {:>6d} {:>16.6e} {:>12.6e} {:>8s}\n",
525 iter, error, tolerance, status);
526 }
527
528 out << " " << std::string(W - 4, '-') << "\n";
529 out << "\n";
530
531 if (converged) {
532 out << fmt::format(" {} CONVERGED after {} iterations.\n", solverName, totalIterations);
533 out << fmt::format(" Final max mismatch = {:.6e}\n", finalError);
534 } else {
535 out << fmt::format(" *** WARNING: {} DID NOT CONVERGE after {} iterations.\n", solverName, totalIterations);
536 out << fmt::format(" Final max mismatch = {:.6e}\n", finalError);
537 }
538
539 out << Display::sectionHeader("B U S D A T A R E S U L T S");
540 out << fmt::format(" {:>4s} {:>9s} {:>9s} {:>10s} {:>10s} {:>10s} {:>10s} {:>10s}\n",
541 "Bus", "Voltage", "Angle", "Load", "Load", "Gen", "Gen", "Injected");
542 out << fmt::format(" {:>4s} {:>9s} {:>9s} {:>10s} {:>10s} {:>10s} {:>10s} {:>10s}\n",
543 "No.", "Mag.", "Degree", "MW", "Mvar", "MW", "Mvar", "Mvar");
544 out << " " << std::string(W - 4, '=') << "\n";
545
546 for (int i = 0; i < nBus; ++i) {
547 double injectedMvar = busData.Qg(i) - busData.Ql(i);
548 out << fmt::format(" {:>4d} {:>9.4f} {:>9.4f} {:>10.4f} {:>10.4f} {:>10.4f} {:>10.4f} {:>10.4f}\n",
549 i + 1, busData.V(i), busData.delta(i),
550 busData.Pl(i), busData.Ql(i), busData.Pg(i), busData.Qg(i), injectedMvar);
551 }
552
553 out << " " << std::string(W - 4, '=') << "\n";
554
555 double totalPl = busData.Pl.sum();
556 double totalQl = busData.Ql.sum();
557 double totalPg = busData.Pg.sum();
558 double totalQg = busData.Qg.sum();
559 double totalInjected = totalQg - totalQl;
560
561 out << fmt::format(" Total{:>27.4f} {:>10.4f} {:>10.4f} {:>10.4f} {:>10.4f}\n",
562 totalPl, totalQl, totalPg, totalQg, totalInjected);
563
564 out << "\n\n";
565 out << " JOB TIME SUMMARY\n";
566 out << fmt::format(" TOTAL CPU TIME (SEC) = {:>12.5f}\n", elapsedSec);
567 out << fmt::format(" WALLCLOCK TIME (SEC) = {:>12d}\n", static_cast<int>(std::round(elapsedSec)));
568 out << "\n";
569
570 out << Display::sectionHeader("A N A L Y S I S C O M P L E T E");
571 if (converged) {
572 out << Display::center("THE ANALYSIS HAS BEEN COMPLETED SUCCESSFULLY") << "\n";
573 } else {
574 out << Display::center("*** THE ANALYSIS HAS NOT CONVERGED ***") << "\n";
575 }
576 out << "\n";
577
578 out.close();
579 return true;
580 }
581
582}
583
584#endif
Data structures and utility functions for reading and displaying bus and branch data in power system ...
Display and formatting utilities for terminal and file output.
std::string center(const std::string &text)
Returns a centered string within the page width.
Definition Display.H:91
constexpr int pageWidth
Standard output page width.
Definition Display.H:51
std::string sectionHeader(const std::string &title)
Returns a section header for output files.
Definition Display.H:226
std::string fileBanner()
Returns a full plain-text banner for output/log files.
Definition Display.H:217
Functions for writing solver output, status, message, and data files.
bool writeOutputFile(const std::string &jobName, const std::string &inputFile, const std::string &solverName, const std::string &formatName, const BusData &busData, const BranchData &branchData, const Eigen::MatrixXcd &Y, int iterations, double finalError, double tolerance, double elapsedSec, double basemva=100.0)
Writes the main output file (.out) with full analysis results.
Definition OutputFile.H:112
bool writeDatFile(const std::string &jobName, const std::string &inputFile, const std::string &solverName, const std::string &formatName, const BusData &busData, const BranchData &branchData, const std::vector< std::pair< int, double > > &iterationHistory, int totalIterations, double finalError, double tolerance, bool converged, double elapsedSec, double basemva=100.0)
Writes the detailed data file (.dat) with full input/output records.
Definition OutputFile.H:457
std::string hostname()
Returns the current hostname.
Definition OutputFile.H:60
bool writeStatusFile(const std::string &jobName, const std::string &inputFile, const std::string &solverName, const std::string &formatName, int nBus, int nBranch, int iterations, double finalError, double tolerance, bool converged, double elapsedSec)
Writes the status file (.sta) with a compact solver summary.
Definition OutputFile.H:314
std::string timestamp()
Returns the current timestamp string.
Definition OutputFile.H:75
std::string timeStr()
Returns the current time string.
Definition OutputFile.H:91
std::string dateStr()
Returns the current date string.
Definition OutputFile.H:83
bool writeMessageFile(const std::string &jobName, const std::string &solverName, const std::vector< std::pair< int, double > > &iterationHistory, double tolerance, bool converged)
Writes the message file (.msg) with iteration history.
Definition OutputFile.H:397
Contains all relevant data for each transmission line or transformer branch.
Definition Data.H:83
Eigen::VectorXd tapRatio
Transformer tap ratio ($$ a $$)
Definition Data.H:90
Eigen::VectorXd B
Line susceptance ($$ B $$) [p.u.].
Definition Data.H:89
Eigen::VectorXi From
From bus indices.
Definition Data.H:84
Eigen::VectorXi To
To bus indices.
Definition Data.H:85
Contains all relevant data for each bus in the power system.
Definition Data.H:55
Eigen::VectorXd Ql
Reactive power load [MVAr or p.u.].
Definition Data.H:65
Eigen::VectorXd V
Voltage magnitude [p.u.].
Definition Data.H:60
Eigen::VectorXd Pg
Active power generation [MW or p.u.].
Definition Data.H:62
Eigen::VectorXd delta
Voltage angle [rad or deg].
Definition Data.H:61
Eigen::VectorXd Pl
Active power load [MW or p.u.].
Definition Data.H:64
Eigen::VectorXd Qg
Reactive power generation [MVAr or p.u.].
Definition Data.H:63
Eigen::VectorXi Type
Bus type (1=Slack, 2=PV, 3=PQ)
Definition Data.H:58