Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,8 @@ set(EP_CXX_PCH_HEADERS
"$<$<COMPILE_LANGUAGE:CXX>:${PROJECT_SOURCE_DIR}/src/EnergyPlus/Data/EnergyPlusData.hh>"
"$<$<COMPILE_LANGUAGE:CXX>:${PROJECT_SOURCE_DIR}/third_party/ObjexxFCL/src/ObjexxFCL/Array.functions.hh>"
"$<$<COMPILE_LANGUAGE:CXX>:${PROJECT_SOURCE_DIR}/third_party/ObjexxFCL/src/ObjexxFCL/Array1D.hh>"
"$<$<COMPILE_LANGUAGE:CXX>:${PROJECT_SOURCE_DIR}/third_party/nlohmann/json.hpp>")
"$<$<COMPILE_LANGUAGE:CXX>:${PROJECT_SOURCE_DIR}/third_party/nlohmann/json.hpp>"
"$<$<COMPILE_LANGUAGE:CXX>:${PROJECT_SOURCE_DIR}/src/EnergyPlus/Formatters.hh>")
set(EP_TEST_CXX_PCH_HEADERS
${EP_CXX_PCH_HEADERS}
"$<$<COMPILE_LANGUAGE:CXX>:<gtest/gtest.h>>"
Expand Down
2 changes: 1 addition & 1 deletion src/EnergyPlus/ChillerElectricASHRAE205.cc
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ void getChillerASHRAE205Input(EnergyPlusData &state)
thisChiller.Representation = std::dynamic_pointer_cast<tk205::rs0001_ns::RS0001>(
RSInstanceFactory::create("RS0001", FileSystem::toString(rep_file_path).c_str(), std::make_shared<EnergyPlusLogger>()));
if (nullptr == thisChiller.Representation) {
ShowSevereError(state, std::format("{} is not an instance of an ASHRAE205 Chiller.", rep_file_path.string()));
ShowSevereError(state, std::format("{} is not an instance of an ASHRAE205 Chiller.", rep_file_path));
ErrorsFound = true;
}
thisChiller.Representation->performance.performance_map_cooling.get_logger()->set_message_context(&thisChiller.LoggerContext);
Expand Down
7 changes: 3 additions & 4 deletions src/EnergyPlus/ChillerElectricEIR.cc
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@
#include <EnergyPlus/EMSManager.hh>
#include <EnergyPlus/FaultsManager.hh>
#include <EnergyPlus/FluidProperties.hh>
#include <EnergyPlus/Formatters.hh>
#include <EnergyPlus/General.hh>
#include <EnergyPlus/GeneralRoutines.hh>
#include <EnergyPlus/GlobalNames.hh>
Expand Down Expand Up @@ -728,10 +729,8 @@ void GetElectricEIRChillerInput(EnergyPlusData &state)
ShowSevereError(state, std::format("{}{}=\"{}\"", RoutineName, s_ipsc->cCurrentModuleObject, s_ipsc->cAlphaArgs(1)));
ShowContinueError(state, "Energy input ratio as a function of part-load ratio curve shows negative values.");
ShowContinueError(state, "EIR as a function of PLR curve output at various part-load ratios shown below:");
ShowContinueError(
state, fmt::format(fmt::runtime("PLR = {:7." + std::to_string(DecimalPrecision) + "F}"), fmt::join(PLRArray, ",")));
ShowContinueError(
state, fmt::format(fmt::runtime("Curve Output = {:7." + std::to_string(DecimalPrecision) + "F}"), fmt::join(CurveValArray, ",")));
ShowContinueError(state, std::format("PLR = {:7.{}F}", EnergyPlus::join(PLRArray, ","), DecimalPrecision));
ShowContinueError(state, std::format("Curve Output = {:7.{}F}", EnergyPlus::join(CurveValArray, ","), DecimalPrecision));
ErrorsFound = true;
}
}
Expand Down
5 changes: 3 additions & 2 deletions src/EnergyPlus/ChillerReformulatedEIR.cc
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@
#include <EnergyPlus/EMSManager.hh>
#include <EnergyPlus/FaultsManager.hh>
#include <EnergyPlus/FluidProperties.hh>
#include <EnergyPlus/Formatters.hh>
#include <EnergyPlus/General.hh>
#include <EnergyPlus/GlobalNames.hh>
#include <EnergyPlus/InputProcessing/InputProcessor.hh>
Expand Down Expand Up @@ -1641,8 +1642,8 @@ void ReformulatedEIRChillerSpecs::size(EnergyPlusData &state)
ShowContinueError(state,
"EIR as a function of PLR curve output at various part-load ratios and condenser water temperatures shown below:");
ShowContinueError(state, "PLR = 0.00 0.10 0.20 0.30 0.40 0.50 0.60 0.70 0.80 0.90 1.00");
ShowContinueError(state, fmt::format("Cond Temp(C) = {:7.2F}", fmt::join(CondTempArray, " ")));
ShowContinueError(state, fmt::format("Curve Output = {:7.2F}", fmt::join(CurveValArray, " ")));
ShowContinueError(state, std::format("Cond Temp(C) = {:7.2F}", EnergyPlus::join(CondTempArray, "")));
ShowContinueError(state, std::format("Curve Output = {:7.2F}", EnergyPlus::join(CurveValArray, "")));
ErrorsFound = true;
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/EnergyPlus/Coils/CoilCoolingDXAshrae205Performance.cc
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ CoilCoolingDX205Performance::CoilCoolingDX205Performance(EnergyPlus::EnergyPlusD
representation =
std::dynamic_pointer_cast<rs0004_ns::RS0004>(RSInstanceFactory::create("RS0004", rep_file_path.string().c_str(), coil_logger));
if (nullptr == representation) {
ShowSevereError(state, std::format("{} is not an instance of an ASHRAE205 Coil.", rep_file_path.string()));
ShowSevereError(state, std::format("{} is not an instance of an ASHRAE205 Coil.", rep_file_path));
errorsFound = true;
} else {
representation->performance.performance_map_cooling.get_logger()->set_message_context(&logger_context);
Expand Down
49 changes: 23 additions & 26 deletions src/EnergyPlus/CommandLineInterface.cc
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@
#include <EnergyPlus/DisplayRoutines.hh>
#include <EnergyPlus/EnergyPlus.hh>
#include <EnergyPlus/FileSystem.hh>
#include <EnergyPlus/Formatters.hh>
#include <EnergyPlus/PluginManager.hh>
#if LINK_WITH_PYTHON
# include <EnergyPlus/PythonEngine.hh>
Expand Down Expand Up @@ -216,20 +217,20 @@ Built on Platform: {}
bool debugCLI = std::any_of(args.begin(), args.end(), [](const auto &arg) { return arg == "--debug-cli"; });
if (debugCLI) {
{
fmt::print("ProcessArgs: received args\n");
std::print("ProcessArgs: received args\n");
int na = 0;
for (const auto &a : args) {
fmt::print("* {}: '{}'\n", na++, a);
std::print("* {}: '{}'\n", na++, a);
}
}
{
fmt::print("\nAfter massaging/expanding of args\n");
std::print("\nAfter massaging/expanding of args\n");
int na = 0;
for (const auto &a : arguments) {
fmt::print("* {}: '{}'\n", na++, a);
std::print("* {}: '{}'\n", na++, a);
}
}
fmt::print("\n");
std::print("\n");
}
// bool debugCLI = false;
app.add_flag("--debug-cli", debugCLI, "Print the result of the CLI assignments to the console and exit")->group(""); // Empty group to hide it
Expand Down Expand Up @@ -296,10 +297,10 @@ main([)python";
bool eplus_dir_provided =
std::any_of(fwd_args.begin(), fwd_args.end(), [](const std::string &a) { return a == "-e" || a == "--eplus-dir"; });
if (!eplus_dir_provided) {
cmd += EnergyPlus::format(R"("--eplus-dir", "{}", )", state.dataStrGlobals->exeDirectoryPath.generic_string());
cmd += std::format(R"("--eplus-dir", "{:g}", )", state.dataStrGlobals->exeDirectoryPath);
}
for (const auto &arg : fwd_args) {
cmd += EnergyPlus::format("\"{}\", ", arg);
cmd += std::format("\"{}\", ", arg);
}
}
cmd += "])\n";
Expand Down Expand Up @@ -357,7 +358,7 @@ run_manager_from_cli()
}

if (debugCLI) {
fmt::print(stderr,
std::print(stderr,
R"debug(
state.dataGlobal->AnnualSimulation = {},
state.dataGlobal->DDOnlySimulation = {},
Expand Down Expand Up @@ -392,7 +393,7 @@ state.dataStrGlobals->inputFilePath='{:g}',
state.files.inputWeatherFilePath.filePath,
state.dataStrGlobals->inputFilePath);

fmt::print(stderr, "--debug-cli passed: exiting early\n");
std::print(stderr, "--debug-cli passed: exiting early\n");

exit(0);
}
Expand Down Expand Up @@ -429,8 +430,7 @@ state.dataStrGlobals->inputFilePath='{:g}',
break;
default:
DisplayString(state,
std::format("ERROR: Input file must have IDF, IMF, or epJSON extension: {}",
state.dataStrGlobals->inputFilePath.generic_string()));
std::format("ERROR: Input file must have IDF, IMF, or epJSON extension: {:g}", state.dataStrGlobals->inputFilePath));
if (eplusRunningViaAPI) {
return static_cast<int>(ReturnCodes::Failure);
}
Expand Down Expand Up @@ -640,7 +640,7 @@ state.dataStrGlobals->inputFilePath='{:g}',
if (FileSystem::fileExists(state.files.iniFile.filePath)) {
EnergyPlus::InputFile iniFile = state.files.iniFile.try_open();
if (!iniFile.good()) {
DisplayString(state, std::format("ERROR: Could not open file {} for input (read).", iniFile.filePath.string()));
DisplayString(state, std::format("ERROR: Could not open file {} for input (read).", iniFile.filePath));
if (eplusRunningViaAPI) {
return static_cast<int>(ReturnCodes::Failure);
}
Expand Down Expand Up @@ -668,8 +668,7 @@ state.dataStrGlobals->inputFilePath='{:g}',
// Check if specified files exist
if (!FileSystem::fileExists(state.dataStrGlobals->inputFilePath)) {
DisplayString(
state,
std::format("ERROR: Could not find input data file: {}.", FileSystem::getAbsolutePath(state.dataStrGlobals->inputFilePath).string()));
state, std::format("ERROR: Could not find input data file: {}.", FileSystem::getAbsolutePath(state.dataStrGlobals->inputFilePath)));
DisplayString(state, errorFollowUp);
if (eplusRunningViaAPI) {
return static_cast<int>(ReturnCodes::Failure);
Expand All @@ -679,9 +678,9 @@ state.dataStrGlobals->inputFilePath='{:g}',

if ((weatherPathOpt->count() > 0) && !state.dataGlobal->DDOnlySimulation) {
if (!FileSystem::fileExists(state.files.inputWeatherFilePath.filePath)) {
DisplayString(state,
std::format("ERROR: Could not find weather file: {}.",
FileSystem::getAbsolutePath(state.files.inputWeatherFilePath.filePath).string()));
DisplayString(
state,
std::format("ERROR: Could not find weather file: {}.", FileSystem::getAbsolutePath(state.files.inputWeatherFilePath.filePath)));
DisplayString(state, errorFollowUp);
if (eplusRunningViaAPI) {
return static_cast<int>(ReturnCodes::Failure);
Expand All @@ -696,7 +695,7 @@ state.dataStrGlobals->inputFilePath='{:g}',
if (runEPMacro) {
fs::path epMacroPath = (state.dataStrGlobals->exeDirectoryPath / "EPMacro").replace_extension(FileSystem::exeExtension);
if (!FileSystem::fileExists(epMacroPath)) {
DisplayString(state, std::format("ERROR: Could not find EPMacro executable: {}.", FileSystem::getAbsolutePath(epMacroPath).string()));
DisplayString(state, std::format("ERROR: Could not find EPMacro executable: {}.", FileSystem::getAbsolutePath(epMacroPath)));
if (eplusRunningViaAPI) {
return static_cast<int>(ReturnCodes::Failure);
}
Expand All @@ -722,9 +721,8 @@ state.dataStrGlobals->inputFilePath='{:g}',
fs::path expandObjectsPath =
(state.dataStrGlobals->exeDirectoryPath / fs::path("ExpandObjects")).replace_extension(FileSystem::exeExtension);
if (!FileSystem::fileExists(expandObjectsPath)) {
DisplayString(
state,
std::format("ERROR: Could not find ExpandObjects executable: {}.", FileSystem::getAbsolutePath(expandObjectsPath).string()));
DisplayString(state,
std::format("ERROR: Could not find ExpandObjects executable: {}.", FileSystem::getAbsolutePath(expandObjectsPath)));
if (eplusRunningViaAPI) {
return static_cast<int>(ReturnCodes::Failure);
}
Expand All @@ -737,7 +735,7 @@ state.dataStrGlobals->inputFilePath='{:g}',
if (!FileSystem::fileExists(state.dataStrGlobals->inputIddFilePath)) {
DisplayString(state,
std::format("ERROR: Could not find input data dictionary: {}.",
FileSystem::getAbsolutePath(state.dataStrGlobals->inputIddFilePath).string()));
FileSystem::getAbsolutePath(state.dataStrGlobals->inputIddFilePath)));
DisplayString(state, errorFollowUp);
if (eplusRunningViaAPI) {
return static_cast<int>(ReturnCodes::Failure);
Expand Down Expand Up @@ -930,8 +928,7 @@ state.dataStrGlobals->inputFilePath='{:g}',
state,
"ERROR: Could not find ReadVarsESO executable. When calling through C API, make sure to call setEnergyPlusRootDirectory");
} else {
DisplayString(
state, std::format("ERROR: Could not find ReadVarsESO executable: {}.", FileSystem::getAbsolutePath(readVarsPath).string()));
DisplayString(state, std::format("ERROR: Could not find ReadVarsESO executable: {}.", FileSystem::getAbsolutePath(readVarsPath)));
}
return static_cast<int>(ReturnCodes::Failure);
}
Expand All @@ -944,7 +941,7 @@ state.dataStrGlobals->inputFilePath='{:g}',
if (!rviFileExists) {
std::ofstream ofs{RVIfile};
if (!ofs.good()) {
ShowFatalError(state, std::format("EnergyPlus: Could not open file \"{}\" for output (write).", RVIfile.string()));
ShowFatalError(state, std::format("EnergyPlus: Could not open file \"{}\" for output (write).", RVIfile));
} else {
ofs << FileSystem::toString(state.files.eso.filePath) << '\n';
ofs << FileSystem::toString(state.files.csv.filePath) << '\n';
Expand All @@ -955,7 +952,7 @@ state.dataStrGlobals->inputFilePath='{:g}',
if (!mviFileExists) {
std::ofstream ofs{MVIfile};
if (!ofs.good()) {
ShowFatalError(state, std::format("EnergyPlus: Could not open file \"{}\" for output (write).", RVIfile.string()));
ShowFatalError(state, std::format("EnergyPlus: Could not open file \"{}\" for output (write).", RVIfile));
} else {
ofs << FileSystem::toString(state.files.mtr.filePath) << '\n';
ofs << FileSystem::toString(state.files.mtr_csv.filePath) << '\n';
Expand Down
29 changes: 12 additions & 17 deletions src/EnergyPlus/CurveManager.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2396,14 +2396,12 @@ namespace Curve {
std::string tmp = indVarInstance.at("external_file_name").get<std::string>();
fs::path filePath(tmp);
if (indVarInstance.count("external_file_column_number") == 0u) {
ShowSevereError(
state, std::format("{}: No column number defined for external file \"{}\"", contextString, filePath.string()));
ShowSevereError(state, std::format("{}: No column number defined for external file \"{}\"", contextString, filePath));
ErrorsFound = true;
}
if (indVarInstance.count("external_file_starting_row_number") == 0u) {
ShowSevereError(
state,
std::format("{}: No starting row number defined for external file \"{}\"", contextString, filePath.string()));
ShowSevereError(state,
std::format("{}: No starting row number defined for external file \"{}\"", contextString, filePath));
ErrorsFound = true;
}

Expand Down Expand Up @@ -2605,14 +2603,13 @@ namespace Curve {
fs::path filePath(tmp);

if (fields.count("external_file_column_number") == 0u) {
ShowSevereError(
state, std::format("{}: No column number defined for external file \"{}\"", thisCurve->contextString, filePath.string()));
ShowSevereError(state,
std::format("{}: No column number defined for external file \"{}\"", thisCurve->contextString, filePath));
ErrorsFound = true;
}
if (fields.count("external_file_starting_row_number") == 0u) {
ShowSevereError(
state,
std::format("{}: No starting row number defined for external file \"{}\"", thisCurve->contextString, filePath.string()));
state, std::format("{}: No starting row number defined for external file \"{}\"", thisCurve->contextString, filePath));
ErrorsFound = true;
}

Expand Down Expand Up @@ -2784,14 +2781,12 @@ namespace Curve {
std::size_t row = colAndRow.second; // 0 indexed
auto &content = contents[col];
if (col >= numColumns) {
ShowFatalError(
state,
std::format("File \"{}\" : Requested column ({}) exceeds the number of columns ({}).", filePath.string(), col + 1, numColumns));
ShowFatalError(state,
std::format("File \"{}\" : Requested column ({}) exceeds the number of columns ({}).", filePath, col + 1, numColumns));
}
if (row >= numRows) {
ShowFatalError(
state,
std::format("File \"{}\" : Requested starting row ({}) exceeds the number of rows ({}).", filePath.string(), row + 1, numRows));
ShowFatalError(state,
std::format("File \"{}\" : Requested starting row ({}) exceeds the number of rows ({}).", filePath, row + 1, numRows));
}
std::vector<double> array(numRows - row);
std::transform(content.begin() + row, content.end(), array.begin(), [](std::string_view str) {
Expand Down Expand Up @@ -2828,7 +2823,7 @@ namespace Curve {
// SUBROUTINE LOCAL VARIABLE DECLARATIONS:
for (auto *thisCurve : state.dataCurveManager->curves) {
for (int dim = 1; dim <= thisCurve->numDims; ++dim) {
std::string numStr = fmt::to_string(dim);
std::string numStr = std::to_string(dim);
SetupOutputVariable(state,
std::format("Performance Curve Input Variable {} Value", numStr),
Constant::Units::None,
Expand Down Expand Up @@ -3070,7 +3065,7 @@ namespace Curve {

ErrorObjectHeader eoh{routineName, objectType, objectName};

std::string validDimsString = fmt::to_string(validDims[0]);
std::string validDimsString = std::to_string(validDims[0]);
for (std::size_t i = 1; i < validDims.size(); i++) {
validDimsString += std::format(" or {}", validDims[i]);
}
Expand Down
4 changes: 2 additions & 2 deletions src/EnergyPlus/DataSystemVariables.cc
Original file line number Diff line number Diff line change
Expand Up @@ -193,10 +193,10 @@ namespace DataSystemVariables {
}

// If we get here, we didn't find the file
ShowSevereError(state, std::format("{}\"{}\" not found.", contextString, originalInputFilePath.string()));
ShowSevereError(state, std::format("{}\"{}\" not found.", contextString, originalInputFilePath));
ShowContinueError(state, " Paths searched:");
for (auto &path : pathsChecked) {
ShowContinueError(state, std::format(" {}: \"{}\"", path.second, path.first.string()));
ShowContinueError(state, std::format(" {}: \"{}\"", path.second, path.first));
}

return foundFilePath;
Expand Down
Loading
Loading