Add Space Concept to EnergyPlus Zone Structure, Part 2#9002
Add Space Concept to EnergyPlus Zone Structure, Part 2#9002Myoldmopar merged 59 commits intodevelopfrom
Conversation
| auto &thisDaylightControl = state.dataDaylightingData->daylightControl(daylightCtrlNum); | ||
| auto &thisEnclDaylight = state.dataDaylightingData->enclDaylight(thisDaylightControl.enclIndex); | ||
|
|
||
| if (thisDaylightControl.DaylightMethod == DataDaylighting::iDaylightingMethod::NoDaylighting) continue; |
There was a problem hiding this comment.
Move line 476 (continue) up 2 lines just to save the set reference if it's not needed? This does look neater, but still.
There was a problem hiding this comment.
@rraustad Actually, this line isn't even necessary anymore. Now that this loops of daylighting controls objects, NoDaylighting would never make it this far. Thanks for drawing attention to it.
| FigureMapPointDayltgFactorsToAddIllums(state, MapNum, ILB, state.dataGlobal->HourOfDay, IWin, loopwin, NWX, NWY, ICtrl); | ||
| } | ||
| // daylightingCtrlNum parameter is unused for map points | ||
| FigureDayltgCoeffsAtPointsForSunPosition(state, |
There was a problem hiding this comment.
This module is going to be the death of someone. And it won't be me.
| Array1D<Real64> &GLINDX, // Glare index | ||
| int const ZoneNum // Zone number | ||
| Array1D<Real64> &GLINDX, // Glare index | ||
| int const daylightCtrlNum // Current daylighting control number |
There was a problem hiding this comment.
This is a little hard to comprehend. It is not the zone reference anymore it is the daylighting control num index, which I guess could imply a space, zone or enclosure.
| @@ -5393,8 +5353,8 @@ void GeometryTransformForDaylighting(EnergyPlusData &state) | |||
| } | |||
| } | |||
| } // refPtNum | |||
| } | |||
| } | |||
| } // daylighting control loop | |||
There was a problem hiding this comment.
I'm going to be somewhat pedantic here (for a change). I love these closing brace comments on large if/for bodies, but the standard comment here should be // for (controlNum), i.e., // for (<induction variable>). 😁
| Real64 &BLUM, // Window background (surround) luminance (cd/m2) | ||
| Real64 &GLINDX, // Glare index | ||
| int &ZoneNum // Zone number | ||
| int &IL, // Reference point index: 1=first ref pt, 2=second ref pt |
There was a problem hiding this comment.
Are all of these output parameters? The ones that are input parameters should be passed by value. If there is an output parameter (GLINDX?) it should be returned via the return value.
There was a problem hiding this comment.
Are all of these output parameters?
Honestly, I don't know for sure. This pattern is present in many of the daylighting functions, and it does appear that some of these indexes get changed along the way and the next function gets the new value as an input. As this exercise has revealed, there is some/much/immense room for improvement in the daylighting code.
| // Initialize reference point illuminance and window background luminance | ||
|
|
||
| for (ILM = 1; ILM <= state.dataDaylightingData->ZoneDaylight(ZoneNum).MapCount; ++ILM) { | ||
| for (int mapNum = 1; mapNum <= state.dataDaylightingData->TotIllumMaps; ++mapNum) { |
There was a problem hiding this comment.
I like this. SysAvailMangers loop over all equip types regardless whether there is an avail manager. GOOD here.
| GlareFlag = true; | ||
| break; | ||
| } | ||
| } | ||
|
|
||
| Array3D<Real64> WDAYIL( | ||
| Array3D<Real64> WDAYIL(2, |
There was a problem hiding this comment.
Heap allocated should preferably not be local variables unless the function is only called once, e.g., during initialization or final reporting then it doesn't matter. If the function is called every time step then these should be moved to state.
There was a problem hiding this comment.
#9067 (which builds on this branch) moves these arrays to state.
src/EnergyPlus/DaylightingManager.cc
Outdated
|
|
||
| std::vector<int> listOfExtWin = state.dataDaylightingData->ZoneDaylight(ZoneNum).ShadeDeployOrderExtWins[igroup - 1]; | ||
| std::vector<int> listOfExtWin = thisDaylightControl.ShadeDeployOrderExtWins[igroup - 1]; |
There was a problem hiding this comment.
You're making a copy of the vector here. Should this be a const &?
There was a problem hiding this comment.
@mjwitte is making a copy appropriate here? (I'm assuming not)
There was a problem hiding this comment.
const &listOfExtWin changed in 3 places.
|
|
||
| for (int ZoneNum = 1; ZoneNum <= state.dataGlobal->NumOfZones; ++ZoneNum) { | ||
| for (int enclNum = 1; enclNum <= state.dataViewFactor->NumOfSolarEnclosures; ++enclNum) { |
There was a problem hiding this comment.
I assume this is more restrictive and selective. Good, and, good,
| { | ||
| // J. Glazer - 2018 | ||
| // create sorted list for shade deployment order | ||
| // first step is to create a sortable list of WindowShadingControl objects by sequence | ||
| std::vector<std::pair<int, int>> shadeControlSequence; // sequence, WindowShadingControl | ||
| for (int iShadeCtrl = 1; iShadeCtrl <= state.dataSurface->TotWinShadingControl; ++iShadeCtrl) { | ||
| if (state.dataSurface->WindowShadingControl(iShadeCtrl).ZoneIndex == ZoneNum) { | ||
| shadeControlSequence.push_back(std::make_pair(state.dataSurface->WindowShadingControl(iShadeCtrl).SequenceNumber, iShadeCtrl)); | ||
| for (int spaceNum : state.dataHeatBal->Zone(state.dataSurface->WindowShadingControl(iShadeCtrl).ZoneIndex).spaceIndexes) { |
There was a problem hiding this comment.
I like it, loop through shading not zones. Translate this to HVAC
| singleMemberVector.push_back(state.dataSurface->WindowShadingControl(curShadeControl).FenestrationIndex(i)); | ||
| state.dataDaylightingData->ZoneDaylight(ZoneNum).ShadeDeployOrderExtWins.push_back(singleMemberVector); | ||
| for (int controlNum : state.dataDaylightingData->enclDaylight(enclNum).daylightControlIndexes) { | ||
| auto &thisDaylightCtrl = state.dataDaylightingData->daylightControl(controlNum); |
There was a problem hiding this comment.
thisDaylightCtrl is used twice, once in each of the if and else if. Does that save performance, or increase it?
There was a problem hiding this comment.
Yeah, that was just kind of a standard pattern, probably not useful for a small loop.
| auto const &thisSolEnclosureName = state.dataViewFactor->EnclSolInfo(enclNum).Name; | ||
| if (state.dataViewFactor->EnclSolInfo(enclNum).TotalEnclosureDaylRefPoints > 0 && thisEnclDaylight.NumOfDayltgExtWins > 0) { | ||
| for (int controlNum : state.dataDaylightingData->enclDaylight(enclNum).daylightControlIndexes) { | ||
| auto &thisDaylightCtrl = state.dataDaylightingData->daylightControl(controlNum); |
|
|
||
| if (state.dataEnvrn->SunIsUp && !state.dataGlobal->DoingSizing) { | ||
| DayltgInteriorMapIllum(state); | ||
| } |
There was a problem hiding this comment.
So as long as this will result in 0 for non-sun up hours
There was a problem hiding this comment.
Maps don't report anything for non-sun up hours, so OK.
| } | ||
| if (!found) { | ||
| state.dataHeatBal->Zone(zoneNum).otherEquipFuelTypeNums.emplace_back(thisZoneOthEq.OtherEquipFuelType); | ||
| state.dataHeatBal->Zone(zoneNum).otherEquipFuelTypeNames.emplace_back(FuelTypeString); |
There was a problem hiding this comment.
Surprised this had to happen. These weren't saved before?
There was a problem hiding this comment.
I was trying to keep the list so all fuel types would be reported at the zone and space level (for other equipment) but ran out of time. The usage is only tracked for one fuel type at the zone/space level. But I left this here so the warning messages could list everything that's not available. It's all metered appropriately and reportable at the object level, just a single fuel type at the space/zone level.
|
I'm not seeing anything that stands out. It took some time to go through all the changes and you can't really see the big picture in this Git context. Relying on example files and unit tests to show issues. I see small diffs here, so I have no issue with this, at this point. |
|
Unit tests run successfully. Second pass also successful. I wonder why I get a first pass failure on some branches and not others. |
|
@Myoldmopar A few minor cleanups here along with squelching 2 of 3 warnings in the 5ZoneAirCooledWithSpaces example file. The zone not enclosed warning is a puzzle that won't be solved here. |
|
This is looking quite clean from a testing perspective now. There have been many, many, great comments on here about best practice, but I don't think we can address them in this PR. We need to circle back to these and improve them and do them better, but I don't plan on holding this up to fix them all. There was one specific comment I noted above about making a copy of a vector. Could you take a look at that one? |
|
This looks great! Let's get this in now. Thanks for polishing it up on the weekend! |
Pull request overview
ZoneProperty:UserViewFactors:BySurfaceName#9047Overview of Daylighting changes:
Diffs
err diffs are due to change in wording for daylighting control warnings. e.g.:
Otherwise, some small eso diffs are present, likely due to changes in computation order for internal gains and daylighting.
ToDo List
ZoneDaylight(ZoneNum)and currentGetDaylightingControlshappily lets you have more than one Daylighting:Controls assigned to the same zone with no complaint. Problem is, only the last one does anything, the others are lost, or possibly you get some kind of merged input if the later one doesn't use the same fields as the first one. Soooo I'm thinking with Space in the mix,int ZoneFirstSpaceSolEnclosure; // TODO MJW: For daylighting, this is a punt, it's the solar enclosure number of the first space in the zone// TODO: This enclosure/zone mapping is a mess, punting for now// ToDo: For now, use min and max enclosure numbers associated with this zone, this could include unrelated enclosures`// TODO MJW: For daylighting, set the zone solar enclosure number to the first space's number// TODO MJW: Reference points will be double-counted for zone with more than one spaceMJW 8/26 - Actually, the
GetInputviewfactorsbyNametries to match an enclosure name which is what it did before. So, existing files should run fine, but any tool that validates on the object-list will fail, because old file likely have a ZoneList if it's a grouped enclosure. IDD needs to be changed, but it's too late for 9.6.DataZoneEquipment::CalcDesignSpecificationOutdoorAirin the air terminal units etc with DSOA method so they can reference a list object or a simple one. And the baseCalcDesignSpecificationOutdoorAirshould probably move into there.Calculate the constants in CalcDesignSpecificationOutdoorAir early (e.g., OA flow per zone, floor area, ACH, etc.) see Add Space Concept to EnergyPlus Zone Structure, Part 1 #8394 (comment)Not possible with current structure. See Add Space Concept to EnergyPlus Zone Structure, Part 1 #8394 (comment).Post-Release ToDo List
RadEnclosureNumandSolEnclosureNuminto a single variable (radiant and solar enclosures have different data, but they're indexed the same).if !.allocatedblocks? SeeHeatBalancemanager::AllocateZoneHeatBalArraysandInternalHeatGains::GetInternalheatGainsInputZoneToResimulatedoesn't play well with Space.// ToDo: For now, use min and max enclosure numbers associated with this zone, this could include unrelated enclosures// ToDo: For now, set the max and min enclosure numbers for each zone to be used in CalcInteriorRadExchange with ZoneToResimulatePull Request Author
Add to this list or remove from it as applicable. This is a simple templated set of guidelines.
Reviewer
This will not be exhaustively relevant to every PR.