Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ZoneHVAC:HybridUnitaryHVAC ERR object type output #8326

Merged
merged 15 commits into from
Nov 4, 2020

Conversation

matthew-larson
Copy link
Contributor

@matthew-larson matthew-larson commented Sep 30, 2020

Pull request overview

  • Fixes ZoneHVAC:HybridUnitaryHVAC ERR output malfunctioning #8316
  • This pull request corrects an inconsistent variable name for the Object type related to the ZoneHVAC:HybridUnitaryHVAC object. This was being referenced as "cCurrentModuleObject" in some places when "CurrentModuleObject" was the original string variable name. I changed all of the references to "cCurrentModuleObject" to match the majority of other Object type variable names for objects.
  • Input processing for optional fields was fixed so that a blank optional field will not throw an error.
  • Various error messages were corrected to use the correct variables for referencing field names and values.

Pull Request Author

Add to this list or remove from it as applicable. This is a simple templated set of guidelines.

  • Title of PR should be user-synopsis style (clearly understandable in a standalone changelog context)
  • Label the PR with at least one of: Defect, Refactoring, NewFeature, Performance, and/or DoNoPublish
  • Pull requests that impact EnergyPlus code must also include unit tests to cover enhancement or defect repair
  • Author should provide a "walkthrough" of relevant code changes using a GitHub code review comment process
  • If any diffs are expected, author must demonstrate they are justified using plots and descriptions
  • If changes fix a defect, the fix should be demonstrated in plots and descriptions
  • If any defect files are updated to a more recent version, upload new versions here or on DevSupport
  • If IDD requires transition, transition source, rules, ExpandObjects, and IDFs must be updated, and add IDDChange label
  • If structural output changes, add to output rules file and add OutputChange label
  • If adding/removing any LaTeX docs or figures, update that document's CMakeLists file dependencies

Reviewer

This will not be exhaustively relevant to every PR.

  • Perform a Code Review on GitHub
  • If branch is behind develop, merge develop and build locally to check for side effects of the merge
  • If defect, verify by running develop branch and reproducing defect, then running PR and reproducing fix
  • If feature, test running new feature, try creative ways to break it
  • CI status: all green or justified
  • Check that performance is not impacted (CI Linux results include performance check)
  • Run Unit Test(s) locally
  • Check any new function arguments for performance impacts
  • Verify IDF naming conventions and styles, memos and notes and defaults
  • If new idf included, locally check the err file and other outputs

@matthew-larson matthew-larson added Defect Includes code to repair a defect in EnergyPlus NotIDDChange Code does not impact IDD (can be merged after IO freeze) labels Sep 30, 2020
@matthew-larson matthew-larson self-assigned this Sep 30, 2020
@mjwitte
Copy link
Contributor

mjwitte commented Oct 16, 2020

@Myoldmopar You disabled some HybridUnitary unit tests in 799b650. They run fine locally. Any reason to keep them disabled?

@Myoldmopar
Copy link
Member

If they are running fine go ahead and re-enable them.

Copy link
Contributor

@mjwitte mjwitte left a comment

Choose a reason for hiding this comment

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

@matthew-larson Please merge in develop and resolve conflicts and address these other comments.

Comment on lines 649 to 650
ShowSevereError(RoutineName + cCurrentModuleObject + "=\"" + Alphas(1) + " invalid data");
ShowSevereError(RoutineName + cCurrentModuleObject + " = " + Alphas(1) + " invalid data");
ShowContinueError("Invalid-not found" + cAlphaFieldNames(19) + "=\"" + Alphas(19) + "\".");
Copy link
Contributor

Choose a reason for hiding this comment

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

The object type for the error message is fixed now, but the error message is still basically empty:

   ** Severe  ** GetInputZoneHybridUnitaryAirConditioners: ZoneHVAC:HybridUnitaryHVAC = MUNTERSEPX5000 invalid data
   **   ~~~   ** Invalid-not found="".

In the call to getObjectItem, the field names are returned in cAlphaFields. Some error messages use this variable, but a few (like the error shown here) are using cAlphaFieldNames which is blank. Replace all of these with cAlphaFields and the error message should show the field name that's in error.

@@ -1265,4 +1265,124 @@ TEST_F(EnergyPlusFixture, DISABLED_Test_UnitaryHybridAirConditioner_ModelOperati
}
}

TEST_F(EnergyPlusFixture, DISABLED_Test_UnitaryHybridAirConditioner_ValidateError)
Copy link
Contributor

Choose a reason for hiding this comment

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

Please enable this unit test and all of the other hybrid unitary tests. They run fine locally here.

@nealkruis
Copy link
Member

nealkruis commented Oct 19, 2020

@mjwitte It may be fine to enable the hybrid unitary tests, but I remember seeing this from @Myoldmopar:

so when I try to run the full unit test suite in debug it is failing on the hybrid unitary tests:

0x000055555629cca5 in EnergyPlus::Psychrometrics::PsyRhFnTdbWPb (TDB=0, dW=0, PB=0, CalledFrom="InitZoneHybridUnitaryAirConditioners")
    at /eplus/repos/myoldmopar/src/EnergyPlus/Psychrometrics.hh:920
920	        Real64 const RHValue(U / (1.0 - (1.0 - U) * (PWS / PB)));

If you run them individually, they pass, but something is not being cleaned up

static bool HybridCoolOneTimeFlag(true); // one time flag

this flag is definitely problematic since it is keeping everything from being reinitialized the second time, but I pulled that out to a namespace variable and reset it in clear_state and it is still failing
maybe there is a second static in there causing an issue, I'm not sure, but I'm going to disable all the hybrid unitary tests for right now

@matthew-larson looked into this a bit and couldn't reproduce the issue. Do we still want to move forward with enabling them?

@mjwitte
Copy link
Contributor

mjwitte commented Oct 19, 2020

@nealkruis I ran all of the hybrid unit tests serially and it was fine here (Windows 10). I'm running everything now. Moving that to the namespace likely corrected the problem. Either way, these need to be enabled. If there's still a problem, then it can be fixed.

@matthew-larson
Copy link
Contributor Author

@mjwitte I updated the code based on your comments and also re-enabled the unit tests. Tests all run successfully for me locally.

@mjwitte
Copy link
Contributor

mjwitte commented Oct 19, 2020

@matthew-larson That's better.

   ** Severe  ** GetInputZoneHybridUnitaryAirConditioners: ZoneHVAC:HybridUnitaryHVAC = MUNTERSEPX5000 invalid data
   **   ~~~   ** Invalid-not found Design Specification Outdoor Air Object Name="".

But why is this an error? The IDD implies that this field is optional.

@Myoldmopar Any idea what happened with the windows CI failure?

@matthew-larson
Copy link
Contributor Author

@mjwitte that's a great point about that particular field being optional. Digging into it a little, the ZoneHybridUnitaryAirConditioner(UnitLoop).OutdoorAir method isn't actually being used for anything and if ZoneHybridUnitaryAirConditioner(UnitLoop).OARequirementsPtr is zero, it just sets the minimum ventilation rate to 0 further in the code, which is the intent. Based on this, I'm tempted to just remove the if/else statement altogether here. I can modify the unit test to present a different error the shows the correct module object.

        // A19, \ OA requirement pointer
        ZoneHybridUnitaryAirConditioner(UnitLoop).OARequirementsPtr = UtilityRoutines::FindItemInList(Alphas(19), OARequirements);
        if (ZoneHybridUnitaryAirConditioner(UnitLoop).OARequirementsPtr == 0) {
            ShowSevereError(RoutineName + cCurrentModuleObject + " = " + Alphas(1) + " invalid data");
            ShowContinueError("Invalid-not found " + cAlphaFields(19) + "=\"" + Alphas(19) + "\".");
            ErrorsFound = true;
        } else {
            ZoneHybridUnitaryAirConditioner(UnitLoop).OutdoorAir = true;
        }

@mjwitte
Copy link
Contributor

mjwitte commented Oct 20, 2020

@matthew-larson This still needs to trap an invalid non-blank OA specification object name. For optional fields without a default, the input processing should check if the field is blank (using the logical array that's returned from getObjectItem) then skip it, but if it's not blank, then get the pointer and throw an error if it's still zero.

@matthew-larson
Copy link
Contributor Author

@mjwitte that makes sense. I modified the code as shown below, which I believe now acts as intended to check if the field is blank, otherwise grab the pointer and throw an error if 0.

                // A19, \ OA requirement pointer
                if (!lAlphaBlanks(19)) {
                    ZoneHybridUnitaryAirConditioner(UnitLoop).OARequirementsPtr = UtilityRoutines::FindItemInList(Alphas(19), OARequirements);
                    if (ZoneHybridUnitaryAirConditioner(UnitLoop).OARequirementsPtr == 0) {
                        ShowSevereError(RoutineName + cCurrentModuleObject + " = " + Alphas(1) + " invalid data");
                        ShowContinueError("Invalid-not found " + cAlphaFields(19) + "=\"" + Alphas(19) + "\".");
                        ErrorsFound = true;
                    } else {
                        ZoneHybridUnitaryAirConditioner(UnitLoop).OutdoorAir = true;
                    }
                }

@mjwitte
Copy link
Contributor

mjwitte commented Oct 20, 2020

@matthew-larson Yes, like that. While you're in there, it would be good to review all of the other optional fields in the (massive) object to see if they are all being processed correctly. I suppose a test file with all optional fields left blank should expose any problems.

@@ -4241,7 +4241,7 @@ \subsubsection{Inputs}
This alpha input field specifies the name of the HVAC system node from which the hybrid unit draws return air. This node name must also be specified as a zone return air node in a \hyperref[zonehvacequipmentconnections]{ZoneHVAC:EquipmentConnections} object. It may also be included in \hyperref[nodelist]{NodeList} object that is specified as a zone return air node in a \hyperref[zonehvacequipmentconnections]{ZoneHVAC:EquipmentConnections} object. (Ref. Group - Zone Equipment \hyperref[zonehvacequipmentconnections]{ZoneHVAC:EquipmentConnections} and Group - Node-Branch Management \hyperref[nodelist]{NodeList}).

\paragraph{Field: Outdoor Air Node Name}
This alpha input field specifies the name of the HVAC system node from which the hybrid unit draws outdoor air. This node name must also be specified in an \hyperref[outdoorairnode]{OutdoorAir:Node} or \hyperref[outdoorairnodelist]{OutdoorAir:NodeList} object. If this field is blank, a node name will be created internally. (Ref. Group - Node-Branch Management \hyperref[outdoorairnode]{OutdoorAir:Node} and \hyperref[outdoorairnodelist]{OutdoorAir:NodeList}).
This alpha input field specifies the name of the HVAC system node from which the hybrid unit draws outdoor air. This node name must also be specified in an \hyperref[outdoorairnode]{OutdoorAir:Node} or \hyperref[outdoorairnodelist]{OutdoorAir:NodeList} object. (Ref. Group - Node-Branch Management \hyperref[outdoorairnode]{OutdoorAir:Node} and \hyperref[outdoorairnodelist]{OutdoorAir:NodeList}).
Copy link
Contributor Author

Choose a reason for hiding this comment

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

The IDD has this as a required field so I just removed the statement about leaving the field blank.

Copy link
Contributor

@mjwitte mjwitte Oct 28, 2020

Choose a reason for hiding this comment

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

Good catch. But the code for this input is wrong. See comment below.

@matthew-larson
Copy link
Contributor Author

@mjwitte I cleaned up a couple more optional fields to prevent incorrect errors and updated the unit test with optional fields left blank.

Copy link
Contributor

@mjwitte mjwitte left a comment

Choose a reason for hiding this comment

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

@matthew-larson Almost there.

@@ -4241,7 +4241,7 @@ \subsubsection{Inputs}
This alpha input field specifies the name of the HVAC system node from which the hybrid unit draws return air. This node name must also be specified as a zone return air node in a \hyperref[zonehvacequipmentconnections]{ZoneHVAC:EquipmentConnections} object. It may also be included in \hyperref[nodelist]{NodeList} object that is specified as a zone return air node in a \hyperref[zonehvacequipmentconnections]{ZoneHVAC:EquipmentConnections} object. (Ref. Group - Zone Equipment \hyperref[zonehvacequipmentconnections]{ZoneHVAC:EquipmentConnections} and Group - Node-Branch Management \hyperref[nodelist]{NodeList}).

\paragraph{Field: Outdoor Air Node Name}
This alpha input field specifies the name of the HVAC system node from which the hybrid unit draws outdoor air. This node name must also be specified in an \hyperref[outdoorairnode]{OutdoorAir:Node} or \hyperref[outdoorairnodelist]{OutdoorAir:NodeList} object. If this field is blank, a node name will be created internally. (Ref. Group - Node-Branch Management \hyperref[outdoorairnode]{OutdoorAir:Node} and \hyperref[outdoorairnodelist]{OutdoorAir:NodeList}).
This alpha input field specifies the name of the HVAC system node from which the hybrid unit draws outdoor air. This node name must also be specified in an \hyperref[outdoorairnode]{OutdoorAir:Node} or \hyperref[outdoorairnodelist]{OutdoorAir:NodeList} object. (Ref. Group - Node-Branch Management \hyperref[outdoorairnode]{OutdoorAir:Node} and \hyperref[outdoorairnodelist]{OutdoorAir:NodeList}).
Copy link
Contributor

@mjwitte mjwitte Oct 28, 2020

Choose a reason for hiding this comment

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

Good catch. But the code for this input is wrong. See comment below.

Comment on lines 590 to 595
ZoneHybridUnitaryAirConditioner(UnitLoop).SecondaryInletNode = GetOnlySingleNode(state, Alphas(10),
ErrorsFound,
CurrentModuleObject,
cCurrentModuleObject,
Alphas(1),
NodeType_Air,
NodeConnectionType_OutsideAirReference,
Copy link
Contributor

Choose a reason for hiding this comment

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

This is kind of nit-picky, but NodeConnectionType_OutsideAirReference should be NodeConnectionType_OutsideAir because this node is a real outdoor air node with flow, not just a sensor.

ZoneHybridUnitaryAirConditioner(UnitLoop).TsaMax_schedule_pointer = GetScheduleIndex(state, Alphas(5));
if (ZoneHybridUnitaryAirConditioner(UnitLoop).TsaMax_schedule_pointer == 0) {
ShowSevereError("Invalid " + cAlphaFields(5) + '=' + Alphas(5));
ShowContinueError("Entered in " + cCurrentModuleObject + '=' + cAlphaArgs(1));
Copy link
Contributor

Choose a reason for hiding this comment

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

Made a test file with bad inputs in a bunch of fields, and some of the error messages are still broken:

   ** Severe  ** Invalid Minimum Supply Air Temperature Schedule Name=XMINSUPPLYT
   **   ~~~   ** Entered in ZoneHVAC:HybridUnitaryHVAC=MAIN ZONE BASEBOARD

cAlphaArgs should be Alphas here and elsewhere. Here's the test file:
UnitaryHybridAC_bug-ForceErrors1.idf.txt

@mjwitte
Copy link
Contributor

mjwitte commented Nov 3, 2020

@matthew-larson Almost there, no more cAlphaArgs lurking. But there are still 2 instances of cAlphaFieldNames that need to be fixed.

Copy link
Contributor

@mjwitte mjwitte left a comment

Choose a reason for hiding this comment

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

All good now. Merging.

@mjwitte mjwitte merged commit fb8d228 into NREL:develop Nov 4, 2020
@matthew-larson matthew-larson deleted the hybridunitary-erroutput branch November 4, 2020 19:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Defect Includes code to repair a defect in EnergyPlus NotIDDChange Code does not impact IDD (can be merged after IO freeze)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

ZoneHVAC:HybridUnitaryHVAC ERR output malfunctioning
9 participants