Skip to content

Commit

Permalink
Seventh time is the charm (probably not)
Browse files Browse the repository at this point in the history
  • Loading branch information
amirroth committed Dec 10, 2023
1 parent fc19b90 commit fa2b9d7
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 36 deletions.
4 changes: 3 additions & 1 deletion src/EnergyPlus/EMSManager.cc
Original file line number Diff line number Diff line change
Expand Up @@ -601,7 +601,7 @@ namespace EMSManager {
thisSensor.OutputVarName = cAlphaArgs(3);

int VarIndex = GetMeterIndex(state, cAlphaArgs(3));
if (VarIndex > 0) {
if (VarIndex > -1) {
if (!lAlphaFieldBlanks(2)) {
ShowWarningError(state, format("Unused{}={}", cAlphaFieldNames(2), cAlphaArgs(2)));
ShowContinueError(state, format("Entered in {}={}", cCurrentModuleObject, cAlphaArgs(1)));
Expand Down Expand Up @@ -1221,6 +1221,8 @@ namespace EMSManager {

if (VarType == OutputProcessor::VariableType::Schedule) {
VarIndex = KeyIndex(1);
} else if (keyName(1) == "ENVIRONMENT") {
VarIndex = KeyIndex(1);
} else {
for (int KeyNum = 1; KeyNum <= NumKeys; ++KeyNum) {
if (state.dataOutputProcessor->outVars[KeyIndex(KeyNum)]->keyUC == VarKeyName) {
Expand Down
69 changes: 34 additions & 35 deletions src/EnergyPlus/OutputProcessor.cc
Original file line number Diff line number Diff line change
Expand Up @@ -4327,7 +4327,7 @@ Real64 GetInstantMeterValue(EnergyPlusData &state,
auto &op = state.dataOutputProcessor;
auto *meter = op->meters[meterNum];

if (meter->type == MeterType::Normal) {
if (meter->type == MeterType::Normal || meter->type == MeterType::Custom) {
for (int srcVarNum : meter->srcVarNums) {
auto *var = op->outVars[srcVarNum];
// Separate the Zone variables from the HVAC variables using TimeStepType
Expand Down Expand Up @@ -4848,17 +4848,6 @@ void ProduceRDDMDD(EnergyPlusData &state)
std::string VarOption2;
bool DoReport;
bool SortByName;
int ItemPtr;

struct VariableTypes
{
// Members
int RealIntegerType = 0; // Real= 1, Integer=2
int VarPtr = 0; // pointer to real/integer VariableTypes structures
int TimeStepType = 0;
int StoreType = 0;
std::string UnitsString;
};

auto &op = state.dataOutputProcessor;
auto &rf = state.dataResultsFramework->resultsFramework;
Expand Down Expand Up @@ -4897,9 +4886,22 @@ void ProduceRDDMDD(EnergyPlusData &state)
}

if (op->ProduceReportVDD == ReportVDD::Yes || op->ProduceReportVDD == ReportVDD::IDF) {

auto miVar = op->ddOutVarMap.begin();
for (int aiVar = 0; aiVar < (int)op->ddOutVars.size() && miVar != op->ddOutVarMap.end(); ++aiVar, ++miVar) {
int iVar = (SortByName) ? miVar->second : aiVar; // Choose either map (sorted) order or array (unsorted) order
int aiVar = 0;
for (;;) {
int iVar = -1;
// Too complicated to do this logic in the for loop header
if (SortByName) {
if (miVar == op->ddOutVarMap.end()) break;
iVar = miVar->second;
++miVar;
} else {
if (aiVar == (int)op->ddOutVars.size()) break;
iVar = aiVar;
++aiVar;
}

auto *ddVar = op->ddOutVars[iVar];

if (ddVar->ReportedOnDDFile) continue;
Expand All @@ -4917,28 +4919,25 @@ void ProduceRDDMDD(EnergyPlusData &state)
}

ddVar->ReportedOnDDFile = true;
while (ddVar->Next != -1) {
if (SortByName) {
++ItemPtr;
} else {
ItemPtr = ddVar->Next;
}
ddVar = op->ddOutVars[ItemPtr];

std::string_view timeStepName = timeStepNames[(int)ddVar->timeStepType];
std::string_view storeTypeName = storeTypeNames[(int)ddVar->storeType];
std::string_view varName = ddVar->name;
std::string_view unitName = (ddVar->units == Constant::Units::customEMS) ? ddVar->unitNameCustomEMS : Constant::unitNames[(int)ddVar->units];
if (SortByName) {
while (ddVar->Next != -1) {
ddVar = op->ddOutVars[ddVar->Next];

std::string_view timeStepName = timeStepNames[(int)ddVar->timeStepType];
std::string_view storeTypeName = storeTypeNames[(int)ddVar->storeType];
std::string_view varName = ddVar->name;
std::string_view unitName = (ddVar->units == Constant::Units::customEMS) ? ddVar->unitNameCustomEMS : Constant::unitNames[(int)ddVar->units];

if (op->ProduceReportVDD == ReportVDD::Yes) {
print(state.files.rdd, "{},{},{} [{}]\n", timeStepName, storeTypeName, varName, unitName);
rf->RDD.push_back(format("{},{},{} [{}]", timeStepName, storeTypeName, varName, unitName));
} else {
print(state.files.rdd, "Output:Variable,*,{},hourly; !- {} {} [{}]\n", varName, timeStepName, storeTypeName, unitName);
rf->RDD.push_back(format("{},{},{} [{}]", timeStepName, storeTypeName, varName, unitName));
}
ddVar->ReportedOnDDFile = true;
} // while (ddVar->Next != 0)
if (op->ProduceReportVDD == ReportVDD::Yes) {
print(state.files.rdd, "{},{},{} [{}]\n", timeStepName, storeTypeName, varName, unitName);
rf->RDD.push_back(format("{},{},{} [{}]", timeStepName, storeTypeName, varName, unitName));
} else {
print(state.files.rdd, "Output:Variable,*,{},hourly; !- {} {} [{}]\n", varName, timeStepName, storeTypeName, unitName);
rf->RDD.push_back(format("{},{},{} [{}]", timeStepName, storeTypeName, varName, unitName));
}
ddVar->ReportedOnDDFile = true;
} // while (ddVar->Next != 0)
} // if (SortByName)
} // for (aiVar, miVar)
} // if (produceReportVDD)
state.files.rdd.close();
Expand Down

5 comments on commit fa2b9d7

@nrel-bot
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Qsort (amirroth) - Win64-Windows-10-VisualStudio-16: OK (2737 of 2756 tests passed, 0 test warnings)

Failures:\n

API Test Summary

  • Passed: 14
  • Failed: 1

integration Test Summary

  • Passed: 771
  • Failed: 18

Build Badge Test Badge

@nrel-bot-2
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Qsort (amirroth) - x86_64-Linux-Ubuntu-22.04-gcc-11.4: OK (3434 of 3584 tests passed, 641 test warnings)

Messages:\n

  • 762 tests had: AUD diffs.
  • 14 tests had: EDD diffs.
  • 69 tests had: ESO big diffs.
  • 64 tests had: MTD diffs.
  • 73 tests had: Table big diffs.
  • 90 tests had: MTR big diffs.
  • 10 tests had: MDD diffs.
  • 17 tests had: EIO diffs.
  • 18 tests had: ERR diffs.
  • 5 tests had: RDD diffs.
  • 1 test had: SSZ small diffs.
  • 1 test had: ZSZ small diffs.
  • 1 test had: MTR small diffs.
  • 3 tests had: SSZ big diffs.
  • 3 tests had: ZSZ big diffs.

Failures:\n

API Test Summary

  • Passed: 14
  • Failed: 1

integration Test Summary

  • Passed: 776
  • Failed: 16

regression Test Summary

  • Passed: 673
  • Failed: 133

Build Badge Test Badge

@nrel-bot-2c
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Qsort (amirroth) - x86_64-Linux-Ubuntu-22.04-gcc-11.4-UnitTestsCoverage-Debug: OK (1967 of 1969 tests passed, 0 test warnings)

Failures:\n

API Test Summary

  • Passed: 14
  • Failed: 1

SQLiteFixture Test Summary

  • Passed: 99
  • Subprocess aborted: 1

Build Badge Test Badge Coverage Badge

@nrel-bot-2b
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Qsort (amirroth) - x86_64-Linux-Ubuntu-22.04-gcc-11.4-IntegrationCoverage-Debug: OK (768 of 790 tests passed, 0 test warnings)

Failures:\n

integration Test Summary

  • Passed: 768
  • Failed: 22

Build Badge Test Badge Coverage Badge

@nrel-bot-3
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Qsort (amirroth) - x86_64-MacOS-10.17-clang-14.0.0: OK (3390 of 3543 tests passed, 637 test warnings)

Messages:\n

  • 758 tests had: AUD diffs.
  • 14 tests had: EDD diffs.
  • 69 tests had: ESO big diffs.
  • 66 tests had: MTD diffs.
  • 73 tests had: Table big diffs.
  • 89 tests had: MTR big diffs.
  • 10 tests had: MDD diffs.
  • 17 tests had: EIO diffs.
  • 18 tests had: ERR diffs.
  • 5 tests had: RDD diffs.
  • 1 test had: SSZ small diffs.
  • 1 test had: ZSZ small diffs.
  • 2 tests had: BND diffs.
  • 1 test had: MTR small diffs.
  • 3 tests had: SSZ big diffs.
  • 3 tests had: ZSZ big diffs.

Failures:\n

API Test Summary

  • Passed: 14
  • Failed: 1

integration Test Summary

  • Passed: 771
  • Failed: 18

regression Test Summary

  • Passed: 653
  • Failed: 133

SQLiteFixture Test Summary

  • Passed: 99
  • Failed: 1

Build Badge Test Badge

Please sign in to comment.