Skip to content

Commit

Permalink
Fix a few more issues
Browse files Browse the repository at this point in the history
  • Loading branch information
amirroth committed Dec 9, 2024
1 parent 1272641 commit 0a5be5d
Show file tree
Hide file tree
Showing 20 changed files with 670 additions and 802 deletions.
9 changes: 2 additions & 7 deletions src/EnergyPlus/DataHeatBalSurface.hh
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ namespace DataHeatBalSurface {
int constexpr MinEMPDIterations(4); // Minimum number of iterations required for EMPD solution
int constexpr IterationsForCondFDRelaxChange(5); // number of iterations for inside temps that triggers a change


} // namespace DataHeatBalSurface

struct HeatBalSurfData : BaseGlobalStruct
Expand Down Expand Up @@ -231,18 +232,12 @@ struct HeatBalSurfData : BaseGlobalStruct
Array1D_bool EnclSolRecDifShortFromZ; // True if Zone gets short radiation from another

// Surface Heat Balance
Array1D<bool> SurfMovInsulExtPresent; // True when interior movable insulation is present
Array1D<bool> SurfMovInsulIntPresent; // True when interior movable insulation is present
Array1D<bool> SurfMovInsulIntPresentPrevTS; // True when interior movable insulation was present during the previous time step

Array1D<Real64> SurfMovInsulHExt; // Resistance or "h" value of exterior movable insulation
Array1D<Real64> SurfMovInsulHInt; // Resistance or "h" value of interior movable insulation
Array1D<Real64> SurfAbsSolarExt; // Solar Absorptivity of surface outside face or interior movable insulation if present
Array1D<Real64> SurfAbsThermalExt; // Thermal Absorptivity of surface outside face or interior movable insulation if present
Array1D<Real64> SurfAbsSolarInt; // Solar absorptivity of surface inside face or exterior movable insulation if present
Array1D<Material::SurfaceRoughness> SurfRoughnessExt; // Roughness of surface inside face or exterior movable insulation if present
Array1D<Real64> SurfAbsThermalInt; // Thermal absorptivity of surface inside face or exterior movable insulation if present
std::vector<int> SurfMovInsulIndexList;

std::vector<int> SurfMovSlatsIndexList;

void init_constant_state([[maybe_unused]] EnergyPlusData &state) override
Expand Down
2 changes: 1 addition & 1 deletion src/EnergyPlus/DataHeatBalance.hh
Original file line number Diff line number Diff line change
Expand Up @@ -732,7 +732,7 @@ namespace DataHeatBalance {
int ZonePtr = 0; // Zone index for this people statement
int spaceIndex = 0; // Space index for this people statement
Real64 NumberOfPeople = 0.0; // Maximum number of people for this statement
Sched::Schedule *numberOfPeopleSched = nullptr; // schedule for number of people
Sched::Schedule *sched = nullptr; // schedule for number of people
bool EMSPeopleOn = false; // EMS actuating number of people if .TRUE.
Real64 EMSNumberOfPeople = 0.0; // Value EMS is directing to use for override
// Note that the schedule and maximum number was kept for people since it seemed likely that
Expand Down
9 changes: 5 additions & 4 deletions src/EnergyPlus/DataSurfaces.cc
Original file line number Diff line number Diff line change
Expand Up @@ -552,10 +552,11 @@ void SurfaceData::make_hash_key(EnergyPlusData &state, const int SurfNum)
calcHashKey.FrameDivider = FrameDivider;
calcHashKey.SurfWinStormWinConstr = s_surf->SurfWinStormWinConstr(SurfNum);

calcHashKey.MaterialMovInsulExt = s_surf->SurfMaterialMovInsulExt(SurfNum);
calcHashKey.MaterialMovInsulInt = s_surf->SurfMaterialMovInsulInt(SurfNum);
calcHashKey.movInsulExtSchedNum = (s_surf->SurfMovInsulExtScheds(SurfNum) != nullptr) ? s_surf->SurfMovInsulExtScheds(SurfNum)->Num : -1;
calcHashKey.movInsulIntSchedNum = (s_surf->SurfMovInsulIntScheds(SurfNum) != nullptr) ? s_surf->SurfMovInsulIntScheds(SurfNum)->Num : -1;
calcHashKey.MaterialMovInsulExt = s_surf->extMovInsuls(SurfNum).matNum;
calcHashKey.MaterialMovInsulInt = s_surf->intMovInsuls(SurfNum).matNum;
calcHashKey.movInsulExtSchedNum = s_surf->extMovInsuls(SurfNum).sched->Num;
calcHashKey.movInsulIntSchedNum = s_surf->intMovInsuls(SurfNum).sched->Num;

calcHashKey.externalShadingSchedNum = (s_surf->Surface(SurfNum).surfExternalShadingSched != nullptr) ? s_surf->Surface(SurfNum).surfExternalShadingSched->Num : -1;
calcHashKey.SurroundingSurfacesNum = s_surf->Surface(SurfNum).SurfSurroundingSurfacesNum;
calcHashKey.LinkedOutAirNode = s_surf->Surface(SurfNum).SurfLinkedOutAirNode;
Expand Down
23 changes: 16 additions & 7 deletions src/EnergyPlus/DataSurfaces.hh
Original file line number Diff line number Diff line change
Expand Up @@ -1461,6 +1461,16 @@ namespace DataSurfaces {

std::string cSurfaceClass(SurfaceClass ClassNo);


struct MovInsul
{
bool present = false;
bool presentPrevTS = false;
Real64 H = 0.0;
int matNum = 0; // Material number
Sched::Schedule *sched = nullptr;
};

} // namespace DataSurfaces

struct SurfacesData : BaseGlobalStruct
Expand Down Expand Up @@ -1524,7 +1534,9 @@ struct SurfacesData : BaseGlobalStruct
std::vector<int> allInsideSourceSurfaceList; // List of all surfaces with SurfaceProperty:HeatBalanceSourceTerm for inside face
std::vector<int> allOutsideSourceSurfaceList; // List of all surfaces with SurfaceProperty:HeatBalanceSourceTerm for outside face
std::vector<int> allGetsRadiantHeatSurfaceList; // List of all surfaces that receive radiant HVAC output

std::vector<int> intMovInsulSurfNums;
std::vector<int> extMovInsulSurfNums;

std::array<std::vector<int>, static_cast<int>(DataSurfaces::SurfaceFilter::Num)> SurfaceFilterLists;

// Surface HB arrays
Expand Down Expand Up @@ -1572,12 +1584,6 @@ struct SurfacesData : BaseGlobalStruct
Array1D<std::vector<int>>
SurfShadowDisabledZoneList; // Array of all disabled shadowing zone number to the current surface the surface diffusion model

// Surface movable insulation properties
Array1D<int> SurfMaterialMovInsulExt; // Pointer to the material used for exterior movable insulation
Array1D<int> SurfMaterialMovInsulInt; // Pointer to the material used for interior movable insulation
Array1D<Sched::Schedule *> SurfMovInsulExtScheds; // Schedule for exterior movable insulation
Array1D<Sched::Schedule *> SurfMovInsulIntScheds; // Schedule for interior movable insulation

// Surface EMS
Array1D<bool> SurfEMSConstructionOverrideON; // if true, EMS is calling to override the construction value
Array1D<int> SurfEMSConstructionOverrideValue; // pointer value to use for Construction when overridden
Expand Down Expand Up @@ -1806,6 +1812,9 @@ struct SurfacesData : BaseGlobalStruct
Array1D<int> SurfActiveConstruction; // The currently active construction with or without storm window
Array1D<int> SurfWinActiveShadedConstruction; // The currently active shaded construction with or without storm window (windows only)

Array1D<DataSurfaces::MovInsul> intMovInsuls;
Array1D<DataSurfaces::MovInsul> extMovInsuls;

EPVector<DataSurfaces::SurfaceData> Surface;
EPVector<DataSurfaces::SurfaceWindowCalc> SurfaceWindow;
EPVector<DataSurfaces::SurfaceShade> surfShades;
Expand Down
2 changes: 1 addition & 1 deletion src/EnergyPlus/HVACStandAloneERV.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1256,7 +1256,7 @@ void SizeStandAloneERV(EnergyPlusData &state, int const StandAloneERVNum)
Real64 MaxPeopleSch = 0.0;
for (int PeopleNum = 1; PeopleNum <= state.dataHeatBal->TotPeople; ++PeopleNum) {
if (ZoneNum != state.dataHeatBal->People(PeopleNum).ZonePtr) continue;
MaxPeopleSch = state.dataHeatBal->People(PeopleNum).numberOfPeopleSched->getMaxVal(state);
MaxPeopleSch = state.dataHeatBal->People(PeopleNum).sched->getMaxVal(state);
NumberOfPeople = NumberOfPeople + (state.dataHeatBal->People(PeopleNum).NumberOfPeople * MaxPeopleSch);
}
SupplyAirVolFlowDes = FloorArea * state.dataHVACStandAloneERV->StandAloneERV(StandAloneERVNum).AirVolFlowPerFloorArea +
Expand Down
2 changes: 1 addition & 1 deletion src/EnergyPlus/HeatBalFiniteDiffManager.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1135,7 +1135,7 @@ namespace HeatBalFiniteDiffManager {
auto &surfaceFD = s_hbfd->SurfaceFD(Surf);

Real64 HMovInsul = 0;
if (state.dataSurface->AnyMovableInsulation) HMovInsul = state.dataHeatBalSurf->SurfMovInsulHExt(Surf);
if (state.dataSurface->AnyMovableInsulation) HMovInsul = state.dataSurface->extMovInsuls(Surf).H; // Even if this is not a movable insulation surface?
// Start stepping through the slab with time.
for (int J = 1, J_end = nint(state.dataGlobal->TimeStepZoneSec / Delt); J <= J_end; ++J) { // PT testing higher time steps

Expand Down
18 changes: 8 additions & 10 deletions src/EnergyPlus/HeatBalanceIntRadExchange.cc
Original file line number Diff line number Diff line change
Expand Up @@ -412,7 +412,7 @@ namespace HeatBalanceIntRadExchange {
}
}

void UpdateMovableInsulationFlag(EnergyPlusData &state, bool &MovableInsulationChange, int const SurfNum)
void UpdateMovableInsulationFlag(EnergyPlusData &state, bool &change, int const SurfNum)
{

// SUBROUTINE INFORMATION:
Expand All @@ -424,16 +424,14 @@ namespace HeatBalanceIntRadExchange {
// If there have been changes due to a schedule change AND a change in properties,
// then the matrices which are used to calculate interior radiation must be recalculated.

MovableInsulationChange = false;
auto &s_surf = state.dataSurface;

change = false;

if (state.dataHeatBalSurf->SurfMovInsulIntPresent(SurfNum) != state.dataHeatBalSurf->SurfMovInsulIntPresentPrevTS(SurfNum)) {
auto const &thissurf = state.dataSurface->Surface(SurfNum);
Real64 AbsorpDiff = std::abs(state.dataConstruction->Construct(thissurf.Construction).InsideAbsorpThermal -
state.dataMaterial->materials(state.dataSurface->SurfMaterialMovInsulInt(SurfNum))->AbsorpThermal);
if (AbsorpDiff > 0.01) {
MovableInsulationChange = true;
}
}
auto &movInsul = s_surf->intMovInsuls(SurfNum);
if (movInsul.present != movInsul.presentPrevTS)
change = (std::abs(state.dataConstruction->Construct(s_surf->Surface(SurfNum).Construction).InsideAbsorpThermal -
state.dataMaterial->materials(movInsul.matNum)->AbsorpThermal) > 0.01);
}

void InitInteriorRadExchange(EnergyPlusData &state)
Expand Down
5 changes: 3 additions & 2 deletions src/EnergyPlus/HeatBalanceManager.cc
Original file line number Diff line number Diff line change
Expand Up @@ -3013,8 +3013,9 @@ namespace HeatBalanceManager {
// Update interior movable insulation flag--needed at the end of a zone time step so that the interior radiant
// exchange algorithm knows whether there has been a change in interior movable insulation or not.
if (state.dataSurface->AnyMovableInsulation) {
for (int surfNum : state.dataHeatBalSurf->SurfMovInsulIndexList) {
state.dataHeatBalSurf->SurfMovInsulIntPresentPrevTS(surfNum) = state.dataHeatBalSurf->SurfMovInsulIntPresent(surfNum);
for (int surfNum : state.dataSurface->intMovInsulSurfNums) {
auto &movInsul = state.dataSurface->intMovInsuls(surfNum);
movInsul.presentPrevTS = movInsul.present;
}
}

Expand Down
Loading

3 comments on commit 0a5be5d

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

ScheduleAPI (amirroth) - x86_64-Linux-Ubuntu-24.04-gcc-13.2: Build Failed

Failures:\n

API Test Summary

  • Passed: 14
  • Subprocess aborted: 2

integration Test Summary

  • Passed: 752
  • Failed: 49

performance Test Summary

  • Passed: 16
  • Failed: 1

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.

ScheduleAPI (amirroth) - x86_64-Linux-Ubuntu-24.04-gcc-13.2-UnitTestsCoverage-RelWithDebInfo: Build Failed

Failures:\n

API Test Summary

  • Passed: 9
  • Failed: 1
  • notrun: 5
  • Subprocess aborted: 1

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.

ScheduleAPI (amirroth) - x86_64-Linux-Ubuntu-24.04-gcc-13.2-IntegrationCoverage-RelWithDebInfo: Build Failed

Failures:\n

integration Test Summary

  • Passed: 753
  • Failed: 48

Build Badge Test Badge Coverage Badge

Please sign in to comment.