Skip to content

Commit

Permalink
adding state to reportSizerOutput, among others
Browse files Browse the repository at this point in the history
  • Loading branch information
mitchute committed Oct 21, 2020
1 parent 3958fd4 commit 955db2a
Show file tree
Hide file tree
Showing 90 changed files with 1,058 additions and 1,048 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -636,7 +636,8 @@ namespace AirflowNetwork {
std::array<Real64, 2> &DF // Partial derivative: DF/DP
);

virtual int calculate(EnergyPlusData &state, const Real64 PDROP, // Total pressure drop across a component (P1 - P2) [Pa]
virtual int calculate(EnergyPlusData &state,
const Real64 PDROP, // Total pressure drop across a component (P1 - P2) [Pa]
const Real64 multiplier, // Element multiplier
const Real64 control, // Element control signal
const AirProperties &propN, // Node 1 properties
Expand Down
20 changes: 10 additions & 10 deletions src/EnergyPlus/Autosizing/All_Simple_Sizing.cc
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ Real64 AutoCalculateSizer::size(EnergyPlusData &EP_UNUSED(state), Real64 _origin
if (!this->checkInitialized(errorsFound)) {
return 0.0;
}
this->preSize(_originalValue);
this->preSize(state, _originalValue);
if (this->dataEMSOverrideON) {
this->autoSizedValue = this->dataEMSOverride;
} else {
Expand All @@ -73,7 +73,7 @@ Real64 MaxHeaterOutletTempSizer::size(EnergyPlusData &EP_UNUSED(state), Real64 _
if (!this->checkInitialized(errorsFound)) {
return 0.0;
}
this->preSize(_originalValue);
this->preSize(state, _originalValue);
if (this->curZoneEqNum > 0) {
if (!this->wasAutoSized && !this->sizingDesRunThisZone) {
this->autoSizedValue = _originalValue;
Expand All @@ -96,7 +96,7 @@ Real64 ZoneCoolingLoadSizer::size(EnergyPlusData &EP_UNUSED(state), Real64 _orig
if (!this->checkInitialized(errorsFound)) {
return 0.0;
}
this->preSize(_originalValue);
this->preSize(state, _originalValue);
if (this->curZoneEqNum > 0) {
if (!this->wasAutoSized && !this->sizingDesRunThisZone) {
this->autoSizedValue = _originalValue;
Expand Down Expand Up @@ -124,7 +124,7 @@ Real64 ZoneHeatingLoadSizer::size(EnergyPlusData &EP_UNUSED(state), Real64 _orig
if (!this->checkInitialized(errorsFound)) {
return 0.0;
}
this->preSize(_originalValue);
this->preSize(state, _originalValue);
if (this->curZoneEqNum > 0) {
if (!this->wasAutoSized && !this->sizingDesRunThisZone) {
this->autoSizedValue = _originalValue;
Expand Down Expand Up @@ -152,7 +152,7 @@ Real64 ASHRAEMinSATCoolingSizer::size(EnergyPlusData &state, Real64 _originalVal
if (!this->checkInitialized(errorsFound)) {
return 0.0;
}
this->preSize(_originalValue);
this->preSize(state, _originalValue);
if (this->curZoneEqNum > 0) {
if (!this->wasAutoSized && !this->sizingDesRunThisZone) {
this->autoSizedValue = _originalValue;
Expand Down Expand Up @@ -214,7 +214,7 @@ Real64 ASHRAEMaxSATHeatingSizer::size(EnergyPlusData &state, Real64 _originalVal
if (!this->checkInitialized(errorsFound)) {
return 0.0;
}
this->preSize(_originalValue);
this->preSize(state, _originalValue);
if (this->curZoneEqNum > 0) {
if (!this->wasAutoSized && !this->sizingDesRunThisZone) {
this->autoSizedValue = _originalValue;
Expand Down Expand Up @@ -276,7 +276,7 @@ Real64 DesiccantDehumidifierBFPerfDataFaceVelocitySizer::size(EnergyPlusData &EP
if (!this->checkInitialized(errorsFound)) {
return 0.0;
}
this->preSize(_originalValue);
this->preSize(state, _originalValue);
if (this->dataEMSOverrideON) {
this->autoSizedValue = this->dataEMSOverride;
} else {
Expand All @@ -293,7 +293,7 @@ Real64 HeatingCoilDesAirInletTempSizer::size(EnergyPlusData &state, Real64 _orig
if (!this->checkInitialized(errorsFound)) {
return 0.0;
}
this->preSize(_originalValue);
this->preSize(state, _originalValue);
if (this->curZoneEqNum > 0) {
if (!this->wasAutoSized && !this->sizingDesRunThisZone) {
this->autoSizedValue = _originalValue;
Expand Down Expand Up @@ -329,7 +329,7 @@ Real64 HeatingCoilDesAirOutletTempSizer::size(EnergyPlusData &EP_UNUSED(state),
if (!this->checkInitialized(errorsFound)) {
return 0.0;
}
this->preSize(_originalValue);
this->preSize(state, _originalValue);
if (this->curZoneEqNum > 0) {
if (!this->wasAutoSized && !this->sizingDesRunThisZone) {
this->autoSizedValue = _originalValue;
Expand Down Expand Up @@ -361,7 +361,7 @@ Real64 HeatingCoilDesAirInletHumRatSizer::size(EnergyPlusData &EP_UNUSED(state),
if (!this->checkInitialized(errorsFound)) {
return 0.0;
}
this->preSize(_originalValue);
this->preSize(state, _originalValue);
if (this->curZoneEqNum > 0) {
if (!this->wasAutoSized && !this->sizingDesRunThisZone) {
this->autoSizedValue = _originalValue;
Expand Down
48 changes: 25 additions & 23 deletions src/EnergyPlus/Autosizing/Base.cc
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,8 @@ std::string BaseSizer::getLastErrorMessages()
return s;
}

void BaseSizer::preSize(Real64 const _originalValue)
void BaseSizer::preSize(EnergyPlusData &state,
Real64 const _originalValue)
{
if (this->sizingType == AutoSizingType::Unknown) {
std::string msg = "Sizing Library Base Class: preSize, SizingType not defined.";
Expand Down Expand Up @@ -310,7 +311,8 @@ void BaseSizer::preSize(Real64 const _originalValue)
}
}

void BaseSizer::reportSizerOutput(std::string const &CompType,
void BaseSizer::reportSizerOutput(EnergyPlusData &state,
std::string const &CompType,
std::string const &CompName,
std::string const &VarDesc,
Real64 const VarValue,
Expand Down Expand Up @@ -352,46 +354,46 @@ void BaseSizer::selectSizerOutput(bool &errorsFound)
if (this->printWarningFlag) {
if (this->dataEMSOverrideON) { // EMS overrides value
this->autoSizedValue = this->dataEMSOverride;
this->reportSizerOutput(
this->reportSizerOutput(state,
this->compType, this->compName, "User-Specified " + this->sizingStringScalable + this->sizingString, this->autoSizedValue);
} else if (this->hardSizeNoDesignRun && !this->wasAutoSized && UtilityRoutines::SameString(this->compType, "Fan:ZoneExhaust")) {
this->autoSizedValue = this->originalValue;
} else if (this->wasAutoSized && this->dataFractionUsedForSizing > 0.0 && this->dataConstantUsedForSizing > 0.0) {
this->autoSizedValue = this->dataFractionUsedForSizing * this->dataConstantUsedForSizing;
this->reportSizerOutput(
this->reportSizerOutput(state,
this->compType, this->compName, "Design Size " + this->sizingStringScalable + this->sizingString, this->autoSizedValue);
} else if (!this->wasAutoSized &&
(this->autoSizedValue == this->originalValue || this->autoSizedValue == 0.0)) { // no sizing run done or autosizes to 0
this->autoSizedValue = this->originalValue;
if (this->dataAutosizable || (!this->sizingDesRunThisZone && UtilityRoutines::SameString(this->compType, "Fan:ZoneExhaust"))) {
this->reportSizerOutput(
this->reportSizerOutput(state,
this->compType, this->compName, "User-Specified " + this->sizingStringScalable + this->sizingString, this->autoSizedValue);
}
} else if (!this->wasAutoSized && this->autoSizedValue >= 0.0 && this->originalValue == 0.0) { // input was blank or zero
this->autoSizedValue = this->originalValue;
this->reportSizerOutput(
this->reportSizerOutput(state,
this->compType, this->compName, "User-Specified " + this->sizingStringScalable + this->sizingString, this->autoSizedValue);
} else if (this->wasAutoSized && this->autoSizedValue >= 0.0 &&
this->originalValue <= 0.0) { // autosized to 0 or greater and input is 0 or autosize
// might need more logic here to catch everything correctly
if (this->dataScalableSizingON && int(this->zoneAirFlowSizMethod) > 0) {
this->reportSizerOutput(
this->reportSizerOutput(state,
this->compType, this->compName, "User-Specified " + this->sizingStringScalable + this->sizingString, this->autoSizedValue);
} else {
this->reportSizerOutput(this->compType, this->compName, "Design Size " + this->sizingString, this->autoSizedValue);
this->reportSizerOutput(state, this->compType, this->compName, "Design Size " + this->sizingString, this->autoSizedValue);
}
} else if (this->autoSizedValue >= 0.0 && this->originalValue > 0.0) {
if ((std::abs(this->autoSizedValue - this->originalValue) / this->originalValue) > DataSizing::AutoVsHardSizingThreshold) {
if (this->dataAutosizable)
this->reportSizerOutput(this->compType,
this->reportSizerOutput(state, this->compType,
this->compName,
"Design Size " + this->sizingString,
this->autoSizedValue,
"User-Specified " + this->sizingStringScalable + this->sizingString,
this->originalValue);
} else {
if (this->dataAutosizable)
this->reportSizerOutput(
this->reportSizerOutput(state,
this->compType, this->compName, "User-Specified " + this->sizingStringScalable + this->sizingString, this->originalValue);
}
if (DataGlobals::DisplayExtraWarnings && this->dataAutosizable) {
Expand Down Expand Up @@ -443,33 +445,33 @@ void BaseSizer::select2StgDXHumCtrlSizerOutput(bool &errorsFound)
{
if (this->printWarningFlag) {
if (this->dataEMSOverrideON) { // EMS overrides value
this->reportSizerOutput(
this->reportSizerOutput(state,
this->compType, this->compName, "User-Specified " + this->sizingStringScalable + this->sizingString, this->autoSizedValue);
if (UtilityRoutines::SameString(this->compType, "COIL:COOLING:DX:TWOSTAGEWITHHUMIDITYCONTROLMODE")) {
this->autoSizedValue *= (1 - this->dataBypassFrac); // now reapply for second message and remianing simulation calcs
this->reportSizerOutput(this->compType,
this->reportSizerOutput(state, this->compType,
this->compName,
"User-Specified " + this->sizingStringScalable + this->sizingString + " ( non-bypassed )",
this->autoSizedValue);
}
} else if (!this->wasAutoSized && (this->autoSizedValue == this->originalValue || this->autoSizedValue == 0.0)) { // no sizing run done
this->autoSizedValue = this->originalValue;
this->reportSizerOutput(
this->reportSizerOutput(state,
this->compType, this->compName, "User-Specified " + this->sizingStringScalable + this->sizingString, this->autoSizedValue);
if (UtilityRoutines::SameString(this->compType, "COIL:COOLING:DX:TWOSTAGEWITHHUMIDITYCONTROLMODE")) {
this->autoSizedValue *= (1 - this->dataBypassFrac); // now reapply for second message and remianing simulation calcs
this->reportSizerOutput(this->compType,
this->reportSizerOutput(state, this->compType,
this->compName,
"User-Specified " + this->sizingStringScalable + this->sizingString + " ( non-bypassed )",
this->autoSizedValue);
}
} else if (!this->wasAutoSized && this->autoSizedValue >= 0.0 && this->originalValue == 0.0) { // input was blank or zero
this->autoSizedValue = this->originalValue;
this->reportSizerOutput(
this->reportSizerOutput(state,
this->compType, this->compName, "User-Specified " + this->sizingStringScalable + this->sizingString, this->autoSizedValue);
if (UtilityRoutines::SameString(this->compType, "COIL:COOLING:DX:TWOSTAGEWITHHUMIDITYCONTROLMODE")) {
this->autoSizedValue *= (1 - this->dataBypassFrac); // now reapply for second message and remianing simulation calcs
this->reportSizerOutput(this->compType,
this->reportSizerOutput(state, this->compType,
this->compName,
"User-Specified " + this->sizingStringScalable + this->sizingString + " ( non-bypassed )",
this->autoSizedValue);
Expand All @@ -478,19 +480,19 @@ void BaseSizer::select2StgDXHumCtrlSizerOutput(bool &errorsFound)
this->originalValue <= 0.0) { // autosized to 0 or greater and input is 0 or autosize
// might need more logic here to catch everything correctly
if (this->dataScalableSizingON && int(this->zoneAirFlowSizMethod) > 0) {
this->reportSizerOutput(
this->reportSizerOutput(state,
this->compType, this->compName, "User-Specified " + this->sizingStringScalable + this->sizingString, this->autoSizedValue);
} else {
this->reportSizerOutput(this->compType, this->compName, "Design Size " + this->sizingString, this->autoSizedValue);
this->reportSizerOutput(state, this->compType, this->compName, "Design Size " + this->sizingString, this->autoSizedValue);
}
if (UtilityRoutines::SameString(this->compType, "COIL:COOLING:DX:TWOSTAGEWITHHUMIDITYCONTROLMODE")) {
this->autoSizedValue *= (1 - this->dataBypassFrac); // now reapply for second message and remianing simulation calcs
this->reportSizerOutput(
this->reportSizerOutput(state,
this->compType, this->compName, "Design Size " + this->sizingString + " ( non-bypassed )", this->autoSizedValue);
}
} else if (this->autoSizedValue >= 0.0 && this->originalValue > 0.0) {
if ((std::abs(this->autoSizedValue - this->originalValue) / this->originalValue) > DataSizing::AutoVsHardSizingThreshold) {
this->reportSizerOutput(this->compType,
this->reportSizerOutput(state, this->compType,
this->compName,
"Design Size " + this->sizingString,
this->autoSizedValue,
Expand All @@ -499,7 +501,7 @@ void BaseSizer::select2StgDXHumCtrlSizerOutput(bool &errorsFound)
if (UtilityRoutines::SameString(this->compType, "COIL:COOLING:DX:TWOSTAGEWITHHUMIDITYCONTROLMODE")) {
this->autoSizedValue *= (1 - this->dataBypassFrac); // now reapply for second message and remianing simulation calcs
this->originalValue *= (1 - this->dataBypassFrac); // now reapply for second message and remianing simulation calcs
this->reportSizerOutput(this->compType,
this->reportSizerOutput(state, this->compType,
this->compName,
"Design Size " + this->sizingString + " ( non-bypassed )",
this->autoSizedValue,
Expand All @@ -510,11 +512,11 @@ void BaseSizer::select2StgDXHumCtrlSizerOutput(bool &errorsFound)
if (UtilityRoutines::SameString(this->compType, "COIL:COOLING:DX:TWOSTAGEWITHHUMIDITYCONTROLMODE")) {
this->autoSizedValue /= (1 - this->dataBypassFrac); // back out bypass fraction applied in GetInput
}
this->reportSizerOutput(
this->reportSizerOutput(state,
this->compType, this->compName, "User-Specified " + this->sizingStringScalable + this->sizingString, this->originalValue);
if (UtilityRoutines::SameString(this->compType, "COIL:COOLING:DX:TWOSTAGEWITHHUMIDITYCONTROLMODE")) {
this->autoSizedValue *= (1 - this->dataBypassFrac); // now reapply for second message and remianing simulation calcs
this->reportSizerOutput(this->compType,
this->reportSizerOutput(state, this->compType,
this->compName,
"User-Specified " + this->sizingStringScalable + this->sizingString + " ( non-bypassed )",
this->autoSizedValue);
Expand Down
5 changes: 3 additions & 2 deletions src/EnergyPlus/Autosizing/Base.hh
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,7 @@ protected:

void initializeFromAPI(Real64 elevation); // don't accidentally call this direct component from outside

void preSize(Real64 originalValue);
void preSize(EnergyPlusData &state, Real64 originalValue);

void selectSizerOutput(bool &errorsFound);

Expand All @@ -290,7 +290,8 @@ protected:
void clearState();

public:
static void reportSizerOutput(std::string const &CompType,
static void reportSizerOutput(EnergyPlusData &state,
std::string const &CompType,
std::string const &CompName,
std::string const &VarDesc,
Real64 VarValue,
Expand Down
2 changes: 1 addition & 1 deletion src/EnergyPlus/Autosizing/CoolingAirFlowSizing.cc
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ Real64 CoolingAirFlowSizer::size(EnergyPlusData &state, Real64 _originalValue, b
if (!this->checkInitialized(errorsFound)) {
return 0.0;
}
this->preSize(_originalValue);
this->preSize(state, _originalValue);
std::string DDNameFanPeak = "";
std::string dateTimeFanPeak = "";

Expand Down
2 changes: 1 addition & 1 deletion src/EnergyPlus/Autosizing/CoolingCapacitySizing.cc
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ Real64 CoolingCapacitySizer::size(EnergyPlusData &state, Real64 _originalValue,
if (!this->checkInitialized(errorsFound)) {
return 0.0;
}
this->preSize(_originalValue);
this->preSize(state, _originalValue);
std::string DDNameFanPeak = "";
std::string dateTimeFanPeak = "";
Real64 DesVolFlow = 0.0;
Expand Down
2 changes: 1 addition & 1 deletion src/EnergyPlus/Autosizing/CoolingSHRSizing.cc
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ Real64 CoolingSHRSizer::size(EnergyPlusData &EP_UNUSED(state), Real64 _originalV
if (!this->checkInitialized(errorsFound)) {
return 0.0;
}
this->preSize(_originalValue);
this->preSize(state, _originalValue);

if (this->dataFractionUsedForSizing > 0.0) {
this->autoSizedValue = this->dataConstantUsedForSizing * this->dataFractionUsedForSizing;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ Real64 CoolingWaterDesAirInletHumRatSizer::size(EnergyPlusData &EP_UNUSED(state)
if (!this->checkInitialized(errorsFound)) {
return 0.0;
}
this->preSize(_originalValue);
this->preSize(state, _originalValue);

if (this->curZoneEqNum > 0) {
if (!this->wasAutoSized && !this->sizingDesRunThisZone) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ Real64 CoolingWaterDesAirInletTempSizer::size(EnergyPlusData &state, Real64 _ori
if (!this->checkInitialized(errorsFound)) {
return 0.0;
}
this->preSize(_originalValue);
this->preSize(state, _originalValue);
if (this->curZoneEqNum > 0) {
if (!this->wasAutoSized && !this->sizingDesRunThisZone) {
this->autoSizedValue = _originalValue;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ Real64 CoolingWaterDesAirOutletHumRatSizer::size(EnergyPlusData &state, Real64 _
if (!this->checkInitialized(errorsFound)) {
return 0.0;
}
this->preSize(_originalValue);
this->preSize(state, _originalValue);

if (this->curZoneEqNum > 0) {
if (!this->wasAutoSized && !this->sizingDesRunThisZone) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ Real64 CoolingWaterDesAirOutletTempSizer::size(EnergyPlusData &state, Real64 _or
if (!this->checkInitialized(errorsFound)) {
return 0.0;
}
this->preSize(_originalValue);
this->preSize(state, _originalValue);
if (this->curZoneEqNum > 0) {
if (!this->wasAutoSized && !this->sizingDesRunThisZone) {
this->autoSizedValue = _originalValue;
Expand Down
Loading

5 comments on commit 955db2a

@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.

global_utility_routines (mitchute) - x86_64-Linux-Ubuntu-18.04-gcc-7.5: Build Failed

Failures:\n

API Test Summary

  • Failed: 6
  • notrun: 3

integration Test Summary

  • Passed: 2
  • Failed: 720

regression Test Summary

  • Passed: 735
  • Failed: 2

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.

global_utility_routines (mitchute) - x86_64-Linux-Ubuntu-18.04-gcc-7.5-UnitTestsCoverage-Debug: Build Failed

Failures:\n

API Test Summary

  • Failed: 6
  • notrun: 3

Build Badge Test Badge Coverage 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.

global_utility_routines (mitchute) - x86_64-Linux-Ubuntu-18.04-gcc-7.5-IntegrationCoverage-Debug: Build Failed

Failures:\n

integration Test Summary

  • Passed: 2
  • Failed: 720

Build Badge Test Badge Coverage Badge

@nrel-bot
Copy link

Choose a reason for hiding this comment

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

global_utility_routines (mitchute) - Win64-Windows-10-VisualStudio-16: Build Failed

Failures:\n

API Test Summary

  • Failed: 1
  • notrun: 3

integration Test Summary

  • Passed: 2
  • Failed: 717

Build Badge Test 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.

global_utility_routines (mitchute) - x86_64-MacOS-10.15-clang-11.0.0: Build Failed

Failures:\n

API Test Summary

  • Failed: 6
  • notrun: 3

integration Test Summary

  • Passed: 2
  • Failed: 717

regression Test Summary

  • Passed: 715
  • Failed: 2

Build Badge Test Badge

Please sign in to comment.