33#ifndef OUTPUT_FILE_COMMON_H
34#define OUTPUT_FILE_COMMON_H
48#include <fmt/chrono.h>
62 char buf[MAX_COMPUTERNAME_LENGTH + 1];
63 DWORD bufLen =
sizeof(buf);
64 if (GetComputerNameA(buf, &bufLen))
return std::string(buf);
67 if (gethostname(buf,
sizeof(buf)) == 0)
return std::string(buf);
74 auto now = std::time(
nullptr);
75 return fmt::format(
"{:%d-%b-%Y %H:%M:%S}", fmt::localtime(now));
80 auto now = std::time(
nullptr);
81 return fmt::format(
"{:%d-%b-%Y}", fmt::localtime(now));
86 auto now = std::time(
nullptr);
87 return fmt::format(
"{:%H:%M:%S}", fmt::localtime(now));
100 int nBus =
static_cast<int>(busData.
Type.size());
101 for (
int i = 0; i < nBus; ++i) {
103 else if (busData.
Type(i) == 2) counts.
nPV++;
Data structures and utility functions for reading and displaying bus and branch data in power system ...
Small pieces of business/formatting logic shared by all OutputFile writers.
std::string timestamp()
Returns the current timestamp string.
std::string hostname()
Returns the current hostname.
std::string dateStr()
Returns the current date string.
BusTotals computeBusTotals(const BusData &busData)
Computes total load/gen/injected Mvar across all buses.
std::string timeStr()
Returns the current time string.
BusTypeCounts countBusTypes(const BusData &busData)
Counts buses by type (1=Slack, 2=PV, else PQ).
Contains all relevant data for each bus in the power system.
Eigen::VectorXd Ql
Reactive power load [MVAr or p.u.].
Eigen::VectorXd Pg
Active power generation [MW or p.u.].
Eigen::VectorXd Pl
Active power load [MW or p.u.].
Eigen::VectorXd Qg
Reactive power generation [MVAr or p.u.].
Eigen::VectorXi Type
Bus type (1=Slack, 2=PV, 3=PQ)
Aggregate bus totals (load/gen) used in the bus-data result tables.
Bus type counts (Slack/PV/PQ).